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

use SelectSubGroup (#1266)

parent d6e78bf0
...@@ -31,16 +31,10 @@ end ...@@ -31,16 +31,10 @@ end
function c12766474.counterfilter(c) function c12766474.counterfilter(c)
return c:IsAttribute(ATTRIBUTE_DARK) return c:IsAttribute(ATTRIBUTE_DARK)
end end
function c12766474.fselect(c,tp,rg,sg)
sg:AddCard(c)
local res=c12766474.fgoal(tp,sg) or rg:IsExists(c12766474.fselect,1,sg,tp,rg,sg)
sg:RemoveCard(c)
return res
end
function c12766474.relfilter(c,g) function c12766474.relfilter(c,g)
return g:IsContains(c) return g:IsContains(c)
end end
function c12766474.fgoal(tp,sg) function c12766474.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -48,9 +42,8 @@ function c12766474.fgoal(tp,sg) ...@@ -48,9 +42,8 @@ function c12766474.fgoal(tp,sg)
end end
function c12766474.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function c12766474.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(Card.IsAttribute,nil,ATTRIBUTE_DARK) local rg=Duel.GetReleaseGroup(tp):Filter(Card.IsAttribute,nil,ATTRIBUTE_DARK)
local g=Group.CreateGroup()
if chk==0 then return Duel.GetCustomActivityCount(12766474,tp,ACTIVITY_SPSUMMON)==0 if chk==0 then return Duel.GetCustomActivityCount(12766474,tp,ACTIVITY_SPSUMMON)==0
and rg:IsExists(c12766474.fselect,1,nil,tp,rg,g) end and rg:CheckSubGroup(c12766474.fgoal,1,#rg,tp) end
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
...@@ -59,13 +52,8 @@ function c12766474.spcost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -59,13 +52,8 @@ function c12766474.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
e1:SetTarget(c12766474.splimit) e1:SetTarget(c12766474.splimit)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
while true do
local mg=rg:Filter(c12766474.fselect,g,tp,rg,g)
if mg:GetCount()==0 or (c12766474.fgoal(tp,g) and not Duel.SelectYesNo(tp,210)) then break end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=Duel.SelectReleaseGroup(tp,c12766474.relfilter,1,1,nil,mg) local g=rg:SelectSubGroup(tp,c12766474.fgoal,false,1,#rg,tp)
g:Merge(sg)
end
e:SetLabel(g:GetCount()) e:SetLabel(g:GetCount())
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
......
...@@ -33,46 +33,28 @@ end ...@@ -33,46 +33,28 @@ end
function c27024795.matfilter(c) function c27024795.matfilter(c)
return c:IsSetCard(0x42) and c:IsType(TYPE_MONSTER) and (c:IsFaceup() or c:IsLocation(LOCATION_DECK)) and c:IsLevelAbove(1) return c:IsSetCard(0x42) and c:IsType(TYPE_MONSTER) and (c:IsFaceup() or c:IsLocation(LOCATION_DECK)) and c:IsLevelAbove(1)
end end
function c27024795.fselect(c,tp,rg,sg,e) function c27024795.fgoal(sg,e,tp)
sg:AddCard(c) return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)==2 and sg:GetSum(Card.GetLevel)==10
local res=false
if #sg<3 then
res=rg:IsExists(c27024795.fselect,1,sg,tp,rg,sg,e)
else
res=c27024795.fgoal(tp,sg,e)
end
sg:RemoveCard(c)
return res
end
function c27024795.fgoal(tp,sg,e)
return #sg==3 and sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)==2 and sg:GetSum(Card.GetLevel)==10
and Duel.IsExistingMatchingCard(c27024795.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,sg) and Duel.IsExistingMatchingCard(c27024795.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,sg)
end end
function c27024795.spfilter(c,e,tp,mg) function c27024795.spfilter(c,e,tp,mg)
return c:IsSetCard(0x4b) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (not mg or Duel.GetLocationCountFromEx(tp,tp,mg,c)>0) return c:IsSetCard(0x4b) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mg,c)>0
end end
function c27024795.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c27024795.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local mg=Duel.GetMatchingGroup(c27024795.matfilter,tp,LOCATION_DECK+LOCATION_MZONE,0,nil) local mg=Duel.GetMatchingGroup(c27024795.matfilter,tp,LOCATION_DECK+LOCATION_MZONE,0,nil)
local sg=Group.CreateGroup() return mg:CheckSubGroup(c27024795.fgoal,3,3,e,tp)
return mg:IsExists(c27024795.fselect,1,nil,tp,mg,sg,e)
end end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,3,tp,LOCATION_DECK+LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,3,tp,LOCATION_DECK+LOCATION_MZONE)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end end
function c27024795.spop(e,tp,eg,ep,ev,re,r,rp) function c27024795.spop(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetMatchingGroup(c27024795.matfilter,tp,LOCATION_DECK+LOCATION_MZONE,0,nil) local mg=Duel.GetMatchingGroup(c27024795.matfilter,tp,LOCATION_DECK+LOCATION_MZONE,0,nil)
local sg=Group.CreateGroup()
for i=0,2 do
local cg=mg:Filter(c27024795.fselect,sg,tp,mg,sg,e)
if cg:GetCount()==0 then break end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=cg:Select(tp,1,1,nil) local sg=mg:SelectSubGroup(tp,c27024795.fgoal,false,3,3,e,tp)
sg:Merge(g) if sg and Duel.SendtoGrave(sg,REASON_EFFECT)==3 then
end
if Duel.SendtoGrave(sg,REASON_EFFECT)==3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c27024795.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) local tg=Duel.SelectMatchingCard(tp,c27024795.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil)
if tg:GetCount()>0 then if tg:GetCount()>0 then
Duel.BreakEffect() Duel.BreakEffect()
Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEUP)
......
...@@ -27,17 +27,7 @@ function c27198001.initial_effect(c) ...@@ -27,17 +27,7 @@ function c27198001.initial_effect(c)
e3:SetOperation(c27198001.operation) e3:SetOperation(c27198001.operation)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c27198001.fselect(c,tp,rg,sg) function c27198001.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c27198001.fselect,1,sg,tp,rg,sg)
else
res=c27198001.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c27198001.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -45,13 +35,9 @@ function c27198001.fgoal(tp,sg) ...@@ -45,13 +35,9 @@ function c27198001.fgoal(tp,sg)
end end
function c27198001.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function c27198001.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp) local rg=Duel.GetReleaseGroup(tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c27198001.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c27198001.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c27198001.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c27198001.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c27198001.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c27198001.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
...@@ -17,20 +17,8 @@ end ...@@ -17,20 +17,8 @@ end
function c29087919.xyzfilter(c,mg,ct) function c29087919.xyzfilter(c,mg,ct)
return c:IsXyzSummonable(mg,2,ct) return c:IsXyzSummonable(mg,2,ct)
end end
function c29087919.mfilter1(c,mg,exg,ct) function c29087919.fgoal(sg,exg)
return mg:IsExists(c29087919.mfilter2,1,nil,Group.FromCards(c),mg,exg,ct) return aux.dncheck(sg) and exg:IsExists(Card.IsXyzSummonable,1,nil,sg,#sg,#sg)
end
function c29087919.mfilter2(c,g,mg,exg,ct)
local tc=g:GetFirst()
while tc do
if c:IsCode(tc:GetCode()) then return false end
tc=g:GetNext()
end
g:AddCard(c)
local result=exg:IsExists(Card.IsXyzSummonable,1,nil,g,g:GetCount(),g:GetCount())
or (g:GetCount()<ct and mg:IsExists(c29087919.mfilter2,1,nil,g,mg,exg,ct))
g:RemoveCard(c)
return result
end end
function c29087919.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c29087919.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
...@@ -39,18 +27,9 @@ function c29087919.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -39,18 +27,9 @@ function c29087919.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local exg=Duel.GetMatchingGroup(c29087919.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg,ct) local exg=Duel.GetMatchingGroup(c29087919.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg,ct)
if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2)
and not Duel.IsPlayerAffectedByEffect(tp,59822133) and not Duel.IsPlayerAffectedByEffect(tp,59822133)
and ct>1 and mg:IsExists(c29087919.mfilter1,1,nil,mg,exg,ct) end and ct>1 and mg:CheckSubGroup(c29087919.fgoal,2,ct,exg) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=mg:FilterSelect(tp,c29087919.mfilter1,1,1,nil,mg,exg,ct)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg2=mg:FilterSelect(tp,c29087919.mfilter2,1,1,nil,sg1,mg,exg,ct) local sg1=mg:SelectSubGroup(tp,c29087919.fgoal,false,2,ct,exg)
sg1:Merge(sg2)
while sg1:GetCount()<ct and mg:IsExists(c29087919.mfilter2,1,nil,sg1,mg,exg,ct)
and (not exg:IsExists(Card.IsXyzSummonable,1,nil,sg1,sg1:GetCount(),sg1:GetCount()) or Duel.SelectYesNo(tp,aux.Stringid(29087919,0))) do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg3=mg:FilterSelect(tp,c29087919.mfilter2,1,1,nil,sg1,mg,exg,ct)
sg1:Merge(sg3)
end
Duel.SetTargetCard(sg1) Duel.SetTargetCard(sg1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,sg1:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,sg1:GetCount(),0,0)
end end
......
...@@ -14,35 +14,18 @@ end ...@@ -14,35 +14,18 @@ end
function c38179121.spcostfilter(c) function c38179121.spcostfilter(c)
return c:IsAbleToRemoveAsCost() and c:IsType(TYPE_MONSTER) return c:IsAbleToRemoveAsCost() and c:IsType(TYPE_MONSTER)
end end
function c38179121.spcost_selector(c,tp,g,sg,i) function c38179121.fgoal(sg,e,tp)
sg:AddCard(c) return sg:FilterCount(Card.IsRace,nil,RACE_DINOSAUR)==1
g:RemoveCard(c) and Duel.IsExistingMatchingCard(c38179121.filter,tp,LOCATION_DECK+LOCATION_HAND,0,1,sg,e,tp)
local flag=false
if i<2 then
flag=g:IsExists(c38179121.spcost_selector,1,nil,tp,g,sg,i+1)
else
flag=sg:FilterCount(Card.IsRace,nil,RACE_DINOSAUR)==1
end
sg:RemoveCard(c)
g:AddCard(c)
return flag
end end
function c38179121.filter(c,e,tp) function c38179121.filter(c,e,tp)
return c:IsRace(RACE_DINOSAUR) and c:IsLevelAbove(7) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) return c:IsRace(RACE_DINOSAUR) and c:IsLevelAbove(7) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end end
function c38179121.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c38179121.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c38179121.filter,tp,LOCATION_DECK+LOCATION_HAND,0,nil,e,tp)
local exc=nil
if g:GetCount()==1 and g:GetFirst():IsLocation(LOCATION_HAND) then exc=g:GetFirst() end
local rg=Duel.GetMatchingGroup(c38179121.spcostfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,exc) local rg=Duel.GetMatchingGroup(c38179121.spcostfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,exc)
local sg=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c38179121.fgoal,2,2,e,tp) end
if chk==0 then return rg:IsExists(c38179121.spcost_selector,1,nil,tp,rg,sg,1) end
for i=1,2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=rg:FilterSelect(tp,c38179121.spcost_selector,1,1,nil,tp,rg,sg,i) local sg=rg:SelectSubGroup(tp,c38179121.fgoal,false,2,2,e,tp)
sg:Merge(g1)
rg:Sub(g1)
end
Duel.Remove(sg,POS_FACEUP,REASON_COST) Duel.Remove(sg,POS_FACEUP,REASON_COST)
end end
function c38179121.target(e,tp,eg,ep,ev,re,r,rp,chk) function c38179121.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
...@@ -41,17 +41,7 @@ end ...@@ -41,17 +41,7 @@ end
function c41329458.rfilter(c,tp) function c41329458.rfilter(c,tp)
return c:IsSetCard(0x101b) and (c:IsControler(tp) or c:IsFaceup()) return c:IsSetCard(0x101b) and (c:IsControler(tp) or c:IsFaceup())
end end
function c41329458.fselect(c,tp,rg,sg) function c41329458.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c41329458.fselect,1,sg,tp,rg,sg)
else
res=c41329458.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c41329458.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -59,13 +49,9 @@ function c41329458.fgoal(tp,sg) ...@@ -59,13 +49,9 @@ function c41329458.fgoal(tp,sg)
end end
function c41329458.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function c41329458.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c41329458.rfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c41329458.rfilter,nil,tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c41329458.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c41329458.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c41329458.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c41329458.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c41329458.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c41329458.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
...@@ -37,17 +37,7 @@ end ...@@ -37,17 +37,7 @@ end
function c46290741.rfilter(c,tp) function c46290741.rfilter(c,tp)
return c:IsAttribute(ATTRIBUTE_WATER) and (c:IsControler(tp) or c:IsFaceup()) return c:IsAttribute(ATTRIBUTE_WATER) and (c:IsControler(tp) or c:IsFaceup())
end end
function c46290741.fselect(c,tp,rg,sg) function c46290741.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c46290741.fselect,1,sg,tp,rg,sg)
else
res=c46290741.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c46290741.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -55,13 +45,9 @@ function c46290741.fgoal(tp,sg) ...@@ -55,13 +45,9 @@ function c46290741.fgoal(tp,sg)
end end
function c46290741.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function c46290741.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c46290741.rfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c46290741.rfilter,nil,tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c46290741.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c46290741.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c46290741.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c46290741.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c46290741.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c46290741.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
...@@ -16,17 +16,7 @@ end ...@@ -16,17 +16,7 @@ end
function c47171541.rfilter(c,tp) function c47171541.rfilter(c,tp)
return c:IsRace(RACE_MACHINE) and (c:IsControler(tp) or c:IsFaceup()) return c:IsRace(RACE_MACHINE) and (c:IsControler(tp) or c:IsFaceup())
end end
function c47171541.fselect(c,tp,rg,sg) function c47171541.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c47171541.fselect,1,sg,tp,rg,sg)
else
res=c47171541.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c47171541.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -35,13 +25,9 @@ end ...@@ -35,13 +25,9 @@ end
function c47171541.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c47171541.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1) e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c47171541.rfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c47171541.rfilter,nil,tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c47171541.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c47171541.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c47171541.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c47171541.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c47171541.spfilter(c,e,tp) function c47171541.spfilter(c,e,tp)
......
...@@ -24,17 +24,7 @@ end ...@@ -24,17 +24,7 @@ end
function c47826112.cfilter(c,tp) function c47826112.cfilter(c,tp)
return c:IsLevelBelow(3) and c:IsAttribute(ATTRIBUTE_WATER) and (c:IsControler(tp) or c:IsFaceup()) return c:IsLevelBelow(3) and c:IsAttribute(ATTRIBUTE_WATER) and (c:IsControler(tp) or c:IsFaceup())
end end
function c47826112.fselect(c,tp,rg,sg) function c47826112.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<3 then
res=rg:IsExists(c47826112.fselect,1,sg,tp,rg,sg)
else
res=c47826112.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c47826112.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -42,13 +32,9 @@ function c47826112.fgoal(tp,sg) ...@@ -42,13 +32,9 @@ function c47826112.fgoal(tp,sg)
end end
function c47826112.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function c47826112.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c47826112.cfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c47826112.cfilter,nil,tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c47826112.fgoal,3,3,tp) end
if chk==0 then return rg:IsExists(c47826112.fselect,1,nil,tp,rg,g) end
while g:GetCount()<3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c47826112.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c47826112.fgoal,false,3,3,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c47826112.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c47826112.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
...@@ -12,31 +12,18 @@ function c54813225.initial_effect(c) ...@@ -12,31 +12,18 @@ function c54813225.initial_effect(c)
e1:SetOperation(c54813225.spop) e1:SetOperation(c54813225.spop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c54813225.relrec(c,tp,sg,mg) function c54813225.relgoal(sg,tp)
sg:AddCard(c)
local res=c54813225.relgoal(tp,sg) or mg:IsExists(c54813225.relrec,1,sg,tp,sg,mg)
sg:RemoveCard(c)
return res
end
function c54813225.relgoal(tp,sg)
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
if sg:CheckWithSumGreater(Card.GetLevel,3) and Duel.GetMZoneCount(tp,sg)>0 then if sg:CheckWithSumGreater(Card.GetLevel,3) and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end else return false end
end end
function c54813225.relfilter(c,g)
return g:IsContains(c)
end
function c54813225.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function c54813225.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local mg=Duel.GetReleaseGroup(tp):Filter(Card.IsType,nil,TYPE_TOKEN) local mg=Duel.GetReleaseGroup(tp):Filter(Card.IsType,nil,TYPE_TOKEN)
local sg=Group.CreateGroup() if chk==0 then return mg:CheckSubGroup(c54813225.relgoal,1,3,tp) end
if chk==0 then return mg:IsExists(c54813225.relrec,1,nil,tp,sg,mg) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
repeat local sg=mg:SelectSubGroup(tp,c54813225.relgoal,false,1,3,tp)
local cg=mg:Filter(c54813225.relrec,sg,tp,sg,mg)
local g=Duel.SelectReleaseGroup(tp,c54813225.relfilter,1,1,nil,cg)
sg:Merge(g)
until c54813225.relgoal(tp,sg)
Duel.Release(sg,REASON_COST) Duel.Release(sg,REASON_COST)
end end
function c54813225.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c54813225.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
...@@ -13,17 +13,7 @@ end ...@@ -13,17 +13,7 @@ end
function c54913680.rfilter(c) function c54913680.rfilter(c)
return c:IsFaceup() and c:IsSetCard(0x3d) return c:IsFaceup() and c:IsSetCard(0x3d)
end end
function c54913680.fselect(c,tp,rg,sg) function c54913680.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c54913680.fselect,1,sg,tp,rg,sg)
else
res=c54913680.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c54913680.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -31,14 +21,10 @@ function c54913680.fgoal(tp,sg) ...@@ -31,14 +21,10 @@ function c54913680.fgoal(tp,sg)
end end
function c54913680.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c54913680.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1) e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c54913680.rfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c54913680.rfilter,nil)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c54913680.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c54913680.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c54913680.fselect,1,1,g,tp,rg,g) local sg=rg:SelectSubGroup(tp,c54913680.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c54913680.spfilter(c,e,tp) function c54913680.spfilter(c,e,tp)
......
...@@ -13,17 +13,7 @@ end ...@@ -13,17 +13,7 @@ end
function c66607691.rfilter(c,tp) function c66607691.rfilter(c,tp)
return c:IsCode(70095154) and (c:IsControler(tp) or c:IsFaceup()) return c:IsCode(70095154) and (c:IsControler(tp) or c:IsFaceup())
end end
function c66607691.fselect(c,tp,rg,sg) function c66607691.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c66607691.fselect,1,sg,tp,rg,sg)
else
res=c66607691.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c66607691.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -32,13 +22,9 @@ end ...@@ -32,13 +22,9 @@ end
function c66607691.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c66607691.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1) e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c66607691.rfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c66607691.rfilter,nil,tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c66607691.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c66607691.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c66607691.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c66607691.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c66607691.spfilter(c,e,tp) function c66607691.spfilter(c,e,tp)
......
...@@ -13,17 +13,7 @@ end ...@@ -13,17 +13,7 @@ end
function c72549351.rfilter(c,tp) function c72549351.rfilter(c,tp)
return c:IsRace(RACE_DRAGON) and (c:IsControler(tp) or c:IsFaceup()) return c:IsRace(RACE_DRAGON) and (c:IsControler(tp) or c:IsFaceup())
end end
function c72549351.fselect(c,tp,rg,sg) function c72549351.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c72549351.fselect,1,sg,tp,rg,sg)
else
res=c72549351.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c72549351.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -32,15 +22,10 @@ end ...@@ -32,15 +22,10 @@ end
function c72549351.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c72549351.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1) e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c72549351.rfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c72549351.rfilter,nil,tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c72549351.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c72549351.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c72549351.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c72549351.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
return true
end end
function c72549351.spfilter(c,e,tp) function c72549351.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON) and c:IsLevel(8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsRace(RACE_DRAGON) and c:IsLevel(8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
...@@ -53,31 +53,21 @@ function c90207654.sptg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -53,31 +53,21 @@ function c90207654.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end end
function c90207654.fselect(c,tp,rg,sg,e) function c90207654.gcheck(tp)
sg:AddCard(c) return function(sg)
local res=c90207654.fgoal(tp,sg,e) or rg:IsExists(c90207654.fselect,1,sg,tp,rg,sg,e) return Duel.GetMZoneCount(tp,sg)>=#sg
sg:RemoveCard(c) end
return res
end
function c90207654.fgoal(tp,sg,e)
local ct=#sg
return ct>0 and ct<=3 and Duel.GetMZoneCount(tp,sg)>=ct
and Duel.IsExistingMatchingCard(c90207654.spfilter,tp,LOCATION_DECK,0,ct,nil,e,tp)
end end
function c90207654.spop(e,tp,eg,ep,ev,re,r,rp) function c90207654.spop(e,tp,eg,ep,ev,re,r,rp)
local rg=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_HAND+LOCATION_ONFIELD,0,nil) local rg=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_HAND+LOCATION_ONFIELD,0,nil)
local sg=Group.CreateGroup() local ct=Duel.GetMatchingGroupCount(c90207654.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
local min=1 if ct>3 then ct=3 end
for i=0,2 do if ct>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=1 end
local cg=rg:Filter(c90207654.fselect,sg,tp,rg,sg,e)
if #cg==0 then break end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=cg:Select(tp,min,1,nil) aux.GCheckAdditional=c90207654.gcheck(tp)
if #g==0 then break end local sg=rg:SelectSubGroup(tp,aux.TRUE,false,1,ct)
sg:Merge(g) aux.GCheckAdditional=nil
min=0 if sg and Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)~=0 then
end
if #sg>0 and Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)~=0 then
local ct=#(Duel.GetOperatedGroup()) local ct=#(Duel.GetOperatedGroup())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c90207654.spfilter,tp,LOCATION_DECK,0,ct,ct,nil,e,tp) local tg=Duel.SelectMatchingCard(tp,c90207654.spfilter,tp,LOCATION_DECK,0,ct,ct,nil,e,tp)
......
...@@ -69,17 +69,7 @@ end ...@@ -69,17 +69,7 @@ end
function c96733134.rfilter(c,tp) function c96733134.rfilter(c,tp)
return c:IsSetCard(0x20f8) and (c:IsControler(tp) or c:IsFaceup()) return c:IsSetCard(0x20f8) and (c:IsControler(tp) or c:IsFaceup())
end end
function c96733134.fselect(c,tp,rg,sg) function c96733134.fgoal(sg,tp)
sg:AddCard(c)
if sg:GetCount()<2 then
res=rg:IsExists(c96733134.fselect,1,sg,tp,rg,sg)
else
res=c96733134.fgoal(tp,sg)
end
sg:RemoveCard(c)
return res
end
function c96733134.fgoal(tp,sg)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil) return Duel.CheckReleaseGroup(tp,nil,0,nil)
...@@ -87,13 +77,9 @@ function c96733134.fgoal(tp,sg) ...@@ -87,13 +77,9 @@ function c96733134.fgoal(tp,sg)
end end
function c96733134.hspcost(e,tp,eg,ep,ev,re,r,rp,chk) function c96733134.hspcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c96733134.rfilter,nil,tp) local rg=Duel.GetReleaseGroup(tp):Filter(c96733134.rfilter,nil,tp)
local g=Group.CreateGroup() if chk==0 then return rg:CheckSubGroup(c96733134.fgoal,2,2,tp) end
if chk==0 then return rg:IsExists(c96733134.fselect,1,nil,tp,rg,g) end
while g:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:FilterSelect(tp,c96733134.fselect,1,1,g,tp,rg,g) local g=rg:SelectSubGroup(tp,c96733134.fgoal,false,2,2,tp)
g:Merge(sg)
end
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c96733134.hsptg(e,tp,eg,ep,ev,re,r,rp,chk) function c96733134.hsptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
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