Commit 1446a593 authored by POLYMER's avatar POLYMER

fix

parent de596498
No preview for this file type
......@@ -3,40 +3,71 @@ xpcall(function() dofile("expansions/script/c20000000.lua") end,function() dofil
local cm,m,o=GetID()
function cm.initial_effect(c)
fuef.A(c):CAT("SP"):Func("tg1,op1")
cm.chks = {"IsRac", "IsAtt", "IsAtk", "IsDef", "IsLv/IsRLv"}
end
--e1
function cm.tg1f4(g,c)
local res, chks, vals = 0, "IsRac,IsAtt,IsAtk,IsDef", fusf.CutString("DR,DA,3000,2500",",")
for i,chk in ipairs(fusf.CutString(chks,",")) do
if fugf.Filter(g, chk, vals[i], 1) then res = res + 1 end
function cm.gettn(c) -- card type count
local tn = 0
for i,chk in ipairs(cm.chks) do
if fucf.Filter(c, chk, cm.vals[i]) then tn = tn|(1<<i) end
end
return tn
end
function cm.tnchk(tn) -- material type count chk
local res = 0
for i = 1, 5 do
if tn&(1<<i) > 0 then res = res + 1 end
end
if fugf.Filter(g, "IsLv/IsRLv", {8, {8, c}}, 1) then res = res + 1 end
return res > 2
end
function cm.tg1f3(g,tp,c)
return cm.tg1f4(g,c) and #fugf.Filter(g,"IsLoc","D") <= (Duel.GetFlagEffect(tp,m) == 0 and 1 or 0) and not g:IsExists(cm.tg1f2,1,nil,g,c)
and Duel.GetMZoneCount(tp,g,tp)>0 and (not c.mat_group_check or c.mat_group_check(g,tp)) and (not aux.RCheckAdditional or aux.RCheckAdditional(tp,g,c))
function cm.mmchk(c, mg) -- material must chk
local g, res = mg - c, 0
for i,chk in ipairs(cm.chks) do
if fugf.Filter(g, chk, cm.vals[i], 1) then res = res + 1 end
end
return res > 2 and cm.mgchk(g)
end
function cm.mgchk(g, mmchk) -- material group chk
local dchk = Duel.GetFlagEffect(cm.tp,m) == 0
if not (Duel.GetMZoneCount(cm.tp, g, cm.tp) > 0 and (not cm.rc.mat_group_check or cm.rc.mat_group_check(g, cm.tp))
and #fugf.Filter(g,"IsLoc","D") <= (dchk and 1 or 0) and (not aux.RCheckAdditional or aux.RCheckAdditional(cm.tp, g, cm.rc))) then
return false
end
return not (mmchk and g:IsExists(cm.mmchk, 1, nil, g))
end
function cm.mfchk(mg, sg, tn) -- material filter chk
if cm.tnchk(tn) and cm.mgchk(sg, true) then return true end
for c in aux.Next(mg) do
local ctn = cm.gettn(c)
if tn|ctn > tn and cm.mfchk(mg - c, sg + c, tn|ctn) then return true end
end
return false
end
function cm.tg1f2(c,g,tc)
return cm.tg1f4(g-c,tc)
function cm.cut_cant(mg, sg, gtn)
local g, rg = mg - sg, Group.CreateGroup()
for c in aux.Next(g) do
local ctn = cm.gettn(c)
if gtn|ctn > gtn and cm.mfchk(g - c, sg + c, gtn|ctn) then rg = rg + c end
end
return rg
end
function cm.tg1f1(c,e,tp,m1,m2)
function cm.rchk(c,e,tp,m1,m2)
if not fucf.Filter(c,"IsTyp+IsSet+CanSp", "RI+M,bfd0", {e,SUMMON_TYPE_RITUAL,tp,false,true}) then return false end
m1 = m1:Filter(Card.IsCanBeRitualMaterial,c,c) + m2
m1, m2 = m1:Filter(c.mat_filter or aux.TRUE,c,tp), Group.CreateGroup()
local chks, vals = "IsRac,IsAtt,IsAtk,IsDef", fusf.CutString("DR,DA,3000,2500",",")
for i,chk in ipairs(fusf.CutString(chks,",")) do
m2 = m2 + fugf.Filter(m1, chk, vals[i])
cm.rc, cm.vals = c, {"DR", "DA", "3000", "2500", {8, {8, c}}}
m1 = m1:Filter(Card.IsCanBeRitualMaterial,c,c)
if Duel.GetFlagEffect(tp,m) == 0 then m1 = m1 + m2 end
m1, m2 = m1:Filter(c.mat_filter or aux.TRUE,c,tp), Group.CreateGroup()
for i,chk in ipairs(cm.chks) do
m2 = m2 + fugf.Filter(m1, chk, cm.vals[i])
end
m2 = m2 + fugf.Filter(m1, "IsLv/IsRLv", {8, {8, c}})
m1 = m2:CheckSubGroup(cm.tg1f3,1,#m2,tp,c)
return m1
return cm.mfchk(m2, Group.CreateGroup(), 0)
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
cm.tp = tp
if chk==0 then
local mg = Duel.GetRitualMaterialEx(tp)
local rg = Duel.GetFlagEffect(tp,m) == 0 and fugf.GetFilter(tp,"D","IsSet+AbleTo+IsTyp","3fd0,R,M") or Group.CreateGroup()
return fugf.GetFilter(tp,"HG",cm.tg1f1,{e,tp,mg,rg},1)
local rg = fugf.GetFilter(tp,"D","IsSet+AbleTo+IsTyp","3fd0,R,M")
return fugf.GetFilter(tp,"HG",cm.rchk,{e,tp,mg,rg},1)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_DECK)
......@@ -44,16 +75,34 @@ end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg = Duel.GetRitualMaterialEx(tp)
local rg = Duel.GetFlagEffect(tp,m) == 0 and fugf.GetFilter(tp,"D","IsSet+AbleTo+IsTyp","3fd0,R,M") or Group.CreateGroup()
local rg = fugf.GetFilter(tp,"D","IsSet+AbleTo+IsTyp","3fd0,R,M")
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc = fugf.SelectFilter(tp,"HG",cm.tg1f1,{e,tp,mg,rg}):GetFirst()
if not tc then return end
mg = mg:Filter(Card.IsCanBeRitualMaterial,tc,tc) + rg
mg = mg:Filter(tc.mat_filter or aux.TRUE,tc,tp)
local rc = fugf.SelectFilter(tp,"HG",cm.rchk,{e,tp,mg,rg}):GetFirst()
if not rc then return end
cm.rc, cm.tp = rc, tp
mg = mg:Filter(Card.IsCanBeRitualMaterial,rc,rc)
if Duel.GetFlagEffect(tp,m) == 0 then mg = mg + rg end
mg, rg = mg:Filter(rc.mat_filter or aux.TRUE,rc,tp), Group.CreateGroup()
for i,chk in ipairs(cm.chks) do
rg = rg + fugf.Filter(mg, chk, cm.vals[i])
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mg = mg:SelectSubGroup(tp,cm.tg1f3,false,1,#mg,tp,tc)
local canfinish, gtn = false, 0
mg = Group.CreateGroup()
while not canfinish do
collectgarbage("collect")
local g = cm.cut_cant(rg, mg, gtn)
local tc = g:SelectUnselect(mg,tp,canfinish,not canfinish)
if not tc then break end
Group[mg:IsContains(tc) and "RemoveCard" or "AddCard"](mg,tc)
gtn = 0
for sc in aux.Next(mg) do
gtn = gtn|cm.gettn(sc)
end
canfinish = cm.tnchk(gtn) and cm.mgchk(mg, gtn, true)
end
if #mg == 0 then goto cancel end
tc:SetMaterial(mg)
rc:SetMaterial(mg)
rg = fugf.Filter(mg,"IsLoc","D")
if #rg > 0 then
mg:Sub(rg)
......@@ -63,6 +112,6 @@ function cm.op1(e,tp,eg,ep,ev,re,r,rp)
Duel.ReleaseRitualMaterial(mg)
Duel.BreakEffect()
Duel.Hint(24,0,aux.Stringid(m,0))
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
Duel.SpecialSummon(rc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
rc:CompleteProcedure()
end
\ No newline at end of file
......@@ -64,7 +64,7 @@ function c28360113.matfilter(c)
return c:GetCounter(0x1283)>0 or c:IsLinkSetCard(0x288)
end
function c28360113.ctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) and e:GetHandler():GetMutualLinkedGroupCount()>0
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) and e:GetHandler():GetMutualLinkedGroupCount()>0 and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_GRAVE,0,1,nil,0x288)
end
function c28360113.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -92,10 +92,10 @@ function c28360113.efilter(e,re)
return e:GetHandlerPlayer()~=re:GetOwnerPlayer() and re:IsActivated()
end
function c28360113.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x283)
return c:IsFaceup() and c:IsSetCard(0x288)
end
function c28360113.sctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c28360113.cfilter,1,nil)
return eg:IsExists(c28360113.cfilter,1,e:GetHandler())
end
function c28360113.sctop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x1283,1)
......
......@@ -139,7 +139,7 @@ function c28361833.discon(e,tp,eg,ep,ev,re,r,rp)
end
function c28361833.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and e:GetHandler():IsRelateToEffect(e) and e:GetHandler():IsFaceup() then
e:GetHandler():IsCanAddCounter(0x1283,1)
e:GetHandler():AddCounter(0x1283,1)
end
end
function c28361833.cfilter(c)
......
......@@ -112,7 +112,7 @@ function c28362146.disop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c28362146.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,28381466)==0 and Duel.IsExistingMatchingCard(c28362146.filter,tp,LOCATION_MZONE,0,1,nil) end
return Duel.GetFlagEffect(tp,28381466)==0 and Duel.IsExistingMatchingCard(c28362146.filter,tp,LOCATION_MZONE,0,1,nil)
end
function c28362146.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
......
......@@ -51,7 +51,7 @@ function c28366995.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)>=9000
end
function c28366995.thfilter(c)
return c:IsSetCard(0x287,0x289) and c:IsAbleToHand()
return c:IsSetCard(0x286,0x289) and c:IsAbleToHand()
end
function c28366995.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c28366995.thfilter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -29,7 +29,7 @@ function c28384498.condition(e,tp,eg,ep,ev,re,r,rp)
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end
function c28384498.filter(c)
return c:IsSetCard(0x283) and c:IsAbleToDeck() and c:IsLevelAbove(1) and Duel.IsExistingMatchingCard(c28384498.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetLevel(),c:GetAttribute())
return c:IsSetCard(0x283) and c:IsAbleToDeck() and c:IsLevelAbove(1) and Duel.IsExistingMatchingCard(c28384498.thfilter,c:GetControler(),LOCATION_DECK,0,1,nil,c:GetLevel(),c:GetAttribute())
end
function c28384498.thfilter(c,lv,attr)
return c:IsLevel(lv) and not c:IsAttribute(attr) and c:IsSetCard(0x283) and c:IsAbleToHand()
......@@ -104,7 +104,7 @@ function c28384498.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sc=Duel.SelectMatchingCard(tp,c28384498.setfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst()
if tc then
if sc then
Duel.SSet(tp,sc)
end
end
......
......@@ -182,7 +182,7 @@ function c7210001.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
c:RegisterEffect(e2)
e:GetHandler():RegisterEffect(e2)
end
function c7210001.smlimit(e,c,sump,sumtype,sumpos,targetp,se)
return not c:IsSetCard(0x6f8)
......
......@@ -38,7 +38,7 @@ function c7210007.thop(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
if Duel.SendtoHand(g,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,g)
local e1=Effect.CreateEffect(c)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
......
......@@ -62,7 +62,7 @@ function c7210013.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(c)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
......
--史莱姆国王
local m=91010021
local cm=c91010021
function c91010021.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,1))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,m*3)
e2:SetCondition(cm.con2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,m*2)
e3:SetCondition(cm.lkcon)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
end
--e2
function cm.filter(c)
return (c:IsSetCard(0x9d0)or c:IsSetCard(0x9d1)) and c:IsAbleToHand()
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--e1
function cm.con2(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cm.hspfilter,tp,LOCATION_MZONE+LOCATION_HAND,0,1,e:GetHandler())
end
function cm.hspfilter(c)
return c:IsSetCard(0x9d1) and c:IsReleasable()
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,cm.hspfilter,tp,LOCATION_MZONE+LOCATION_HAND,0,1,1,e:GetHandler())
Duel.Release(g,REASON_EFFECT)
end
function cm.spfilter1(c,e)
return not c:IsImmuneToEffect(e)
end
function cm.spfilter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c)) and c:IsSetCard(0x9d0)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp)
local res=Duel.IsExistingMatchingCard(cm.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(cm.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(cm.spfilter1,nil,e)
local sg1=Duel.GetMatchingGroup(cm.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.Release(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function cm.lkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment