Commit ca55be37 authored by mercury233's avatar mercury233 Committed by GitHub

add Group.SelectSubGroupEach etc. (#1269)

parent c2b044f6
......@@ -43,6 +43,7 @@ function c12289247.initial_effect(c)
Duel.RegisterEffect(ge1,0)
end
end
c12289247.hnchecks=aux.CreateChecks(Card.IsSetCard,{0x10f2,0x2073,0x2017,0x1046})
function c12289247.spcfilter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT)
and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_ONFIELD)
......@@ -114,26 +115,10 @@ function c12289247.cfilter(c)
and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
and (not c:IsLocation(LOCATION_MZONE) or c:IsFaceup())
end
function c12289247.fcheck(c,sg,g,code,...)
if not c:IsSetCard(code) then return false end
if ... then
g:AddCard(c)
local res=sg:IsExists(c12289247.fcheck,1,g,sg,g,...)
g:RemoveCard(c)
return res
else return true end
end
function c12289247.fselect(c,tp,mg,sg,mc,...)
sg:AddCard(c)
local res=false
if sg:GetCount()<5 then
res=mg:IsExists(c12289247.fselect,1,sg,tp,mg,sg,mc,...)
elseif Duel.GetLocationCountFromEx(tp,tp,sg)>0 then
local g=Group.FromCards(mc)
res=sg:IsExists(c12289247.fcheck,1,g,sg,g,...)
end
sg:RemoveCard(c)
return res
function c12289247.hngoal(g,tp,c)
local sg=Group.FromCards(c)
sg:Merge(g)
return Duel.GetLocationCountFromEx(tp,tp,sg)>0
end
function c12289247.hnfilter(c,e,tp)
return c:IsCode(13331639) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial()
......@@ -141,14 +126,11 @@ end
function c12289247.hncost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local mg=Duel.GetMatchingGroup(c12289247.cfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil)
local sg=Group.FromCards(c)
if chk==0 then return c:IsAbleToRemoveAsCost()
and mg:IsExists(c12289247.fselect,1,sg,tp,mg,sg,c,0x10f2,0x2073,0x2017,0x1046) end
while sg:GetCount()<5 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=mg:FilterSelect(tp,c12289247.fselect,1,1,sg,tp,mg,sg,c,0x10f2,0x2073,0x2017,0x1046)
sg:Merge(g)
end
and mg:CheckSubGroupEach(c12289247.hnchecks,c12289247.hngoal,tp,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=mg:SelectSubGroupEach(tp,c12289247.hnchecks,false,c12289247.hngoal,tp,c)
sg:AddCard(c)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c12289247.hntg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -22,41 +22,21 @@ function c15574615.initial_effect(c)
e2:SetOperation(c15574615.operation)
c:RegisterEffect(e2)
end
c15574615.spchecks=aux.CreateChecks(Card.IsCode,{80208158,16796157,43791861,79185500})
function c15574615.spcostfilter(c)
return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost()
and c:IsCode(80208158,16796157,43791861,79185500)
end
c15574615.spcost_list={80208158,16796157,43791861,79185500}
function c15574615.spcost_selector(c,tp,g,sg,i)
if not c:IsCode(c15574615.spcost_list[i]) then return false end
sg:AddCard(c)
g:RemoveCard(c)
local flag=false
if i<4 then
flag=g:IsExists(c15574615.spcost_selector,1,nil,tp,g,sg,i+1)
else
flag=Duel.GetMZoneCount(tp,sg,tp)>0
end
sg:RemoveCard(c)
g:AddCard(c)
return flag
end
function c15574615.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(c15574615.spcostfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil)
local sg=Group.CreateGroup()
return g:IsExists(c15574615.spcost_selector,1,nil,tp,g,sg,1)
return g:CheckSubGroupEach(c15574615.spchecks,aux.mzctcheck,tp)
end
function c15574615.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(c15574615.spcostfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil)
local sg=Group.CreateGroup()
for i=1,4 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=g:FilterSelect(tp,c15574615.spcost_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:SelectSubGroupEach(tp,c15574615.spchecks,false,aux.mzctcheck,tp)
Duel.SendtoGrave(sg,REASON_COST)
end
function c15574615.cost(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -66,33 +46,15 @@ end
function c15574615.spfilter(c,e,tp)
return c:IsCode(80208158,16796157,43791861,79185500) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsCanBeEffectTarget(e)
end
function c15574615.sptarget_selector(c,tp,g,sg,i)
if not c:IsCode(c15574615.spcost_list[i]) then return false end
if i<4 then
sg:AddCard(c)
g:RemoveCard(c)
local flag=g:IsExists(c15574615.sptarget_selector,1,nil,tp,g,sg,i+1)
sg:RemoveCard(c)
g:AddCard(c)
return flag
else
return true
end
end
function c15574615.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c15574615.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp)
local sg=Group.CreateGroup()
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>=3
and g:IsExists(c15574615.sptarget_selector,1,nil,tp,g,sg,1)
end
for i=1,4 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g1=g:FilterSelect(tp,c15574615.sptarget_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
and g:CheckSubGroupEach(c15574615.spchecks)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroupEach(tp,c15574615.spchecks)
Duel.SetTargetCard(sg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,4,0,0)
end
......
......@@ -11,34 +11,15 @@ function c22666164.initial_effect(c)
e1:SetOperation(c22666164.operation)
c:RegisterEffect(e1)
end
c22666164.spchecks=aux.CreateChecks(Card.IsCode,{60999392,23782705,96384007})
function c22666164.spcostfilter(c)
return c:IsFaceup() and c:IsAbleToGraveAsCost() and c:IsCode(60999392,23782705,96384007)
end
c22666164.spcost_list={60999392,23782705,96384007}
function c22666164.spcost_selector(c,tp,g,sg,i)
if not c:IsCode(c22666164.spcost_list[i]) then return false end
sg:AddCard(c)
g:RemoveCard(c)
local flag=false
if i<3 then
flag=g:IsExists(c22666164.spcost_selector,1,nil,tp,g,sg,i+1)
else
flag=Duel.GetMZoneCount(tp,sg,tp)>0
end
sg:RemoveCard(c)
g:AddCard(c)
return flag
end
function c22666164.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c22666164.spcostfilter,tp,LOCATION_MZONE,0,nil)
local sg=Group.CreateGroup()
if chk==0 then return g:IsExists(c22666164.spcost_selector,1,nil,tp,g,sg,1) end
for i=1,3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=g:FilterSelect(tp,c22666164.spcost_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
end
if chk==0 then return g:CheckSubGroupEach(c22666164.spchecks,aux.mzctcheck,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:SelectSubGroupEach(tp,c22666164.spchecks,false,aux.mzctcheck,tp)
Duel.SendtoGrave(sg,REASON_COST)
end
function c22666164.filter(c,e,tp)
......
......@@ -12,33 +12,16 @@ function c34898052.initial_effect(c)
e1:SetOperation(c34898052.activate)
c:RegisterEffect(e1)
end
function c34898052.rfilter(c,att)
return (not att or c:IsAttribute(att)) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
c34898052.cost_table={ATTRIBUTE_EARTH,ATTRIBUTE_WATER,ATTRIBUTE_FIRE,ATTRIBUTE_WIND}
function c34898052.rcostselector(c,g,sg,i)
if not c:IsAttribute(c34898052.cost_table[i]) then return false end
if i<4 then
g:RemoveCard(c)
sg:AddCard(c)
local flag=g:IsExists(c34898052.rcostselector,1,nil,g,sg,i+1)
g:AddCard(c)
sg:RemoveCard(c)
return flag
else
return true
end
c34898052.rchecks=aux.CreateChecks(Card.IsAttribute,{ATTRIBUTE_EARTH,ATTRIBUTE_WATER,ATTRIBUTE_FIRE,ATTRIBUTE_WIND})
function c34898052.rfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH+ATTRIBUTE_WATER+ATTRIBUTE_FIRE+ATTRIBUTE_WIND)
and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c34898052.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c34898052.rfilter,tp,LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
if chk==0 then return g:IsExists(c34898052.rcostselector,1,nil,g,sg,1) end
for i=1,4 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=g:FilterSelect(tp,c34898052.rcostselector,1,1,nil,g,sg,i)
g:Sub(g1)
sg:Merge(g1)
end
if chk==0 then return g:CheckSubGroupEach(c34898052.rchecks) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroupEach(tp,c34898052.rchecks)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c34898052.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -31,41 +31,21 @@ function c42901635.initial_effect(c)
e3:SetOperation(c42901635.spop2)
c:RegisterEffect(e3)
end
c42901635.spchecks=aux.CreateChecks(Card.IsCode,{42023223,79418928,15502037})
function c42901635.spcostfilter(c)
return (c:IsLocation(LOCATION_HAND+LOCATION_GRAVE) or c:IsFaceup())
and c:IsAbleToRemoveAsCost() and c:IsCode(42023223,79418928,15502037)
end
c42901635.spcost_list={42023223,79418928,15502037}
function c42901635.spcost_selector(c,tp,g,sg,i)
if not c:IsCode(c42901635.spcost_list[i]) then return false end
sg:AddCard(c)
g:RemoveCard(c)
local flag=false
if i<3 then
flag=g:IsExists(c42901635.spcost_selector,1,nil,tp,g,sg,i+1)
else
flag=Duel.GetMZoneCount(tp,sg,tp)>0
end
sg:RemoveCard(c)
g:AddCard(c)
return flag
end
function c42901635.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(c42901635.spcostfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
return g:IsExists(c42901635.spcost_selector,1,nil,tp,g,sg,1)
return g:CheckSubGroupEach(c42901635.spchecks,aux.mzctcheck,tp)
end
function c42901635.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(c42901635.spcostfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
for i=1,3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=g:FilterSelect(tp,c42901635.spcost_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroupEach(tp,c42901635.spchecks,false,aux.mzctcheck,tp)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c42901635.costfilter(c)
......@@ -100,32 +80,14 @@ function c42901635.spfilter(c,e,tp)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and c:IsCanBeEffectTarget(e)
end
function c42901635.sptarget_selector(c,tp,g,sg,i)
if not c:IsCode(c42901635.spcost_list[i]) then return false end
if i<3 then
sg:AddCard(c)
g:RemoveCard(c)
local flag=g:IsExists(c42901635.sptarget_selector,1,nil,tp,g,sg,i+1)
sg:RemoveCard(c)
g:AddCard(c)
return flag
else
return true
end
end
function c42901635.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c42901635.spfilter,tp,LOCATION_REMOVED,0,nil,e,tp)
local sg=Group.CreateGroup()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>2
and not Duel.IsPlayerAffectedByEffect(tp,59822133)
and g:IsExists(c42901635.sptarget_selector,1,nil,tp,g,sg,1) end
for i=1,3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g1=g:FilterSelect(tp,c42901635.sptarget_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
end
and g:CheckSubGroupEach(c42901635.spchecks) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroupEach(tp,c42901635.spchecks)
Duel.SetTargetCard(sg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,3,0,0)
end
......
......@@ -31,40 +31,20 @@ function c4335427.initial_effect(c)
e4:SetOperation(c4335427.rmop)
c:RegisterEffect(e4)
end
c4335427.spchecks=aux.CreateChecks(Card.IsType,{TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ})
function c4335427.spcostfilter(c)
return c:IsFaceup() and c:IsAbleToRemoveAsCost() and c:IsType(TYPE_RITUAL+TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ)
end
c4335427.spcost_table={TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ}
function c4335427.spcost_selector(c,tp,g,sg,i)
if not c:IsType(c4335427.spcost_table[i]) then return false end
sg:AddCard(c)
g:RemoveCard(c)
local flag=false
if i<4 then
flag=g:IsExists(c4335427.spcost_selector,1,nil,tp,g,sg,i+1)
else
flag=Duel.GetMZoneCount(tp,sg,tp)>0
end
sg:RemoveCard(c)
g:AddCard(c)
return flag
end
function c4335427.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(c4335427.spcostfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local sg=Group.CreateGroup()
return g:IsExists(c4335427.spcost_selector,1,nil,tp,g,sg,1)
return g:CheckSubGroupEach(c4335427.spchecks,aux.mzctcheck,tp)
end
function c4335427.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(c4335427.spcostfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local sg=Group.CreateGroup()
for i=1,4 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=g:FilterSelect(tp,c4335427.spcost_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroupEach(tp,c4335427.spchecks,false,aux.mzctcheck,tp)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c4335427.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -10,31 +10,22 @@ function c45898858.initial_effect(c)
e1:SetOperation(c45898858.activate)
c:RegisterEffect(e1)
end
c45898858.spchecks=aux.CreateChecks(Card.IsCode,{22587018,22587018,58071123})
function c45898858.costfilter(c,tp)
return c:IsCode(22587018,58071123) and (c:IsControler(tp) or c:IsFaceup())
end
function c45898858.fcheck(c,mg,sg,code,...)
if not c:IsCode(code) then return false end
if ... then
sg:AddCard(c)
local res=mg:IsExists(c45898858.fcheck,1,sg,mg,sg,...)
sg:RemoveCard(c)
return res
else return true end
end
function c45898858.fselect(g,tp,sg)
if g:IsExists(c45898858.fcheck,1,nil,g,sg,22587018,22587018,58071123) and Duel.GetMZoneCount(tp,g)>0 then
function c45898858.fgoal(g,tp)
if Duel.GetMZoneCount(tp,g)>0 then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c45898858.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local sg=Group.CreateGroup()
local g=Duel.GetReleaseGroup(tp):Filter(c45898858.costfilter,nil,tp)
if chk==0 then return g:CheckSubGroup(c45898858.fselect,3,3,tp,sg) end
if chk==0 then return g:CheckSubGroupEach(c45898858.spchecks,c45898858.fgoal,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg=g:SelectSubGroup(tp,c45898858.fselect,false,3,3,tp,sg)
local rg=g:SelectSubGroupEach(tp,c45898858.spchecks,false,c45898858.fgoal,tp)
Duel.Release(rg,REASON_COST)
end
function c45898858.filter(c,e,tp)
......
......@@ -26,6 +26,7 @@ function c58054262.initial_effect(c)
e3:SetOperation(c58054262.spop)
c:RegisterEffect(e3)
end
c58054262.spchecks=aux.CreateChecks(Card.IsCode,{60999392,23782705,96384007})
function c58054262.atcost(e,c,tp)
return Duel.CheckLPCost(tp,1000)
end
......@@ -42,34 +43,15 @@ end
function c58054262.sptargetfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsCode(60999392,23782705,96384007) and c:IsCanBeEffectTarget(e)
end
c58054262.sptarget_list={60999392,23782705,96384007}
function c58054262.sptarget_selector(c,tp,g,sg,i)
if not c:IsCode(c58054262.sptarget_list[i]) then return false end
if i<3 then
sg:AddCard(c)
g:RemoveCard(c)
local flag=g:IsExists(c58054262.sptarget_selector,1,nil,tp,g,sg,i+1)
sg:RemoveCard(c)
g:AddCard(c)
return flag
else
return true
end
end
function c58054262.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c58054262.sptargetfilter,tp,LOCATION_GRAVE,0,nil,e,tp)
local sg=Group.CreateGroup()
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetMZoneCount(tp,e:GetHandler())>=3
and g:IsExists(c58054262.sptarget_selector,1,nil,tp,g,sg,1)
end
for i=1,3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g1=g:FilterSelect(tp,c58054262.sptarget_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
and g:CheckSubGroupEach(c58054262.spchecks)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroupEach(tp,c58054262.spchecks)
Duel.SetTargetCard(sg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,3,0,0)
end
......
......@@ -11,50 +11,16 @@ function c61411502.initial_effect(c)
e1:SetOperation(c61411502.activate)
c:RegisterEffect(e1)
end
function c61411502.cfilter1(c,rg)
if not c:IsAttribute(ATTRIBUTE_WIND) then return false end
rg:RemoveCard(c)
local ret=rg:IsExists(c61411502.cfilter2,1,nil,rg)
rg:AddCard(c)
return ret
end
function c61411502.cfilter2(c,rg)
if not c:IsAttribute(ATTRIBUTE_WATER) then return false end
rg:RemoveCard(c)
local ret=rg:IsExists(c61411502.cfilter3,1,nil,rg)
rg:AddCard(c)
return ret
end
function c61411502.cfilter3(c,rg)
if not c:IsAttribute(ATTRIBUTE_FIRE) then return false end
rg:RemoveCard(c)
local ret=rg:IsExists(Card.IsAttribute,1,nil,ATTRIBUTE_EARTH)
rg:AddCard(c)
return ret
end
function c61411502.rfilter(c)
return c:IsFaceup() and c:IsHasEffect(EFFECT_EXTRA_RELEASE) and c:IsReleasable()
c61411502.rchecks=aux.CreateChecks(Card.IsAttribute,{ATTRIBUTE_WIND,ATTRIBUTE_WATER,ATTRIBUTE_FIRE,ATTRIBUTE_EARTH})
function c61411502.rgoal(g,tp)
return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,g)
end
function c61411502.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g1=Duel.GetMatchingGroup(Card.IsReleasable,tp,LOCATION_MZONE,0,nil)
local g2=Duel.GetMatchingGroup(c61411502.rfilter,tp,0,LOCATION_MZONE,nil)
g1:Merge(g2)
if chk==0 then return g1:GetCount()>3 and g1:IsExists(c61411502.cfilter1,1,nil,g1) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg1=g1:FilterSelect(tp,c61411502.cfilter1,1,1,nil,g1)
g1:Sub(rg1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg2=g1:FilterSelect(tp,c61411502.cfilter2,1,1,nil,g1)
g1:Sub(rg2)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg3=g1:FilterSelect(tp,c61411502.cfilter3,1,1,nil,g1)
g1:Sub(rg3)
local g=Duel.GetReleaseGroup(tp)
if chk==0 then return g:CheckSubGroupEach(c61411502.rchecks,c61411502.rgoal,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg4=g1:FilterSelect(tp,Card.IsAttribute,1,1,nil,ATTRIBUTE_EARTH)
rg1:Merge(rg2)
rg1:Merge(rg3)
rg1:Merge(rg4)
Duel.Release(rg1,REASON_COST)
local rg=g:SelectSubGroupEach(tp,c61411502.rchecks,false,c61411502.rgoal,tp)
Duel.Release(rg,REASON_COST)
end
function c61411502.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end
......
......@@ -20,35 +20,16 @@ function c6890729.initial_effect(c)
e2:SetOperation(c6890729.thop)
c:RegisterEffect(e2)
end
c6890729.spchecks=aux.CreateChecks(Card.IsCode,{43017476,22587018,58071123})
function c6890729.spcostfilter(c)
return c:IsAbleToDeckAsCost() and c:IsCode(43017476,22587018,58071123)
end
c6890729.spcost_list={43017476,22587018,58071123}
function c6890729.spcost_selector(c,tp,g,sg,i)
if not c:IsCode(c6890729.spcost_list[i]) then return false end
if i<3 then
sg:AddCard(c)
g:RemoveCard(c)
local flag=g:IsExists(c6890729.spcost_selector,1,nil,tp,g,sg,i+1)
sg:RemoveCard(c)
g:AddCard(c)
return flag
else
return true
end
end
function c6890729.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c6890729.spcostfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and g:IsExists(c6890729.spcost_selector,1,nil,tp,g,sg,1)
end
for i=1,3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g1=g:FilterSelect(tp,c6890729.spcost_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
end
and g:CheckSubGroupEach(c6890729.spchecks) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=g:SelectSubGroupEach(tp,c6890729.spchecks)
Duel.ConfirmCards(1-tp,sg)
Duel.SendtoDeck(sg,nil,2,REASON_COST)
end
......
......@@ -48,6 +48,7 @@ function c76794549.initial_effect(c)
Duel.RegisterEffect(ge2,0)
end
end
c76794549.hnchecks=aux.CreateChecks(Card.IsSetCard,{0x10f2,0x2073,0x2017,0x1046})
function c76794549.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
while tc do
......@@ -142,26 +143,10 @@ function c76794549.cfilter(c)
and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
and (not c:IsLocation(LOCATION_MZONE) or c:IsFaceup())
end
function c76794549.fcheck(c,sg,g,code,...)
if not c:IsSetCard(code) then return false end
if ... then
g:AddCard(c)
local res=sg:IsExists(c76794549.fcheck,1,g,sg,g,...)
g:RemoveCard(c)
return res
else return true end
end
function c76794549.fselect(c,tp,mg,sg,mc,...)
sg:AddCard(c)
local res=false
if sg:GetCount()<5 then
res=mg:IsExists(c76794549.fselect,1,sg,tp,mg,sg,mc,...)
elseif Duel.GetLocationCountFromEx(tp,tp,sg)>0 then
local g=Group.FromCards(mc)
res=sg:IsExists(c76794549.fcheck,1,g,sg,g,...)
end
sg:RemoveCard(c)
return res
function c76794549.hngoal(g,tp,c)
local sg=Group.FromCards(c)
sg:Merge(g)
return Duel.GetLocationCountFromEx(tp,tp,sg)>0
end
function c76794549.hnfilter(c,e,tp)
return c:IsCode(13331639) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial()
......@@ -169,14 +154,11 @@ end
function c76794549.hncost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local mg=Duel.GetMatchingGroup(c76794549.cfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil)
local sg=Group.FromCards(c)
if chk==0 then return c:IsAbleToRemoveAsCost()
and mg:IsExists(c76794549.fselect,1,sg,tp,mg,sg,c,0x10f2,0x2073,0x2017,0x1046) end
while sg:GetCount()<5 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=mg:FilterSelect(tp,c76794549.fselect,1,1,sg,tp,mg,sg,c,0x10f2,0x2073,0x2017,0x1046)
sg:Merge(g)
end
and mg:CheckSubGroupEach(c76794549.hnchecks,c76794549.hngoal,tp,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=mg:SelectSubGroupEach(tp,c76794549.hnchecks,false,c76794549.hngoal,tp,c)
sg:AddCard(c)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c76794549.hntg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -22,20 +22,12 @@ function c79402185.initial_effect(c)
e2:SetOperation(c79402185.thop)
c:RegisterEffect(e2)
end
c79402185.spchecks=aux.CreateChecks(Card.IsCode,{43017476,43017476,58071123})
function c79402185.costfilter(c,tp)
return c:IsCode(43017476,58071123) and (c:IsControler(tp) or c:IsFaceup())
end
function c79402185.fcheck(c,mg,sg,code,...)
if not c:IsCode(code) then return false end
if ... then
sg:AddCard(c)
local res=mg:IsExists(c79402185.fcheck,1,sg,mg,sg,...)
sg:RemoveCard(c)
return res
else return true end
end
function c79402185.fselect(g,tp,sg)
if g:IsExists(c79402185.fcheck,1,nil,g,sg,43017476,43017476,58071123) and Duel.GetMZoneCount(tp,g)>0 then
function c79402185.fgoal(g,tp)
if Duel.GetMZoneCount(tp,g)>0 then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroupEx(tp,nil,0,nil)
else return false end
......@@ -44,9 +36,9 @@ function c79402185.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local sg=Group.CreateGroup()
local g=Duel.GetReleaseGroup(tp,true):Filter(c79402185.costfilter,nil,tp)
if chk==0 then return g:CheckSubGroup(c79402185.fselect,3,3,tp,sg) end
if chk==0 then return g:CheckSubGroupEach(c79402185.spchecks,c79402185.fgoal,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg=g:SelectSubGroup(tp,c79402185.fselect,false,3,3,tp,sg)
local rg=g:SelectSubGroupEach(tp,c79402185.spchecks,false,c79402185.fgoal,tp)
Duel.Release(rg,REASON_COST)
end
function c79402185.filter(c,e,tp)
......
......@@ -9,6 +9,7 @@ function c80033124.initial_effect(c)
e1:SetOperation(c80033124.activate)
c:RegisterEffect(e1)
end
c80033124.fchecks=aux.CreateChecks(Card.IsFusionCode,{41230939,77625948,3019642})
function c80033124.ffilter0(c)
return c:IsFusionCode(41230939,77625948,3019642) and c:IsCanBeFusionMaterial() and c:IsAbleToDeck()
end
......@@ -19,34 +20,15 @@ end
function c80033124.spfilter(c,e,tp)
return c:IsCode(40418351) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)
end
function c80033124.fcheck(c,sg,g,code,...)
if not c:IsFusionCode(code) then return false end
if ... then
g:AddCard(c)
local res=sg:IsExists(c80033124.fcheck,1,g,sg,g,...)
g:RemoveCard(c)
return res
else return true end
end
function c80033124.fselect(c,tp,mg,sg,...)
sg:AddCard(c)
local res=false
if sg:GetCount()<3 then
res=mg:IsExists(c80033124.fselect,1,sg,tp,mg,sg,...)
elseif Duel.GetLocationCountFromEx(tp,tp,sg)>0 then
local g=Group.CreateGroup()
res=sg:IsExists(c80033124.fcheck,1,nil,sg,g,...)
end
sg:RemoveCard(c)
return res
function c80033124.fgoal(g,tp)
return Duel.GetLocationCountFromEx(tp,tp,g)>0
end
function c80033124.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if not aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_FMATERIAL) then return false end
if not Duel.IsExistingMatchingCard(c80033124.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) then return false end
local mg=Duel.GetMatchingGroup(c80033124.ffilter0,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
return mg:IsExists(c80033124.fselect,1,nil,tp,mg,sg,41230939,77625948,3019642)
return mg:CheckSubGroupEach(c80033124.fchecks,c80033124.fgoal,tp)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
......@@ -57,13 +39,9 @@ function c80033124.activate(e,tp,eg,ep,ev,re,r,rp)
if not aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_FMATERIAL) then return end
if not Duel.IsExistingMatchingCard(c80033124.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) then return end
local mg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c80033124.ffilter),tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,e)
local sg=Group.CreateGroup()
if not mg:IsExists(c80033124.fselect,1,nil,tp,mg,sg,41230939,77625948,3019642) then return end
while sg:GetCount()<3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=mg:FilterSelect(tp,c80033124.fselect,1,1,sg,tp,mg,sg,41230939,77625948,3019642)
sg:Merge(g)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=mg:SelectSubGroupEach(tp,c80033124.fchecks,false,c80033124.fgoal,tp)
if not sg then return end
local cg=sg:Filter(c80033124.cfilter,nil)
if cg:GetCount()>0 then
Duel.ConfirmCards(1-tp,cg)
......
......@@ -11,50 +11,54 @@ function c8512558.initial_effect(c)
e1:SetOperation(c8512558.spop)
c:RegisterEffect(e1)
end
function c8512558.spfilter(c,e,tp,set)
return c:IsSetCard(set) and not c:IsCode(8512558) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
c8512558.combination2={}
c8512558.combination2[1]=aux.CreateChecks(Card.IsSetCard,{0x54,0x59})
c8512558.combination2[2]=aux.CreateChecks(Card.IsSetCard,{0x54,0x82})
c8512558.combination2[3]=aux.CreateChecks(Card.IsSetCard,{0x54,0x8f})
c8512558.combination2[4]=aux.CreateChecks(Card.IsSetCard,{0x59,0x82})
c8512558.combination2[5]=aux.CreateChecks(Card.IsSetCard,{0x59,0x8f})
c8512558.combination2[6]=aux.CreateChecks(Card.IsSetCard,{0x82,0x8f})
c8512558.combination3={}
c8512558.combination3[1]=aux.CreateChecks(Card.IsSetCard,{0x59,0x82,0x8f})
c8512558.combination3[2]=aux.CreateChecks(Card.IsSetCard,{0x54,0x82,0x8f})
c8512558.combination3[3]=aux.CreateChecks(Card.IsSetCard,{0x54,0x59,0x8f})
c8512558.combination3[4]=aux.CreateChecks(Card.IsSetCard,{0x54,0x59,0x82})
c8512558.combination4=aux.CreateChecks(Card.IsSetCard,{0x54,0x59,0x82,0x8f})
function c8512558.spfilter(c,e,tp)
return c:IsSetCard(0x54,0x59,0x82,0x8f) and not c:IsCode(8512558) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c8512558.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and (Duel.IsExistingMatchingCard(c8512558.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,0x54)
or Duel.IsExistingMatchingCard(c8512558.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,0x59)
or Duel.IsExistingMatchingCard(c8512558.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,0x82)
or Duel.IsExistingMatchingCard(c8512558.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,0x8f))
and Duel.IsExistingMatchingCard(c8512558.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c8512558.gcheck(g)
if #g==1 then
return true
elseif #g==2 then
return g:CheckSubGroupEach(c8512558.combination2[1])
or g:CheckSubGroupEach(c8512558.combination2[2])
or g:CheckSubGroupEach(c8512558.combination2[3])
or g:CheckSubGroupEach(c8512558.combination2[4])
or g:CheckSubGroupEach(c8512558.combination2[5])
or g:CheckSubGroupEach(c8512558.combination2[6])
elseif #g==3 then
return g:CheckSubGroupEach(c8512558.combination3[1])
or g:CheckSubGroupEach(c8512558.combination3[2])
or g:CheckSubGroupEach(c8512558.combination3[3])
or g:CheckSubGroupEach(c8512558.combination3[4])
elseif #g==4 then
return g:CheckSubGroupEach(c8512558.combination4)
end
end
function c8512558.spop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(c8512558.spfilter,tp,LOCATION_HAND,0,nil,e,tp,0x54)
local g2=Duel.GetMatchingGroup(c8512558.spfilter,tp,LOCATION_HAND,0,nil,e,tp,0x59)
local g3=Duel.GetMatchingGroup(c8512558.spfilter,tp,LOCATION_HAND,0,nil,e,tp,0x82)
local g4=Duel.GetMatchingGroup(c8512558.spfilter,tp,LOCATION_HAND,0,nil,e,tp,0x8f)
local g=Duel.GetMatchingGroup(c8512558.spfilter,tp,LOCATION_HAND,0,nil,e,tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft>0 and (#g1>0 or #g2>0 or #g3>0 or #g4>0) then
if ft>0 and #g>0 then
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local sg=Group.CreateGroup()
if g1:GetCount()>0 and ((g2:GetCount()==0 and g3:GetCount()==0 and g4:GetCount()==0) or Duel.SelectYesNo(tp,aux.Stringid(8512558,1))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=g1:Select(tp,1,1,nil)
sg:Merge(sg1)
ft=ft-1
end
if g2:GetCount()>0 and ft>0 and ((sg:GetCount()==0 and g3:GetCount()==0 and g4:GetCount()==0) or Duel.SelectYesNo(tp,aux.Stringid(8512558,2))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg2=g2:Select(tp,1,1,nil)
sg:Merge(sg2)
ft=ft-1
end
if g3:GetCount()>0 and ft>0 and ((sg:GetCount()==0 and g4:GetCount()==0) or Duel.SelectYesNo(tp,aux.Stringid(8512558,3))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg3=g3:Select(tp,1,1,nil)
sg:Merge(sg3)
ft=ft-1
end
if g4:GetCount()>0 and ft>0 and (sg:GetCount()==0 or Duel.SelectYesNo(tp,aux.Stringid(8512558,4))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg4=g4:Select(tp,1,1,nil)
sg:Merge(sg4)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroup(tp,c8512558.gcheck,false,1,math.min(4,ft))
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
local e1=Effect.CreateEffect(e:GetHandler())
......
......@@ -41,6 +41,7 @@ function c89493368.initial_effect(c)
e5:SetOperation(c89493368.spop)
c:RegisterEffect(e5)
end
c89493368.spchecks=aux.CreateChecks(Card.IsCode,{15175429,52286175})
function c89493368.damcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,1-tp)
end
......@@ -72,32 +73,16 @@ end
function c89493368.spcostfilter(c)
return c:IsAbleToGraveAsCost() and c:IsCode(15175429,52286175)
end
function c89493368.spcost_selector(c,tp,g,sg,i)
sg:AddCard(c)
g:RemoveCard(c)
local flag=false
if i<2 then
flag=g:IsExists(c89493368.spcost_selector,1,nil,tp,g,sg,i+1)
else
flag=Duel.GetMZoneCount(tp,sg,tp)>-1
and sg:FilterCount(Card.IsCode,nil,15175429)>0
and sg:FilterCount(Card.IsCode,nil,52286175)>0
end
sg:RemoveCard(c)
g:AddCard(c)
return flag
function c89493368.fgoal(g,tp,c)
local sg=Group.FromCards(c)
sg:Merge(g)
return Duel.GetMZoneCount(tp,sg)>0
end
function c89493368.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(c89493368.spcostfilter,tp,LOCATION_MZONE,0,c)
local sg=Group.CreateGroup()
if chk==0 then return c:IsAbleToGraveAsCost() and g:IsExists(c89493368.spcost_selector,1,nil,tp,g,sg,1) end
for i=1,2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=g:FilterSelect(tp,c89493368.spcost_selector,1,1,nil,tp,g,sg,i)
sg:Merge(g1)
g:Sub(g1)
end
if chk==0 then return c:IsAbleToGraveAsCost() and g:CheckSubGroupEach(c89493368.spchecks,c89493368.fgoal,tp,c) end
local sg=g:SelectSubGroupEach(tp,c89493368.spchecks,false,c89493368.fgoal,tp,c)
sg:AddCard(c)
Duel.SendtoGrave(sg,REASON_COST)
end
......
......@@ -10,41 +10,30 @@ function c99162753.initial_effect(c)
e1:SetOperation(c99162753.activate)
c:RegisterEffect(e1)
end
c99162753.spchecks=aux.CreateChecks(Card.IsType,{TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_PENDULUM,TYPE_LINK})
function c99162753.rmfilter(c)
return (not c:IsLocation(LOCATION_MZONE) or c:IsFaceup()) and c:IsType(TYPE_RITUAL+TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_PENDULUM+TYPE_LINK) and c:IsAbleToRemove()
end
function c99162753.fcheck(c,mg,sg,type,...)
if not c:IsType(type) then return false end
if ... then
sg:AddCard(c)
local res=mg:IsExists(c99162753.fcheck,1,sg,mg,sg,...)
sg:RemoveCard(c)
return res
else return true end
end
function c99162753.fselect(g,e,tp,sg)
function c99162753.fgoal(g,e,tp)
if g:GetClassCount(Card.GetOriginalRace)~=1 then return false end
local loc=0
if Duel.GetMZoneCount(tp,g)>0 then loc=loc+LOCATION_DECK end
if Duel.GetLocationCountFromEx(tp,tp,g)>0 then loc=loc+LOCATION_EXTRA end
return loc~=0 and g:GetClassCount(Card.GetOriginalRace)==1
and g:IsExists(c99162753.fcheck,1,nil,g,sg,TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_PENDULUM,TYPE_LINK)
and Duel.IsExistingMatchingCard(c99162753.spfilter,tp,loc,0,1,nil,e,tp,g)
return loc~=0 and Duel.IsExistingMatchingCard(c99162753.spfilter,tp,loc,0,1,nil,e,tp,g)
end
function c99162753.spfilter(c,e,tp,g)
return g:IsExists(aux.FilterEqualFunction(Card.GetOriginalRace,c:GetOriginalRace()),1,nil) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c99162753.target(e,tp,eg,ep,ev,re,r,rp,chk)
local sg=Group.CreateGroup()
local g=Duel.GetMatchingGroup(c99162753.rmfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil)
if chk==0 then return g:CheckSubGroup(c99162753.fselect,6,6,e,tp,sg) end
if chk==0 then return g:CheckSubGroupEach(c99162753.spchecks,c99162753.fgoal,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,6,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA)
end
function c99162753.activate(e,tp,eg,ep,ev,re,r,rp,chk)
local sg=Group.CreateGroup()
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c99162753.rmfilter),tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=g:SelectSubGroup(tp,c99162753.fselect,false,6,6,e,tp,sg)
local rg=g:SelectSubGroupEach(tp,c99162753.spchecks,false,c99162753.fgoal,e,tp)
if rg and rg:GetCount()==6 and Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)~=0 then
local loc=0
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then loc=loc+LOCATION_DECK end
......
......@@ -2236,6 +2236,9 @@ function Auxiliary.gffcheck(g,f1,a1,f2,a2)
local c2=g:GetNext()
return f1(c1,a1) and f2(c2,a2) or f1(c2,a1) and f2(c1,a2)
end
function Auxiliary.mzctcheck(g,tp)
return Duel.GetMZoneCount(tp,g)>0
end
--used for "except this card"
function Auxiliary.ExceptThisCard(e)
local c=e:GetHandler()
......@@ -2349,6 +2352,63 @@ function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
return nil
end
end
function Auxiliary.CreateChecks(f,list)
local checks={}
for i=1,#list do
checks[i]=function(c) return f(c,list[i]) end
end
return checks
end
function Auxiliary.CheckGroupRecursiveEach(c,sg,g,f,checks,ext_params)
if not checks[1+#sg](c) then
return false
end
sg:AddCard(c)
if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g,f,min,max,ext_params) then
sg:RemoveCard(c)
return false
end
local res
if #sg==#checks then
res=f(sg,table.unpack(ext_params))
else
res=g:IsExists(Auxiliary.CheckGroupRecursiveEach,1,sg,sg,g,f,checks,ext_params)
end
sg:RemoveCard(c)
return res
end
function Group.CheckSubGroupEach(g,checks,f,...)
if f==nil then f=Auxiliary.TRUE end
if #g<#checks then return false end
local ext_params={...}
local sg=Group.CreateGroup()
return g:IsExists(Auxiliary.CheckGroupRecursiveEach,1,sg,sg,g,f,checks,ext_params)
end
function Group.SelectSubGroupEach(g,tp,checks,cancelable,f,...)
if cancelable==nil then cancelable=false end
if f==nil then f=Auxiliary.TRUE end
local ct=#checks
local ext_params={...}
local sg=Group.CreateGroup()
local finish=false
while #sg<ct do
local cg=g:Filter(Auxiliary.CheckGroupRecursiveEach,sg,sg,g,f,checks,ext_params)
if #cg==0 then break end
local tc=cg:SelectUnselect(sg,tp,false,cancelable,ct,ct)
if not tc then break end
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==ct then finish=true end
else
sg:Clear()
end
end
if finish then
return sg
else
return nil
end
end
--target function of continuous trap with a card target
function Auxiliary.ctg(e,c)
return e:GetHandler():IsHasCardTarget(c)
......
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