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

add Auxiliary.IsInGroup and Auxiliary.mzctcheckrel (#1344)

parent 117db756
......@@ -26,10 +26,7 @@ function c10000.sumfilter(c)
end
function c10000.fselect(g,tp)
Duel.SetSelectedCard(g)
if Duel.GetMZoneCount(tp,g)>0 and g:CheckWithSumGreater(c10000.sumfilter,10000) then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
return g:CheckWithSumGreater(c10000.sumfilter,10000) and aux.mzctcheckrel(g,tp)
end
function c10000.spcon(e,c)
if c==nil then return true end
......
......@@ -34,16 +34,10 @@ end
function c12766474.relfilter(c,g)
return g:IsContains(c)
end
function c12766474.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c12766474.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(Card.IsAttribute,nil,ATTRIBUTE_DARK)
if chk==0 then return Duel.GetCustomActivityCount(12766474,tp,ACTIVITY_SPSUMMON)==0
and rg:CheckSubGroup(c12766474.fgoal,1,#rg,tp) end
and rg:CheckSubGroup(aux.mzctcheckrel,1,#rg,tp) end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
......@@ -53,7 +47,7 @@ function c12766474.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c12766474.fgoal,false,1,#rg,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,1,#rg,tp)
e:SetLabel(g:GetCount())
Duel.Release(g,REASON_COST)
end
......
......@@ -21,17 +21,11 @@ end
function c26866984.cfilter(c,tp)
return c:IsRace(RACE_FAIRY) and (c:IsControler(tp) or c:IsFaceup())
end
function c26866984.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c26866984.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c26866984.cfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c26866984.fgoal,1,3,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,1,3,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c26866984.fgoal,false,1,3,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,1,3,tp)
e:SetLabel(Duel.Release(g,REASON_COST))
end
function c26866984.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -27,17 +27,11 @@ function c27198001.initial_effect(c)
e3:SetOperation(c27198001.operation)
c:RegisterEffect(e3)
end
function c27198001.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c27198001.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp)
if chk==0 then return rg:CheckSubGroup(c27198001.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c27198001.fgoal,false,2,2,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(g,REASON_COST)
end
function c27198001.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -20,10 +20,8 @@ function c40998517.costfilter(c,tp)
and Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,c)
end
function c40998517.fselect(g,tp)
if Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,g:GetCount(),g) then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
return Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,g:GetCount(),g)
and Duel.CheckReleaseGroup(tp,aux.IsInGroup,#g,nil,g)
end
function c40998517.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c40998517.costfilter,1,nil,tp) end
......
......@@ -41,17 +41,11 @@ end
function c41329458.rfilter(c,tp)
return c:IsSetCard(0x101b) and (c:IsControler(tp) or c:IsFaceup())
end
function c41329458.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c41329458.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c41329458.rfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c41329458.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c41329458.fgoal,false,2,2,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(g,REASON_COST)
end
function c41329458.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -14,18 +14,12 @@ 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.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 g=Duel.GetReleaseGroup(tp):Filter(c45898858.costfilter,nil,tp)
if chk==0 then return g:CheckSubGroupEach(c45898858.spchecks,c45898858.fgoal,tp) end
if chk==0 then return g:CheckSubGroupEach(c45898858.spchecks,aux.mzctcheckrel,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg=g:SelectSubGroupEach(tp,c45898858.spchecks,false,c45898858.fgoal,tp)
local rg=g:SelectSubGroupEach(tp,c45898858.spchecks,false,aux.mzctcheckrel,tp)
Duel.Release(rg,REASON_COST)
end
function c45898858.filter(c,e,tp)
......
......@@ -37,17 +37,11 @@ end
function c46290741.rfilter(c,tp)
return c:IsAttribute(ATTRIBUTE_WATER) and (c:IsControler(tp) or c:IsFaceup())
end
function c46290741.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c46290741.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c46290741.rfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c46290741.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c46290741.fgoal,false,2,2,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(g,REASON_COST)
end
function c46290741.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -16,18 +16,12 @@ end
function c47171541.rfilter(c,tp)
return c:IsRace(RACE_MACHINE) and (c:IsControler(tp) or c:IsFaceup())
end
function c47171541.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c47171541.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c47171541.rfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c47171541.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c47171541.fgoal,false,2,2,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(g,REASON_COST)
end
function c47171541.spfilter(c,e,tp)
......
......@@ -24,17 +24,11 @@ end
function c47826112.cfilter(c,tp)
return c:IsLevelBelow(3) and c:IsAttribute(ATTRIBUTE_WATER) and (c:IsControler(tp) or c:IsFaceup())
end
function c47826112.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c47826112.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c47826112.cfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c47826112.fgoal,3,3,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,3,3,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c47826112.fgoal,false,3,3,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,3,3,tp)
Duel.Release(g,REASON_COST)
end
function c47826112.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -14,10 +14,7 @@ function c54813225.initial_effect(c)
end
function c54813225.relgoal(sg,tp)
Duel.SetSelectedCard(sg)
if sg:CheckWithSumGreater(Card.GetLevel,3) and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
return sg:CheckWithSumGreater(Card.GetLevel,3) and aux.mzctcheckrel(sg,tp)
end
function c54813225.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local mg=Duel.GetReleaseGroup(tp):Filter(Card.IsType,nil,TYPE_TOKEN)
......
......@@ -13,18 +13,12 @@ end
function c54913680.rfilter(c)
return c:IsFaceup() and c:IsSetCard(0x3d)
end
function c54913680.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c54913680.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c54913680.rfilter,nil)
if chk==0 then return rg:CheckSubGroup(c54913680.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=rg:SelectSubGroup(tp,c54913680.fgoal,false,2,2,tp)
local sg=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(sg,REASON_COST)
end
function c54913680.spfilter(c,e,tp)
......
......@@ -35,10 +35,7 @@ function c63972571.rfilter(c,tp)
end
function c63972571.fselect(g,tp)
Duel.SetSelectedCard(g)
if Duel.GetMZoneCount(tp,g)>0 and g:CheckWithSumGreater(Card.GetLevel,8) then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
return g:CheckWithSumGreater(Card.GetLevel,8) and aux.mzctcheckrel(g,tp)
end
function c63972571.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetReleaseGroup(tp):Filter(c63972571.rfilter,nil,tp)
......
......@@ -13,18 +13,12 @@ end
function c66607691.rfilter(c,tp)
return c:IsCode(70095154) and (c:IsControler(tp) or c:IsFaceup())
end
function c66607691.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c66607691.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c66607691.rfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c66607691.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c66607691.fgoal,false,2,2,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(g,REASON_COST)
end
function c66607691.spfilter(c,e,tp)
......
......@@ -29,10 +29,8 @@ function c720147.matfilter2(c)
return c:IsSetCard(0x134) and c:IsType(TYPE_MONSTER) and c:IsCanOverlay()
end
function c720147.fselect(g,tp)
if Duel.IsExistingTarget(c720147.matfilter1,tp,LOCATION_MZONE,0,1,g,tp,g) then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
return Duel.IsExistingTarget(c720147.matfilter1,tp,LOCATION_MZONE,0,1,g,tp,g)
and Duel.CheckReleaseGroup(tp,aux.IsInGroup,#g,nil,g)
end
function c720147.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=e:GetLabelObject()
......
......@@ -13,18 +13,12 @@ end
function c72549351.rfilter(c,tp)
return c:IsRace(RACE_DRAGON) and (c:IsControler(tp) or c:IsFaceup())
end
function c72549351.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c72549351.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local rg=Duel.GetReleaseGroup(tp):Filter(c72549351.rfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c72549351.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c72549351.fgoal,false,2,2,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(g,REASON_COST)
end
function c72549351.spfilter(c,e,tp)
......
......@@ -20,10 +20,8 @@ function c744887.costfilter(c)
return c:IsSetCard(0x134) or c:IsRace(RACE_ROCK)
end
function c744887.fselect(g,tp)
if Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,g) then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,g)
and Duel.CheckReleaseGroup(tp,aux.IsInGroup,#g,nil,g)
end
function c744887.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetReleaseGroup(tp):Filter(c744887.costfilter,nil)
......
......@@ -33,8 +33,7 @@ function c76382116.fselect(g,e,tp)
end
local sg=Duel.GetMatchingGroup(c76382116.spfilter,tp,LOCATION_HAND,0,nil,e,tp,table.unpack(code))
if sg:GetClassCount(Card.GetCode)>=g:GetCount() and Duel.GetMZoneCount(tp,g)>=g:GetCount() then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
return Duel.CheckReleaseGroup(tp,aux.IsInGroup,#g,nil,g)
else return false end
end
function c76382116.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -98,8 +98,7 @@ function c77522571.costfilter(c)
end
function c77522571.fgoal(sg,e,tp)
local lv=sg:GetSum(Card.GetLevel)
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
return Duel.CheckReleaseGroup(tp,aux.IsInGroup,#sg,nil,sg)
and Duel.IsExistingMatchingCard(c77522571.spfilter3,tp,LOCATION_EXTRA,0,1,nil,e,tp,lv,sg)
end
function c77522571.spfilter3(c,e,tp,lv,sg)
......
......@@ -27,10 +27,7 @@ function c79402185.costfilter(c,tp)
return c:IsCode(43017476,58071123) and (c:IsControler(tp) or c:IsFaceup())
end
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
return Duel.GetMZoneCount(tp,g)>0 and Duel.CheckReleaseGroupEx(tp,aux.IsInGroup,#g,nil,g)
end
function c79402185.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
......
......@@ -56,10 +56,8 @@ function c88000953.desfilter(c,g)
return not ec or not g:IsContains(ec)
end
function c88000953.fselect(g,tp)
if Duel.IsExistingMatchingCard(c88000953.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,g:GetCount(),g,g) then
Duel.SetSelectedCard(g)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
return Duel.IsExistingMatchingCard(c88000953.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,g:GetCount(),g,g)
and Duel.CheckReleaseGroup(tp,aux.IsInGroup,#g,nil,g)
end
function c88000953.descost(e,tp,eg,ep,ev,re,r,rp,chk)
local lg=e:GetHandler():GetLinkedGroup()
......
......@@ -70,17 +70,11 @@ end
function c96733134.rfilter(c,tp)
return c:IsSetCard(0x20f8) and (c:IsControler(tp) or c:IsFaceup())
end
function c96733134.fgoal(sg,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp,sg)>0 then
Duel.SetSelectedCard(sg)
return Duel.CheckReleaseGroup(tp,nil,0,nil)
else return false end
end
function c96733134.hspcost(e,tp,eg,ep,ev,re,r,rp,chk)
local rg=Duel.GetReleaseGroup(tp):Filter(c96733134.rfilter,nil,tp)
if chk==0 then return rg:CheckSubGroup(c96733134.fgoal,2,2,tp) end
if chk==0 then return rg:CheckSubGroup(aux.mzctcheckrel,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=rg:SelectSubGroup(tp,c96733134.fgoal,false,2,2,tp)
local g=rg:SelectSubGroup(tp,aux.mzctcheckrel,false,2,2,tp)
Duel.Release(g,REASON_COST)
end
function c96733134.hsptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -2011,6 +2011,9 @@ function Auxiliary.IsCounterAdded(c,counter)
end
return false
end
function Auxiliary.IsInGroup(c,g)
return g:IsContains(c)
end
--return the column of card c (from the viewpoint of p)
function Auxiliary.GetColumn(c,p)
local seq=c:GetSequence()
......@@ -2258,6 +2261,9 @@ end
function Auxiliary.mzctcheck(g,tp)
return Duel.GetMZoneCount(tp,g)>0
end
function Auxiliary.mzctcheckrel(g,tp)
return Duel.GetMZoneCount(tp,g)>0 and Duel.CheckReleaseGroup(tp,Auxiliary.IsInGroup,#g,nil,g)
end
--used for "except this card"
function Auxiliary.ExceptThisCard(e)
local c=e:GetHandler()
......
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