Commit 88adb0e3 authored by mercury233's avatar mercury233 Committed by GitHub

add Auxiliary.GCheckAdditional (#1152)

parent b1fce4ae
...@@ -59,6 +59,9 @@ end ...@@ -59,6 +59,9 @@ end
function c31444249.fcheck(tp,sg,fc) function c31444249.fcheck(tp,sg,fc)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=6 return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=6
end end
function c31444249.fcheck(sg)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=6
end
function c31444249.dmcon(tp) function c31444249.dmcon(tp)
return not Duel.IsExistingMatchingCard(aux.FilterEqualFunction(Card.GetSummonLocation,LOCATION_EXTRA),tp,LOCATION_MZONE,0,1,nil) return not Duel.IsExistingMatchingCard(aux.FilterEqualFunction(Card.GetSummonLocation,LOCATION_EXTRA),tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(aux.FilterEqualFunction(Card.GetSummonLocation,LOCATION_EXTRA),tp,0,LOCATION_MZONE,1,nil) and Duel.IsExistingMatchingCard(aux.FilterEqualFunction(Card.GetSummonLocation,LOCATION_EXTRA),tp,0,LOCATION_MZONE,1,nil)
...@@ -72,10 +75,12 @@ function c31444249.sptg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -72,10 +75,12 @@ function c31444249.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if sg:GetCount()>0 then if sg:GetCount()>0 then
mg1:Merge(sg) mg1:Merge(sg)
Auxiliary.FCheckAdditional=c31444249.fcheck Auxiliary.FCheckAdditional=c31444249.fcheck
Auxiliary.GCheckAdditional=c31444249.gcheck
end end
end end
local res=Duel.IsExistingMatchingCard(c31444249.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) local res=Duel.IsExistingMatchingCard(c31444249.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
...@@ -100,9 +105,13 @@ function c31444249.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -100,9 +105,13 @@ function c31444249.spop(e,tp,eg,ep,ev,re,r,rp)
exmat=true exmat=true
end end
end end
if exmat then Auxiliary.FCheckAdditional=c31444249.fcheck end if exmat then
Auxiliary.FCheckAdditional=c31444249.fcheck
Auxiliary.GCheckAdditional=c31444249.gcheck
end
local sg1=Duel.GetMatchingGroup(c31444249.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local sg1=Duel.GetMatchingGroup(c31444249.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
local mg2=nil local mg2=nil
local sg2=nil local sg2=nil
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
...@@ -119,9 +128,13 @@ function c31444249.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -119,9 +128,13 @@ function c31444249.spop(e,tp,eg,ep,ev,re,r,rp)
local tg=sg:Select(tp,1,1,nil) local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst() local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
if exmat then Auxiliary.FCheckAdditional=c31444249.fcheck end if exmat then
Auxiliary.FCheckAdditional=c31444249.fcheck
Auxiliary.GCheckAdditional=c31444249.gcheck
end
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
tc:SetMaterial(mat1) tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect() Duel.BreakEffect()
......
...@@ -26,6 +26,9 @@ end ...@@ -26,6 +26,9 @@ end
function c48144509.fcheck(tp,sg,fc) function c48144509.fcheck(tp,sg,fc)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)<=2 return sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)<=2
end end
function c48144509.gcheck(sg)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)<=2
end
function c48144509.target(e,tp,eg,ep,ev,re,r,rp,chk) function c48144509.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp local chkf=tp
...@@ -35,10 +38,12 @@ function c48144509.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -35,10 +38,12 @@ function c48144509.target(e,tp,eg,ep,ev,re,r,rp,chk)
if sg:GetCount()>0 then if sg:GetCount()>0 then
mg1:Merge(sg) mg1:Merge(sg)
Auxiliary.FCheckAdditional=c48144509.fcheck Auxiliary.FCheckAdditional=c48144509.fcheck
Auxiliary.GCheckAdditional=c48144509.gcheck
end end
end end
local res=Duel.IsExistingMatchingCard(c48144509.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) local res=Duel.IsExistingMatchingCard(c48144509.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
...@@ -63,9 +68,13 @@ function c48144509.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -63,9 +68,13 @@ function c48144509.activate(e,tp,eg,ep,ev,re,r,rp)
exmat=true exmat=true
end end
end end
if exmat then Auxiliary.FCheckAdditional=c48144509.fcheck end if exmat then
Auxiliary.FCheckAdditional=c48144509.fcheck
Auxiliary.GCheckAdditional=c48144509.gcheck
end
local sg1=Duel.GetMatchingGroup(c48144509.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local sg1=Duel.GetMatchingGroup(c48144509.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
local mg2=nil local mg2=nil
local sg2=nil local sg2=nil
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
...@@ -83,9 +92,13 @@ function c48144509.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -83,9 +92,13 @@ function c48144509.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=tg:GetFirst() local tc=tg:GetFirst()
mg1:RemoveCard(tc) mg1:RemoveCard(tc)
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
if exmat then Auxiliary.FCheckAdditional=c48144509.fcheck end if exmat then
Auxiliary.FCheckAdditional=c48144509.fcheck
Auxiliary.GCheckAdditional=c48144509.gcheck
end
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
tc:SetMaterial(mat1) tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect() Duel.BreakEffect()
......
...@@ -28,6 +28,9 @@ end ...@@ -28,6 +28,9 @@ end
function c65801012.fcheck(tp,sg,fc) function c65801012.fcheck(tp,sg,fc)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_GRAVE)<=1 return sg:FilterCount(Card.IsLocation,nil,LOCATION_GRAVE)<=1
end end
function c65801012.gcheck(sg)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_GRAVE)<=1
end
function c65801012.target(e,tp,eg,ep,ev,re,r,rp,chk) function c65801012.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp local chkf=tp
...@@ -37,10 +40,12 @@ function c65801012.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -37,10 +40,12 @@ function c65801012.target(e,tp,eg,ep,ev,re,r,rp,chk)
if sg:GetCount()>0 then if sg:GetCount()>0 then
mg1:Merge(sg) mg1:Merge(sg)
Auxiliary.FCheckAdditional=c65801012.fcheck Auxiliary.FCheckAdditional=c65801012.fcheck
Auxiliary.GCheckAdditional=c65801012.gcheck
end end
end end
local res=Duel.IsExistingMatchingCard(c65801012.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) local res=Duel.IsExistingMatchingCard(c65801012.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
...@@ -65,9 +70,13 @@ function c65801012.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -65,9 +70,13 @@ function c65801012.activate(e,tp,eg,ep,ev,re,r,rp)
exmat=true exmat=true
end end
end end
if exmat then Auxiliary.FCheckAdditional=c65801012.fcheck end if exmat then
Auxiliary.FCheckAdditional=c65801012.fcheck
Auxiliary.GCheckAdditional=c65801012.gcheck
end
local sg1=Duel.GetMatchingGroup(c65801012.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local sg1=Duel.GetMatchingGroup(c65801012.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
local mg2=nil local mg2=nil
local sg2=nil local sg2=nil
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
...@@ -85,9 +94,13 @@ function c65801012.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -85,9 +94,13 @@ function c65801012.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=tg:GetFirst() local tc=tg:GetFirst()
mg1:RemoveCard(tc) mg1:RemoveCard(tc)
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
if exmat then Auxiliary.FCheckAdditional=c65801012.fcheck end if exmat then
Auxiliary.FCheckAdditional=c65801012.fcheck
Auxiliary.GCheckAdditional=c65801012.gcheck
end
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
tc:SetMaterial(mat1) tc:SetMaterial(mat1)
local rg=mat1:Filter(Card.IsLocation,nil,LOCATION_GRAVE) local rg=mat1:Filter(Card.IsLocation,nil,LOCATION_GRAVE)
mat1:Sub(rg) mat1:Sub(rg)
......
...@@ -30,6 +30,9 @@ end ...@@ -30,6 +30,9 @@ end
function c76647978.fcheck(tp,sg,fc) function c76647978.fcheck(tp,sg,fc)
return #sg<=2 return #sg<=2
end end
function c76647978.gcheck(sg)
return #sg<=2
end
function c76647978.filter1(c,e) function c76647978.filter1(c,e)
return c:IsOnField() and not c:IsImmuneToEffect(e) return c:IsOnField() and not c:IsImmuneToEffect(e)
end end
...@@ -42,6 +45,7 @@ function c76647978.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -42,6 +45,7 @@ function c76647978.target(e,tp,eg,ep,ev,re,r,rp,chk)
local chkf=tp local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil) local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil)
Auxiliary.FCheckAdditional=c76647978.fcheck Auxiliary.FCheckAdditional=c76647978.fcheck
Auxiliary.GCheckAdditional=c76647978.gcheck
local res=Duel.IsExistingMatchingCard(c76647978.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) local res=Duel.IsExistingMatchingCard(c76647978.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
...@@ -53,6 +57,7 @@ function c76647978.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -53,6 +57,7 @@ function c76647978.target(e,tp,eg,ep,ev,re,r,rp,chk)
end end
end end
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
return res return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
...@@ -64,6 +69,7 @@ function c76647978.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -64,6 +69,7 @@ function c76647978.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c76647978.filter1,nil,e) local mg1=Duel.GetFusionMaterial(tp):Filter(c76647978.filter1,nil,e)
Auxiliary.FCheckAdditional=c76647978.fcheck Auxiliary.FCheckAdditional=c76647978.fcheck
Auxiliary.GCheckAdditional=c76647978.gcheck
local sg1=Duel.GetMatchingGroup(c76647978.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local sg1=Duel.GetMatchingGroup(c76647978.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil local mg2=nil
local sg2=nil local sg2=nil
...@@ -96,6 +102,7 @@ function c76647978.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -96,6 +102,7 @@ function c76647978.activate(e,tp,eg,ep,ev,re,r,rp)
e:GetLabelObject():SetLabelObject(tc) e:GetLabelObject():SetLabelObject(tc)
end end
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
end end
function c76647978.mgfilter(c,e,tp,fusc,mg) function c76647978.mgfilter(c,e,tp,fusc,mg)
return c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE) return c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE)
......
...@@ -26,6 +26,9 @@ end ...@@ -26,6 +26,9 @@ end
function c87931906.fcheck(tp,sg,fc) function c87931906.fcheck(tp,sg,fc)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)<=1 return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)<=1
end end
function c87931906.gcheck(sg)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)<=1
end
function c87931906.target(e,tp,eg,ep,ev,re,r,rp,chk) function c87931906.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp local chkf=tp
...@@ -35,10 +38,12 @@ function c87931906.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -35,10 +38,12 @@ function c87931906.target(e,tp,eg,ep,ev,re,r,rp,chk)
if mg2:GetCount()>0 then if mg2:GetCount()>0 then
mg1:Merge(mg2) mg1:Merge(mg2)
Auxiliary.FCheckAdditional=c87931906.fcheck Auxiliary.FCheckAdditional=c87931906.fcheck
Auxiliary.GCheckAdditional=c87931906.gcheck
end end
end end
local res=Duel.IsExistingMatchingCard(c87931906.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) local res=Duel.IsExistingMatchingCard(c87931906.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
...@@ -63,9 +68,13 @@ function c87931906.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -63,9 +68,13 @@ function c87931906.activate(e,tp,eg,ep,ev,re,r,rp)
exmat=true exmat=true
end end
end end
if exmat then Auxiliary.FCheckAdditional=c87931906.fcheck end if exmat then
Auxiliary.FCheckAdditional=c87931906.fcheck
Auxiliary.GCheckAdditional=c87931906.gcheck
end
local sg1=Duel.GetMatchingGroup(c87931906.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local sg1=Duel.GetMatchingGroup(c87931906.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
local mg3=nil local mg3=nil
local sg2=nil local sg2=nil
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
...@@ -83,9 +92,13 @@ function c87931906.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -83,9 +92,13 @@ function c87931906.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=tg:GetFirst() local tc=tg:GetFirst()
mg1:RemoveCard(tc) mg1:RemoveCard(tc)
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
if exmat then Auxiliary.FCheckAdditional=c87931906.fcheck end if exmat then
Auxiliary.FCheckAdditional=c87931906.fcheck
Auxiliary.GCheckAdditional=c87931906.gcheck
end
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
Auxiliary.FCheckAdditional=nil Auxiliary.FCheckAdditional=nil
Auxiliary.GCheckAdditional=nil
tc:SetMaterial(mat1) tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect() Duel.BreakEffect()
......
...@@ -534,6 +534,11 @@ function Auxiliary.TuneMagicianCheckX(c,sg,ecode) ...@@ -534,6 +534,11 @@ function Auxiliary.TuneMagicianCheckX(c,sg,ecode)
end end
return false return false
end end
function Auxiliary.TuneMagicianCheckAdditionalX(ecode)
return function(g)
return not g:IsExists(Auxiliary.TuneMagicianCheckX,1,nil,g,ecode)
end
end
function Auxiliary.XyzAlterFilter(c,alterf,xyzc,e,tp,op) function Auxiliary.XyzAlterFilter(c,alterf,xyzc,e,tp,op)
return alterf(c) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0 and Auxiliary.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and (not op or op(e,tp,0,c)) return alterf(c) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0 and Auxiliary.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and (not op or op(e,tp,0,c))
end end
...@@ -750,7 +755,6 @@ function Auxiliary.XyzLevelFreeFilter(c,xyzc,f) ...@@ -750,7 +755,6 @@ function Auxiliary.XyzLevelFreeFilter(c,xyzc,f)
return c:IsFaceup() and c:IsCanBeXyzMaterial(xyzc) and (not f or f(c,xyzc)) return c:IsFaceup() and c:IsCanBeXyzMaterial(xyzc) and (not f or f(c,xyzc))
end end
function Auxiliary.XyzLevelFreeGoal(g,tp,xyzc,gf) function Auxiliary.XyzLevelFreeGoal(g,tp,xyzc,gf)
if g:IsExists(Auxiliary.TuneMagicianCheckX,1,nil,g,EFFECT_TUNE_MAGICIAN_X) then return false end
return (not gf or gf(g)) and Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0 return (not gf or gf(g)) and Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
end end
function Auxiliary.XyzLevelFreeCondition(f,gf,minct,maxct) function Auxiliary.XyzLevelFreeCondition(f,gf,minct,maxct)
...@@ -774,7 +778,10 @@ function Auxiliary.XyzLevelFreeCondition(f,gf,minct,maxct) ...@@ -774,7 +778,10 @@ function Auxiliary.XyzLevelFreeCondition(f,gf,minct,maxct)
local sg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_XMATERIAL) local sg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_XMATERIAL)
if sg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end if sg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return mg:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf) Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
local res=mg:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf)
Auxiliary.GCheckAdditional=nil
return res
end end
end end
function Auxiliary.XyzLevelFreeTarget(f,gf,minct,maxct) function Auxiliary.XyzLevelFreeTarget(f,gf,minct,maxct)
...@@ -797,7 +804,9 @@ function Auxiliary.XyzLevelFreeTarget(f,gf,minct,maxct) ...@@ -797,7 +804,9 @@ function Auxiliary.XyzLevelFreeTarget(f,gf,minct,maxct)
local sg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_XMATERIAL) local sg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_XMATERIAL)
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
local g=mg:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,true,minc,maxc,tp,c,gf) local g=mg:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,true,minc,maxc,tp,c,gf)
Auxiliary.GCheckAdditional=nil
if g and g:GetCount()>0 then if g and g:GetCount()>0 then
g:KeepAlive() g:KeepAlive()
e:SetLabelObject(g) e:SetLabelObject(g)
...@@ -868,7 +877,10 @@ function Auxiliary.XyzLevelFreeCondition2(f,gf,minct,maxct,alterf,desc,op) ...@@ -868,7 +877,10 @@ function Auxiliary.XyzLevelFreeCondition2(f,gf,minct,maxct,alterf,desc,op)
local sg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_XMATERIAL) local sg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_XMATERIAL)
if sg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end if sg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
return mg:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf) Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
local res=mg:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf)
Auxiliary.GCheckAdditional=nil
return res
end end
end end
function Auxiliary.XyzLevelFreeTarget2(f,gf,minct,maxct,alterf,desc,op) function Auxiliary.XyzLevelFreeTarget2(f,gf,minct,maxct,alterf,desc,op)
...@@ -903,7 +915,9 @@ function Auxiliary.XyzLevelFreeTarget2(f,gf,minct,maxct,alterf,desc,op) ...@@ -903,7 +915,9 @@ function Auxiliary.XyzLevelFreeTarget2(f,gf,minct,maxct,alterf,desc,op)
e:SetLabel(0) e:SetLabel(0)
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
g=mg2:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,true,minc,maxc,tp,c,gf) g=mg2:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,true,minc,maxc,tp,c,gf)
Auxiliary.GCheckAdditional=nil
end end
if g and g:GetCount()>0 then if g and g:GetCount()>0 then
g:KeepAlive() g:KeepAlive()
...@@ -1401,6 +1415,31 @@ end ...@@ -1401,6 +1415,31 @@ end
function Auxiliary.RitualCheck(g,tp,c,lv,greater_or_equal) function Auxiliary.RitualCheck(g,tp,c,lv,greater_or_equal)
return Auxiliary["RitualCheck"..greater_or_equal](g,c,lv) and Duel.GetMZoneCount(tp,g,tp)>0 and (not c.mat_group_check or c.mat_group_check(g,tp)) return Auxiliary["RitualCheck"..greater_or_equal](g,c,lv) and Duel.GetMZoneCount(tp,g,tp)>0 and (not c.mat_group_check or c.mat_group_check(g,tp))
end end
function Auxiliary.RitualCheckAdditionalLevel(c,rc)
local raw_level=c:GetRitualLevel(rc)
local lv1=raw_level&0xffff
local lv2=raw_level>>16
if lv2>0 then
return math.min(lv1,lv2)
else
return lv1
end
end
function Auxiliary.RitualCheckAdditional(c,lv,greater_or_equal)
if greater_or_equal=="Equal" then
return function(g)
return g:GetSum(Auxiliary.RitualCheckAdditionalLevel,c)<=lv
end
else
return function(g,ec)
if ec then
return g:GetSum(Auxiliary.RitualCheckAdditionalLevel,c)-Auxiliary.RitualCheckAdditionalLevel(ec,c)<=lv
else
return true
end
end
end
end
function Auxiliary.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal) function Auxiliary.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal)
if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c) local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
...@@ -1412,7 +1451,11 @@ function Auxiliary.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,great ...@@ -1412,7 +1451,11 @@ function Auxiliary.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,great
else else
mg:RemoveCard(c) mg:RemoveCard(c)
end end
return mg:CheckSubGroup(Auxiliary.RitualCheck,1,level_function(c),tp,c,level_function(c),greater_or_equal) local lv=level_function(c)
Auxiliary.GCheckAdditional=Auxiliary.RitualCheckAdditional(c,lv,greater_or_equal)
local res=mg:CheckSubGroup(Auxiliary.RitualCheck,1,lv,tp,c,lv,greater_or_equal)
Auxiliary.GCheckAdditional=nil
return res
end end
function Auxiliary.RitualExtraFilter(c,f) function Auxiliary.RitualExtraFilter(c,f)
return c:GetLevel()>0 and f(c) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() return c:GetLevel()>0 and f(c) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove()
...@@ -1453,7 +1496,10 @@ function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equa ...@@ -1453,7 +1496,10 @@ function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equa
mg:RemoveCard(tc) mg:RemoveCard(tc)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat=mg:SelectSubGroup(tp,Auxiliary.RitualCheck,false,1,level_function(tc),tp,tc,level_function(tc),greater_or_equal) local lv=level_function(tc)
Auxiliary.GCheckAdditional=Auxiliary.RitualCheckAdditional(tc,lv,greater_or_equal)
local mat=mg:SelectSubGroup(tp,Auxiliary.RitualCheck,false,1,lv,tp,tc,lv,greater_or_equal)
Auxiliary.GCheckAdditional=nil
tc:SetMaterial(mat) tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat) Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect() Duel.BreakEffect()
...@@ -1601,10 +1647,12 @@ function Auxiliary.PendCondition() ...@@ -1601,10 +1647,12 @@ function Auxiliary.PendCondition()
return g:IsExists(Auxiliary.PConditionFilter,1,nil,e,tp,lscale,rscale,eset) return g:IsExists(Auxiliary.PConditionFilter,1,nil,e,tp,lscale,rscale,eset)
end end
end end
function Auxiliary.PendOperationCheck(g,ft1,ft2,ft) function Auxiliary.PendOperationCheck(ft1,ft2,ft)
return function(g)
local exg=g:Filter(Card.IsLocation,nil,LOCATION_EXTRA) local exg=g:Filter(Card.IsLocation,nil,LOCATION_EXTRA)
local mg=g-exg local mg=g-exg
return #g<=ft and #exg<=ft2 and #mg<=ft1 return #g<=ft and #exg<=ft2 and #mg<=ft1
end
end end
function Auxiliary.PendOperation() function Auxiliary.PendOperation()
return function(e,tp,eg,ep,ev,re,r,rp,c,sg,og) return function(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
...@@ -1656,7 +1704,9 @@ function Auxiliary.PendOperation() ...@@ -1656,7 +1704,9 @@ function Auxiliary.PendOperation()
tg=tg:Filter(Auxiliary.PConditionExtraFilterSpecific,nil,e,tp,lscale,rscale,ce) tg=tg:Filter(Auxiliary.PConditionExtraFilterSpecific,nil,e,tp,lscale,rscale,ce)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=tg:SelectSubGroup(tp,Auxiliary.PendOperationCheck,true,1,math.min(#tg,ft),ft1,ft2,ft) Auxiliary.GCheckAdditional=Auxiliary.PendOperationCheck(ft1,ft2,ft)
local g=tg:SelectSubGroup(tp,aux.TRUE,true,1,math.min(#tg,ft),ft1,ft2,ft)
Auxiliary.GCheckAdditional=nil
if not g then return end if not g then return end
if ce then if ce then
Duel.Hint(HINT_CARD,0,ce:GetOwner():GetOriginalCode()) Duel.Hint(HINT_CARD,0,ce:GetOwner():GetOriginalCode())
...@@ -2009,8 +2059,13 @@ function Auxiliary.GetMultiLinkedZone(tp) ...@@ -2009,8 +2059,13 @@ function Auxiliary.GetMultiLinkedZone(tp)
return multi_linked_zone return multi_linked_zone
end end
Auxiliary.SubGroupCaptured=nil Auxiliary.SubGroupCaptured=nil
Auxiliary.GCheckAdditional=nil
function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params) function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
sg:AddCard(c) 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=(#sg>=min and #sg<=max and f(sg,table.unpack(ext_params))) local res=(#sg>=min and #sg<=max and f(sg,table.unpack(ext_params)))
or (#sg<max and g:IsExists(Auxiliary.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params)) or (#sg<max and g:IsExists(Auxiliary.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params))
sg:RemoveCard(c) sg:RemoveCard(c)
...@@ -2018,6 +2073,10 @@ function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params) ...@@ -2018,6 +2073,10 @@ function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
end end
function Auxiliary.CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params) function Auxiliary.CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params)
sg:AddCard(c) 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=#sg>=min and #sg<=max and f(sg,table.unpack(ext_params)) local res=#sg>=min and #sg<=max and f(sg,table.unpack(ext_params))
if res then if res then
Auxiliary.SubGroupCaptured:Clear() Auxiliary.SubGroupCaptured:Clear()
...@@ -2034,8 +2093,9 @@ function Group.CheckSubGroup(g,f,min,max,...) ...@@ -2034,8 +2093,9 @@ function Group.CheckSubGroup(g,f,min,max,...)
if min>max then return false end if min>max then return false end
local ext_params={...} local ext_params={...}
local sg=Duel.GrabSelectedCard() local sg=Duel.GrabSelectedCard()
if #sg>max or #(g+sg)<min or #sg==max and not f(sg,...) then return false end if #sg>max or #(g+sg)<min then return false end
if #sg>=min and #sg<=max and f(sg,...) then return true end if #sg==max and (not f(sg,...) or Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,nil,g,f,min,max,ext_params)) then return false end
if #sg>=min and #sg<=max and f(sg,...) and (not Auxiliary.GCheckAdditional or Auxiliary.GCheckAdditional(sg,nil,g,f,min,max,ext_params)) then return true end
local eg=g:Clone() local eg=g:Clone()
for c in aux.Next(g-sg) do for c in aux.Next(g-sg) do
if Auxiliary.CheckGroupRecursive(c,sg,eg,f,min,max,ext_params) then return true end if Auxiliary.CheckGroupRecursive(c,sg,eg,f,min,max,ext_params) then return true end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment