Commit c9de72fe authored by Momobako's avatar Momobako

Auto Push by Miyuki

parent 157974e1
miyuki=miyuki or {} miyuki=miyuki or {}
local cm=miyuki local cm=miyuki
--updated overlay --updated overlay
function cm.overlaycard(c,tc,xm,nchk) function cm.OverlayCard(c,tc,xm,nchk)
if not nchk and (not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() or not c:IsType(TYPE_XYZ) or tc:IsType(TYPE_TOKEN)) then return end if not nchk and (not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() or not c:IsType(TYPE_XYZ) or tc:IsType(TYPE_TOKEN)) then return end
if tc:IsStatus(STATUS_LEAVE_CONFIRMED) then if tc:IsStatus(STATUS_LEAVE_CONFIRMED) then
tc:CancelToGrave() tc:CancelToGrave()
...@@ -16,12 +16,12 @@ function cm.overlaycard(c,tc,xm,nchk) ...@@ -16,12 +16,12 @@ function cm.overlaycard(c,tc,xm,nchk)
end end
Duel.Overlay(c,tc) Duel.Overlay(c,tc)
end end
function cm.overlayfilter(c,nchk) function cm.OverlayFilter(c,nchk)
return nchk or not c:IsType(TYPE_TOKEN) return nchk or not c:IsType(TYPE_TOKEN)
end end
function cm.overlaygroup(c,g,xm,nchk) function cm.OverlayGroup(c,g,xm,nchk)
if not nchk and (not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() or g:GetCount()<=0 or not c:IsType(TYPE_XYZ)) then return end if not nchk and (not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() or g:GetCount()<=0 or not c:IsType(TYPE_XYZ)) then return end
local tg=g:Filter(cm.overlayfilter,nil,nchk) local tg=g:Filter(cm.OverlayFilter,nil,nchk)
if tg:GetCount()==0 then return end if tg:GetCount()==0 then return end
local og=Group.CreateGroup() local og=Group.CreateGroup()
for tc in aux.Next(tg) do for tc in aux.Next(tg) do
...@@ -40,85 +40,44 @@ function cm.overlaygroup(c,g,xm,nchk) ...@@ -40,85 +40,44 @@ function cm.overlaygroup(c,g,xm,nchk)
Duel.Overlay(c,tg) Duel.Overlay(c,tg)
end end
--xyz summon of prim --xyz summon of prim
function cm.rxyz1(c,rk,f,minct,maxct,xm,...) function cm.CheckFieldFilter(g,tp,c,f,...)
if c:IsLocation(LOCATION_EXTRA) then
return Duel.GetLocationCountFromEx(tp,tp,g,c)>0 and (not f or f(g,...))
else
return Duel.GetMZoneCount(tp,g,tp)>0 and (not f or f(g,...))
end
end
function cm.AddXyzProcedureRank(c,rk,f,minct,maxct,xm,...)
local ext_params={...} local ext_params={...}
c:EnableReviveLimit() return cm.AddXyzProcedureCustom(c,cm.XyzProcedureRankFilter(rk,f,ext_params),cm.XyzProcedureRankCheck,minct,maxct,xm)
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(cm.xyzcon1(rk,f,minct,maxct,ext_params))
e1:SetOperation(cm.xyzop1(rk,f,minct,maxct,xm,ext_params))
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
return e1
end end
function cm.mfilter(c,xyzc,rk,f,ext_params) function cm.XyzProcedureRankFilter(rk,f,ext_params)
return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:IsCanBeXyzMaterial(xyzc) and (not rk or c:GetRank()==rk) and (not f or f(c,xyzc,table.unpack(ext_params))) return function(c,xyzc)
return c:IsXyzType(TYPE_XYZ) and (not rk or c:GetRank()==rk) and (not f or f(c,xyzc,table.unpack(ext_params)))
end end
function cm.xyzfilter1(c,tp,g,xyzc,minc,maxc)
local tg=g:Filter(cm.xyzfilter2,c,c:GetRank())
return cm.CheckGroup(tg,cm.CheckFieldFilter,Group.FromCards(c),minc,maxc,tp,xyzc)
end end
function cm.xyzfilter2(c,rk) function cm.XyzProcedureRankCheck(g,xyzc)
return c:GetRank()==rk return g:GetClassCount(Card.GetRank)==1
end end
function cm.CheckFieldFilter(g,tp,c,f,...) function cm.rxyz2(c,rk,f,ct,xm,...)
return Duel.GetLocationCountFromEx(tp,tp,g,c)>0 and (not f or f(g,...)) return cm.AddXyzProcedureRank(c,rk,f,ct,ct,xm,...)
end
function cm.xyzcon1(rk,f,minct,maxct,ext_params)
return function(e,c,og,min,max)
if c==nil then return true end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
local tp=c:GetControler()
local minc=minct or 2
local maxc=maxct or minct or 63
if min then
minc=math.max(minc,min)
maxc=math.min(maxc,max)
end
local mg=nil
if og then
mg=og:Filter(cm.mfilter,nil,c,rk,f,ext_params)
else
mg=Duel.GetMatchingGroup(cm.mfilter,tp,LOCATION_MZONE,0,nil,c,rk,f,ext_params)
end
return maxc>=minc and mg:IsExists(cm.xyzfilter1,1,nil,tp,mg,c,minc,maxc)
end end
function cm.XyzProcedureCustomTuneMagicianFilter(c,te)
local f=te:GetValue()
return f(te,c)
end end
function cm.xyzop1(rk,f,minct,maxct,xm,ext_params) function cm.XyzProcedureCustomTuneMagicianCheck(c,g)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) local eset={c:IsHasEffect(EFFECT_TUNE_MAGICIAN_X)}
local g=nil for _,te in ipairs(eset) do
if og and not min then if g:IsExists(cm.XyzProcedureCustomTuneMagicianFilter,1,c,te) then return true end
g=og
else
local mg=nil
if og then
mg=og:Filter(cm.mfilter,nil,c,rk,f,ext_params)
else
mg=Duel.GetMatchingGroup(cm.mfilter,tp,LOCATION_MZONE,0,nil,c,rk,f,ext_params)
end
local minc=minct or 2
local maxc=maxct or minct or 63
if min then
minc=math.max(minc,min)
maxc=math.min(maxc,max)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g1=mg:FilterSelect(tp,cm.xyzfilter1,1,1,nil,tp,mg,c,minc,maxc)
local tg=mg:Filter(cm.xyzfilter2,g1:GetFirst(),g1:GetFirst():GetRank())
g=cm.SelectGroup(tp,HINTMSG_XMATERIAL,tg,cm.CheckFieldFilter,g1,minc,maxc,tp,c)
end end
c:SetMaterial(g) return false
cm.overlaygroup(c,g,xm,true)
end
end end
function cm.XyzProcedureCustomCheck(g,xyzc,tp,gf)
function cm.rxyz2(c,rk,f,ct,xm,...) if g:IsExists(cm.XyzProcedureCustomTuneMagicianCheck,1,nil,g) then return false end
return cm.rxyz1(c,rk,f,ct,ct,xm,...) return not gf or gf(g,xyzc,tp)
end end
function cm.rxyz3(c,func,gf,minc,maxc,xm,...) function cm.AddXyzProcedureCustom(c,func,gf,minc,maxc,xm,...)
local ext_params={...} local ext_params={...}
c:EnableReviveLimit() c:EnableReviveLimit()
local maxc=maxc or minc local maxc=maxc or minc
...@@ -127,17 +86,18 @@ function cm.rxyz3(c,func,gf,minc,maxc,xm,...) ...@@ -127,17 +86,18 @@ function cm.rxyz3(c,func,gf,minc,maxc,xm,...)
e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA) e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(cm.rxyz3Condition(func,gf,minc,maxc,ext_params)) e1:SetCondition(cm.XyzProcedureCustomCondition(func,gf,minc,maxc,ext_params))
e1:SetOperation(cm.rxyz3Operation(func,gf,minc,maxc,xm,ext_params)) e1:SetTarget(cm.XyzProcedureCustomTarget(func,gf,minc,maxc,ext_params))
e1:SetOperation(cm.XyzProcedureCustomOperation(xm))
e1:SetValue(SUMMON_TYPE_XYZ) e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1) c:RegisterEffect(e1)
return e1 return e1
end end
function cm.rxyz3Filter(c,xyzcard,func,ext_params) function cm.XyzProcedureCustomFilter(c,xyzcard,func,ext_params)
if c:IsLocation(LOCATION_ONFIELD+LOCATION_REMOVED) and c:IsFacedown() then return false end if c:IsLocation(LOCATION_ONFIELD+LOCATION_REMOVED) and c:IsFacedown() then return false end
return c:IsCanBeXyzMaterial(xyzcard) and (not func or func(c,xyzcard,table.unpack(ext_params))) return c:IsCanBeXyzMaterial(xyzcard) and (not func or func(c,xyzcard,table.unpack(ext_params)))
end end
function cm.rxyz3Condition(func,gf,minct,maxct,ext_params) function cm.XyzProcedureCustomCondition(func,gf,minct,maxct,ext_params)
return function(e,c,og,min,max) return function(e,c,og,min,max)
if c==nil then return true end if c==nil then return true end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
...@@ -150,24 +110,31 @@ function cm.rxyz3Condition(func,gf,minct,maxct,ext_params) ...@@ -150,24 +110,31 @@ function cm.rxyz3Condition(func,gf,minct,maxct,ext_params)
end end
local mg=nil local mg=nil
if og then if og then
mg=og:Filter(cm.rxyz3Filter,nil,c,func,ext_params) mg=og:Filter(cm.XyzProcedureCustomFilter,nil,c,func,ext_params)
else else
mg=Duel.GetMatchingGroup(cm.rxyz3Filter,tp,LOCATION_MZONE,0,nil,c,func,ext_params) mg=Duel.GetMatchingGroup(cm.XyzProcedureCustomFilter,tp,LOCATION_MZONE,0,nil,c,func,ext_params)
end
local sg=Group.CreateGroup()
local ce={Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_XMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
if not mg:IsContains(tc) then return false end
sg:AddCard(tc)
end end
return maxc>=minc and cm.CheckGroup(mg,cm.CheckFieldFilter,nil,minc,maxc,tp,c,gf,c) return maxc>=minc and cm.CheckGroup(mg,cm.CheckFieldFilter,sg,minc,maxc,tp,c,cm.XyzProcedureCustomCheck,c,tp,gf)
end end
end end
function cm.rxyz3Operation(func,gf,minct,maxct,xm,ext_params) function cm.XyzProcedureCustomTarget(func,gf,minct,maxct,ext_params)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) return function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
local g=nil local g=nil
if og and not min then if og and not min then
g=og g=og
else else
local mg=nil local mg=nil
if og then if og then
mg=og:Filter(cm.rxyz3Filter,nil,c,func,ext_params) mg=og:Filter(cm.XyzProcedureCustomFilter,nil,c,func,ext_params)
else else
mg=Duel.GetMatchingGroup(cm.rxyz3Filter,tp,LOCATION_MZONE,0,nil,c,func,ext_params) mg=Duel.GetMatchingGroup(cm.XyzProcedureCustomFilter,tp,LOCATION_MZONE,0,nil,c,func,ext_params)
end end
local minc=minct or 2 local minc=minct or 2
local maxc=maxct or minct or 63 local maxc=maxct or minct or 63
...@@ -175,16 +142,54 @@ function cm.rxyz3Operation(func,gf,minct,maxct,xm,ext_params) ...@@ -175,16 +142,54 @@ function cm.rxyz3Operation(func,gf,minct,maxct,xm,ext_params)
minc=math.max(minc,min) minc=math.max(minc,min)
maxc=math.min(maxc,max) maxc=math.min(maxc,max)
end end
g=cm.SelectGroup(tp,HINTMSG_XMATERIAL,mg,cm.CheckFieldFilter,nil,minc,maxc,tp,c,gf,c) local ce={Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_XMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
sg:AddCard(tc)
end
g=cm.SelectGroupWithCancel(tp,HINTMSG_XMATERIAL,mg,cm.CheckFieldFilter,sg,minc,maxc,tp,c,cm.XyzProcedureCustomCheck,c,tp,gf)
end end
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else return false end
end
end
function cm.XyzProcedureCustomOperation(xm)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local g=e:GetLabelObject()
c:SetMaterial(g) c:SetMaterial(g)
cm.overlaygroup(c,g,xm,true) cm.OverlayGroup(c,g,xm,true)
g:DeleteGroup()
end end
end end
function cm.AddXyzProcedureClariS(c,ct,rk)
local f=rk and cm.ClariSRankFilter or cm.ClariSRankFilter
cm.AddXyzProcedureCustom(c,f,cm.ClariSXyzCheck(ct),1,ct)
end
function cm.ClariSXyzFilter(c,xyzc)
return c:IsSetCard(0x570) and c:IsXyzLevel(xyzc,2)
end
function cm.ClariSRankFilter(c,xyzc)
return c:IsSetCard(0x570) and c:IsXyzType(TYPE_XYZ) and c:GetRank()==2
end
function c57300009.ClariSXyzValue(c)
local v=1
if c:IsHasEffect(57300021) then v=v+0x20000 end
return v
end
function cm.ClariSXyzCheck(ct)
return function(g,xyzc)
local i=g:GetCount()
if not g:CheckWithSumEqual(c57300009.ClariSXyzValue,ct,i,i) then return false end
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end
end
function cm.CheckGroupRecursive(c,sg,g,f,min,max,ext_params) function cm.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
sg:AddCard(c) sg:AddCard(c)
local ct=sg:GetCount() local ct=sg:GetCount()
local res=(ct>=min and f(sg,table.unpack(ext_params))) local res=(ct>=min and ct<= max and f(sg,table.unpack(ext_params)))
or (ct<max and g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params)) or (ct<max and g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params))
sg:RemoveCard(c) sg:RemoveCard(c)
return res return res
...@@ -197,34 +202,100 @@ function cm.CheckGroup(g,f,cg,min,max,...) ...@@ -197,34 +202,100 @@ function cm.CheckGroup(g,f,cg,min,max,...)
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
if cg then sg:Merge(cg) end if cg then sg:Merge(cg) end
local ct=sg:GetCount() local ct=sg:GetCount()
if ct>=min and ct<max and f(sg,...) then return true end if ct>=min and ct<=max and f(sg,...) then return true end
return g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params) return g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params)
end end
function cm.SelectGroup(tp,desc,g,f,cg,min,max,...) if Group.SelectUnselect then
local min=min or 1 function cm.SelectGroup(tp,desc,g,f,cg,min,max,...)
local max=max or g:GetCount() local min=min or 1
local ext_params={...} local max=max or g:GetCount()
local sg=Group.CreateGroup() local ext_params={...}
if cg then local sg=Group.CreateGroup()
local cg=cg or Group.CreateGroup()
sg:Merge(cg) sg:Merge(cg)
local ct=sg:GetCount()
local ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
while ct<max and ag:GetCount()>0 do
local finish=(ct>=min and ct<=max and f(sg,...))
local seg=sg:Clone()
local dmin=min-cg:GetCount()
local dmax=math.min(max-cg:GetCount(),g:GetCount())
seg:Sub(cg)
Duel.Hint(HINT_SELECTMSG,tp,desc)
local tc=ag:SelectUnselect(seg,tp,finish,finish,dmin,dmax)
if not tc then break end
if sg:IsContains(tc) then
sg:RemoveCard(tc)
else
sg:AddCard(tc)
end
ct=sg:GetCount()
ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
end
return sg
end end
local ct=sg:GetCount() function cm.SelectGroupWithCancel(tp,desc,g,f,cg,min,max,...)
local ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params) local min=min or 1
while ct<max and ag:GetCount()>0 do local max=max or g:GetCount()
local minc=1 local ext_params={...}
local finish=(ct>=min and f(sg,...)) local sg=Group.CreateGroup()
if finish then local cg=cg or Group.CreateGroup()
minc=0 sg:Merge(cg)
if not Duel.SelectYesNo(tp,210) then break end local ct=sg:GetCount()
local ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
while ct<max and ag:GetCount()>0 do
local finish=(ct>=min and ct<=max and f(sg,...))
local cancel=finish or ct==0
local seg=sg:Clone()
local dmin=min-cg:GetCount()
local dmax=math.min(max-cg:GetCount(),g:GetCount())
seg:Sub(cg)
Duel.Hint(HINT_SELECTMSG,tp,desc)
local tc=ag:SelectUnselect(seg,tp,finish,cancel,dmin,dmax)
if not tc then
if not finish then return end
break
end
if sg:IsContains(tc) then
sg:RemoveCard(tc)
else
sg:AddCard(tc)
end
ct=sg:GetCount()
ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
end
return sg
end
else
function cm.SelectGroup(tp,desc,g,f,cg,min,max,...)
local min=min or 1
local max=max or g:GetCount()
local ext_params={...}
local sg=Group.CreateGroup()
if cg then
sg:Merge(cg)
end end
Duel.Hint(HINT_SELECTMSG,tp,desc) local ct=sg:GetCount()
local tg=ag:Select(tp,minc,1,nil) local ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
if tg:GetCount()==0 then break end while ct<max and ag:GetCount()>0 do
sg:Merge(tg) local minc=1
ct=sg:GetCount() local finish=(ct>=min and ct<=max and f(sg,...))
ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params) if finish then
end minc=0
return sg if cm.master_rule_3_flag and not Duel.SelectYesNo(tp,210) then break end
end
Duel.Hint(HINT_SELECTMSG,tp,desc)
local tg=ag:Select(tp,minc,1,nil)
if tg:GetCount()==0 then break end
sg:Merge(tg)
ct=sg:GetCount()
ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
end
return sg
end
function cm.SelectGroupWithCancel(tp,desc,g,f,cg,min,max,...)
return cm.SelectGroup(tp,desc,g,f,cg,min,max,...)
end
end end
function cm.exgoal(g,tp,fc) function cm.exgoal(g,tp,fc)
return Duel.GetLocationCountFromEx(tp,tp,g,fc)>0 return Duel.GetLocationCountFromEx(tp,tp,g,fc)>0
......
--库拉丽丝-怨念 --库拉丽丝-怨念
function c57300010.initial_effect(c) function c57300010.initial_effect(c)
c:EnableReviveLimit() xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
local e1=Effect.CreateEffect(c) miyuki.AddXyzProcedureClariS(c,2)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetLabel(2)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c57300010.xyzcon)
e1:SetOperation(c57300010.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(57300010,0)) e1:SetDescription(aux.Stringid(57300010,0))
e1:SetCategory(CATEGORY_DISABLE) e1:SetCategory(CATEGORY_DISABLE)
...@@ -25,80 +16,6 @@ function c57300010.initial_effect(c) ...@@ -25,80 +16,6 @@ function c57300010.initial_effect(c)
e1:SetOperation(c57300010.operation) e1:SetOperation(c57300010.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c57300010.mfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x570) and c:IsCanBeXyzMaterial(xyzc) and c:IsXyzLevel(xyzc,2)
end
function c57300010.xyzfilter(c,mg,sg,ct,min,max,tp,xyzc)
sg:AddCard(c)
local i=sg:GetCount()
local res=(i>=min and c57300010.xyzgoal(sg,ct,tp,xyzc))
or (i<max and mg:IsExists(c57300010.xyzfilter,1,sg,mg,sg,ct,min,max,tp,xyzc))
sg:RemoveCard(c)
return res
end
function c57300010.xyzgoal(g,ct,tp,xyzc)
local i=g:GetCount()
if not g:CheckWithSumEqual(c57300010.xyzval,ct,i,i) then return false end
--to be changed in mr4
--return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end
function c57300010.xyzval(c)
local v=1
if c:IsHasEffect(57300021) then v=v+0x20000 end
return v
end
function c57300010.xyzcon(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local mg=nil
if og then
mg=og:Filter(c57300010.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300010.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
return min<=max and mg:IsExists(c57300010.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c)
end
function c57300010.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local mg=nil
if og then
if not min then
local tg=Group.CreateGroup()
for tc in aux.Next(og) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(og)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,og)
return
end
mg=og:Filter(c57300010.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300010.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
local i=sg:GetCount()
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=mg:FilterSelect(tp,c57300010.xyzfilter,1,1,sg,mg,sg,ct,min,max,tp,c)
sg:Merge(g)
i=sg:GetCount()
until i>=max or (i>=min and c57300010.xyzgoal(sg,ct,tp,xyzc) and not (mg:IsExists(c57300010.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c) and Duel.SelectYesNo(tp,210)))
local tg=Group.CreateGroup()
for tc in aux.Next(sg) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(sg)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,sg)
end
function c57300010.tdcost(e,tp,eg,ep,ev,re,r,rp,chk) function c57300010.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
......
--库拉丽丝-尝试 --库拉丽丝-尝试
function c57300011.initial_effect(c) function c57300011.initial_effect(c)
c:EnableReviveLimit() xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
local e1=Effect.CreateEffect(c) miyuki.AddXyzProcedureClariS(c,2)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetLabel(2)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c57300011.xyzcon)
e1:SetOperation(c57300011.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetDescription(aux.Stringid(57300011,0)) e1:SetDescription(aux.Stringid(57300011,0))
...@@ -24,80 +15,6 @@ function c57300011.initial_effect(c) ...@@ -24,80 +15,6 @@ function c57300011.initial_effect(c)
e1:SetOperation(c57300011.operation) e1:SetOperation(c57300011.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c57300011.mfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x570) and c:IsCanBeXyzMaterial(xyzc) and c:IsXyzLevel(xyzc,2)
end
function c57300011.xyzfilter(c,mg,sg,ct,min,max,tp,xyzc)
sg:AddCard(c)
local i=sg:GetCount()
local res=(i>=min and c57300011.xyzgoal(sg,ct,tp,xyzc))
or (i<max and mg:IsExists(c57300011.xyzfilter,1,sg,mg,sg,ct,min,max,tp,xyzc))
sg:RemoveCard(c)
return res
end
function c57300011.xyzgoal(g,ct,tp,xyzc)
local i=g:GetCount()
if not g:CheckWithSumEqual(c57300011.xyzval,ct,i,i) then return false end
--to be changed in mr4
--return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end
function c57300011.xyzval(c)
local v=1
if c:IsHasEffect(57300021) then v=v+0x20000 end
return v
end
function c57300011.xyzcon(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local mg=nil
if og then
mg=og:Filter(c57300011.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300011.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
return min<=max and mg:IsExists(c57300011.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c)
end
function c57300011.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local mg=nil
if og then
if not min then
local tg=Group.CreateGroup()
for tc in aux.Next(og) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(og)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,og)
return
end
mg=og:Filter(c57300011.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300011.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
local i=sg:GetCount()
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=mg:FilterSelect(tp,c57300011.xyzfilter,1,1,sg,mg,sg,ct,min,max,tp,c)
sg:Merge(g)
i=sg:GetCount()
until i>=max or (i>=min and c57300011.xyzgoal(sg,ct,tp,xyzc) and not (mg:IsExists(c57300011.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c) and Duel.SelectYesNo(tp,210)))
local tg=Group.CreateGroup()
for tc in aux.Next(sg) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(sg)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,sg)
end
function c57300011.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c57300011.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
......
--库拉丽丝-心配 --库拉丽丝-心配
function c57300012.initial_effect(c) function c57300012.initial_effect(c)
c:EnableReviveLimit() xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
local e1=Effect.CreateEffect(c) miyuki.AddXyzProcedureClariS(c,3)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetLabel(3)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c57300012.xyzcon)
e1:SetOperation(c57300012.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(57300012,0)) e2:SetDescription(aux.Stringid(57300012,0))
e2:SetCategory(CATEGORY_REMOVE) e2:SetCategory(CATEGORY_REMOVE)
...@@ -32,81 +23,6 @@ function c57300012.initial_effect(c) ...@@ -32,81 +23,6 @@ function c57300012.initial_effect(c)
e4:SetOperation(c57300012.tdop) e4:SetOperation(c57300012.tdop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
function c57300012.mfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x570) and c:IsCanBeXyzMaterial(xyzc) and c:IsXyzLevel(xyzc,2)
end
function c57300012.xyzfilter(c,mg,sg,ct,min,max,tp,xyzc)
sg:AddCard(c)
local i=sg:GetCount()
local res=(i>=min and c57300012.xyzgoal(sg,ct,tp,xyzc))
or (i<max and mg:IsExists(c57300012.xyzfilter,1,sg,mg,sg,ct,min,max,tp,xyzc))
sg:RemoveCard(c)
return res
end
function c57300012.xyzgoal(g,ct,tp,xyzc)
local i=g:GetCount()
if not g:CheckWithSumEqual(c57300012.xyzval,ct,i,i) then return false end
--to be changed in mr4
--return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end
function c57300012.xyzval(c)
local v=1
if c:IsHasEffect(57300021) then v=v+0x20000 end
return v
end
function c57300012.xyzcon(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local mg=nil
if og then
mg=og:Filter(c57300012.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300012.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
return min<=max and mg:IsExists(c57300012.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c)
end
function c57300012.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local mg=nil
if og then
if not min then
local tg=Group.CreateGroup()
for tc in aux.Next(og) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(og)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,og)
return
end
mg=og:Filter(c57300012.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300012.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
local i=sg:GetCount()
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=mg:FilterSelect(tp,c57300012.xyzfilter,1,1,sg,mg,sg,ct,min,max,tp,c)
sg:Merge(g)
i=sg:GetCount()
until i>=max or (i>=min and c57300012.xyzgoal(sg,ct,tp,xyzc) and not (mg:IsExists(c57300012.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c) and Duel.SelectYesNo(tp,210)))
local tg=Group.CreateGroup()
for tc in aux.Next(sg) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(sg)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,sg)
Duel.Hint(11,0,aux.Stringid(57300012,1))
end
function c57300012.tdcost(e,tp,eg,ep,ev,re,r,rp,chk) function c57300012.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
......
--库拉丽丝-初梦 --库拉丽丝-初梦
function c57300013.initial_effect(c) function c57300013.initial_effect(c)
c:EnableReviveLimit() xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
local e1=Effect.CreateEffect(c) miyuki.AddXyzProcedureClariS(c,3)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetLabel(3)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c57300013.xyzcon)
e1:SetOperation(c57300013.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
...@@ -27,80 +18,6 @@ function c57300013.initial_effect(c) ...@@ -27,80 +18,6 @@ function c57300013.initial_effect(c)
e5:SetOperation(c57300013.desop) e5:SetOperation(c57300013.desop)
c:RegisterEffect(e5) c:RegisterEffect(e5)
end end
function c57300013.mfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x570) and c:IsCanBeXyzMaterial(xyzc) and c:IsXyzLevel(xyzc,2)
end
function c57300013.xyzfilter(c,mg,sg,ct,min,max,tp,xyzc)
sg:AddCard(c)
local i=sg:GetCount()
local res=(i>=min and c57300013.xyzgoal(sg,ct,tp,xyzc))
or (i<max and mg:IsExists(c57300013.xyzfilter,1,sg,mg,sg,ct,min,max,tp,xyzc))
sg:RemoveCard(c)
return res
end
function c57300013.xyzgoal(g,ct,tp,xyzc)
local i=g:GetCount()
if not g:CheckWithSumEqual(c57300013.xyzval,ct,i,i) then return false end
--to be changed in mr4
--return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end
function c57300013.xyzval(c)
local v=1
if c:IsHasEffect(57300021) then v=v+0x20000 end
return v
end
function c57300013.xyzcon(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local mg=nil
if og then
mg=og:Filter(c57300013.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300013.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
return min<=max and mg:IsExists(c57300013.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c)
end
function c57300013.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local mg=nil
if og then
if not min then
local tg=Group.CreateGroup()
for tc in aux.Next(og) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(og)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,og)
return
end
mg=og:Filter(c57300013.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300013.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
local i=sg:GetCount()
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=mg:FilterSelect(tp,c57300013.xyzfilter,1,1,sg,mg,sg,ct,min,max,tp,c)
sg:Merge(g)
i=sg:GetCount()
until i>=max or (i>=min and c57300013.xyzgoal(sg,ct,tp,xyzc) and not (mg:IsExists(c57300013.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c) and Duel.SelectYesNo(tp,210)))
local tg=Group.CreateGroup()
for tc in aux.Next(sg) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(sg)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,sg)
end
function c57300013.descon(e,tp,eg,ep,ev,re,r,rp) function c57300013.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local bc=c:GetBattleTarget() local bc=c:GetBattleTarget()
......
--库拉丽丝-终曲 --库拉丽丝-终曲
function c57300014.initial_effect(c) function c57300014.initial_effect(c)
c:EnableReviveLimit() xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
--xs miyuki.AddXyzProcedureClariS(c,2,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetLabel(2)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c57300014.xyzcon)
e1:SetOperation(c57300014.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
--material --material
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE) e4:SetType(EFFECT_TYPE_SINGLE)
...@@ -42,78 +32,6 @@ function c57300014.initial_effect(c) ...@@ -42,78 +32,6 @@ function c57300014.initial_effect(c)
e3:SetOperation(c57300014.disop) e3:SetOperation(c57300014.disop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c57300014.mfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x570) and c:IsXyzType(TYPE_XYZ) and c:IsCanBeXyzMaterial(xyzc) and c:GetRank()==2
end
function c57300014.xyzfilter(c,mg,sg,ct,min,max,tp,xyzc)
sg:AddCard(c)
local i=sg:GetCount()
local res=(i>=min and c57300014.xyzgoal(sg,ct,tp,xyzc))
or (i<max and mg:IsExists(c57300014.xyzfilter,1,sg,mg,sg,ct,min,max,tp,xyzc))
sg:RemoveCard(c)
return res
end
function c57300014.xyzgoal(g,ct,tp,xyzc)
local i=g:GetCount()
if not g:CheckWithSumEqual(c57300014.xyzval,ct,i,i) then return false end
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end
function c57300014.xyzval(c)
local v=1
if c:IsHasEffect(57300021) then v=v+0x20000 end
return v
end
function c57300014.xyzcon(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local mg=nil
if og then
mg=og:Filter(c57300014.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300014.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
return min<=max and mg:IsExists(c57300014.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c)
end
function c57300014.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local mg=nil
if og then
if not min then
local tg=Group.CreateGroup()
for tc in aux.Next(og) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(og)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,og)
return
end
mg=og:Filter(c57300014.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300014.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
local i=sg:GetCount()
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=mg:FilterSelect(tp,c57300014.xyzfilter,1,1,sg,mg,sg,ct,min,max,tp,c)
sg:Merge(g)
i=sg:GetCount()
until i>=max or (i>=min and c57300014.xyzgoal(sg,ct,tp,xyzc) and not (mg:IsExists(c57300014.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c) and Duel.SelectYesNo(tp,210)))
local tg=Group.CreateGroup()
for tc in aux.Next(sg) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(sg)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,sg)
end
function c57300014.filter(c,tp) function c57300014.filter(c,tp)
return not c:IsType(TYPE_TOKEN) and (c:IsControler(tp) or c:IsAbleToChangeControler()) return not c:IsType(TYPE_TOKEN) and (c:IsControler(tp) or c:IsAbleToChangeControler())
end end
......
--Approved·樱野美雪 --Approved·樱野美雪
xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end) xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
function c57300019.initial_effect(c) function c57300019.initial_effect(c)
miyuki.rxyz1(c,nil,nil,3,3) miyuki.AddXyzProcedureRank(c,nil,nil,3,3)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
......
--终焉的物语·物凄 --终焉的物语·物凄
xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end) xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
function c57300020.initial_effect(c) function c57300020.initial_effect(c)
miyuki.rxyz1(c,nil,nil,2,63) miyuki.AddXyzProcedureRank(c,nil,nil,2,63)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetCode(EFFECT_SPSUMMON_PROC)
......
--库拉丽丝-银莲 --库拉丽丝-银莲
function c57300022.initial_effect(c) function c57300022.initial_effect(c)
c:EnableReviveLimit() xpcall(function() require("expansions/script/c57300000") end,function() require("script/c57300000") end)
local e1=Effect.CreateEffect(c) miyuki.AddXyzProcedureClariS(c,3)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetLabel(3)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c57300022.xyzcon)
e1:SetOperation(c57300022.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
local ex=Effect.CreateEffect(c) local ex=Effect.CreateEffect(c)
ex:SetType(EFFECT_TYPE_SINGLE) ex:SetType(EFFECT_TYPE_SINGLE)
ex:SetCode(57300022) ex:SetCode(57300022)
...@@ -96,81 +87,7 @@ function c57300022.rcon(con,tc,copyt) ...@@ -96,81 +87,7 @@ function c57300022.rcon(con,tc,copyt)
copyt[tc]=nil copyt[tc]=nil
return false return false
end end
return not con or con(e,tp,eg,ep,ev,re,r,rp) if not con or con(e,tp,eg,ep,ev,re,r,rp) then return true end
return e:IsHasType(0x7e0) and c:GetFlagEffect(m)>0
end end
end
function c57300022.mfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x570) and c:IsCanBeXyzMaterial(xyzc) and c:IsXyzLevel(xyzc,2)
end
function c57300022.xyzfilter(c,mg,sg,ct,min,max,tp,xyzc)
sg:AddCard(c)
local i=sg:GetCount()
local res=(i>=min and c57300022.xyzgoal(sg,ct,tp,xyzc))
or (i<max and mg:IsExists(c57300022.xyzfilter,1,sg,mg,sg,ct,min,max,tp,xyzc))
sg:RemoveCard(c)
return res
end
function c57300022.xyzgoal(g,ct,tp,xyzc)
local i=g:GetCount()
if not g:CheckWithSumEqual(c57300022.xyzval,ct,i,i) then return false end
--to be changed in mr4
--return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end
function c57300022.xyzval(c)
local v=1
if c:IsHasEffect(57300021) then v=v+0x20000 end
return v
end
function c57300022.xyzcon(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local mg=nil
if og then
mg=og:Filter(c57300022.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300022.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
return min<=max and mg:IsExists(c57300022.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c)
end
function c57300022.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local mg=nil
if og then
if not min then
local tg=Group.CreateGroup()
for tc in aux.Next(og) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(og)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,og)
return
end
mg=og:Filter(c57300022.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c57300022.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
local ct=e:GetLabel()
local sg=Group.CreateGroup()
local min=min or 1
local max=max and math.min(max,ct) or ct
local i=sg:GetCount()
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=mg:FilterSelect(tp,c57300022.xyzfilter,1,1,sg,mg,sg,ct,min,max,tp,c)
sg:Merge(g)
i=sg:GetCount()
until i>=max or (i>=min and c57300022.xyzgoal(sg,ct,tp,xyzc) and not (mg:IsExists(c57300022.xyzfilter,1,sg,mg,sg,ct,min,max,tp,c) and Duel.SelectYesNo(tp,210)))
local tg=Group.CreateGroup()
for tc in aux.Next(sg) do
tg:Merge(tc:GetOverlayGroup())
end
c:SetMaterial(sg)
Duel.SendtoGrave(tg,REASON_RULE)
Duel.Overlay(c,sg)
Duel.Hint(11,0,aux.Stringid(57300022,0))
end end
\ No newline at end of file
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