From 92d8d7e500e8ddbc81738dfd4a4fcb25be3ec5c8 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Mon, 29 Jan 2024 12:09:28 +0100 Subject: [PATCH 01/19] Replace magic effect values in xyz proc with constants --- constant.lua | 7 ++ official/c23187256.lua | 4 +- official/c43490025.lua | 4 +- official/c52653092.lua | 2 +- official/c57314798.lua | 2 +- official/c65305468.lua | 4 +- official/c86466163.lua | 4 +- official/c91110378.lua | 2 +- proc_xyz.lua | 135 ++++++++++++++++++-------------------- unofficial/c100000350.lua | 2 +- unofficial/c511000189.lua | 2 +- unofficial/c511000510.lua | 2 +- unofficial/c511001058.lua | 2 +- unofficial/c511001175.lua | 2 +- unofficial/c511001188.lua | 2 +- unofficial/c511001225.lua | 2 +- unofficial/c511001373.lua | 2 +- unofficial/c511001407.lua | 4 +- unofficial/c511001514.lua | 2 +- unofficial/c511001613.lua | 2 +- unofficial/c511002101.lua | 2 +- unofficial/c511002116.lua | 2 +- unofficial/c511002163.lua | 2 +- unofficial/c511002733.lua | 2 +- unofficial/c511002759.lua | 2 +- unofficial/c511002760.lua | 2 +- unofficial/c511002761.lua | 4 +- unofficial/c511002772.lua | 2 +- unofficial/c511002793.lua | 2 +- unofficial/c511002848.lua | 4 +- unofficial/c511002849.lua | 2 +- unofficial/c511002850.lua | 2 +- unofficial/c511002927.lua | 2 +- unofficial/c511003001.lua | 2 +- unofficial/c511003039.lua | 2 +- unofficial/c511010501.lua | 2 +- unofficial/c511015103.lua | 4 +- unofficial/c511018508.lua | 2 +- unofficial/c511600298.lua | 2 +- 39 files changed, 115 insertions(+), 117 deletions(-) diff --git a/constant.lua b/constant.lua index 9591a53830..77a3708184 100644 --- a/constant.lua +++ b/constant.lua @@ -621,6 +621,13 @@ EFFECT_FUSION_MAT_RESTRICTION = 73941492+TYPE_FUSION EFFECT_SYNCHRO_MAT_RESTRICTION = 73941492+TYPE_SYNCHRO EFFECT_XYZ_MAT_RESTRICTION = 73941492+TYPE_XYZ EFFECT_SYNCHRO_MAT_FROM_HAND = 97682931 +EFFECT_XYZ_MAT_FROM_GRAVE = 511002793 +EFFECT_SPELL_XYZ_MAT = 511000189 --Solid Overlay and similar cards +EFFECT_EQUIP_SPELL_XYZ_MAT = 511001175 +EFFECT_ORICHALCUM_CHAIN = 511002116 +EFFECT_DOUBLE_XYZ_MATERIAL = 511001225 +EFFECT_SATELLARKNIGHT_CAPELLA = 86466163 +EFFECT_STAR_SERAPH_SOVEREIGNTY = 91110378 --Events EVENT_STARTUP = 1000 EVENT_FLIP = 1001 diff --git a/official/c23187256.lua b/official/c23187256.lua index 3d7cea6512..fcc84fc8a0 100644 --- a/official/c23187256.lua +++ b/official/c23187256.lua @@ -34,11 +34,11 @@ function s.xyzfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_XYZ,xyz,sumtype,tp) and c:IsSetCard(SET_NUMBER,xyz,sumtype,tp) and c:GetOverlayCount()>0 end function s.xyzcheck(g,tp,xyz) - local mg=g:Filter(function(c) return not c:IsHasEffect(511001175) end,nil) + local mg=g:Filter(function(c) return not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end,nil) return mg:GetClassCount(Card.GetRank)==1 end function s.check(c,rk) - return c:GetRank()~=rk and not c:IsHasEffect(511001175) + return c:GetRank()~=rk and not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end function s.filter(c,e,tp,rp) return c:IsRankBelow(9) and c:IsAttackBelow(3000) and c:IsSetCard(SET_NUMBER) diff --git a/official/c43490025.lua b/official/c43490025.lua index eeb7f31bb5..2c35d39524 100644 --- a/official/c43490025.lua +++ b/official/c43490025.lua @@ -46,7 +46,7 @@ function s.xyzfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_XYZ,xyz,sumtype,tp) and not c:IsSetCard(SET_NUMBER,xyz,sumtype,tp) end function s.xyzcheck(g,tp,xyz) - local mg=g:Filter(function(c) return not c:IsHasEffect(511001175) end,nil) + local mg=g:Filter(function(c) return not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end,nil) return mg:GetClassCount(Card.GetRank)==1 end function s.ovfilter(c,tp,lc) @@ -77,4 +77,4 @@ function s.atkop(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c52653092.lua b/official/c52653092.lua index c57e0f11c7..d98571a9f9 100644 --- a/official/c52653092.lua +++ b/official/c52653092.lua @@ -49,7 +49,7 @@ function s.xyzfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_XYZ,xyz,sumtype,tp) and c:IsSetCard(SET_NUMBER,xyz,sumtype,tp) end function s.xyzcheck(g,tp,xyz) - local mg=g:Filter(function(c) return not c:IsHasEffect(511001175) end,nil) + local mg=g:Filter(function(c) return not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end,nil) return mg:GetClassCount(Card.GetRank)==1 end function s.cfilter(c) diff --git a/official/c57314798.lua b/official/c57314798.lua index 307c8a91d4..c713c7efd3 100644 --- a/official/c57314798.lua +++ b/official/c57314798.lua @@ -43,7 +43,7 @@ function s.xyzfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_XYZ,xyz,sumtype,tp) and c:IsSetCard(SET_NUMBER,xyz,sumtype,tp) end function s.xyzcheck(g,tp,xyz) - local mg=g:Filter(function(c) return not c:IsHasEffect(511001175) end,nil) + local mg=g:Filter(function(c) return not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end,nil) return mg:GetClassCount(Card.GetRank)==1 and mg:GetClassCount(Card.GetCode)==1 end function s.filter(c) diff --git a/official/c65305468.lua b/official/c65305468.lua index 2628f8340b..b3ebded2df 100644 --- a/official/c65305468.lua +++ b/official/c65305468.lua @@ -44,7 +44,7 @@ function s.xyzfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_XYZ,xyz,sumtype,tp) and not c:IsSetCard(SET_NUMBER,xyz,sumtype,tp) end function s.xyzcheck(g,tp,xyz) - local mg=g:Filter(function(c) return not c:IsHasEffect(511001175) end,nil) + local mg=g:Filter(function(c) return not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end,nil) return mg:GetClassCount(Card.GetRank)==1 end function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk) @@ -60,7 +60,7 @@ function s.ctop(e,tp,eg,ep,ev,re,r,rp) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - if chk==0 then return not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT) + if chk==0 then return not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT) and c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) end if Duel.SelectEffectYesNo(tp,c,96) then c:RemoveOverlayCard(tp,1,1,REASON_EFFECT) diff --git a/official/c86466163.lua b/official/c86466163.lua index 67882183a9..5f53ad6818 100644 --- a/official/c86466163.lua +++ b/official/c86466163.lua @@ -30,7 +30,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() - e2:SetCode(id) + e2:SetCode(EFFECT_SATELLARKNIGHT_CAPELLA) e2:SetLabelObject(e1) e2:SetValue(0x30003) --0x1 >, 0x2 =, 0x4 <, value == last digit(s) Duel.RegisterEffect(e2,tp) @@ -40,4 +40,4 @@ function s.xyztg(e,c) end function s.xyzlv(e,c,rc) return 0x50000+c:GetLevel() -end \ No newline at end of file +end diff --git a/official/c91110378.lua b/official/c91110378.lua index a598bc56a8..4fbe69c9f2 100644 --- a/official/c91110378.lua +++ b/official/c91110378.lua @@ -6,7 +6,7 @@ function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(id) + e1:SetCode(EFFECT_STAR_SERAPH_SOVEREIGNTY) e1:SetValue(0x30003) --0x1 >, 0x2 =, 0x4 <, value == last digit(s) c:RegisterEffect(e1) --spsummon diff --git a/proc_xyz.lua b/proc_xyz.lua index cd7ea3ae4d..f468772297 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -16,7 +16,7 @@ function Xyz.EffectXyzMaterialChk(c,xyz,tp) end function Xyz.AlterFilter(c,alterf,xyzc,e,tp,op) if not alterf(c,tp,xyzc) or not c:IsCanBeXyzMaterial(xyzc,tp) - or (c:IsControler(1-tp) and not Xyz.EffectXyzMaterialChk(c,xyzc,tp)) + or (c:IsControler(1-tp) and not Xyz.EffectXyzMaterialChk(c,xyzc,tp)) or (op and not op(e,tp,0,c)) then return false end if xyzc:IsLocation(LOCATION_EXTRA) then return Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0 @@ -28,7 +28,7 @@ end function Xyz.AddProcedure(c,f,lv,ct,alterf,desc,maxct,op,mustbemat,exchk) --exchk for special xyz, checking other materials --mustbemat for Startime Magician - if not maxct then maxct=ct end + if not maxct then maxct=ct end if c.xyz_filter==nil then local mt=c:GetMetatable() mt.xyz_filter=function(mc,ignoretoken,xyz,tp) return mc and (not f or f(mc,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) and (not lv or mc:IsXyzLevel(c,lv)) and (not mc:IsType(TYPE_TOKEN) or ignoretoken) end @@ -36,7 +36,7 @@ function Xyz.AddProcedure(c,f,lv,ct,alterf,desc,maxct,op,mustbemat,exchk) mt.minxyzct=ct mt.maxxyzct=maxct end - + local chk1=Effect.CreateEffect(c) chk1:SetType(EFFECT_TYPE_SINGLE) chk1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) @@ -93,18 +93,18 @@ function Xyz.MatGenerate(e,tp,eg,ep,ev,re,r,rp) end --Xyz Summon(normal) function Xyz.MatFilter2(c,f,lv,xyz,tp) - if c:IsLocation(LOCATION_GRAVE) and not c:IsHasEffect(511002793) then return false end + if c:IsLocation(LOCATION_GRAVE) and not c:IsHasEffect(EFFECT_XYZ_MAT_FROM_GRAVE) then return false end if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return false end return Xyz.MatFilter(c,f,lv,xyz,tp) end function Xyz.MatFilter(c,f,lv,xyz,tp) - return (not f or f(c,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) and (not lv or c:IsXyzLevel(xyz,lv)) and c:IsCanBeXyzMaterial(xyz,tp) + return (not f or f(c,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) and (not lv or c:IsXyzLevel(xyz,lv)) and c:IsCanBeXyzMaterial(xyz,tp) and (c:IsControler(tp) or Xyz.EffectXyzMaterialChk(c,xyz,tp)) end function Xyz.SubMatFilter(c,fil,lv,xg,xyz,tp) if not lv then return false end --Solid Overlay-type - local te=c:GetCardEffect(511000189) + local te=c:GetCardEffect(EFFECT_SPELL_XYZ_MAT) if not te then return false end local f=te:GetValue() if type(f)=='function' then @@ -117,20 +117,19 @@ end function Xyz.SubFilterChk(c,f,xyz,tp) return (not f or f(c,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) end -function Xyz.CheckValidMultiXyzMaterial(c,xyz,matg) - if not c:IsHasEffect(511001225) then return false end - local eff={c:GetCardEffect(511001225)} - for i=1,#eff do +function Xyz.CheckValidMultiXyzMaterial(c,xyz) + local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} + for i,te in ipairs(eff) do local te=eff[i] local tgf=te:GetOperation() - if not tgf or tgf(te,xyz,matg) then return true end + if not tgf or tgf(te,xyz) then return true end end return false end function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbemat,exchk,f,mustg,lv) local xct=ct local rg=Group.CreateGroup() - if not c:IsHasEffect(511002116) then + if not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then xct=xct+1 end local xmatct=matct+1 @@ -156,20 +155,20 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe end end tc=g2:GetNext() - end + end end if xct>max or xmatct>maxc then mg:Merge(rg) return false end - if not c:IsHasEffect(511002116) then + if not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then matg:AddCard(c) end sg:AddCard(c) local res=nil if xct>=min and xmatct>=minc then local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,91110378) then + if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then ok=Xyz.MatNumChkF(matg) end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,86466163) then + if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then ok=Xyz.MatNumChkF2(matg,lv,xyz) end if ok and exchk then @@ -186,22 +185,22 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe end local retchknum={0} local retchk={mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv)} - if not res and c:IsHasEffect(511001225) and not mustbemat then - local eff={c:GetCardEffect(511001225)} + if not res and c:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) and not mustbemat then + local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} for i,te in ipairs(eff) do local tgf=te:GetOperation() local val=te:GetValue() local redun=false for _,v in ipairs(retchknum) do if v==val then redun=true break end - end - if not redun and val>0 and (not tgf or tgf(te,xyz,matg)) then + end + if not redun and val>0 and (not tgf or tgf(te,xyz)) then if xct>=min and xmatct+val>=minc and xct<=max and xmatct+val<=maxc then local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,91110378) then + if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then ok=Xyz.MatNumChkF(matg) end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,86466163) then + if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then ok=Xyz.MatNumChkF2(matg,lv,xyz) end if ok and exchk then @@ -233,7 +232,7 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe end function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mustg,lv) local rg=Group.CreateGroup() - if c:IsHasEffect(511001175) and not sg:IsContains(c:GetEquipTarget()) then return false end + if c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not sg:IsContains(c:GetEquipTarget()) then return false end local xct=ct+1 local eff={c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)} for i,f in ipairs(eff) do @@ -260,17 +259,17 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu end end if xct>maxc then mg:Merge(rg) return false end - if not c:IsHasEffect(511001175) and not c:IsHasEffect(511002116) then + if not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then matg:AddCard(c) end sg:AddCard(c) local res=nil if xct>=minc then local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,91110378) then + if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then ok=Xyz.MatNumChkF(matg) end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,86466163) then + if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then ok=Xyz.MatNumChkF2(matg,lv,xyz) end if ok and exchk then @@ -287,13 +286,13 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu end local eqg=Group.CreateGroup() if not mustbemat then - eqg:Merge(c:GetEquipGroup():Filter(Card.IsHasEffect,nil,511001175)) + eqg:Merge(c:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT)) mg:Merge(eqg) end local retchknum={0} local retchk={mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct,mustbemat,exchk,f,mustg,lv)} - if not res and c:IsHasEffect(511001225) and not mustbemat then - local eff={c:GetCardEffect(511001225)} + if not res and c:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) and not mustbemat then + local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} for i,te in ipairs(eff) do local tgf=te:GetOperation() local val=te:GetValue() @@ -301,13 +300,13 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu for _,v in ipairs(retchknum) do if v==val then redun=true break end end - if val>0 and (not tgf or tgf(te,xyz,matg)) and not redun then + if val>0 and (not tgf or tgf(te,xyz)) and not redun then if xct+val>=minc and xct+val<=maxc then local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,91110378) then + if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then ok=Xyz.MatNumChkF(matg) end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,86466163) then + if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then ok=Xyz.MatNumChkF2(matg,lv,xyz) end if ok and exchk then @@ -339,9 +338,9 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu return res end function Xyz.MatNumChkF(tg) - local chkg=tg:Filter(Card.IsHasEffect,nil,91110378) + local chkg=tg:Filter(Card.IsHasEffect,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) for chkc in aux.Next(chkg) do - for _,te in ipairs({chkc:GetCardEffect(91110378)}) do + for _,te in ipairs({chkc:GetCardEffect(EFFECT_STAR_SERAPH_SOVEREIGNTY)}) do local rct=te:GetValue()&0xffff local comp=te:GetValue()>>16 if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then return false end @@ -357,10 +356,10 @@ function Xyz.MatNumChk(matct,ct,comp) return ok end function Xyz.MatNumChkF2(tg,lv,xyz) - local chkg=tg:Filter(Card.IsHasEffect,nil,86466163) + local chkg=tg:Filter(Card.IsHasEffect,nil,EFFECT_SATELLARKNIGHT_CAPELLA) for chkc in aux.Next(chkg) do local rev={} - for _,te in ipairs({chkc:GetCardEffect(86466163)}) do + for _,te in ipairs({chkc:GetCardEffect(EFFECT_SATELLARKNIGHT_CAPELLA)}) do local rct=te:GetValue()&0xffff local comp=te:GetValue()>>16 if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then @@ -385,7 +384,7 @@ function Xyz.MatNumChkF2(tg,lv,xyz) return true end function Auxiliary.HarmonizingMagFilterXyz(c,e,f) - return not f or f(e,c) or c:IsHasEffect(511002116) or c:IsHasEffect(511001175) + return not f or f(e,c) or c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) or c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) --og: use special material @@ -401,18 +400,14 @@ function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) end if not xg or #xg==0 then return false end local mg - local g if og then - g=og mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) else - g=Duel.GetMatchingGroup(function(cc) return ((cc:IsLocation(LOCATION_GRAVE) and cc:IsHasEffect(511002793)) - or cc:IsFaceup()) and (cc:IsControler(tp) or Xyz.EffectXyzMaterialChk(cc,c,tp)) end,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE,nil) mg=Duel.GetMatchingGroup(Xyz.MatFilter2,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE,nil,f,lv,c,tp) if not mustbemat then local eqmg=Group.CreateGroup() for tc in aux.Next(mg) do - local eq=tc:GetEquipGroup():Filter(Card.IsHasEffect,nil,511001175) + local eq=tc:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) eqmg:Merge(eq) end mg:Merge(eqmg) @@ -423,7 +418,7 @@ function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) if must then mustg:Merge(must) end if not mg:Includes(mustg) then return false end if not mustbemat then - mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,511002116)) + mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN)) end if min and min~=99 then return mg:IsExists(Xyz.RecursionChk1,1,nil,mg,c,tp,min,max,minc,maxc,Group.CreateGroup(),Group.CreateGroup(),0,0,mustbemat,exchk,f,mustg,lv) @@ -436,7 +431,7 @@ end function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) return function(e,tp,eg,ep,ev,re,r,rp,chk,c,must,og,min,max) if og and not min then - if (#og>=minc and #og<=maxc) or not og:IsExists(Card.IsHasEffect,1,nil,511002116) then + if (#og>=minc and #og<=maxc) or not og:IsExists(Card.IsHasEffect,1,nil,EFFECT_ORICHALCUM_CHAIN) then local sg=og:Clone() sg:KeepAlive() e:SetLabelObject(sg) @@ -447,7 +442,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) local matg=Group.CreateGroup() local sg=Group.CreateGroup() local mg=og:Clone() - mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,511002116)) + mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN)) local finish=false while ct=min and matct>=maxc then finish=true end if not sg:IsContains(sc) then sg:AddCard(sc) - if sc:IsHasEffect(511002116) then + if sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then matct=matct+1 - elseif sc:IsHasEffect(511001225) then + elseif sc:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) then matg:AddCard(sc) ct=ct+1 - if not Xyz.CheckValidMultiXyzMaterial(sc,c,matg) or (min>=ct and minc>=matct+1) then + if not Xyz.CheckValidMultiXyzMaterial(sc,c) or (min>=ct and minc>=matct+1) then matct=matct+1 else local multi={} if mg:IsExists(Xyz.RecursionChk1,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct,matct+1,mustbemat,exchk,f,mustg,lv) then table.insert(multi,1) end - local eff={sc:GetCardEffect(511001225)} + local eff={sc:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} for i=1,#eff do local te=eff[i] local tgf=te:GetOperation() local val=te:GetValue() - if val>0 and (not tgf or tgf(te,c,matg)) then - if (min>=ct and minc>=matct+1+val) + if val>0 and (not tgf or tgf(te,c)) then + if (min>=ct and minc>=matct+1+val) or mg:IsExists(Xyz.RecursionChk1,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct,matct+1+val,mustbemat,exchk,f,mustg,lv) then table.insert(multi,1+val) end @@ -499,7 +494,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) end else sg:RemoveCard(sc) - if sc:IsHasEffect(511002116) then + if sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then matct=matct-1 else matg:RemoveCard(sc) @@ -528,18 +523,14 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) xg=xyztempg1 end local mg - local g if og then - g=og mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) else - g=Duel.GetMatchingGroup(function(cc) return ((cc:IsLocation(LOCATION_GRAVE) and cc:IsHasEffect(511002793)) - or cc:IsFaceup()) and (cc:IsControler(tp) or Xyz.EffectXyzMaterialChk(cc,c,tp)) end,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE,nil) mg=Duel.GetMatchingGroup(Xyz.MatFilter2,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE,nil,f,lv,c,tp) if not mustbemat then local eqmg=Group.CreateGroup() for tc in aux.Next(mg) do - local eq=tc:GetEquipGroup():Filter(Card.IsHasEffect,nil,511001175) + local eq=tc:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) eqmg:Merge(eq) end mg:Merge(eqmg) @@ -549,7 +540,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) local mustg=Auxiliary.GetMustBeMaterialGroup(tp,g,tp,c,mg,REASON_XYZ) if must then mustg:Merge(must) end if not mustbemat then - mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,511002116)) + mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN)) end local finish=false if not og or max==99 then @@ -563,8 +554,8 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local sc=Group.SelectUnselect(tg,sg,tp,finish,cancel) if not sc then - if ct0 and (not tgf or tgf(te,c,matg)) then + if val>0 and (not tgf or tgf(te,c)) then if minc<=ct+val and ct+val<=maxc or mg:IsExists(Xyz.RecursionChk2,1,sg,mg,c,tp,minc,maxc,sg,matg,ct+val,mustbemat,exchk,f,mustg,lv) then table.insert(multi,1+val) @@ -613,8 +604,8 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) end else sg:RemoveCard(sc) - mg:Sub(sc:GetEquipGroup():Filter(Card.IsHasEffect,nil,511001175)) - if not sc:IsHasEffect(511002116) then + mg:Sub(sc:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT)) + if not sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then matg:RemoveCard(sc) end ct=ct-1 @@ -623,8 +614,8 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) tab[sc]=nil end end - if ct>=minc and (not matg:IsExists(Card.IsHasEffect,1,nil,91110378) or Xyz.MatNumChkF(matg)) - and (not lv or not matg:IsExists(Card.IsHasEffect,1,nil,86466163) or Xyz.MatNumChkF2(matg,lv,c)) and matg:Includes(mustg) then + if ct>=minc and (not matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) or Xyz.MatNumChkF(matg)) + and (not lv or not matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) or Xyz.MatNumChkF2(matg,lv,c)) and matg:Includes(mustg) then finish=true end cancel=not og and Duel.IsSummonCancelable() and #sg==0 @@ -641,9 +632,9 @@ function Xyz.Operation(f,lv,minc,maxc,mustbemat,exchk) return function(e,tp,eg,ep,ev,re,r,rp,c,must,og,min,max) local g=e:GetLabelObject() if not g then return end - local remg=g:Filter(Card.IsHasEffect,nil,511002116) + local remg=g:Filter(Card.IsHasEffect,nil,EFFECT_ORICHALCUM_CHAIN) remg:ForEach(function(c) c:RegisterFlagEffect(511002115,RESET_EVENT+RESETS_STANDARD,0,0) end) - g:Remove(Card.IsHasEffect,nil,511002116):Remove(Card.IsHasEffect,nil,511002115) + g:Remove(Card.IsHasEffect,nil,EFFECT_ORICHALCUM_CHAIN):Remove(Card.IsHasEffect,nil,511002115) c:SetMaterial(g) Duel.Overlay(c,g,true) g:DeleteGroup() @@ -704,7 +695,7 @@ function Xyz.Target2(alterf,op) return true end end -end +end function Xyz.Operation2(alterf,op) return function(e,tp,eg,ep,ev,re,r,rp,c,must,og,min,max) local oc=e:GetLabelObject() diff --git a/unofficial/c100000350.lua b/unofficial/c100000350.lua index 27e2c01732..be78c96592 100644 --- a/unofficial/c100000350.lua +++ b/unofficial/c100000350.lua @@ -9,7 +9,7 @@ function s.initial_effect(c) --xyz local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) - e2:SetCode(511001225) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(0x7f,0x7f) e2:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER)) diff --git a/unofficial/c511000189.lua b/unofficial/c511000189.lua index 55f9adffcb..c55f45c6e7 100644 --- a/unofficial/c511000189.lua +++ b/unofficial/c511000189.lua @@ -10,7 +10,7 @@ function s.initial_effect(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e2:SetCode(id) + e2:SetCode(EFFECT_SPELL_XYZ_MAT) e2:SetValue(4) e2:SetRange(LOCATION_SZONE) c:RegisterEffect(e2) diff --git a/unofficial/c511000510.lua b/unofficial/c511000510.lua index a7acb55ad4..f7bfa95460 100644 --- a/unofficial/c511000510.lua +++ b/unofficial/c511000510.lua @@ -10,7 +10,7 @@ function s.initial_effect(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e2:SetCode(511000189) + e2:SetCode(EFFECT_SPELL_XYZ_MAT) e2:SetValue(4) e2:SetRange(LOCATION_SZONE) c:RegisterEffect(e2) diff --git a/unofficial/c511001058.lua b/unofficial/c511001058.lua index c3226bafb6..aa2af8ea2b 100644 --- a/unofficial/c511001058.lua +++ b/unofficial/c511001058.lua @@ -13,7 +13,7 @@ function s.initial_effect(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e2:SetCode(511000189) + e2:SetCode(EFFECT_SPELL_XYZ_MAT) e2:SetCondition(s.con) e2:SetValue(s.val) e2:SetRange(LOCATION_SZONE) diff --git a/unofficial/c511001175.lua b/unofficial/c511001175.lua index c46b051559..06f4abcdb2 100644 --- a/unofficial/c511001175.lua +++ b/unofficial/c511001175.lua @@ -6,7 +6,7 @@ function s.initial_effect(c) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e4:SetCode(id) + e4:SetCode(EFFECT_EQUIP_SPELL_XYZ_MAT) e4:SetRange(LOCATION_SZONE) c:RegisterEffect(e4) end diff --git a/unofficial/c511001188.lua b/unofficial/c511001188.lua index 2d9cc30dcd..75db83e1e7 100644 --- a/unofficial/c511001188.lua +++ b/unofficial/c511001188.lua @@ -70,7 +70,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e5:SetCode(511001175) + e5:SetCode(EFFECT_EQUIP_SPELL_XYZ_MAT) e5:SetRange(LOCATION_SZONE) e5:SetReset(RESET_EVENT+RESETS_STANDARD) c:RegisterEffect(e5) diff --git a/unofficial/c511001225.lua b/unofficial/c511001225.lua index 6241ede08a..c087730ed8 100644 --- a/unofficial/c511001225.lua +++ b/unofficial/c511001225.lua @@ -5,7 +5,7 @@ function s.initial_effect(c) --double xyz material local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) - e2:SetCode(id) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetValue(1) c:RegisterEffect(e2) local e5=Effect.CreateEffect(c) diff --git a/unofficial/c511001373.lua b/unofficial/c511001373.lua index 5fc6f1e5e2..3e9cea1a15 100644 --- a/unofficial/c511001373.lua +++ b/unofficial/c511001373.lua @@ -6,7 +6,7 @@ function s.initial_effect(c) --Treat the equipped monster as 2 Xyz Materials local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) --Attach this card to an Xyz monster Summoned using the attached monster as material diff --git a/unofficial/c511001407.lua b/unofficial/c511001407.lua index ee50b1bba6..ea04b8ae4d 100644 --- a/unofficial/c511001407.lua +++ b/unofficial/c511001407.lua @@ -9,9 +9,9 @@ function s.initial_effect(c) --xyz local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) - e2:SetCode(511001225) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetRange(LOCATION_SZONE) - e2:SetTargetRange(LOCATION_MZONE,0) + e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x54)) e2:SetValue(1) c:RegisterEffect(e2) diff --git a/unofficial/c511001514.lua b/unofficial/c511001514.lua index b30099ba39..de3249be5d 100644 --- a/unofficial/c511001514.lua +++ b/unofficial/c511001514.lua @@ -48,7 +48,7 @@ function s.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) e1:SetReset(RESET_EVENT+RESETS_STANDARD) c:RegisterEffect(e1) diff --git a/unofficial/c511001613.lua b/unofficial/c511001613.lua index 823cbcfd00..2f254818d2 100644 --- a/unofficial/c511001613.lua +++ b/unofficial/c511001613.lua @@ -11,7 +11,7 @@ end function s.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetReset(RESET_PHASE+PHASE_END) diff --git a/unofficial/c511002101.lua b/unofficial/c511002101.lua index f5c3a6d096..1e4f65d95d 100644 --- a/unofficial/c511002101.lua +++ b/unofficial/c511002101.lua @@ -12,7 +12,7 @@ function s.initial_effect(c) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(511001225) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetValue(1) c:RegisterEffect(e2) end diff --git a/unofficial/c511002116.lua b/unofficial/c511002116.lua index f48e764565..f3b401ed1a 100644 --- a/unofficial/c511002116.lua +++ b/unofficial/c511002116.lua @@ -10,7 +10,7 @@ function s.initial_effect(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e2:SetCode(id) + e2:SetCode(EFFECT_ORICHALCUM_CHAIN) e2:SetCondition(s.con) e2:SetRange(LOCATION_SZONE) c:RegisterEffect(e2) diff --git a/unofficial/c511002163.lua b/unofficial/c511002163.lua index 86dd37d7d2..62ef83d20a 100644 --- a/unofficial/c511002163.lua +++ b/unofficial/c511002163.lua @@ -5,7 +5,7 @@ function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCondition(s.con) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) --register diff --git a/unofficial/c511002733.lua b/unofficial/c511002733.lua index aee149dc29..5c46ab1201 100644 --- a/unofficial/c511002733.lua +++ b/unofficial/c511002733.lua @@ -40,7 +40,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) - e3:SetCode(511001225) + e3:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e3:SetValue(1) e3:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e3) diff --git a/unofficial/c511002759.lua b/unofficial/c511002759.lua index 2e84dfdab1..26e583c773 100644 --- a/unofficial/c511002759.lua +++ b/unofficial/c511002759.lua @@ -4,7 +4,7 @@ function s.initial_effect(c) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(511001225) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetOperation(s.tgval) e2:SetValue(1) c:RegisterEffect(e2) diff --git a/unofficial/c511002760.lua b/unofficial/c511002760.lua index c2e3c16498..568763807b 100644 --- a/unofficial/c511002760.lua +++ b/unofficial/c511002760.lua @@ -4,7 +4,7 @@ function s.initial_effect(c) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(511001225) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetOperation(s.tgval) e2:SetValue(1) c:RegisterEffect(e2) diff --git a/unofficial/c511002761.lua b/unofficial/c511002761.lua index 1271518cc0..8385676378 100644 --- a/unofficial/c511002761.lua +++ b/unofficial/c511002761.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetOperation(s.tgval) e1:SetValue(1) c:RegisterEffect(e1) @@ -12,4 +12,4 @@ end s.listed_series={0x84} function s.tgval(e,c) return c:IsSetCard(0x84) -end \ No newline at end of file +end diff --git a/unofficial/c511002772.lua b/unofficial/c511002772.lua index e5db91af44..4848af1312 100644 --- a/unofficial/c511002772.lua +++ b/unofficial/c511002772.lua @@ -4,7 +4,7 @@ function s.initial_effect(c) -- local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) end diff --git a/unofficial/c511002793.lua b/unofficial/c511002793.lua index c9aa187ba2..d838317df5 100644 --- a/unofficial/c511002793.lua +++ b/unofficial/c511002793.lua @@ -17,7 +17,7 @@ function s.initial_effect(c) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) - e3:SetCode(id) + e3:SetCode(EFFECT_XYZ_MAT_FROM_GRAVE) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) diff --git a/unofficial/c511002848.lua b/unofficial/c511002848.lua index cd5ad46759..3a6e76cae2 100644 --- a/unofficial/c511002848.lua +++ b/unofficial/c511002848.lua @@ -22,7 +22,7 @@ end function s.xyzfilter(c,ce,a) local e1=Effect.CreateEffect(ce) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) ce:RegisterEffect(e1) local res=c:IsXyzSummonable(nil,Group.FromCards(ce,a),2,2) @@ -47,7 +47,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) local xyz=g:Select(tp,1,1,nil):GetFirst() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) e1:SetReset(RESET_EVENT+RESETS_STANDARD) c:RegisterEffect(e1) diff --git a/unofficial/c511002849.lua b/unofficial/c511002849.lua index 70040914ac..bd34a1a9d9 100644 --- a/unofficial/c511002849.lua +++ b/unofficial/c511002849.lua @@ -4,7 +4,7 @@ function s.initial_effect(c) -- local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) end diff --git a/unofficial/c511002850.lua b/unofficial/c511002850.lua index 7f3e264a08..ad1a588c17 100644 --- a/unofficial/c511002850.lua +++ b/unofficial/c511002850.lua @@ -47,7 +47,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(1) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) diff --git a/unofficial/c511002927.lua b/unofficial/c511002927.lua index d7f2d5b500..782f726868 100644 --- a/unofficial/c511002927.lua +++ b/unofficial/c511002927.lua @@ -13,7 +13,7 @@ function s.initial_effect(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e2:SetCode(511000189) + e2:SetCode(EFFECT_SPELL_XYZ_MAT) e2:SetCondition(s.con) e2:SetValue(s.val) e2:SetRange(LOCATION_SZONE) diff --git a/unofficial/c511003001.lua b/unofficial/c511003001.lua index dd0513ac42..a151443bf6 100644 --- a/unofficial/c511003001.lua +++ b/unofficial/c511003001.lua @@ -24,7 +24,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(2) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) diff --git a/unofficial/c511003039.lua b/unofficial/c511003039.lua index a9acaf4615..9ff6a0e3f4 100644 --- a/unofficial/c511003039.lua +++ b/unofficial/c511003039.lua @@ -31,7 +31,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp,c) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT+0xff0000) - e1:SetCode(511001225) + e1:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e1:SetValue(ct) e1:SetOperation(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER)) c:RegisterEffect(e1) diff --git a/unofficial/c511010501.lua b/unofficial/c511010501.lua index 0373ecd444..36d51b85e6 100644 --- a/unofficial/c511010501.lua +++ b/unofficial/c511010501.lua @@ -13,7 +13,7 @@ function s.initial_effect(c) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(511001225) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetOperation(s.tgval) e2:SetValue(1) c:RegisterEffect(e2) diff --git a/unofficial/c511015103.lua b/unofficial/c511015103.lua index 0d1ec65c61..bcab2e59a1 100644 --- a/unofficial/c511015103.lua +++ b/unofficial/c511015103.lua @@ -26,7 +26,7 @@ function s.xyzfilter(c,sg,e,tp) e1=Effect.CreateEffect(mc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) - e1:SetCode(511002116) + e1:SetCode(EFFECT_ORICHALCUM_CHAIN) e1:SetReset(RESET_CHAIN) mc:RegisterEffect(e1,true) end @@ -88,7 +88,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) - e1:SetCode(511002116) + e1:SetCode(EFFECT_ORICHALCUM_CHAIN) c:RegisterEffect(e1,true) end Duel.XyzSummon(tp,xyz,nil,g) diff --git a/unofficial/c511018508.lua b/unofficial/c511018508.lua index ea66a6211b..8467e1321e 100644 --- a/unofficial/c511018508.lua +++ b/unofficial/c511018508.lua @@ -15,7 +15,7 @@ function s.initial_effect(c) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(511001225) + e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetOperation(s.tgval) e2:SetValue(1) c:RegisterEffect(e2) diff --git a/unofficial/c511600298.lua b/unofficial/c511600298.lua index 8f2fab7d91..2293cd729f 100644 --- a/unofficial/c511600298.lua +++ b/unofficial/c511600298.lua @@ -38,7 +38,7 @@ function s.xyzfilter(c,xyz,tp) return c:IsAttribute(ATTRIBUTE_LIGHT,xyz,SUMMON_TYPE_XYZ,tp) end function s.xyzcheck(g,tp,xyz) - local mg=g:Filter(function(c) return not c:IsHasEffect(511001175) end,nil) + local mg=g:Filter(function(c) return not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end,nil) return mg:IsExists(s.xyzfilter,1,nil,xyz,tp) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) From b87fbf45d6f2eec8c46ba0ce77a49fe14916f0df Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Mon, 29 Jan 2024 14:31:58 +0100 Subject: [PATCH 02/19] Xyz proc: remove usage of 946 token It was used when the xyz had an extra filter function on its materials while parsing EFFECT_SPELL_XYZ_MAT, being it a random generic token with properties this check is redoundant and most of the times it won't work, as if a card has a filter then it requires specific properties from the monster, now EFFECT_SPELL_XYZ_MAT will only be applied if the xyz has no filter function --- proc_xyz.lua | 48 ++++++++---------------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index f468772297..f29ee46e45 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -71,25 +71,6 @@ function Xyz.AddProcedure(c,f,lv,ct,alterf,desc,maxct,op,mustbemat,exchk) e2:SetOperation(Xyz.Operation2(alterf,op)) c:RegisterEffect(e2) end - if not xyztemp then - xyztemp=true - xyztempg0=Group.CreateGroup() - xyztempg0:KeepAlive() - xyztempg1=Group.CreateGroup() - xyztempg1:KeepAlive() - local e3=Effect.CreateEffect(c) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) - e3:SetCode(EVENT_STARTUP) - e3:SetOperation(Xyz.MatGenerate) - Duel.RegisterEffect(e3,0) - end -end -function Xyz.MatGenerate(e,tp,eg,ep,ev,re,r,rp) - local tck0=Duel.CreateToken(0,946) - xyztempg0:AddCard(tck0) - local tck1=Duel.CreateToken(1,946) - xyztempg1:AddCard(tck1) - e:Reset() end --Xyz Summon(normal) function Xyz.MatFilter2(c,f,lv,xyz,tp) @@ -101,9 +82,8 @@ function Xyz.MatFilter(c,f,lv,xyz,tp) return (not f or f(c,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) and (not lv or c:IsXyzLevel(xyz,lv)) and c:IsCanBeXyzMaterial(xyz,tp) and (c:IsControler(tp) or Xyz.EffectXyzMaterialChk(c,xyz,tp)) end -function Xyz.SubMatFilter(c,fil,lv,xg,xyz,tp) +function Xyz.SubMatFilter(c,lv,xyz,tp) if not lv then return false end - --Solid Overlay-type local te=c:GetCardEffect(EFFECT_SPELL_XYZ_MAT) if not te then return false end local f=te:GetValue() @@ -112,10 +92,7 @@ function Xyz.SubMatFilter(c,fil,lv,xg,xyz,tp) else if f~=lv then return false end end - return xg:IsExists(Xyz.SubFilterChk,1,nil,fil,xyz,tp) -end -function Xyz.SubFilterChk(c,f,xyz,tp) - return (not f or f(c,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) + return true end function Xyz.CheckValidMultiXyzMaterial(c,xyz) local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} @@ -392,13 +369,6 @@ function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) if c==nil then return true end if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end local tp=c:GetControler() - local xg=nil - if tp==0 then - xg=xyztempg0 - else - xg=xyztempg1 - end - if not xg or #xg==0 then return false end local mg if og then mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) @@ -411,7 +381,9 @@ function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) eqmg:Merge(eq) end mg:Merge(eqmg) - mg:Merge(Duel.GetMatchingGroup(Xyz.SubMatFilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,f,lv,xg,c,tp)) + if not f then + mg:Merge(Duel.GetMatchingGroup(Xyz.SubMatFilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,lv,c,tp)) + end end end local mustg=Auxiliary.GetMustBeMaterialGroup(tp,g,tp,c,mg,REASON_XYZ) @@ -516,12 +488,6 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) --end of part 1 else local cancel=not og and Duel.IsSummonCancelable() - local xg=nil - if tp==0 then - xg=xyztempg0 - else - xg=xyztempg1 - end local mg if og then mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) @@ -534,7 +500,9 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) eqmg:Merge(eq) end mg:Merge(eqmg) - mg:Merge(Duel.GetMatchingGroup(Xyz.SubMatFilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,f,lv,xg,c,tp)) + if not f then + mg:Merge(Duel.GetMatchingGroup(Xyz.SubMatFilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,lv,c,tp)) + end end end local mustg=Auxiliary.GetMustBeMaterialGroup(tp,g,tp,c,mg,REASON_XYZ) From bbeaaf0a5a8f0930264894d2f9af4e47e2aae186 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Mon, 29 Jan 2024 14:33:21 +0100 Subject: [PATCH 03/19] Xyz proc: add Xyz.GetMaterials to clean up the logic a bit --- proc_xyz.lua | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index f29ee46e45..3b9118e9c6 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -74,13 +74,19 @@ function Xyz.AddProcedure(c,f,lv,ct,alterf,desc,maxct,op,mustbemat,exchk) end --Xyz Summon(normal) function Xyz.MatFilter2(c,f,lv,xyz,tp) - if c:IsLocation(LOCATION_GRAVE) and not c:IsHasEffect(EFFECT_XYZ_MAT_FROM_GRAVE) then return false end - if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return false end - return Xyz.MatFilter(c,f,lv,xyz,tp) + if f and not f(c,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp) then return false end + if lv and not c:IsXyzLevel(xyz,lv) then return false end + return c:IsCanBeXyzMaterial(xyz,tp) +end +function Xyz.GetMaterials(tp,xyz) + return Duel.GetMatchingGroup(function(c) + if c:IsLocation(LOCATION_GRAVE) and not c:IsHasEffect(EFFECT_XYZ_MAT_FROM_GRAVE) then return false end + if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return false end + return (c:IsControler(tp) or Xyz.EffectXyzMaterialChk(c,xyz,tp)) + end,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE,nil) end function Xyz.MatFilter(c,f,lv,xyz,tp) - return (not f or f(c,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) and (not lv or c:IsXyzLevel(xyz,lv)) and c:IsCanBeXyzMaterial(xyz,tp) - and (c:IsControler(tp) or Xyz.EffectXyzMaterialChk(c,xyz,tp)) + return (c:IsControler(tp) or Xyz.EffectXyzMaterialChk(c,xyz,tp)) and Xyz.MatFilter2(c,f,lv,xyz,tp) end function Xyz.SubMatFilter(c,lv,xyz,tp) if not lv then return false end @@ -364,16 +370,19 @@ function Auxiliary.HarmonizingMagFilterXyz(c,e,f) return not f or f(e,c) or c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) or c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) - --og: use special material + --og: use specific material return function(e,c,must,og,min,max) if c==nil then return true end if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end local tp=c:GetControler() local mg + local g if og then + g=og mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) else - mg=Duel.GetMatchingGroup(Xyz.MatFilter2,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE,nil,f,lv,c,tp) + g=Xyz.GetMaterials(tp,c) + mg=g:Filter(Xyz.MatFilter2,nil,f,lv,c,tp) if not mustbemat then local eqmg=Group.CreateGroup() for tc in aux.Next(mg) do @@ -404,17 +413,14 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) return function(e,tp,eg,ep,ev,re,r,rp,chk,c,must,og,min,max) if og and not min then if (#og>=minc and #og<=maxc) or not og:IsExists(Card.IsHasEffect,1,nil,EFFECT_ORICHALCUM_CHAIN) then - local sg=og:Clone() - sg:KeepAlive() - e:SetLabelObject(sg) + e:SetLabelObject(og:Clone():KeepAlive()) return true else local tab={} local ct,matct,min,max=0,0,#og,#og local matg=Group.CreateGroup() local sg=Group.CreateGroup() - local mg=og:Clone() - mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN)) + local mg=og+Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN) local finish=false while ct Date: Mon, 29 Jan 2024 15:36:01 +0100 Subject: [PATCH 04/19] Xyz proc: update logic in Xyz.RecursionChk Remove repeated checks for GetCardEffect, also properly short circuit the recursive function if a valid material set is found --- proc_xyz.lua | 212 +++++++++++++++++++++++++-------------------------- 1 file changed, 104 insertions(+), 108 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index 3b9118e9c6..f1df9ffcd4 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -103,7 +103,6 @@ end function Xyz.CheckValidMultiXyzMaterial(c,xyz) local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} for i,te in ipairs(eff) do - local te=eff[i] local tgf=te:GetOperation() if not tgf or tgf(te,xyz) then return true end end @@ -126,26 +125,21 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe rg:Merge(sg2) mg:Sub(sg2) end - local g2=matg:Filter(Card.IsHasEffect,nil,EFFECT_XYZ_MAT_RESTRICTION) - if #g2>0 then - local tc=g2:GetFirst() - while tc do - local eff={tc:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)} - for i,f in ipairs(eff) do - if Auxiliary.HarmonizingMagFilter(c,f,f:GetValue()) then - mg:Merge(rg) - return false - end + for tc in matg:Iter() do + for i,f in ipairs({tc:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do + if Auxiliary.HarmonizingMagFilter(c,f,f:GetValue()) then + mg:Merge(rg) + return false end - tc=g2:GetNext() end end if xct>max or xmatct>maxc then mg:Merge(rg) return false end - if not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then + local addToMatg=not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) + if addToMatg then matg:AddCard(c) end sg:AddCard(c) - local res=nil + local res=false if xct>=min and xmatct>=minc then local ok=true if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then @@ -160,55 +154,58 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe if not matg:Includes(mustg) then ok=false end if ok then if xyz:IsLocation(LOCATION_EXTRA) then - res = Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 + res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 else - res = Duel.GetMZoneCount(tp,matg,tp)>0 + res=Duel.GetMZoneCount(tp,matg,tp)>0 end end end - local retchknum={0} - local retchk={mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv)} - if not res and c:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) and not mustbemat then - local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} - for i,te in ipairs(eff) do - local tgf=te:GetOperation() - local val=te:GetValue() - local redun=false - for _,v in ipairs(retchknum) do - if v==val then redun=true break end - end - if not redun and val>0 and (not tgf or tgf(te,xyz)) then - if xct>=min and xmatct+val>=minc and xct<=max and xmatct+val<=maxc then - local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then - ok=Xyz.MatNumChkF(matg) - end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then - ok=Xyz.MatNumChkF2(matg,lv,xyz) - end - if ok and exchk then - if #matg>0 and not exchk(matg,tp,xyz) then ok=false end - end - if not matg:Includes(mustg) then ok=false end - if ok then - if xyz:IsLocation(LOCATION_EXTRA) then - res = Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 - else - res = Duel.GetMZoneCount(tp,matg,tp)>0 + if not res then + local retchknum={0} + local retchk={mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv)} + if not mustbemat then + for i,te in ipairs({c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)}) do + local tgf=te:GetOperation() + local val=te:GetValue() + local redun=false + for _,v in ipairs(retchknum) do + if v==val then redun=true break end + end + if not redun and val>0 and (not tgf or tgf(te,xyz)) then + if xct>=min and xmatct+val>=minc and xct<=max and xmatct+val<=maxc then + local ok=true + if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then + ok=Xyz.MatNumChkF(matg) + end + if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then + ok=Xyz.MatNumChkF2(matg,lv,xyz) + end + if ok and exchk then + if #matg>0 and not exchk(matg,tp,xyz) then ok=false end + end + if not matg:Includes(mustg) then ok=false end + if ok then + if xyz:IsLocation(LOCATION_EXTRA) then + res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 + else + res=Duel.GetMZoneCount(tp,matg,tp)>0 + end end end - end - if xmatct+val<=maxc then - table.insert(retchknum,val) - table.insert(retchk,mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv)) + if xmatct+val<=maxc then + table.insert(retchknum,val) + table.insert(retchk,mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv)) + end end end end + for i=1,#retchk do + if retchk[i] then res=true break end + end end - for i=1,#retchk do - if retchk[i] then res=true break end + if addToMatg then + matg:RemoveCard(c) end - matg:RemoveCard(c) sg:RemoveCard(c) mg:Merge(rg) return res @@ -217,8 +214,7 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu local rg=Group.CreateGroup() if c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not sg:IsContains(c:GetEquipTarget()) then return false end local xct=ct+1 - local eff={c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)} - for i,f in ipairs(eff) do + for i,f in ipairs({c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do if matg:IsExists(Auxiliary.HarmonizingMagFilter,1,c,f,f:GetValue()) then mg:Merge(rg) return false @@ -227,26 +223,21 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu rg:Merge(sg2) mg:Sub(sg2) end - local g2=sg:Filter(Card.IsHasEffect,nil,EFFECT_XYZ_MAT_RESTRICTION) - if #g2>0 then - local tc=g2:GetFirst() - while tc do - local eff={tc:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)} - for i,f in ipairs(eff) do - if Auxiliary.HarmonizingMagFilter(c,f,f:GetValue()) then - mg:Merge(rg) - return false - end + for tc in sg:Iter() do + for i,f in ipairs({tc:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do + if Auxiliary.HarmonizingMagFilter(c,f,f:GetValue()) then + mg:Merge(rg) + return false end - tc=g2:GetNext() end end if xct>maxc then mg:Merge(rg) return false end - if not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then + local addToMatg=not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) + if addToMatg then matg:AddCard(c) end sg:AddCard(c) - local res=nil + local res=false if xct>=minc then local ok=true if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then @@ -261,62 +252,67 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu if not matg:Includes(mustg) then ok=false end if ok then if xyz:IsLocation(LOCATION_EXTRA) then - res = Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 + res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 else - res = Duel.GetMZoneCount(tp,matg,tp)>0 + res=Duel.GetMZoneCount(tp,matg,tp)>0 end end end - local eqg=Group.CreateGroup() + local eqg=nil if not mustbemat then - eqg:Merge(c:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT)) + eqg=c:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) mg:Merge(eqg) end - local retchknum={0} - local retchk={mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct,mustbemat,exchk,f,mustg,lv)} - if not res and c:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) and not mustbemat then - local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} - for i,te in ipairs(eff) do - local tgf=te:GetOperation() - local val=te:GetValue() - local redun=false - for _,v in ipairs(retchknum) do - if v==val then redun=true break end - end - if val>0 and (not tgf or tgf(te,xyz)) and not redun then - if xct+val>=minc and xct+val<=maxc then - local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then - ok=Xyz.MatNumChkF(matg) - end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then - ok=Xyz.MatNumChkF2(matg,lv,xyz) - end - if ok and exchk then - if #matg>0 and not exchk(matg,tp,xyz) then ok=false end - end - if not matg:Includes(mustg) then ok=false end - if ok then - if xyz:IsLocation(LOCATION_EXTRA) then - res = Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 - else - res = Duel.GetMZoneCount(tp,matg,tp)>0 + if not res then + local retchknum={0} + local retchk={mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct,mustbemat,exchk,f,mustg,lv)} + if not mustbemat then + for i,te in ipairs({c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)}) do + local tgf=te:GetOperation() + local val=te:GetValue() + local redun=false + for _,v in ipairs(retchknum) do + if v==val then redun=true break end + end + if val>0 and (not tgf or tgf(te,xyz)) and not redun then + if xct+val>=minc and xct+val<=maxc then + local ok=true + if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then + ok=Xyz.MatNumChkF(matg) + end + if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then + ok=Xyz.MatNumChkF2(matg,lv,xyz) + end + if ok and exchk then + if #matg>0 and not exchk(matg,tp,xyz) then ok=false end + end + if not matg:Includes(mustg) then ok=false end + if ok then + if xyz:IsLocation(LOCATION_EXTRA) then + res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 + else + res=Duel.GetMZoneCount(tp,matg,tp)>0 + end end end - end - if xct+val<=maxc then - retchknum[#retchknum+1]=val - retchk[#retchk+1]=mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct+val,mustbemat,exchk,f,mustg,lv) + if xct+val<=maxc then + table.insert(retchknum,val) + table.insert(retchk,mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct+val,mustbemat,exchk,f,mustg,lv)) + end end end end + for i=1,#retchk do + if retchk[i] then res=true break end + end end - for i=1,#retchk do - if retchk[i] then res=true break end + if addToMatg then + matg:RemoveCard(c) end - matg:RemoveCard(c) sg:RemoveCard(c) - mg:Sub(eqg) + if eqg then + mg:Sub(eqg) + end mg:Merge(rg) return res end From b9c8d9940a7fb6904c93cc164f10c7ef501ad23f Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Mon, 29 Jan 2024 16:22:52 +0100 Subject: [PATCH 05/19] Xyz proc: other updates to Xyz.RecursionChk Add more early returns and avoid extra recursions --- proc_xyz.lua | 158 +++++++++++++++------------------------------------ 1 file changed, 45 insertions(+), 113 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index f1df9ffcd4..ed6d854b0e 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -108,6 +108,23 @@ function Xyz.CheckValidMultiXyzMaterial(c,xyz) end return false end +function Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) + if not matg:Includes(mustg) then return false end + if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) and not Xyz.MatNumChkF(matg) then + return false + end + if lv and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) and not Xyz.MatNumChkF2(matg,lv,xyz) then + return false + end + if exchk and #matg>0 and not exchk(matg,tp,xyz) then + return false + end + if xyz:IsLocation(LOCATION_EXTRA) then + return Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 + else + return Duel.GetMZoneCount(tp,matg,tp)>0 + end +end function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbemat,exchk,f,mustg,lv) local xct=ct local rg=Group.CreateGroup() @@ -115,8 +132,7 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe xct=xct+1 end local xmatct=matct+1 - local eff={c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)} - for i,f in ipairs(eff) do + for i,f in ipairs({c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do if matg:IsExists(Auxiliary.HarmonizingMagFilter,1,c,f,f:GetValue()) then mg:Merge(rg) return false @@ -139,70 +155,28 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe matg:AddCard(c) end sg:AddCard(c) - local res=false - if xct>=min and xmatct>=minc then - local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then - ok=Xyz.MatNumChkF(matg) - end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then - ok=Xyz.MatNumChkF2(matg,lv,xyz) - end - if ok and exchk then - if #matg>0 and not exchk(matg,tp,xyz) then ok=false end - end - if not matg:Includes(mustg) then ok=false end - if ok then - if xyz:IsLocation(LOCATION_EXTRA) then - res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 - else - res=Duel.GetMZoneCount(tp,matg,tp)>0 - end - end - end - if not res then - local retchknum={0} - local retchk={mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv)} + local res=(function() + if (xct>=min) and (xmatct>=minc) and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) then return true end + if mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv) then return true end if not mustbemat then + local retchknum={} for i,te in ipairs({c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)}) do local tgf=te:GetOperation() local val=te:GetValue() - local redun=false - for _,v in ipairs(retchknum) do - if v==val then redun=true break end - end - if not redun and val>0 and (not tgf or tgf(te,xyz)) then + if val>0 and not retchknum[val] and (not tgf or tgf(te,xyz)) then + local res2=false if xct>=min and xmatct+val>=minc and xct<=max and xmatct+val<=maxc then - local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then - ok=Xyz.MatNumChkF(matg) - end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then - ok=Xyz.MatNumChkF2(matg,lv,xyz) - end - if ok and exchk then - if #matg>0 and not exchk(matg,tp,xyz) then ok=false end - end - if not matg:Includes(mustg) then ok=false end - if ok then - if xyz:IsLocation(LOCATION_EXTRA) then - res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 - else - res=Duel.GetMZoneCount(tp,matg,tp)>0 - end - end + res2=Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) end if xmatct+val<=maxc then - table.insert(retchknum,val) - table.insert(retchk,mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv)) + retchknum[val]=true + if res2 or mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv) then return true end end end end end - for i=1,#retchk do - if retchk[i] then res=true break end - end - end + return false + end)() if addToMatg then matg:RemoveCard(c) end @@ -211,8 +185,8 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe return res end function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mustg,lv) - local rg=Group.CreateGroup() if c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not sg:IsContains(c:GetEquipTarget()) then return false end + local rg=Group.CreateGroup() local xct=ct+1 for i,f in ipairs({c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do if matg:IsExists(Auxiliary.HarmonizingMagFilter,1,c,f,f:GetValue()) then @@ -237,75 +211,33 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu matg:AddCard(c) end sg:AddCard(c) - local res=false - if xct>=minc then - local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then - ok=Xyz.MatNumChkF(matg) - end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then - ok=Xyz.MatNumChkF2(matg,lv,xyz) - end - if ok and exchk then - if #matg>0 and not exchk(matg,tp,xyz) then ok=false end - end - if not matg:Includes(mustg) then ok=false end - if ok then - if xyz:IsLocation(LOCATION_EXTRA) then - res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 - else - res=Duel.GetMZoneCount(tp,matg,tp)>0 - end - end - end local eqg=nil - if not mustbemat then - eqg=c:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) - mg:Merge(eqg) - end - if not res then - local retchknum={0} - local retchk={mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct,mustbemat,exchk,f,mustg,lv)} + local res=(function() + if (xct>=minc) and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) then return true end if not mustbemat then + eqg=c:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) + mg:Merge(eqg) + end + if mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct,mustbemat,exchk,f,mustg,lv) then return true end + if not mustbemat then + local retchknum={} for i,te in ipairs({c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)}) do local tgf=te:GetOperation() local val=te:GetValue() - local redun=false - for _,v in ipairs(retchknum) do - if v==val then redun=true break end - end - if val>0 and (not tgf or tgf(te,xyz)) and not redun then + if val>0 and (not tgf or tgf(te,xyz)) and not retchknum[val] then + local res2=false if xct+val>=minc and xct+val<=maxc then - local ok=true - if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) then - ok=Xyz.MatNumChkF(matg) - end - if lv and ok and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) then - ok=Xyz.MatNumChkF2(matg,lv,xyz) - end - if ok and exchk then - if #matg>0 and not exchk(matg,tp,xyz) then ok=false end - end - if not matg:Includes(mustg) then ok=false end - if ok then - if xyz:IsLocation(LOCATION_EXTRA) then - res=Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 - else - res=Duel.GetMZoneCount(tp,matg,tp)>0 - end - end + res2=Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) end if xct+val<=maxc then - table.insert(retchknum,val) - table.insert(retchk,mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct+val,mustbemat,exchk,f,mustg,lv)) + retchknum[val]=true + if res2 or mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct+val,mustbemat,exchk,f,mustg,lv) then return true end end end end end - for i=1,#retchk do - if retchk[i] then res=true break end - end - end + return false + end)() if addToMatg then matg:RemoveCard(c) end From 58732d22a76190c79de08b47ad727a5b7bf77b7f Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Thu, 1 Feb 2024 21:24:55 +0100 Subject: [PATCH 06/19] Xyz proc: Remove the separate logics for material selection Use the same function to check for a valid summonable xyz --- proc_xyz.lua | 397 ++++++++++++++++++--------------------------------- 1 file changed, 140 insertions(+), 257 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index ed6d854b0e..f144ec0679 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -100,9 +100,8 @@ function Xyz.SubMatFilter(c,lv,xyz,tp) end return true end -function Xyz.CheckValidMultiXyzMaterial(c,xyz) - local eff={c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} - for i,te in ipairs(eff) do +function Xyz.CheckValidMultiXyzMaterial(effs,xyz) + for i,te in ipairs(effs) do local tgf=te:GetOperation() if not tgf or tgf(te,xyz) then return true end end @@ -125,11 +124,18 @@ function Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) return Duel.GetMZoneCount(tp,matg,tp)>0 end end -function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbemat,exchk,f,mustg,lv) +function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) + local addToMatg=true + if eqmg and eqmg:IsContains(c) then + if not sg:IsContains(c:GetEquipTarget()) then return false end + addToMatg=false + end local xct=ct local rg=Group.CreateGroup() if not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then xct=xct+1 + else + addToMatg=true end local xmatct=matct+1 for i,f in ipairs({c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do @@ -141,62 +147,6 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe rg:Merge(sg2) mg:Sub(sg2) end - for tc in matg:Iter() do - for i,f in ipairs({tc:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do - if Auxiliary.HarmonizingMagFilter(c,f,f:GetValue()) then - mg:Merge(rg) - return false - end - end - end - if xct>max or xmatct>maxc then mg:Merge(rg) return false end - local addToMatg=not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) - if addToMatg then - matg:AddCard(c) - end - sg:AddCard(c) - local res=(function() - if (xct>=min) and (xmatct>=minc) and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) then return true end - if mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv) then return true end - if not mustbemat then - local retchknum={} - for i,te in ipairs({c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)}) do - local tgf=te:GetOperation() - local val=te:GetValue() - if val>0 and not retchknum[val] and (not tgf or tgf(te,xyz)) then - local res2=false - if xct>=min and xmatct+val>=minc and xct<=max and xmatct+val<=maxc then - res2=Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) - end - if xmatct+val<=maxc then - retchknum[val]=true - if res2 or mg:IsExists(Xyz.RecursionChk1,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv) then return true end - end - end - end - end - return false - end)() - if addToMatg then - matg:RemoveCard(c) - end - sg:RemoveCard(c) - mg:Merge(rg) - return res -end -function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mustg,lv) - if c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not sg:IsContains(c:GetEquipTarget()) then return false end - local rg=Group.CreateGroup() - local xct=ct+1 - for i,f in ipairs({c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do - if matg:IsExists(Auxiliary.HarmonizingMagFilter,1,c,f,f:GetValue()) then - mg:Merge(rg) - return false - end - local sg2=mg:Filter(Auxiliary.HarmonizingMagFilter,nil,f,f:GetValue()) - rg:Merge(sg2) - mg:Sub(sg2) - end for tc in sg:Iter() do for i,f in ipairs({tc:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do if Auxiliary.HarmonizingMagFilter(c,f,f:GetValue()) then @@ -205,8 +155,7 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu end end end - if xct>maxc then mg:Merge(rg) return false end - local addToMatg=not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) and not c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) + if (max and xct>max) or (xmatct and xmatct>maxc) then mg:Merge(rg) return false end if addToMatg then matg:AddCard(c) end @@ -214,24 +163,23 @@ function Xyz.RecursionChk2(c,mg,xyz,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mu local eqg=nil local res=(function() if (xct>=minc) and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) then return true end - if not mustbemat then - eqg=c:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) - mg:Merge(eqg) + if equips_inverse then + eqg=equips_inverse[c] + if eqg then + mg:Merge(eqg) + end end - if mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct,mustbemat,exchk,f,mustg,lv) then return true end + if mg:IsExists(Xyz.RecursionChk,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) then return true end if not mustbemat then local retchknum={} for i,te in ipairs({c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)}) do local tgf=te:GetOperation() local val=te:GetValue() - if val>0 and (not tgf or tgf(te,xyz)) and not retchknum[val] then - local res2=false - if xct+val>=minc and xct+val<=maxc then - res2=Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) - end - if xct+val<=maxc then - retchknum[val]=true - if res2 or mg:IsExists(Xyz.RecursionChk2,1,sg,mg,xyz,tp,minc,maxc,sg,matg,xct+val,mustbemat,exchk,f,mustg,lv) then return true end + if val>0 and not retchknum[val] and (not maxc or xmatct+val<=maxc) and (not tgf or tgf(te,xyz)) then + retchknum[val]=true + if (xct+val>=minc and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv)) + or mg:IsExists(Xyz.RecursionChk,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) then + return true end end end @@ -299,12 +247,14 @@ function Auxiliary.HarmonizingMagFilterXyz(c,e,f) end function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) --og: use specific material - return function(e,c,must,og,min,max) + return function(e,c,must,og,min,max) if c==nil then return true end if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end local tp=c:GetControler() local mg local g + local eqmg + local equips_inverse if og then g=og mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) @@ -312,12 +262,20 @@ function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) g=Xyz.GetMaterials(tp,c) mg=g:Filter(Xyz.MatFilter2,nil,f,lv,c,tp) if not mustbemat then - local eqmg=Group.CreateGroup() for tc in aux.Next(mg) do local eq=tc:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) - eqmg:Merge(eq) + if #eq~=0 then + if not equips_inverse then + eqmg=Group.CreateGroup() + equips_inverse={} + end + equips_inverse[tc]=eq + eqmg:Merge(eq) + end + end + if eqmg then + mg:Merge(eqmg) end - mg:Merge(eqmg) if not f then mg:Merge(Duel.GetMatchingGroup(Xyz.SubMatFilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,lv,c,tp)) end @@ -329,207 +287,132 @@ function Xyz.Condition(f,lv,minc,maxc,mustbemat,exchk) if not mustbemat then mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN)) end - if min and min~=99 then - return mg:IsExists(Xyz.RecursionChk1,1,nil,mg,c,tp,min,max,minc,maxc,Group.CreateGroup(),Group.CreateGroup(),0,0,mustbemat,exchk,f,mustg,lv) - else - return mg:IsExists(Xyz.RecursionChk2,1,nil,mg,c,tp,minc,maxc,Group.CreateGroup(),Group.CreateGroup(),0,mustbemat,exchk,f,mustg,lv) - end - return false + min=min or 0 + return mg:IsExists(Xyz.RecursionChk,1,nil,mg,c,tp,min,max,minc,maxc,Group.CreateGroup(),Group.CreateGroup(),0,0,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) end end function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) return function(e,tp,eg,ep,ev,re,r,rp,chk,c,must,og,min,max) - if og and not min then - if (#og>=minc and #og<=maxc) or not og:IsExists(Card.IsHasEffect,1,nil,EFFECT_ORICHALCUM_CHAIN) then - e:SetLabelObject(og:Clone():KeepAlive()) - return true - else - local tab={} - local ct,matct,min,max=0,0,#og,#og - local matg=Group.CreateGroup() - local sg=Group.CreateGroup() - local mg=og+Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN) - local finish=false - while ct=min and matct>=maxc then finish=true end - if not sg:IsContains(sc) then - sg:AddCard(sc) - if sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then - matct=matct+1 - elseif sc:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) then - matg:AddCard(sc) - ct=ct+1 - if not Xyz.CheckValidMultiXyzMaterial(sc,c) or (min>=ct and minc>=matct+1) then - matct=matct+1 - else - local multi={} - if mg:IsExists(Xyz.RecursionChk1,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct,matct+1,mustbemat,exchk,f,mustg,lv) then - table.insert(multi,1) - end - local eff={sc:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} - for i=1,#eff do - local te=eff[i] - local tgf=te:GetOperation() - local val=te:GetValue() - if val>0 and (not tgf or tgf(te,c)) then - if (min>=ct and minc>=matct+1+val) - or mg:IsExists(Xyz.RecursionChk1,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct,matct+1+val,mustbemat,exchk,f,mustg,lv) then - table.insert(multi,1+val) - end - end - end - if #multi==1 then - tab[sc]=multi[1] - matct=matct+multi[1] - else - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local num=Duel.AnnounceNumber(tp,table.unpack(multi)) - tab[sc]=num - matct=matct+num - end - end - else - matg:AddCard(sc) - ct=ct+1 - matct=matct+1 - end - else - sg:RemoveCard(sc) - if sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then - matct=matct-1 - else - matg:RemoveCard(sc) - ct=ct-1 - local num=tab[sc] - if num then - tab[sc]=nil - matct=matct-num - else - matct=matct-1 - end - end - end - end - sg:KeepAlive() - e:SetLabelObject(sg) - return true - end - --end of part 1 + local cancel=not og and Duel.IsSummonCancelable() + local mg + local eqmg + local equips_inverse + if og then + g=og + mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) else - local cancel=not og and Duel.IsSummonCancelable() - local mg - if og then - g=og - mg=og:Filter(Xyz.MatFilter,nil,f,lv,c,tp) - else - g=Xyz.GetMaterials(tp,c) - mg=g:Filter(Xyz.MatFilter2,nil,f,lv,c,tp) - if not mustbemat then - local eqmg=Group.CreateGroup() - for tc in aux.Next(mg) do - local eq=tc:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) + g=Xyz.GetMaterials(tp,c) + mg=g:Filter(Xyz.MatFilter2,nil,f,lv,c,tp) + if not mustbemat then + for tc in aux.Next(mg) do + local eq=tc:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT) + if #eq~=0 then + if not equips_inverse then + eqmg=Group.CreateGroup() + equips_inverse={} + end + equips_inverse[tc]=eq eqmg:Merge(eq) end + end + if eqmg then mg:Merge(eqmg) - if not f then - mg:Merge(Duel.GetMatchingGroup(Xyz.SubMatFilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,lv,c,tp)) - end + end + if not f then + mg:Merge(Duel.GetMatchingGroup(Xyz.SubMatFilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,lv,c,tp)) end end - local mustg=Auxiliary.GetMustBeMaterialGroup(tp,g,tp,c,mg,REASON_XYZ) - if must then mustg:Merge(must) end - if not mustbemat then - mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN)) - end - local finish=false - if not og or max==99 then - local ct=0 - local matg=Group.CreateGroup() - local sg=Group.CreateGroup() - local tab={} - while ct0 and Xyz.CheckValidMultiXyzMaterial(effs,c) and ct0 and (not tgf or tgf(te,c)) then - if minc<=ct+val and ct+val<=maxc - or mg:IsExists(Xyz.RecursionChk2,1,sg,mg,c,tp,minc,maxc,sg,matg,ct+val,mustbemat,exchk,f,mustg,lv) then - table.insert(multi,1+val) - end + local eff={sc:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} + for i=1,#eff do + local te=eff[i] + local tgf=te:GetOperation() + local val=te:GetValue() + if val>0 and (not tgf or tgf(te,c)) then + if minc<=ct+val and ct+val<=maxc + or mg:IsExists(Xyz.RecursionChk,1,sg,mg,c,tp,minc,maxc,sg,matg,ct+val,mustbemat,exchk,f,mustg,lv) then + table.insert(multi,1+val) end end - if #multi==1 then - if multi[1]>1 then - ct=ct+multi[1]-1 - tab[sc]=multi[1] - end - else - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local num=Duel.AnnounceNumber(tp,table.unpack(multi)) - if num>1 then - ct=ct+num-1 - tab[sc]=num - end + end + if #multi==1 then + if multi[1]>1 then + extra_mats=extra_mats+multi[1] + tab[sc]=multi[1] + end + else + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) + local num=Duel.AnnounceNumber(tp,table.unpack(multi)) + if num>1 then + extra_mats=extra_mats+num + tab[sc]=num end end + elseif sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then + extra_mats=extra_mats+1 else - sg:RemoveCard(sc) - mg:Sub(sc:GetEquipGroup():Filter(Card.IsHasEffect,nil,EFFECT_EQUIP_SPELL_XYZ_MAT)) - if not sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then - matg:RemoveCard(sc) - end - ct=ct-1 - if tab[sc] then - ct=ct-tab[sc]+1 - tab[sc]=nil - end + matg:AddCard(sc) + end + else + sg:RemoveCard(sc) + if equips_inverse and equips_inverse[sc] then + mg:Sub(equips_inverse[sc]) end - if ct>=minc and (not matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) or Xyz.MatNumChkF(matg)) - and (not lv or not matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) or Xyz.MatNumChkF2(matg,lv,c)) and matg:Includes(mustg) then - finish=true + if not sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then + matg:RemoveCard(sc) + end + local num=tab[sc] + if num then + tab[sc]=nil + matct=matct-num + else + matct=matct-1 end - cancel=not og and Duel.IsSummonCancelable() and #sg==0 end - sg:KeepAlive() - e:SetLabelObject(sg) - return true + finishable=#matg>=minc and Xyz.CheckMaterialSet(matg,c,tp,exchk,mustg,lv) end - return false + sg:KeepAlive() + e:SetLabelObject(sg) + return true end + return false end end function Xyz.Operation(f,lv,minc,maxc,mustbemat,exchk) From cc85c7c94f185519abf140751d67c7aa459f4f70 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Thu, 1 Feb 2024 21:40:23 +0100 Subject: [PATCH 07/19] Xyz proc: update alternate xyz summon --- proc_xyz.lua | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index f144ec0679..d031103f9f 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -21,7 +21,7 @@ function Xyz.AlterFilter(c,alterf,xyzc,e,tp,op) if xyzc:IsLocation(LOCATION_EXTRA) then return Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0 else - return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or c:GetSequence()<5 + return Duel.GetMZoneCount(tp,c,tp)>0 end end --Xyz monster, lv k*n @@ -452,35 +452,29 @@ function Xyz.Condition2(alterf,op) end function Xyz.Target2(alterf,op) return function(e,tp,eg,ep,ev,re,r,rp,chk,c,must,og,min,max) - local cancel=not og and Duel.IsSummonCancelable() - Xyz.ProcCancellable=cancel - if og and not min then - e:SetLabelObject(og:GetFirst()) - if op then op(e,tp,1,og:GetFirst()) end - return true + local cancelable=not og and Duel.IsSummonCancelable() + Xyz.ProcCancellable=cancelable + local mg=nil + if og then + mg=og else - local mg=nil - if og then - mg=og - else - mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,LOCATION_MZONE) - end - local mustg=Auxiliary.GetMustBeMaterialGroup(tp,og,tp,c,mg,REASON_XYZ) - if must then mustg:Merge(must) end - local oc - if #mustg>0 then - oc=mustg:GetFirst() - else - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - oc=mg:Filter(Xyz.AlterFilter,nil,alterf,c,e,tp,op):SelectUnselect(Group.CreateGroup(),tp,false,cancel) - end - if not oc then return false end - local ok=true - if op then ok=op(e,tp,1,oc) end - if not ok then return false end - e:SetLabelObject(oc) - return true + mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,LOCATION_MZONE) + end + local mustg=Auxiliary.GetMustBeMaterialGroup(tp,og,tp,c,mg,REASON_XYZ) + if must then mustg:Merge(must) end + local oc + if #mustg>0 then + oc=mustg:GetFirst() + else + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) + oc=mg:FilterSelect(tp,Xyz.AlterFilter,1,1,cancelable,nil,alterf,c,e,tp,op):GetFirst() end + if not oc then return false end + local ok=true + if op then ok=op(e,tp,1,oc) end + if not ok then return false end + e:SetLabelObject(oc) + return true end end function Xyz.Operation2(alterf,op) From 6ddae978dad0572dbe84801f2f73d9e695bedbdb Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Thu, 1 Feb 2024 21:49:22 +0100 Subject: [PATCH 08/19] Xyz proc: add Xyz.InfiniteMats to represent n+ materials The value for now is set to '99', but will be updated to an unique token value in future --- proc_xyz.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index d031103f9f..f4c348864e 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -5,6 +5,10 @@ end if not Xyz then Xyz = aux.XyzProcedure end +-- TODO: Update when we make using '99' deprecated +-- local infToken={} +-- Xyz.InfiniteMats=infToken +Xyz.InfiniteMats=99 Xyz.ProcCancellable=false function Xyz.EffectXyzMaterialChk(c,xyz,tp) local eff_xyzmat={c:GetCardEffect(EFFECT_XYZ_MATERIAL)} @@ -29,6 +33,12 @@ function Xyz.AddProcedure(c,f,lv,ct,alterf,desc,maxct,op,mustbemat,exchk) --exchk for special xyz, checking other materials --mustbemat for Startime Magician if not maxct then maxct=ct end + -- TODO: Update when we make using '99' deprecated + --[[if maxct==99 then + maxct=Xyz.InfiniteMats + Debug.PrintStacktrace() + Debug.Message("Using 99 to represent any number of Xyz materials is deprecated, use the value Xyz.InfiniteMats instead") + end--]] if c.xyz_filter==nil then local mt=c:GetMetatable() mt.xyz_filter=function(mc,ignoretoken,xyz,tp) return mc and (not f or f(mc,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) and (not lv or mc:IsXyzLevel(c,lv)) and (not mc:IsType(TYPE_TOKEN) or ignoretoken) end @@ -155,7 +165,7 @@ function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbem end end end - if (max and xct>max) or (xmatct and xmatct>maxc) then mg:Merge(rg) return false end + if (max and xct>max) or (maxc~=infToken and xmatct>maxc) then mg:Merge(rg) return false end if addToMatg then matg:AddCard(c) end @@ -338,7 +348,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) while true do local ct=#matg local matct=ct+extra_mats - if not ((not max or #matg Date: Fri, 2 Feb 2024 23:11:59 +0100 Subject: [PATCH 09/19] Xyz proc: Fixup anime effects interactions --- proc_xyz.lua | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index f4c348864e..4981febbe3 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -148,6 +148,7 @@ function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbem addToMatg=true end local xmatct=matct+1 + if (max and xct>max) or (maxc~=infToken and xmatct>maxc) then mg:Merge(rg) return false end for i,f in ipairs({c:GetCardEffect(EFFECT_XYZ_MAT_RESTRICTION)}) do if matg:IsExists(Auxiliary.HarmonizingMagFilter,1,c,f,f:GetValue()) then mg:Merge(rg) @@ -165,14 +166,13 @@ function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbem end end end - if (max and xct>max) or (maxc~=infToken and xmatct>maxc) then mg:Merge(rg) return false end if addToMatg then matg:AddCard(c) end sg:AddCard(c) local eqg=nil local res=(function() - if (xct>=minc) and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) then return true end + if (xct>=min and xmatct>=minc) and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) then return true end if equips_inverse then eqg=equips_inverse[c] if eqg then @@ -187,7 +187,7 @@ function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbem local val=te:GetValue() if val>0 and not retchknum[val] and (not maxc or xmatct+val<=maxc) and (not tgf or tgf(te,xyz)) then retchknum[val]=true - if (xct+val>=minc and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv)) + if (xct+val>=min and xmatct+val>=minc and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv)) or mg:IsExists(Xyz.RecursionChk,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) then return true end @@ -364,10 +364,10 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) mg:Merge(equips_inverse[sc]) end local multiXyz={sc:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} - if #multiXyz>0 and Xyz.CheckValidMultiXyzMaterial(effs,c) and ct0 and Xyz.CheckValidMultiXyzMaterial(multiXyz,c) and ct0 and (not tgf or tgf(te,c)) then - if minc<=ct+val and ct+val<=maxc - or mg:IsExists(Xyz.RecursionChk,1,sg,mg,c,tp,minc,maxc,sg,matg,ct+val,mustbemat,exchk,f,mustg,lv) then + local newCount=matct+1+val + if (minc<=newCount and newCount<=maxc) + or mg:IsExists(Xyz.RecursionChk,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct,newCount,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) then table.insert(multi,1+val) end end end if #multi==1 then if multi[1]>1 then - extra_mats=extra_mats+multi[1] + extra_mats=extra_mats+multi[1]-1 tab[sc]=multi[1] end else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local num=Duel.AnnounceNumber(tp,table.unpack(multi)) if num>1 then - extra_mats=extra_mats+num + extra_mats=extra_mats+num-1 tab[sc]=num end end @@ -401,22 +402,27 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) matg:AddCard(sc) end else - sg:RemoveCard(sc) if equips_inverse and equips_inverse[sc] then - mg:Sub(equips_inverse[sc]) - end - if not sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then - matg:RemoveCard(sc) + local equips=equips_inverse[sc] + if sg:Includes(equips) then + goto continue + end + mg:Sub(equips) end - local num=tab[sc] - if num then - tab[sc]=nil - matct=matct-num + sg:RemoveCard(sc) + if sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then + extra_mats=extra_mats-1 else - matct=matct-1 + matg:RemoveCard(sc) + local num=tab[sc] + if num then + tab[sc]=nil + extra_mats=extra_mats-(num-1) + end end end finishable=#matg>=minc and Xyz.CheckMaterialSet(matg,c,tp,exchk,mustg,lv) + ::continue:: end sg:KeepAlive() e:SetLabelObject(sg) @@ -477,7 +483,9 @@ function Xyz.Target2(alterf,op) oc=mustg:GetFirst() else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - oc=mg:FilterSelect(tp,Xyz.AlterFilter,1,1,cancelable,nil,alterf,c,e,tp,op):GetFirst() + local ocg=mg:FilterSelect(tp,Xyz.AlterFilter,1,1,cancelable,nil,alterf,c,e,tp,op) + if not ocg then return false end + oc=ocg:GetFirst() end if not oc then return false end local ok=true From a6d03d6c8e9ee7c074d5b4ffe459272f25cbeb13 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Sat, 3 Feb 2024 14:59:40 +0100 Subject: [PATCH 10/19] Xyz proc: update automatic material selection logic If a must material group is passed to the xyz proc, and the min and max values match the size of that group, then if those materials are valid within the material group, the selection will be skipped --- proc_xyz.lua | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index 4981febbe3..5b73e43a50 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -335,8 +335,14 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) end local mustg=Auxiliary.GetMustBeMaterialGroup(tp,g,tp,c,mg,REASON_XYZ) if must then mustg:Merge(must) end + local orichalcumGroup if not mustbemat then - mg:Merge(Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN)) + orichalcumGroup=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,EFFECT_ORICHALCUM_CHAIN) + mg:Merge(orichalcumGroup) + end + if (not orichalcumGroup or #orichalcumGroup==0) and (must and #must==min and #must==max) then + e:SetLabelObject(mustg:Clone():KeepAlive()) + return true end do local extra_mats=0 @@ -479,18 +485,22 @@ function Xyz.Target2(alterf,op) local mustg=Auxiliary.GetMustBeMaterialGroup(tp,og,tp,c,mg,REASON_XYZ) if must then mustg:Merge(must) end local oc - if #mustg>0 then + if must and #must==min and #must==max then oc=mustg:GetFirst() + elseif #mustg>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) + local ocg=mustg:Select(tp,1,1,cancelable,nil) + if ocg then + oc=ocg:GetFirst() + end else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local ocg=mg:FilterSelect(tp,Xyz.AlterFilter,1,1,cancelable,nil,alterf,c,e,tp,op) - if not ocg then return false end - oc=ocg:GetFirst() + if ocg then + oc=ocg:GetFirst() + end end - if not oc then return false end - local ok=true - if op then ok=op(e,tp,1,oc) end - if not ok then return false end + if not oc or (op and not op(e,tp,1,oc)) then return false end e:SetLabelObject(oc) return true end From 313b7fb2dcec4cad46c4c3612cdd893f75776872 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Tue, 9 Apr 2024 11:40:10 +0200 Subject: [PATCH 11/19] Update cards using Duel.XyzSummon Use the parameters according to the new way required by the xyz proc --- official/c20285786.lua | 2 +- official/c23536866.lua | 2 +- official/c24658418.lua | 2 +- official/c29087919.lua | 4 ++-- official/c44161893.lua | 4 ++-- official/c4575541.lua | 4 ++-- official/c46005939.lua | 2 +- official/c4606229.lua | 2 +- official/c50311058.lua | 2 +- official/c56611470.lua | 4 ++-- official/c61314842.lua | 21 ++++++++--------- official/c62829077.lua | 4 ++-- official/c65305978.lua | 4 ++-- official/c71095768.lua | 2 +- official/c87804365.lua | 4 ++-- unofficial/c100000490.lua | 2 +- unofficial/c511000295.lua | 4 ++-- unofficial/c511000698.lua | 4 ++-- unofficial/c511001445.lua | 23 +++++-------------- unofficial/c511001447.lua | 4 ++-- unofficial/c511001874.lua | 48 +++++++++++++-------------------------- unofficial/c511002746.lua | 11 +++++---- unofficial/c511002769.lua | 15 ++++++------ unofficial/c511002848.lua | 2 +- unofficial/c511003000.lua | 2 +- unofficial/c511003051.lua | 4 ++-- unofficial/c511004413.lua | 2 +- unofficial/c511009325.lua | 2 +- unofficial/c511015103.lua | 2 +- unofficial/c511015106.lua | 8 +++---- unofficial/c511015134.lua | 2 +- unofficial/c511600071.lua | 2 +- unofficial/c511600335.lua | 2 +- 33 files changed, 86 insertions(+), 116 deletions(-) diff --git a/official/c20285786.lua b/official/c20285786.lua index ecbd756ad8..a63036f75b 100644 --- a/official/c20285786.lua +++ b/official/c20285786.lua @@ -69,6 +69,6 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) end end \ No newline at end of file diff --git a/official/c23536866.lua b/official/c23536866.lua index c61a6a600c..de16a2d737 100644 --- a/official/c23536866.lua +++ b/official/c23536866.lua @@ -78,6 +78,6 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) end end \ No newline at end of file diff --git a/official/c24658418.lua b/official/c24658418.lua index 6ec82e4723..3c0356d5de 100644 --- a/official/c24658418.lua +++ b/official/c24658418.lua @@ -61,6 +61,6 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g,1,99) + Duel.XyzSummon(tp,xyz,nil,g) end end \ No newline at end of file diff --git a/official/c29087919.lua b/official/c29087919.lua index 9865506687..0db860465f 100644 --- a/official/c29087919.lua +++ b/official/c29087919.lua @@ -52,6 +52,6 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyzc=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyzc,nil,sg) + Duel.XyzSummon(tp,xyzc,g,nil,#g,#g) end -end \ No newline at end of file +end diff --git a/official/c44161893.lua b/official/c44161893.lua index 316b02710b..cc0ff41394 100644 --- a/official/c44161893.lua +++ b/official/c44161893.lua @@ -76,7 +76,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=Duel.SelectMatchingCard(tp,s.xyzfilter,tp,LOCATION_EXTRA,0,1,1,nil,sg):GetFirst() if xyz then - Duel.XyzSummon(tp,xyz,nil,sg) + Duel.XyzSummon(tp,xyz,sg,nil,2,2) end end function s.efcon(e,tp,eg,ep,ev,re,r,rp) @@ -103,4 +103,4 @@ function s.efop(e,tp,eg,ep,ev,re,r,rp) e2:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e2,true) end -end \ No newline at end of file +end diff --git a/official/c4575541.lua b/official/c4575541.lua index 4ef29d7233..6b82a87838 100644 --- a/official/c4575541.lua +++ b/official/c4575541.lua @@ -51,7 +51,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=g:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,sc,nil,mg,2,99) + Duel.XyzSummon(tp,sc,nil,mg) end end end @@ -71,4 +71,4 @@ function s.tgop(e,tp,eg,ep,ev,re,r,rp) if #tg>0 then Duel.SendtoGrave(tg,REASON_EFFECT|REASON_RETURN) end -end \ No newline at end of file +end diff --git a/official/c46005939.lua b/official/c46005939.lua index 251ee6d2a5..a05e39c6dd 100644 --- a/official/c46005939.lua +++ b/official/c46005939.lua @@ -74,7 +74,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if xyzg and #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,g,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) else if e1 then e1:Reset() end if e2 then e2:Reset() end diff --git a/official/c4606229.lua b/official/c4606229.lua index a60ed06c5b..fed2351068 100644 --- a/official/c4606229.lua +++ b/official/c4606229.lua @@ -77,7 +77,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=Duel.SelectMatchingCard(tp,s.xyzfilter,tp,LOCATION_EXTRA,0,1,1,nil,g):GetFirst() if xyz then - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) xyz:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD&~RESET_TOFIELD,0,1) end if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end diff --git a/official/c50311058.lua b/official/c50311058.lua index 69290207f3..b5e39ad4cd 100644 --- a/official/c50311058.lua +++ b/official/c50311058.lua @@ -53,7 +53,7 @@ function s.xyzop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xc=Duel.SelectMatchingCard(tp,Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,1,nil,nil,mg):GetFirst() if xc then - Duel.XyzSummon(tp,xc,nil,mg,1,99) + Duel.XyzSummon(tp,xc,nil,mg) end end function s.gfilter(c) diff --git a/official/c56611470.lua b/official/c56611470.lua index 2612593302..28a2daccc3 100644 --- a/official/c56611470.lua +++ b/official/c56611470.lua @@ -71,7 +71,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) end end function s.attg(e,c) @@ -99,4 +99,4 @@ end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) -end \ No newline at end of file +end diff --git a/official/c61314842.lua b/official/c61314842.lua index c0da093417..689e065d44 100644 --- a/official/c61314842.lua +++ b/official/c61314842.lua @@ -2,7 +2,7 @@ --Advanced Heraldry Art local s,id=GetID() function s.initial_effect(c) - --Activate + --Special Summon 2 "Heraldic Beast" monsters from your GY and Xyz Summon using them as material local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) @@ -22,21 +22,18 @@ end function s.mfilter1(c,mg,exg,tp) return mg:IsExists(s.mfilter2,1,c,c,exg,tp) end -function s.zonecheck(c,tp,g) - return Duel.GetLocationCountFromEx(tp,tp,g,c)>0 and c:IsXyzSummonable(nil,g) -end function s.mfilter2(c,mc,exg,tp) - local g=Group.FromCards(c,mc) - return exg:IsExists(s.zonecheck,1,nil,tp,Group.FromCards(c,mc),tp) + return exg:IsExists(s.xyzfilter,1,nil,Group.FromCards(c,mc),tp,true) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,e,tp) - local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) + if chk==0 then return #mg>=2 + and Duel.IsPlayerCanSpecialSummonCount(tp,2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 - and mg:IsExists(s.mfilter1,1,nil,mg,exg,tp) end + and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end + local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,exg,tp) local tc1=sg1:GetFirst() @@ -53,13 +50,13 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.filter2,nil,e,tp) - if #g<2 then return end - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) + if #g~=2 then return end + if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=2 then return end Duel.BreakEffect() local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g,tp,true) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) end end \ No newline at end of file diff --git a/official/c62829077.lua b/official/c62829077.lua index ccc72bbdc9..12b2d0c966 100644 --- a/official/c62829077.lua +++ b/official/c62829077.lua @@ -95,6 +95,6 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() xyz:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,3,3) end -end \ No newline at end of file +end diff --git a/official/c65305978.lua b/official/c65305978.lua index 03d2c62129..b6a1ca76ec 100644 --- a/official/c65305978.lua +++ b/official/c65305978.lua @@ -95,6 +95,6 @@ function s.xyzop(e,tp,eg,ep,ev,re,r,rp) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=g:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,sc,nil,mg,2,99) + Duel.XyzSummon(tp,sc,nil,mg) end -end \ No newline at end of file +end diff --git a/official/c71095768.lua b/official/c71095768.lua index 9d1b3d2044..c55a415de1 100644 --- a/official/c71095768.lua +++ b/official/c71095768.lua @@ -101,7 +101,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,sg,sg) + Duel.XyzSummon(tp,xyz,sg,nil,2,2) end end function s.checkop(e,tp,eg,ep,ev,re,r,rp) diff --git a/official/c87804365.lua b/official/c87804365.lua index f9ab212dd0..2605bb97e6 100644 --- a/official/c87804365.lua +++ b/official/c87804365.lua @@ -19,7 +19,7 @@ function s.initial_effect(c) local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetTarget(s.target(TYPE_XYZ,Card.IsXyzSummonable)) - e2:SetOperation(s.operation(TYPE_XYZ,Card.IsXyzSummonable,function(sc,g,tp) Duel.XyzSummon(tp,sc,nil,g) end)) + e2:SetOperation(s.operation(TYPE_XYZ,Card.IsXyzSummonable,function(sc,g,tp) Duel.XyzSummon(tp,sc,g,nil,#g,#g) end)) c:RegisterEffect(e2) end s.listed_series={SET_MATHMECH} @@ -50,7 +50,7 @@ function s.target(montype,chkfun) local cancelcon=s.rescon(exg,chkfun) if chkc then return chkc:IsControler(tp) and c:IsLocation(LOCATION_GRAVE) and c:IsSetCard(SET_MATHMECH) and chkc:IsCanBeSpecialSummoned(e,0,tp,false,false) and cancelcon(Group.FromCards(chkc)) end local mg=Duel.GetMatchingGroup(s.matfilter,tp,LOCATION_GRAVE,0,nil,e,tp) - local min=math.min(math.min(Duel.GetLocationCount(tp,LOCATION_MZONE),Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and 1 or 99),1) + local min=math.min(Duel.GetLocationCount(tp,LOCATION_MZONE),Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and 1 or #mg,1) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>3 then ft=3 end if chk==0 then return min>0 and Duel.IsPlayerCanSpecialSummonCount(tp,2) diff --git a/unofficial/c100000490.lua b/unofficial/c100000490.lua index 4b72b44198..16d57ef66e 100644 --- a/unofficial/c100000490.lua +++ b/unofficial/c100000490.lua @@ -75,7 +75,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,#g,#g) else for _,te in ipairs(reset) do te:Reset() diff --git a/unofficial/c511000295.lua b/unofficial/c511000295.lua index 39eb1d1e79..160f23ffb1 100644 --- a/unofficial/c511000295.lua +++ b/unofficial/c511000295.lua @@ -1,5 +1,5 @@ --ヌメロン・カオス・リチューアル ---Numeron Chaos Ritual +--Numeron Chaos Ritual (Anime) local s,id=GetID() function s.initial_effect(c) --Activate @@ -137,7 +137,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - Duel.XyzSummon(tp,xyz,nil,matg) + Duel.XyzSummon(tp,xyz,matg,nil,5,5) else for _,eff in ipairs(reset) do eff:Reset() diff --git a/unofficial/c511000698.lua b/unofficial/c511000698.lua index 6fa799d51b..e95ed0bf34 100644 --- a/unofficial/c511000698.lua +++ b/unofficial/c511000698.lua @@ -58,6 +58,6 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() matg:KeepAlive() - Duel.XyzSummon(tp,xyz,nil,matg) + Duel.XyzSummon(tp,xyz,matg,nil,3,3) end -end \ No newline at end of file +end diff --git a/unofficial/c511001445.lua b/unofficial/c511001445.lua index c139fa61b1..439067413f 100644 --- a/unofficial/c511001445.lua +++ b/unofficial/c511001445.lua @@ -1,7 +1,8 @@ ---Halfway to Forever +--マスター・ピース (Anime) +--Halfway to Forever (Anime) local s,id=GetID() function s.initial_effect(c) - --Activate + --Xyz Summon using monsters destroyed by battle this turn in your GY local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) @@ -13,12 +14,6 @@ end function s.filter(c,tid) return c:GetTurnID()==tid and c:IsReason(REASON_BATTLE) end -function s.mfilter1(c,mg,tp) - return mg:IsExists(s.mfilter2,1,c,c,tp) -end -function s.mfilter2(c,c1,tp) - return Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,Group.FromCards(c,c1)) -end function s.xyzfilter(c,mg) return c:IsXyzSummonable(nil,mg,2,2) end @@ -30,20 +25,14 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local tid=Duel.GetTurnCount() if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end + local tid=Duel.GetTurnCount() local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,tid) if #mg<=1 then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local mg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,tp) - local mc=mg1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local mg2=mg:FilterSelect(tp,s.mfilter2,1,1,mc,mc,tp) - mg1:Merge(mg2) - local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg1) + local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,mg1) + Duel.XyzSummon(tp,xyz,nil,mg,2,2) end end diff --git a/unofficial/c511001447.lua b/unofficial/c511001447.lua index fc736c3036..f9f29f6cac 100644 --- a/unofficial/c511001447.lua +++ b/unofficial/c511001447.lua @@ -32,7 +32,7 @@ function s.xyzfilter(c,mg) return c:IsXyzSummonable(nil,mg,2,2) end function s.op(e,tp,eg,ep,ev,re,r,rp) - if ep~=tp or Duel.GetCurrentPhase()~=PHASE_DRAW or Duel.GetTurnPlayer()~=tp + if ep~=tp or Duel.GetCurrentPhase()~=PHASE_DRAW or Duel.GetTurnPlayer()~=tp or (r&REASON_RULE)==0 then return end Duel.Hint(HINT_CARD,0,id) local tc1=eg:GetFirst() @@ -46,7 +46,7 @@ function s.op(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) end end end diff --git a/unofficial/c511001874.lua b/unofficial/c511001874.lua index 8439a275c0..4a3b0694a6 100644 --- a/unofficial/c511001874.lua +++ b/unofficial/c511001874.lua @@ -2,7 +2,7 @@ --Xyz Rescue local s,id=GetID() function s.initial_effect(c) - --xyz effect + --Xyz Summon using monsters you own controlled by the opponent local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -15,61 +15,45 @@ end function s.filter(c) return c:IsFaceup() and c:GetOwner()~=c:GetControler() end -function s.cfilter(c) - return not c:IsHasEffect(EFFECT_XYZ_MATERIAL) -end function s.xyzfilter(c,tp,mg) return c:IsXyzSummonable(nil,mg) and Duel.GetLocationCountFromEx(tp,tp,mg,c)>0 end +function s.registerxyzmateffect(e,tp) + local matEff=Effect.CreateEffect(e:GetHandler()) + matEff:SetType(EFFECT_TYPE_FIELD) + matEff:SetCode(EFFECT_XYZ_MATERIAL) + matEff:SetTargetRange(0,LOCATION_MZONE) + matEff:SetTarget(aux.TargetBoolFunction(s.filter)) + Duel.RegisterEffect(matEff,tp) + return matEff +end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then - local c=e:GetHandler() - local reset={} local mg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) - for tc in aux.Next(mg) do - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_XYZ_MATERIAL) - tc:RegisterEffect(e1) - table.insert(reset,e1) - end + local matEff=s.registerxyzmateffect(e,tp) local res=Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,tp,mg) - for _,eff in ipairs(reset) do - eff:Reset() - end + matEff:Reset() return res end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - local reset={} local mg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) - for tc in aux.Next(mg) do - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_XYZ_MATERIAL) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - tc:RegisterEffect(e1) - table.insert(reset,e1) - end + local matEff=s.registerxyzmateffect(e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=Duel.SelectMatchingCard(tp,s.xyzfilter,tp,LOCATION_EXTRA,0,1,1,nil,tp,mg):GetFirst() if xyz then - Duel.XyzSummon(tp,xyz,nil,mg,1,99) + Duel.XyzSummon(tp,xyz,nil,mg) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_COST) e1:SetOperation(function() - for _,eff in ipairs(reset) do - eff:Reset() - end + matEff:Reset() end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) xyz:RegisterEffect(e1,true) else - for _,eff in ipairs(reset) do - eff:Reset() - end + matEff:Reset() end end diff --git a/unofficial/c511002746.lua b/unofficial/c511002746.lua index f6e884fa48..af92a48ef2 100644 --- a/unofficial/c511002746.lua +++ b/unofficial/c511002746.lua @@ -13,20 +13,21 @@ function s.initial_effect(c) c:RegisterEffect(e1) end s.listed_series={SET_HERALDIC_BEAST} -function s.xyzfilter(c,tp,mg) - return c:IsXyzSummonable(nil,mg) and Duel.GetLocationCountFromEx(tp,tp,mg,c)>0 +function s.xyzfilter(c,mg) + return c:IsXyzSummonable(nil,mg) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local mg=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_GRAVE,0,nil,SET_HERALDIC_BEAST) - if chk==0 then return #mg>0 and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,tp,mg) end + if chk==0 then return #mg>0 and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) + if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local mg=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_GRAVE,0,nil,SET_HERALDIC_BEAST) - local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,tp,mg) + local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,mg,99,99) + Duel.XyzSummon(tp,xyz,nil,mg) end end diff --git a/unofficial/c511002769.lua b/unofficial/c511002769.lua index 794073234f..09630289a0 100644 --- a/unofficial/c511002769.lua +++ b/unofficial/c511002769.lua @@ -2,7 +2,7 @@ --Modify Deep Blue local s,id=GetID() function s.initial_effect(c) - --Activate + --Banish 1 Xyz Monster and Xyz Summon using Materials from the Deck local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) @@ -14,15 +14,15 @@ function s.initial_effect(c) c:RegisterEffect(e1) end function s.filter(c,rk) - return c:GetLevel()==rk + return c:IsLevel(rk) end function s.xyzfilter(c,mg) - return c:IsXyzSummonable(nil,mg,1,99) + return c:IsXyzSummonable(nil,mg) end function s.cfilter(c,e,tp) local rk=c:GetRank() local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,rk) - return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAbleToRemoveAsCost() + return c:IsFaceup() and c:IsType(TYPE_XYZ) and Duel.GetMZoneCount(tp,c,tp)>0 and c:IsAbleToRemoveAsCost() and #mg>1 and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) @@ -33,8 +33,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) - return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 - and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) + return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) @@ -43,13 +42,13 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local rk=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end + local rk=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,rk) local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,mg,1,99) + Duel.XyzSummon(tp,xyz,nil,mg) end end diff --git a/unofficial/c511002848.lua b/unofficial/c511002848.lua index 3a6e76cae2..6c7af72fe5 100644 --- a/unofficial/c511002848.lua +++ b/unofficial/c511002848.lua @@ -57,7 +57,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) e2:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD) e2:SetOperation(s.regop) xyz:RegisterEffect(e2) - Duel.XyzSummon(tp,xyz,nil,Group.FromCards(c,a)) + Duel.XyzSummon(tp,xyz,Group.FromCards(c,a),nil,2,2) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) diff --git a/unofficial/c511003000.lua b/unofficial/c511003000.lua index 1a0613a60a..5c146c7447 100644 --- a/unofficial/c511003000.lua +++ b/unofficial/c511003000.lua @@ -47,7 +47,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if g and #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=g:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,pg,pg) + Duel.XyzSummon(tp,xyz,pg,nil,2,2) else if e1 then e1:Reset() end if e2 then e2:Reset() end diff --git a/unofficial/c511003051.lua b/unofficial/c511003051.lua index 6c678e1c3b..f8bf938015 100644 --- a/unofficial/c511003051.lua +++ b/unofficial/c511003051.lua @@ -97,7 +97,7 @@ end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.lvfilter(chkc) end local c=e:GetHandler() - if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) + if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil,c,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil,c,tp) @@ -193,7 +193,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) c:CancelToGrave() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,sg) + Duel.XyzSummon(tp,xyz,sg,sg,2,2) local fid=c:GetFieldID() xyz:RegisterFlagEffect(51103051,RESET_EVENT+RESETS_STANDARD,0,1,fid) local e16=Effect.CreateEffect(e:GetHandler()) diff --git a/unofficial/c511004413.lua b/unofficial/c511004413.lua index c37831d9fd..9935c4a1cb 100644 --- a/unofficial/c511004413.lua +++ b/unofficial/c511004413.lua @@ -62,6 +62,6 @@ function s.operation(e,tp,eg,ev,ep,re,r,rp) e1:SetValue(xc:GetRank()) e1:SetReset(RESET_EVENT+RESETS_STANDARD) xc:RegisterEffect(e1) - Duel.XyzSummon(tp,tc,nil,Group.FromCards(mc,xc)) + Duel.XyzSummon(tp,tc,Group.FromCards(mc,xc),nil,2,2) end end diff --git a/unofficial/c511009325.lua b/unofficial/c511009325.lua index 5d85a4fa76..c2d3b63542 100644 --- a/unofficial/c511009325.lua +++ b/unofficial/c511009325.lua @@ -64,7 +64,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) end end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) diff --git a/unofficial/c511015103.lua b/unofficial/c511015103.lua index bcab2e59a1..1e23a223e8 100644 --- a/unofficial/c511015103.lua +++ b/unofficial/c511015103.lua @@ -91,7 +91,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) e1:SetCode(EFFECT_ORICHALCUM_CHAIN) c:RegisterEffect(e1,true) end - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,#g,#g) if e1 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) diff --git a/unofficial/c511015106.lua b/unofficial/c511015106.lua index 5bcbe24fd0..7c2351e34e 100644 --- a/unofficial/c511015106.lua +++ b/unofficial/c511015106.lua @@ -58,8 +58,8 @@ function s.filter3(c,e,tp,xyz,odd) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end - if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsPlayerCanSpecialSummonCount(tp,2) - and aux.CheckSummonGate(tp,2) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsPlayerCanSpecialSummonCount(tp,2) + and aux.CheckSummonGate(tp,2) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetUsableMZoneCount(tp)>1 and Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local c1=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() @@ -70,7 +70,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 + if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM)<=0 or Duel.GetUsableMZoneCount(tp)<=1 then return false end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) @@ -88,7 +88,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=g:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,sg) + Duel.XyzSummon(tp,xyz,sg,nil,2,2) if not c:IsRelateToEffect(e) or not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end xyz:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD,0,0) local e1=Effect.CreateEffect(c) diff --git a/unofficial/c511015134.lua b/unofficial/c511015134.lua index c4f18be72d..3dd63d39c6 100644 --- a/unofficial/c511015134.lua +++ b/unofficial/c511015134.lua @@ -132,7 +132,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() aux.RankUpComplete(xyz,aux.Stringid(id,1)) - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,#g,#g) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_COST) diff --git a/unofficial/c511600071.lua b/unofficial/c511600071.lua index d76e0f154d..e82692b860 100644 --- a/unofficial/c511600071.lua +++ b/unofficial/c511600071.lua @@ -61,7 +61,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=Duel.SelectMatchingCard(tp,Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,1,nil,nil,mg,#mg,#mg):GetFirst() if xyz then - Duel.XyzSummon(tp,xyz,nil,mg) + Duel.XyzSummon(tp,xyz,mg,nil,#mg,#mg) notSg:KeepAlive() notSg:ForEach(function(_c) _c:Level((_c:Level()+1)) end) local e1=Effect.CreateEffect(c) diff --git a/unofficial/c511600335.lua b/unofficial/c511600335.lua index 07ce53639f..9a965a77b9 100644 --- a/unofficial/c511600335.lua +++ b/unofficial/c511600335.lua @@ -90,7 +90,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - Duel.XyzSummon(tp,xyz,nil,g) + Duel.XyzSummon(tp,xyz,g,nil,2,2) end end function s.efcon(e,tp,eg,ep,ev,re,r,rp) From 489e14d30023c216535145313ef5fa0bddb45edf Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Tue, 9 Apr 2024 11:57:50 +0200 Subject: [PATCH 12/19] Modernize and cleanup some cards changed by previous commit Halfway to Forever Gazer Shark Galaxy Tyranno Geargia Change Artifacts Unleashed Advanced Heraldry Art Shining Hope Road Destiny overlay Dimension Xyz The Phantom Knights' Twin Medals D/D/D Xyz Salamangreat Zebroid X (Anime) --- official/c20285786.lua | 37 +++++++----------- official/c23536866.lua | 75 +++++++++++++++-------------------- official/c24658418.lua | 4 +- official/c29087919.lua | 28 +++++++------ official/c56611470.lua | 53 ++++++++++--------------- official/c61314842.lua | 20 +++++----- official/c62829077.lua | 48 ++++++++--------------- unofficial/c100000490.lua | 82 ++++++++++++++++----------------------- unofficial/c511000698.lua | 43 +++++++------------- unofficial/c511009325.lua | 38 +++++++----------- unofficial/c511015103.lua | 19 ++++----- unofficial/c511600335.lua | 13 +++---- 12 files changed, 186 insertions(+), 274 deletions(-) diff --git a/official/c20285786.lua b/official/c20285786.lua index a63036f75b..fb76d0cfe6 100644 --- a/official/c20285786.lua +++ b/official/c20285786.lua @@ -2,7 +2,7 @@ --Halfway to Forever local s,id=GetID() function s.initial_effect(c) - --Activate + --Special Summon 2 monsters from your GY then Xyz Summon 1 Utopic monster using those monsters as materials local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) @@ -20,39 +20,32 @@ end function s.xyzfilter(c,mg) return c:IsSetCard(SET_UTOPIC) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsXyzSummonable(nil,mg,2,2) end -function s.mfilter1(c,mg,exg) - return mg:IsExists(s.mfilter2,1,c,c,exg) -end -function s.mfilter2(c,mc,exg) - return exg:IsExists(Card.IsXyzSummonable,1,nil,nil,Group.FromCards(c,mc)) +function s.rescon(exg) + return function(sg) + return #sg==2 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,2,2) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,e,tp) local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) + if chk==0 then return #exg>0 + and Duel.IsPlayerCanSpecialSummonCount(tp,2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) - and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 - and #exg>0 end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,exg) - local tc1=sg1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg2=mg:FilterSelect(tp,s.mfilter2,1,1,tc1,tc1,exg) - sg1:Merge(sg2) - Duel.SetTargetCard(sg1) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0) + and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 end + local sg=aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon(exg),1,tp,HINTMSG_SPSUMMON) + Duel.SetTargetCard(sg) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,2,0,0) end function s.filter2(c,e,tp) - return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end - local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.filter2,nil,e,tp) - if #g<2 then return end - local tc=g:GetFirst() - for tc in aux.Next(g) do + local g=Duel.GetTargetCards(e):Match(s.filter2,nil,e,tp) + if #g~=2 then return end + for tc in g:Iter() do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) diff --git a/official/c23536866.lua b/official/c23536866.lua index de16a2d737..2794d44498 100644 --- a/official/c23536866.lua +++ b/official/c23536866.lua @@ -2,7 +2,7 @@ --Gazer Shark local s,id=GetID() function s.initial_effect(c) - --Xyz Summon + --Banish itself, Special Summon 2 level 5 WATER monsters from your GY then Xyz Summon 1 WATER monster using those monsters as materials local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -17,67 +17,54 @@ function s.initial_effect(c) end s.listed_names={id} function s.filter(c,e,tp) - return c:GetLevel()==5 and c:IsAttribute(ATTRIBUTE_WATER) and not c:IsCode(id) + return c:IsLevel(5) and c:IsAttribute(ATTRIBUTE_WATER) and not c:IsCode(id) and c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.xyzfilter(c,tp,mg) - return c:IsAttribute(ATTRIBUTE_WATER) and Duel.GetLocationCountFromEx(tp,tp,mg,c)>0 and c:IsXyzSummonable(nil,mg,2,2) +function s.xyzfilter(c,mg) + return c:IsAttribute(ATTRIBUTE_WATER) and c:IsXyzSummonable(nil,mg,2,2) end -function s.mfilter1(c,mg,exg) - return mg:IsExists(s.mfilter2,1,c,c,exg) -end -function s.mfilter2(c,mc,exg) - return exg:IsExists(Card.IsXyzSummonable,1,nil,nil,Group.FromCards(c,mc)) +function s.rescon(exg) + return function(sg) + return #sg==2 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,2,2) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,e,tp) - local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,tp,mg) - if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) + local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) + if chk==0 then return #exg>0 + and Duel.IsPlayerCanSpecialSummonCount(tp,2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) - and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 - and #exg>0 end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,exg) - local tc1=sg1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg2=mg:FilterSelect(tp,s.mfilter2,1,1,tc1,tc1,exg) - sg1:Merge(sg2) - Duel.SetTargetCard(sg1) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0) + and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 end + local sg=aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon(exg),1,tp,HINTMSG_SPSUMMON) + Duel.SetTargetCard(sg) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,2,0,0) end function s.filter2(c,e,tp) - return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end - local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.filter2,nil,e,tp) - if #g<2 then return end - local tc1=g:GetFirst() - local tc2=g:GetNext() - Duel.SpecialSummonStep(tc1,0,tp,tp,false,false,POS_FACEUP) - Duel.SpecialSummonStep(tc2,0,tp,tp,false,false,POS_FACEUP) - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_DISABLE) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - tc1:RegisterEffect(e1) - local e2=e1:Clone() - tc2:RegisterEffect(e2) - local e3=Effect.CreateEffect(e:GetHandler()) - e3:SetType(EFFECT_TYPE_SINGLE) - e3:SetCode(EFFECT_DISABLE_EFFECT) - e3:SetReset(RESET_EVENT|RESETS_STANDARD) - tc1:RegisterEffect(e3) - local e4=e3:Clone() - tc2:RegisterEffect(e4) + local g=Duel.GetTargetCards(e):Match(s.filter2,nil,e,tp) + if #g~=2 then return end + for tc in g:Iter() do + Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_DISABLE) + e1:SetReset(RESET_EVENT|RESETS_STANDARD) + tc:RegisterEffect(e1) + local e2=e1:Clone() + e2:SetCode(EFFECT_DISABLE_EFFECT) + tc:RegisterEffect(e2) + end Duel.SpecialSummonComplete() Duel.BreakEffect() - local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,tp,g) + local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() Duel.XyzSummon(tp,xyz,g,nil,2,2) end -end \ No newline at end of file +end diff --git a/official/c24658418.lua b/official/c24658418.lua index 3c0356d5de..ba5abbf403 100644 --- a/official/c24658418.lua +++ b/official/c24658418.lua @@ -2,7 +2,7 @@ --Galaxy Tyranno local s,id=GetID() function s.initial_effect(c) - --special summon itself + --When a "Galaxy" monster you control is targeted by an attack, Special Summon itself local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -13,7 +13,7 @@ function s.initial_effect(c) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) - --xyz summon + --If Summoned by its own effect, Xyz Summon 1 "Galaxy" monster using "Galaxy" monsters you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) diff --git a/official/c29087919.lua b/official/c29087919.lua index 0db860465f..d15bad6ce5 100644 --- a/official/c29087919.lua +++ b/official/c29087919.lua @@ -18,26 +18,29 @@ s.listed_series={SET_GEARGIANO} function s.gyspfilter(c,e,tp) return c:IsSetCard(SET_GEARGIANO) and c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.extraspfilter(c,mg) - return c:IsXyzSummonable(nil,mg,2,#mg) +function s.xyzfilter(c,mg,ct) + return c:IsXyzSummonable(nil,mg,ct,ct) end -function s.rescon(sg,e,tp,mg) - return sg:GetClassCount(Card.GetCode)==#sg and Duel.IsExistingMatchingCard(s.extraspfilter,tp,LOCATION_EXTRA,0,1,nil,sg) +function s.rescon(exg) + return function(sg) + if #sg<2 then return false end + if not sg:CheckDifferentProperty(Card.GetCode) then return false,false end + return sg:GetClassCount(Card.GetCode)==#sg and exg:IsExists(s.xyzfilter,tp,LOCATION_EXTRA,1,nil,sg,#sg) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end - local mg=Duel.GetMatchingGroup(s.gyspfilter,tp,LOCATION_GRAVE,0,nil,e,tp) - local maxct=math.min(Duel.GetLocationCount(tp,LOCATION_MZONE),mg:GetClassCount(Card.GetCode)) + local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,e,tp) + local ct=Duel.GetLocationCount(tp,LOCATION_MZONE) + local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg,ct) + local rescon=s.rescon(exg) if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) - and maxct>=2 and aux.SelectUnselectGroup(mg,e,tp,2,maxct,s.rescon,0) end - local sg=aux.SelectUnselectGroup(mg,e,tp,2,maxct,s.rescon,1,tp,HINTMSG_SPSUMMON) + and ct>1 and aux.SelectUnselectGroup(mg,e,tp,2,math.min(#mg,ct),rescon,0) end + local sg=aux.SelectUnselectGroup(mg,e,tp,2,math.min(#mg,ct),rescon,1,tp,HINTMSG_SPSUMMON,rescon) Duel.SetTargetCard(sg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,#sg,tp,0) end -function s.xyzfilter(c,mg,ct) - return c:IsXyzSummonable(nil,mg,ct,ct) -end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetTargetCards(e):Filter(Card.IsCanBeSpecialSummoned,nil,e,0,tp,false,false) if #sg>=2 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end @@ -47,8 +50,9 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) sg=sg:Select(tp,ft,ft,nil) end local ct=Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) + if ct<1 then return end local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,sg,ct) - if ct>=2 and #xyzg>0 then + if #xyzg>0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyzc=xyzg:Select(tp,1,1,nil):GetFirst() diff --git a/official/c56611470.lua b/official/c56611470.lua index 28a2daccc3..ff2d37be02 100644 --- a/official/c56611470.lua +++ b/official/c56611470.lua @@ -27,47 +27,36 @@ s.listed_series={SET_ARTIFACT} function s.filter(c,e) return c:IsFaceup() and c:IsSetCard(SET_ARTIFACT) and c:IsCanBeEffectTarget(e) end -function s.xyzfilter(c,mg,tp,chk) - return c:IsXyzSummonable(nil,mg,2,2) and (not chk or Duel.GetLocationCountFromEx(tp,tp,mg,c)>0) +function s.xyzfilter(c,mg,tp) + return c:IsXyzSummonable(nil,mg,2,2) end -function s.mfilter1(c,mg,exg,tp) - return mg:IsExists(s.mfilter2,1,c,c,exg,tp) -end -function s.zonecheck(c,tp,g) - return Duel.GetLocationCountFromEx(tp,tp,g,c)>0 and c:IsXyzSummonable(nil,g) -end -function s.mfilter2(c,mc,exg,tp) - local g=Group.FromCards(c,mc) - return exg:IsExists(s.zonecheck,1,nil,tp,g) +function s.rescon(exg) + return function(sg) + return #sg==2 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,2,2) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil,e) local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - if chk==0 then return mg:IsExists(s.mfilter1,1,nil,mg,exg,tp) end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local sg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,exg,tp) - local tc1=sg1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local sg2=mg:FilterSelect(tp,s.mfilter2,1,1,tc1,tc1,exg,tp) - sg1:Merge(sg2) - Duel.SetTargetCard(sg1) + if chk==0 then return #exg>0 end + local sg=aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon(exg),1,tp,HINTMSG_XMATERIAL) + Duel.SetTargetCard(sg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end -function s.tfilter(c,e) - return c:IsRelateToEffect(e) and c:IsFaceup() -end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_CANNOT_ATTACK) - e1:SetTargetRange(LOCATION_MZONE,0) - e1:SetTarget(s.attg) - e1:SetReset(RESET_PHASE|PHASE_END) - Duel.RegisterEffect(e1,tp) - local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.tfilter,nil,e) + if e:IsHasType(EFFECT_TYPE_ACTIVATE) then + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_FIELD) + e1:SetCode(EFFECT_CANNOT_ATTACK) + e1:SetTargetRange(LOCATION_MZONE,0) + e1:SetTarget(s.attg) + e1:SetReset(RESET_PHASE|PHASE_END) + Duel.RegisterEffect(e1,tp) + end + local g=Duel.GetTargetCards(e):Match(Card.IsFaceup,nil) if #g<2 then return end - local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g,tp,true) + local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g,tp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() @@ -81,7 +70,7 @@ function s.drcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end function s.cffilter(c) - return c:IsAttribute(ATTRIBUTE_LIGHT) and c:GetLevel()==5 and not c:IsPublic() + return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(5) and not c:IsPublic() end function s.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cffilter,tp,LOCATION_HAND,0,1,nil) end diff --git a/official/c61314842.lua b/official/c61314842.lua index 689e065d44..93426e4079 100644 --- a/official/c61314842.lua +++ b/official/c61314842.lua @@ -25,6 +25,11 @@ end function s.mfilter2(c,mc,exg,tp) return exg:IsExists(s.xyzfilter,1,nil,Group.FromCards(c,mc),tp,true) end +function s.rescon(exg) + return function(sg) + return #sg==2 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,2,2) + end +end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,e,tp) @@ -34,22 +39,17 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,exg,tp) - local tc1=sg1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg2=mg:FilterSelect(tp,s.mfilter2,1,1,tc1,tc1,exg,tp) - sg1:Merge(sg2) - Duel.SetTargetCard(sg1) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0) + local sg=aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon(exg),1,tp,HINTMSG_SPSUMMON) + Duel.SetTargetCard(sg) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,2,0,0) end function s.filter2(c,e,tp) - return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end - local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.filter2,nil,e,tp) + local g=Duel.GetTargetCards(e):Match(s.filter2,nil,e,tp) if #g~=2 then return end if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=2 then return end Duel.BreakEffect() diff --git a/official/c62829077.lua b/official/c62829077.lua index 12b2d0c966..5f0270ddb4 100644 --- a/official/c62829077.lua +++ b/official/c62829077.lua @@ -33,50 +33,34 @@ end function s.filter(c,e,tp) return c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.xyzfilter(c,mg,tp,chk) - return c:IsSetCard(SET_UTOPIC) and c:IsXyzSummonable(nil,mg,3,3) and (not chk or Duel.GetLocationCountFromEx(tp,tp,mg,c)>0) +function s.xyzfilter(c,mg,tp) + return c:IsSetCard(SET_UTOPIC) and c:IsXyzSummonable(nil,mg,3,3) end -function s.mfilter1(c,mg,exg,tp) - return mg:IsExists(s.mfilter2,1,c,c,mg,exg,tp) -end -function s.mfilter2(c,mc,mg,exg,tp) - return mg:IsExists(s.mfilter3,1,c,c,mc,exg,tp) -end -function s.zonecheck(c,tp,g) - return Duel.GetLocationCountFromEx(tp,tp,g,c)>0 and c:IsXyzSummonable(nil,g) -end -function s.mfilter3(c,mc1,mc2,exg,tp) - return c~=mc2 and exg:IsExists(s.zonecheck,1,nil,tp,Group.FromCards(c,mc1,mc2),3,3) +function s.rescon(exg) + return function(sg) + return #sg==3 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,3,3) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,e,tp) local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) + if chk==0 then return #exg>0 + and Duel.IsPlayerCanSpecialSummonCount(tp,2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) - and Duel.GetLocationCount(tp,LOCATION_MZONE)>2 - and mg:IsExists(s.mfilter1,1,nil,mg,exg,tp) end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,exg,tp) - local tc1=sg1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg2=mg:FilterSelect(tp,s.mfilter2,1,1,tc1,tc1,mg,exg,tp) - local tc2=sg2:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg3=mg:FilterSelect(tp,s.mfilter3,1,1,tc2,tc2,tc1,exg,tp) - sg1:Merge(sg2) - sg1:Merge(sg3) - Duel.SetTargetCard(sg1) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,3,0,0) + and Duel.GetLocationCount(tp,LOCATION_MZONE)>2 end + local sg=aux.SelectUnselectGroup(mg,e,tp,3,3,s.rescon(exg),1,tp,HINTMSG_SPSUMMON) + Duel.SetTargetCard(sg) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,2,0,0) end function s.filter2(c,e,tp) - return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<3 then return end - local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.filter2,nil,e,tp) - if #g<3 then return end + local g=Duel.GetTargetCards(e):Match(s.filter2,nil,e,tp) + if #g~=3 then return end for tc in aux.Next(g) do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) @@ -90,7 +74,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) end Duel.SpecialSummonComplete() Duel.BreakEffect() - local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g,tp,true) + local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g,tp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() diff --git a/unofficial/c100000490.lua b/unofficial/c100000490.lua index 16d57ef66e..321d753799 100644 --- a/unofficial/c100000490.lua +++ b/unofficial/c100000490.lua @@ -15,70 +15,56 @@ end function s.filter(c,e) return c:IsFaceup() and c:IsCanBeEffectTarget(e) and not c:IsType(TYPE_TOKEN) end -function s.xyzfilter(c,mg,sc,set) - local reset={} - if not set then - for tc in aux.Next(mg) do - local e1=Effect.CreateEffect(sc) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) - e1:SetCode(EFFECT_XYZ_MATERIAL) - tc:RegisterEffect(e1) - table.insert(reset,e1) - end - end - local res=c:IsXyzSummonable(nil,mg,#mg,#mg) - for _,te in ipairs(reset) do - te:Reset() - end - return res +function s.registerxyzmateffect(e,tp) + local matEff=Effect.CreateEffect(e:GetHandler()) + matEff:SetType(EFFECT_TYPE_FIELD) + matEff:SetCode(EFFECT_XYZ_MATERIAL) + matEff:SetTargetRange(0,LOCATION_MZONE) + Duel.RegisterEffect(matEff,tp) + return matEff +end +function s.xyzfilter(c,mg,fg,minc,maxg) + return c:IsXyzSummonable(mg,fg,minc,maxg) end -function s.rescon(set) - return function(sg,e,tp,mg) - return Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,sg,e:GetHandler(),set) - end +function s.rescon(exg) + return function(sg) + return exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,#sg,#sg) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e) - if chk==0 then return aux.SelectUnselectGroup(mg,e,tp,nil,nil,s.rescon(false),0) end - local reset={} - for tc in aux.Next(mg) do - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) - e1:SetCode(EFFECT_XYZ_MATERIAL) - tc:RegisterEffect(e1) - table.insert(reset,e1) + if chk==0 then + local matEff=s.registerxyzmateffect(e,tp) + local res=Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) + matEff:Reset() + return res end - local tg=aux.SelectUnselectGroup(mg,e,tp,nil,nil,s.rescon(true),1,tp,HINTMSG_XMATERIAL,s.rescon(true)) + local matEff=s.registerxyzmateffect(e,tp) + local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) + local tg=aux.SelectUnselectGroup(mg,e,tp,nil,nil,s.rescon(exg),1,tp,HINTMSG_XMATERIAL,s.rescon(exg)) + matEff:Reset() Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) - for _,te in ipairs(reset) do - te:Reset() - end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetTargetCards(e) - local reset={} - for tc in aux.Next(g) do - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) - e1:SetCode(EFFECT_XYZ_MATERIAL) - e1:SetReset(RESET_EVENT+RESETS_STANDARD) - tc:RegisterEffect(e1) - table.insert(reset,e1) - end - local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g,c,true) + local matEff=s.registerxyzmateffect(e,tp) + local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,nil,g,#g,#g) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() Duel.XyzSummon(tp,xyz,g,nil,#g,#g) + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_SPSUMMON_COST) + e1:SetOperation(function() + matEff:Reset() + end) + e1:SetReset(RESET_EVENT|RESETS_STANDARD) + xyz:RegisterEffect(e1,true) else - for _,te in ipairs(reset) do - te:Reset() - end + matEff:Reset() end end diff --git a/unofficial/c511000698.lua b/unofficial/c511000698.lua index e95ed0bf34..87b1d12d96 100644 --- a/unofficial/c511000698.lua +++ b/unofficial/c511000698.lua @@ -18,46 +18,31 @@ end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(tp)<=1000 end -function s.filter(c,g,tp) - local mg=g:Filter(Card.IsCode,nil,c:GetCode()) - return Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) -end -function s.mfilter(c,g,tg,ct,tp) - local mg=g:Filter(Card.IsCode,nil,c:GetCode()) - local xct=ct+1 - mg:RemoveCard(c) - tg:AddCard(c) - local res=false - if xct==3 then - local res=Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,tg) - else - local res=mg:IsExists(s.mfilter,1,c,mg,tg,xct,tp) - end - tg:RemoveCard(c) - return res -end function s.xyzfilter(c,g) return c:IsXyzSummonable(nil,g,3,3) end -function s.matcond(sg,e,tp) - return sg:GetClassCount(Card.GetCode)==1 and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,sg) +function s.rescon(exg) + return function(sg) + if sg:CheckDifferentProperty(Card.GetCode) then return false,false end + return #sg==3 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,3,3) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - local g=Duel.GetMatchingGroup(s.xyzmatfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil) - if chk==0 then return g:IsExists(s.filter,1,nil,g,tp) and - Duel.GetLocationCountFromEx(tp,tp,g:Filter(Card.IsLocation,nil,LOCATION_MZONE))>0 end + local mg=Duel.GetMatchingGroup(s.xyzmatfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_GRAVE,0,nil) + local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) + if chk==0 then return aux.SelectUnselectGroup(mg,e,tp,3,3,s.rescon(exg),0) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.operation(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetMatchingGroup(s.xyzmatfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,nil) - local mg=g:Filter(s.filter,nil,g,tp) - if #mg<3 then return end - local matg=aux.SelectUnselectGroup(mg,e,tp,3,3,s.matcond,1,tp,HINTMSG_XMATERIAL) + local mg=Duel.GetMatchingGroup(s.xyzmatfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_GRAVE,0,nil) + local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) + if #exg==0 then return end + local matg=aux.SelectUnselectGroup(mg,e,tp,3,3,s.rescon(exg),1,tp,HINTMSG_XMATERIAL1) + if #matg~=3 then return end local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,matg) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - matg:KeepAlive() - Duel.XyzSummon(tp,xyz,matg,nil,3,3) + Duel.XyzSummon(tp,xyz,matg,matg,3,3) end end diff --git a/unofficial/c511009325.lua b/unofficial/c511009325.lua index c2d3b63542..5b1a8e2641 100644 --- a/unofficial/c511009325.lua +++ b/unofficial/c511009325.lua @@ -1,4 +1,4 @@ ---The Phantom Knights of Double Badge +--The Phantom Knights' Twin Medals local s,id=GetID() function s.initial_effect(c) --Activate @@ -7,13 +7,13 @@ function s.initial_effect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) - e1:SetCondition(s.condition) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ep==tp end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(18563744,1)) + e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) @@ -23,42 +23,30 @@ function s.initial_effect(c) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return ep==tp -end +s.listed_series={SET_THE_PHANTOM_KNIGHTS} function s.filter(c,e) - return c:IsFaceup() and c:IsSetCard(0x10db) and c:IsCanBeEffectTarget(e) + return c:IsFaceup() and c:IsSetCard(SET_THE_PHANTOM_KNIGHTS) and c:IsCanBeEffectTarget(e) end function s.xyzfilter(c,mg) return c:IsXyzSummonable(nil,mg,2,2) end -function s.mfilter1(c,mg,exg) - return mg:IsExists(s.mfilter2,1,c,c,exg) -end -function s.mfilter2(c,mc,exg) - return exg:IsExists(Card.IsXyzSummonable,1,nil,nil,Group.FromCards(c,mc)) +function s.rescon(exg) + return function(sg) + return #sg==2 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,2,2) + end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil,e) local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 - and #exg>0 end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local sg1=mg:FilterSelect(tp,s.mfilter1,1,1,nil,mg,exg) - local tc1=sg1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local sg2=mg:FilterSelect(tp,s.mfilter2,1,1,tc1,tc1,exg) - sg1:Merge(sg2) - Duel.SetTargetCard(sg1) + if chk==0 then return #exg>0 end + local sg=aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon(exg),1,tp,HINTMSG_XMATERIAL) + Duel.SetTargetCard(sg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end -function s.tfilter(c,e) - return c:IsRelateToEffect(e) and c:IsFaceup() -end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<-1 then return end - local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.tfilter,nil,e) + local g=Duel.GetTargetCards(e):Match(Card.IsFaceup,nil) if #g<2 then return end local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g) if #xyzg>0 then diff --git a/unofficial/c511015103.lua b/unofficial/c511015103.lua index 1e23a223e8..5996f702a6 100644 --- a/unofficial/c511015103.lua +++ b/unofficial/c511015103.lua @@ -12,11 +12,11 @@ function s.initial_effect(c) e1:SetOperation(s.activate) c:RegisterEffect(e1) end -s.listed_series={0x10af} +s.listed_series={SET_DDD} s.listed_names={47198668} function s.filter(c,e,tp) - return c:IsType(TYPE_PENDULUM) and c:IsSetCard(0x10af) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and (c:IsLocation(LOCATION_GRAVE) and c:IsCanBeEffectTarget(e) or (c:IsFaceup() and not c:IsHasEffect(EFFECT_CANNOT_BE_EFFECT_TARGET))) + return c:IsType(TYPE_PENDULUM) and c:IsSetCard(SET_DDD) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + and (not c:IsLocation(LOCATION_GRAVE) or c:IsCanBeEffectTarget(e)) end function s.xyzfilter(c,sg,e,tp) local ct=#sg @@ -44,7 +44,7 @@ function s.rescon(mft,exft,ft) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end - local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,nil,e,tp) + local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE|LOCATION_EXTRA,0,nil,e,tp) local ftex=Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local ftt=Duel.GetUsableMZoneCount(tp) @@ -69,14 +69,11 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) if #sg<=0 then return false end g=sg end - if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then - for tc in aux.Next(g) do - if tc:IsLocation(LOCATION_MZONE) then - s.disop(tc,e:GetHandler()) - end + if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)==0 then return end + for tc in g:Iter() do + if tc:IsLocation(LOCATION_MZONE) then + s.disop(tc,e:GetHandler()) end - else - return end Duel.AdjustInstantly(c) local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,g,g,e,tp) diff --git a/unofficial/c511600335.lua b/unofficial/c511600335.lua index 9a965a77b9..60a767d308 100644 --- a/unofficial/c511600335.lua +++ b/unofficial/c511600335.lua @@ -31,28 +31,27 @@ function s.initial_effect(c) Duel.RegisterEffect(ge1,0) end) end -s.listed_series={0x119} -s.listed_names={} +s.listed_series={SET_SALAMANGREAT} +s.listed_names={id} function s.checkop(e,tp,eg,ep,ev,re,r,rp) for ec in aux.Next(eg) do if ec:GetPreviousTypeOnField()&TYPE_LINK>0 - and ec:IsPreviousSetCard(0x119) and REASON_EFFECT&ec:GetReason()>0 + and ec:IsPreviousSetCard(SET_SALAMANGREAT) and REASON_EFFECT&ec:GetReason()>0 and ec:GetPreviousControler()~=ec:GetReasonEffect():GetHandlerPlayer() then Duel.RegisterFlagEffect(ec:GetPreviousControler(),id,RESET_PHASE+PHASE_END,0,1) end end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) - local ph=Duel.GetCurrentPhase() - return Duel.GetFlagEffect(tp,id)>0 and ph>=PHASE_MAIN1 and ph<=PHASE_MAIN2 + return Duel.GetFlagEffect(tp,id)>0 and (Duel.IsMainPhase() or Duel.IsBattlePhase()) end function s.filter(c,e,tp) - return c:IsSetCard(0x119) and c:IsLevelBelow(4) and not c:IsCode(id) + return c:IsSetCard(SET_SALAMANGREAT) and c:IsLevelBelow(4) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,Group.FromCards(c,e:GetHandler())) end function s.xyzfilter(c,mg) - return c:IsSetCard(0x119) and c:IsType(TYPE_XYZ) and c:IsXyzSummonable(nil,mg,2,2) + return c:IsSetCard(SET_SALAMANGREAT) and c:IsType(TYPE_XYZ) and c:IsXyzSummonable(nil,mg,2,2) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end From ce401188bfa2e80d050a0147a2e4c67569af4142 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Tue, 9 Apr 2024 15:56:57 +0200 Subject: [PATCH 13/19] Use Xyz.InfiniteMats constant --- official/c10666000.lua | 4 ++-- official/c11132674.lua | 4 ++-- official/c1174075.lua | 2 +- official/c12615446.lua | 2 +- official/c14970113.lua | 2 +- official/c18326736.lua | 2 +- official/c19369609.lua | 4 ++-- official/c21065189.lua | 6 +++--- official/c21858819.lua | 2 +- official/c23187256.lua | 2 +- official/c2665273.lua | 2 +- official/c27069566.lua | 2 +- official/c29208536.lua | 4 ++-- official/c31539614.lua | 4 ++-- official/c32302078.lua | 8 ++++---- official/c32453837.lua | 4 ++-- official/c34909328.lua | 4 ++-- official/c35772782.lua | 2 +- official/c41375811.lua | 4 ++-- official/c44241999.lua | 4 ++-- official/c45935145.lua | 4 ++-- official/c46014517.lua | 4 ++-- official/c47195442.lua | 4 ++-- official/c48608796.lua | 2 +- official/c53054164.lua | 4 ++-- official/c58600555.lua | 4 ++-- official/c58858807.lua | 4 ++-- official/c59071624.lua | 6 +++--- official/c61307542.lua | 4 ++-- official/c61641818.lua | 6 +++--- official/c62941499.lua | 4 ++-- official/c62967433.lua | 2 +- official/c64182380.lua | 2 +- official/c67926903.lua | 4 ++-- official/c6906306.lua | 4 ++-- official/c69757518.lua | 4 ++-- official/c70597485.lua | 4 ++-- official/c70636044.lua | 4 ++-- official/c71100270.lua | 4 ++-- official/c71166481.lua | 2 +- official/c72409226.lua | 4 ++-- official/c72971064.lua | 2 +- official/c73082255.lua | 4 ++-- official/c73542331.lua | 4 ++-- official/c74615388.lua | 4 ++-- official/c7511613.lua | 4 ++-- official/c76833149.lua | 2 +- official/c78144171.lua | 4 ++-- official/c78876707.lua | 4 ++-- official/c80993256.lua | 4 ++-- official/c8387138.lua | 2 +- official/c8491961.lua | 2 +- official/c85004150.lua | 2 +- official/c85692042.lua | 8 ++++---- official/c88581108.lua | 2 +- official/c90126061.lua | 4 ++-- official/c90664857.lua | 4 ++-- official/c9272381.lua | 6 +++--- official/c9453320.lua | 4 ++-- official/c9486959.lua | 2 +- official/c95134948.lua | 2 +- official/c95243515.lua | 4 ++-- official/c9940036.lua | 6 +++--- unofficial/c511001363.lua | 2 +- unofficial/c511009002.lua | 2 +- unofficial/c511010205.lua | 2 +- 66 files changed, 117 insertions(+), 117 deletions(-) diff --git a/official/c10666000.lua b/official/c10666000.lua index 9d1fa29e35..efc9636b8b 100644 --- a/official/c10666000.lua +++ b/official/c10666000.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,8,2,nil,nil,99) + Xyz.AddProcedure(c,nil,8,2,nil,nil,Xyz.InfiniteMats) --Attach 1 card from your opponent's GY to this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -98,4 +98,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.BreakEffect() Duel.Damage(1-tp,dam,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c11132674.lua b/official/c11132674.lua index e3ba755141..5c3f99a58f 100644 --- a/official/c11132674.lua +++ b/official/c11132674.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,8,2,s.ovfilter,aux.Stringid(id,0),99,s.xyzop) + Xyz.AddProcedure(c,nil,8,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --Search 1 "Springans" or "Therion" card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) @@ -75,4 +75,4 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(tc,nil,REASON_EFFECT) end end -end \ No newline at end of file +end diff --git a/official/c1174075.lua b/official/c1174075.lua index 848d0b2480..a8686af1a5 100644 --- a/official/c1174075.lua +++ b/official/c1174075.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,1,2,nil,nil,99) + Xyz.AddProcedure(c,nil,1,2,nil,nil,Xyz.InfiniteMats) --ritual material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) diff --git a/official/c12615446.lua b/official/c12615446.lua index d45fcdade0..7cd1fdd1db 100644 --- a/official/c12615446.lua +++ b/official/c12615446.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,s.matfilter,3,2,nil,nil,99) + Xyz.AddProcedure(c,s.matfilter,3,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --Position+Negate local e1=Effect.CreateEffect(c) diff --git a/official/c14970113.lua b/official/c14970113.lua index abb1a980ff..9bb6cf0676 100644 --- a/official/c14970113.lua +++ b/official/c14970113.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,4,3,s.ovfilter,aux.Stringid(id,0),99,s.xyzop) + Xyz.AddProcedure(c,nil,4,3,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) c:EnableReviveLimit() --atk local e1=Effect.CreateEffect(c) diff --git a/official/c18326736.lua b/official/c18326736.lua index 2219a9ec93..c303b2133b 100644 --- a/official/c18326736.lua +++ b/official/c18326736.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --spsummon local e1=Effect.CreateEffect(c) diff --git a/official/c19369609.lua b/official/c19369609.lua index ed7cb81f53..dd94961a53 100644 --- a/official/c19369609.lua +++ b/official/c19369609.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure - Xyz.AddProcedure(c,nil,1,2,nil,nil,99) + Xyz.AddProcedure(c,nil,1,2,nil,nil,Xyz.InfiniteMats) --Gains 500 ATK for each material attached to it local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -84,4 +84,4 @@ function s.atkop(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_PHASE|PHASE_END|RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c21065189.lua b/official/c21065189.lua index c261312c9a..73cf792df3 100644 --- a/official/c21065189.lua +++ b/official/c21065189.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) --atk gain local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -38,7 +38,7 @@ function s.atkval(e,c) end function s.spfilter(c,e,tp,ec) local zone=ec:GetToBeLinkedZone(c,tp) - return zone~=0 and c:IsLinkMonster() and c:IsRace(RACE_CYBERSE) and c:GetLink()==4 + return zone~=0 and c:IsLinkMonster() and c:IsRace(RACE_CYBERSE) and c:GetLink()==4 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) @@ -54,7 +54,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then local zone=c:GetToBeLinkedZone(tc,tp) - if zone~=0 then + if zone~=0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone) end end diff --git a/official/c21858819.lua b/official/c21858819.lua index 9891b9e8f3..e79eb09a54 100644 --- a/official/c21858819.lua +++ b/official/c21858819.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,10,2,nil,nil,99) + Xyz.AddProcedure(c,nil,10,2,nil,nil,Xyz.InfiniteMats) --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) diff --git a/official/c23187256.lua b/official/c23187256.lua index fcc84fc8a0..4962386dc7 100644 --- a/official/c23187256.lua +++ b/official/c23187256.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon c:EnableReviveLimit() - Xyz.AddProcedure(c,s.xyzfilter,nil,2,nil,nil,99,nil,false,s.xyzcheck) + Xyz.AddProcedure(c,s.xyzfilter,nil,2,nil,nil,Xyz.InfiniteMats,nil,false,s.xyzcheck) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c2665273.lua b/official/c2665273.lua index 86648dac87..f03ff29276 100644 --- a/official/c2665273.lua +++ b/official/c2665273.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() c:SetUniqueOnField(1,0,id) - Xyz.AddProcedure(c,nil,9,2,nil,nil,99) + Xyz.AddProcedure(c,nil,9,2,nil,nil,Xyz.InfiniteMats) --This card's original ATK/DEF become 1000 x its number of materials local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) diff --git a/official/c27069566.lua b/official/c27069566.lua index 3520b7b3cc..36d7e91bf3 100644 --- a/official/c27069566.lua +++ b/official/c27069566.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,6,2,nil,nil,99) + Xyz.AddProcedure(c,nil,6,2,nil,nil,Xyz.InfiniteMats) --Banish 2 targets local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c29208536.lua b/official/c29208536.lua index a2f3030f95..21c4647cd0 100644 --- a/official/c29208536.lua +++ b/official/c29208536.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,2,2,nil,nil,99) + Xyz.AddProcedure(c,nil,2,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --negate local e1=Effect.CreateEffect(c) @@ -63,4 +63,4 @@ function s.aclimit(e,re,tp) table.insert(cg,tc:GetCode()) end return re:GetHandler():IsCode(table.unpack(cg)) -end \ No newline at end of file +end diff --git a/official/c31539614.lua b/official/c31539614.lua index 1a240d3069..c065c8721f 100644 --- a/official/c31539614.lua +++ b/official/c31539614.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 3 monsters - Xyz.AddProcedure(c,nil,3,2,nil,nil,99) + Xyz.AddProcedure(c,nil,3,2,nil,nil,Xyz.InfiniteMats) --Change the ATK/DEF of a monster whose current ATK and/or DEF is different from its original value to its original ATK/DEF local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -96,4 +96,4 @@ function s.gainatkop(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c32302078.lua b/official/c32302078.lua index efb91af9b9..8b324c4b1d 100644 --- a/official/c32302078.lua +++ b/official/c32302078.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 6 monsters - Xyz.AddProcedure(c,nil,6,2,nil,nil,99) + Xyz.AddProcedure(c,nil,6,2,nil,nil,Xyz.InfiniteMats) --Treat 1 monster you control with a Level owned by your opponent as Level 6 for Xyz Summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -76,8 +76,8 @@ function s.tgop(e,tp,eg,ep,ev,re,r,rp) end end function s.spfilter(c,e,tp) - return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsLocation(LOCATION_GRAVE) - and c:IsControler(1-tp) and c:IsReason(REASON_BATTLE|REASON_EFFECT) + return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsLocation(LOCATION_GRAVE) + and c:IsControler(1-tp) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) @@ -111,4 +111,4 @@ function s.regop(e,tp,eg,ep,ev,re,r,rp) Duel.RaiseEvent(g,EVENT_CUSTOM+id,re,r,tp,ep,ev) end end -end \ No newline at end of file +end diff --git a/official/c32453837.lua b/official/c32453837.lua index fb1bd4a0bf..2115534822 100644 --- a/official/c32453837.lua +++ b/official/c32453837.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure - Xyz.AddProcedure(c,nil,2,2,nil,nil,99) + Xyz.AddProcedure(c,nil,2,2,nil,nil,Xyz.InfiniteMats) --Cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -88,4 +88,4 @@ function s.ctdmgop(e,tp,eg,ep,ev,re,r,rp) Duel.HintSelection(tc,true) Duel.Damage(1-tp,tc:GetAttack(),REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c34909328.lua b/official/c34909328.lua index 2f606b47e5..4c9a07c2e5 100644 --- a/official/c34909328.lua +++ b/official/c34909328.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure: 2+ Level 4 "Ryzeal" monsters - Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_RYZEAL),4,2,nil,nil,99) + Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_RYZEAL),4,2,nil,nil,Xyz.InfiniteMats) --Destroy 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -80,4 +80,4 @@ function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return eg:IsExists(s.repfilter,1,nil,tp) and c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) end return Duel.SelectEffectYesNo(tp,c,96) -end \ No newline at end of file +end diff --git a/official/c35772782.lua b/official/c35772782.lua index 0d309d244d..7da78fd84e 100644 --- a/official/c35772782.lua +++ b/official/c35772782.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,5,2,nil,nil,99) + Xyz.AddProcedure(c,nil,5,2,nil,nil,Xyz.InfiniteMats) --roll dice local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DICE) diff --git a/official/c41375811.lua b/official/c41375811.lua index 17452067fb..f1ac08efe8 100644 --- a/official/c41375811.lua +++ b/official/c41375811.lua @@ -5,7 +5,7 @@ function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Xyz summon procedure - Xyz.AddProcedure(c,nil,4,2,s.ovfilter,aux.Stringid(id,0),99,s.xyzop) + Xyz.AddProcedure(c,nil,4,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --Gains ATK/DEF equal to the total ATK/DEF of the "Zoodiac" monsters attached local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -87,4 +87,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) tc:RegisterEffect(e3) end Duel.SpecialSummonComplete() -end \ No newline at end of file +end diff --git a/official/c44241999.lua b/official/c44241999.lua index 56f547e55e..6db9b863c2 100644 --- a/official/c44241999.lua +++ b/official/c44241999.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure - Xyz.AddProcedure(c,nil,3,2,nil,nil,99) + Xyz.AddProcedure(c,nil,3,2,nil,nil,Xyz.InfiniteMats) --Your "Goblin" monsters can attack directly local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -77,4 +77,4 @@ function s.negatkop(e,tp,eg,ep,ev,re,r,rp) if Duel.RemoveOverlayCard(tp,1,1,1,1,REASON_EFFECT)>0 then Duel.NegateAttack() end -end \ No newline at end of file +end diff --git a/official/c45935145.lua b/official/c45935145.lua index d6ebc1a846..0fa715cfce 100644 --- a/official/c45935145.lua +++ b/official/c45935145.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,6,2,nil,nil,99) + Xyz.AddProcedure(c,nil,6,2,nil,nil,Xyz.InfiniteMats) --Increase ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -85,4 +85,4 @@ function s.efop(e,tp,eg,ep,ev,re,r,rp) Duel.SSet(tp,tc) end end -end \ No newline at end of file +end diff --git a/official/c46014517.lua b/official/c46014517.lua index bd94dccb8d..20bcd3ed19 100644 --- a/official/c46014517.lua +++ b/official/c46014517.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 6 monsters - Xyz.AddProcedure(c,nil,6,2,nil,nil,99) + Xyz.AddProcedure(c,nil,6,2,nil,nil,Xyz.InfiniteMats) --Attach face-up monsters your opponent controls up to the number of "Goblin" monsters you control to this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -68,4 +68,4 @@ function s.tgop(e,tp,eg,ep,ev,re,r,rp) if #tg>0 then Duel.SendtoGrave(tg,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c47195442.lua b/official/c47195442.lua index 1145e50425..e537373cf7 100644 --- a/official/c47195442.lua +++ b/official/c47195442.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) --Unaffected by other cards' effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -57,4 +57,4 @@ function s.atchop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(dg,REASON_EFFECT) end end -end \ No newline at end of file +end diff --git a/official/c48608796.lua b/official/c48608796.lua index 1c63c3fd4c..54ccf410b1 100644 --- a/official/c48608796.lua +++ b/official/c48608796.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,1,2,nil,nil,99) + Xyz.AddProcedure(c,nil,1,2,nil,nil,Xyz.InfiniteMats) --ATK Up local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) diff --git a/official/c53054164.lua b/official/c53054164.lua index ff7e43d694..a7e89bb770 100644 --- a/official/c53054164.lua +++ b/official/c53054164.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) --Xyz Summon c:EnableReviveLimit() - Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_BEAST),2,2,nil,nil,99) + Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_BEAST),2,2,nil,nil,Xyz.InfiniteMats) --Your "Melffy" monsters can attack directly this turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -74,4 +74,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g:Select(tp,1,ft,nil),0,tp,tp,false,false,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/official/c58600555.lua b/official/c58600555.lua index e055a734b3..7ff94ad3c4 100644 --- a/official/c58600555.lua +++ b/official/c58600555.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,s.mfilter,5,2,s.ovfilter,aux.Stringid(id,2),99,s.xyzop) + Xyz.AddProcedure(c,s.mfilter,5,2,s.ovfilter,aux.Stringid(id,2),Xyz.InfiniteMats,s.xyzop) --Back to Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) @@ -65,7 +65,7 @@ function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) + if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_GRAVE,0,1,nil,RACE_INSECT) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) diff --git a/official/c58858807.lua b/official/c58858807.lua index 7140115d63..f28dd90670 100644 --- a/official/c58858807.lua +++ b/official/c58858807.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) --Add 1 "tellarknight" and/or 1 "Constellar" card from the GY to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -106,4 +106,4 @@ function s.applyop(e,tp,eg,ep,ev,re,r,rp) end e:SetLabel(0) e:SetLabelObject(nil) -end \ No newline at end of file +end diff --git a/official/c59071624.lua b/official/c59071624.lua index 4f1156859a..03f4d12797 100644 --- a/official/c59071624.lua +++ b/official/c59071624.lua @@ -6,7 +6,7 @@ local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) --Unaffected by trap effects while has material(s) attached local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -82,7 +82,7 @@ end --Detach 1 material as cost --Check for opponent's monster that sent there by your effect function s.cfilter(c,tp) - return c:IsMonster() and c:GetPreviousControler()==1-tp and c:IsPreviousLocation(LOCATION_MZONE) + return c:IsMonster() and c:GetPreviousControler()==1-tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==tp end --Check for opponent's sent monster in GY/banished @@ -110,4 +110,4 @@ function s.ssop(e,tp,eg,ep,ev,re,r,rp) if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c61307542.lua b/official/c61307542.lua index 223efe0303..02c5fa0d30 100644 --- a/official/c61307542.lua +++ b/official/c61307542.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure - Xyz.AddProcedure(c,nil,2,3,nil,nil,99) + Xyz.AddProcedure(c,nil,2,3,nil,nil,Xyz.InfiniteMats) --Unnafected by monsters' effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -83,4 +83,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c61641818.lua b/official/c61641818.lua index 704f551b45..9922a4b2c2 100644 --- a/official/c61641818.lua +++ b/official/c61641818.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,3,2,nil,nil,99,nil,false,s.xyzcheck) + Xyz.AddProcedure(c,nil,3,2,nil,nil,Xyz.InfiniteMats,nil,false,s.xyzcheck) --Cannot be target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -36,7 +36,7 @@ function s.ntcon(e) return e:GetHandler():GetOverlayCount()>0 end function s.discon(e,tp,eg,ep,ev,re,r,rp) - if rp==tp or e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) + if rp==tp or e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not re:IsMonsterEffect() or not Duel.IsChainNegatable(ev) then return false end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) if #g==0 then return false end @@ -49,4 +49,4 @@ function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateActivation(ev) -end \ No newline at end of file +end diff --git a/official/c62941499.lua b/official/c62941499.lua index 59c26a5b35..e8815eb768 100644 --- a/official/c62941499.lua +++ b/official/c62941499.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon - Xyz.AddProcedure(c,nil,8,2,nil,nil,99) + Xyz.AddProcedure(c,nil,8,2,nil,nil,Xyz.InfiniteMats) --Destroy cards adjacent to the selected zone local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) @@ -129,4 +129,4 @@ function s.banop(e,tp,eg,ep,ev,re,r,rp) end function s.retop(e,tp,eg,ep,ev,re,r,rp) Duel.ReturnToField(e:GetLabelObject()) -end \ No newline at end of file +end diff --git a/official/c62967433.lua b/official/c62967433.lua index 80aa9a5263..c4c7987197 100644 --- a/official/c62967433.lua +++ b/official/c62967433.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) --Place 1 Normal Trap in your GY on the bottom of the Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c64182380.lua b/official/c64182380.lua index 1b497b1040..3dcc6eeff0 100644 --- a/official/c64182380.lua +++ b/official/c64182380.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure - Xyz.AddProcedure(c,nil,8,2,nil,nil,99) + Xyz.AddProcedure(c,nil,8,2,nil,nil,Xyz.InfiniteMats) --Destroy all other monsters on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c67926903.lua b/official/c67926903.lua index c03f7cb7ef..bb66bb363d 100644 --- a/official/c67926903.lua +++ b/official/c67926903.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3+ Level 7 monsters OR 1 "Number C101" through "Number C107" - Xyz.AddProcedure(c,nil,7,3,s.ovfilter,aux.Stringid(id,0),99) + Xyz.AddProcedure(c,nil,7,3,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats) --Gains 1000 ATK for each Xyz material it has local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -88,4 +88,4 @@ function s.resettop(e,tp,eg,ep,ev,re,r,rp) e1:Reset() Duel.HintSelection(Group.FromCards(c)) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) -end \ No newline at end of file +end diff --git a/official/c6906306.lua b/official/c6906306.lua index 4f827818ca..62718c2db2 100644 --- a/official/c6906306.lua +++ b/official/c6906306.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 9 monsters - Xyz.AddProcedure(c,nil,9,2,nil,nil,99) + Xyz.AddProcedure(c,nil,9,2,nil,nil,Xyz.InfiniteMats) --If this card would be destroyed, you can detach 1 material from this card instead local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) @@ -95,4 +95,4 @@ end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.NegateEffect(ev) -end \ No newline at end of file +end diff --git a/official/c69757518.lua b/official/c69757518.lua index feecbea758..b324fab321 100644 --- a/official/c69757518.lua +++ b/official/c69757518.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,6,3,nil,nil,99) + Xyz.AddProcedure(c,nil,6,3,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --atk local e1=Effect.CreateEffect(c) @@ -59,7 +59,7 @@ function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end - if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) + if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,2,2,nil) diff --git a/official/c70597485.lua b/official/c70597485.lua index 0b1c11c067..18db65bd78 100644 --- a/official/c70597485.lua +++ b/official/c70597485.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,3,2,nil,nil,99) + Xyz.AddProcedure(c,nil,3,2,nil,nil,Xyz.InfiniteMats) --Increase ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -78,4 +78,4 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end -end \ No newline at end of file +end diff --git a/official/c70636044.lua b/official/c70636044.lua index f89216d553..587de791f3 100644 --- a/official/c70636044.lua +++ b/official/c70636044.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,10,2,nil,nil,99) + Xyz.AddProcedure(c,nil,10,2,nil,nil,Xyz.InfiniteMats) --Negate the activation of a card or effect, then destroy 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -89,4 +89,4 @@ end function s.xyzdescon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsXyzSummoned() -end \ No newline at end of file +end diff --git a/official/c71100270.lua b/official/c71100270.lua index 9255d889ab..dd24137171 100644 --- a/official/c71100270.lua +++ b/official/c71100270.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --2+ Level 6 monsters - Xyz.AddProcedure(c,nil,6,2,nil,nil,99) + Xyz.AddProcedure(c,nil,6,2,nil,nil,Xyz.InfiniteMats) --Detach 2 materials from a monster(s) on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -90,4 +90,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.BreakEffect() Duel.Overlay(c,g) end -end \ No newline at end of file +end diff --git a/official/c71166481.lua b/official/c71166481.lua index 253e8dfeba..a720138752 100644 --- a/official/c71166481.lua +++ b/official/c71166481.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,3,2,nil,nil,7) + Xyz.AddProcedure(c,nil,3,2,nil,nil,Xyz.InfiniteMats) --Change effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c72409226.lua b/official/c72409226.lua index e69fadf9b1..28dda806dc 100644 --- a/official/c72409226.lua +++ b/official/c72409226.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 3 monsters - Xyz.AddProcedure(c,nil,3,2,nil,nil,99) + Xyz.AddProcedure(c,nil,3,2,nil,nil,Xyz.InfiniteMats) --Special Summon 1 "Materiactor" monster from your Deck, OR add 1 "Materiactor" Spell/Trap from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -84,4 +84,4 @@ function s.xyzthop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(rthg,nil,REASON_EFFECT) end end -end \ No newline at end of file +end diff --git a/official/c72971064.lua b/official/c72971064.lua index 20b6cecedf..8e39571436 100644 --- a/official/c72971064.lua +++ b/official/c72971064.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Procedure: 2+ Level 1 monsters - Xyz.AddProcedure(c,nil,1,2,nil,nil,99) + Xyz.AddProcedure(c,nil,1,2,nil,nil,Xyz.InfiniteMats) --This card gains 500 ATK for each material attached to it local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) diff --git a/official/c73082255.lua b/official/c73082255.lua index 0ba0fd6fd9..092b8e2832 100644 --- a/official/c73082255.lua +++ b/official/c73082255.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,8,2,nil,nil,99) + Xyz.AddProcedure(c,nil,8,2,nil,nil,Xyz.InfiniteMats) --lv change local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -73,4 +73,4 @@ function s.gyop(e,tp,eg,ep,ev,re,r,rp) local sg=og:FilterSelect(tp,s.spfilter,1,1,nil,e,tp) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c73542331.lua b/official/c73542331.lua index 51bc373891..8e9f3e4a24 100644 --- a/official/c73542331.lua +++ b/official/c73542331.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) --Xyz Summon - Xyz.AddProcedure(c,nil,7,2,nil,nil,99) + Xyz.AddProcedure(c,nil,7,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --Special Summon 1 "Kshatri-la" monster from the Deck local e1=Effect.CreateEffect(c) @@ -90,4 +90,4 @@ function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) c:RemoveOverlayCard(tp,1,1,REASON_EFFECT) return true else return false end -end \ No newline at end of file +end diff --git a/official/c74615388.lua b/official/c74615388.lua index 0c872919c4..e5c3b7ebd2 100644 --- a/official/c74615388.lua +++ b/official/c74615388.lua @@ -6,7 +6,7 @@ function s.initial_effect(c) c:EnableReviveLimit() c:SetUniqueOnField(1,0,id) --Xyz Summon procedure: 2+ Level 9 monsters - Xyz.AddProcedure(c,nil,9,2,nil,nil,99) + Xyz.AddProcedure(c,nil,9,2,nil,nil,Xyz.InfiniteMats) --Decrease ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -72,4 +72,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.BreakEffect() Duel.Overlay(tc,g,true) end -end \ No newline at end of file +end diff --git a/official/c7511613.lua b/official/c7511613.lua index 185bb02db4..cd096d26a3 100644 --- a/official/c7511613.lua +++ b/official/c7511613.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 4 monsters - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) --For each material attached to this card, monsters you control gain 100 ATK and monsters your opponent controls lose 100 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -75,4 +75,4 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.ConfirmCards(1-tp,thg) end end -end \ No newline at end of file +end diff --git a/official/c76833149.lua b/official/c76833149.lua index 8432878765..a731f53a1a 100644 --- a/official/c76833149.lua +++ b/official/c76833149.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) --Xyz Summon c:EnableReviveLimit() - Xyz.AddProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_BEAST),2,2,nil,nil,99) + Xyz.AddProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_BEAST),2,2,nil,nil,Xyz.InfiniteMats) --Attach material local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c78144171.lua b/official/c78144171.lua index fd48fb8031..48864c20c4 100644 --- a/official/c78144171.lua +++ b/official/c78144171.lua @@ -6,7 +6,7 @@ function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,7,2,s.ovfilter,aux.Stringid(id,0),99,s.xyzop) + Xyz.AddProcedure(c,nil,7,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --Destroy 1 opponent's card, then banish 1 card from your GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) @@ -60,4 +60,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) -end \ No newline at end of file +end diff --git a/official/c78876707.lua b/official/c78876707.lua index 556b38bc99..e738d05fbf 100644 --- a/official/c78876707.lua +++ b/official/c78876707.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure - Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_NOBLE_KNIGHT),4,2,nil,nil,7) + Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_NOBLE_KNIGHT),4,2,nil,nil,Xyz.InfiniteMats) --Return cards to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -81,4 +81,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Overlay(sc,c) end end -end \ No newline at end of file +end diff --git a/official/c80993256.lua b/official/c80993256.lua index dc041d8c64..b80f68a11f 100644 --- a/official/c80993256.lua +++ b/official/c80993256.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,3,3,nil,nil,99) + Xyz.AddProcedure(c,nil,3,3,nil,nil,Xyz.InfiniteMats) --Multiple attacks local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) @@ -68,4 +68,4 @@ function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c8387138.lua b/official/c8387138.lua index 8e40f85f72..9f4c098536 100644 --- a/official/c8387138.lua +++ b/official/c8387138.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --destroy local e1=Effect.CreateEffect(c) diff --git a/official/c8491961.lua b/official/c8491961.lua index aece475e21..c56db3d31f 100644 --- a/official/c8491961.lua +++ b/official/c8491961.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,1,2,nil,nil,99) + Xyz.AddProcedure(c,nil,1,2,nil,nil,Xyz.InfiniteMats) --ATK Up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c85004150.lua b/official/c85004150.lua index 7f5db49926..68b940e8e9 100644 --- a/official/c85004150.lua +++ b/official/c85004150.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,s.mfilter,7,2,s.ovfilter,aux.Stringid(id,0),99,s.xyzop) + Xyz.AddProcedure(c,s.mfilter,7,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --destroy local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) diff --git a/official/c85692042.lua b/official/c85692042.lua index d021caae1c..4c692b12b3 100644 --- a/official/c85692042.lua +++ b/official/c85692042.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,4,2,nil,nil,99) + Xyz.AddProcedure(c,nil,4,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --search local e1=Effect.CreateEffect(c) @@ -62,7 +62,7 @@ function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(id,1)) elseif sel==3 then Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(id,2)) - else + else Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(id,3)) end e:SetLabel(sel) @@ -74,7 +74,7 @@ function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) s.mmtg(e,tp,eg,ep,ev,re,r,rp,chk) elseif sel==3 then s.l4tg(e,tp,eg,ep,ev,re,r,rp,chk) - else + else s.sttg(e,tp,eg,ep,ev,re,r,rp,chk) end end @@ -84,7 +84,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) s.mmop(e,tp,eg,ep,ev,re,r,rp) elseif sel==3 then s.l4op(e,tp,eg,ep,ev,re,r,rp) - else + else s.stop(e,tp,eg,ep,ev,re,r,rp) end end diff --git a/official/c88581108.lua b/official/c88581108.lua index 6ee2d1dac4..688641714b 100644 --- a/official/c88581108.lua +++ b/official/c88581108.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --Xyz Summon - Xyz.AddProcedure(c,nil,9,2,nil,nil,99) + Xyz.AddProcedure(c,nil,9,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --Attribute change and prevent effect activation local e1=Effect.CreateEffect(c) diff --git a/official/c90126061.lua b/official/c90126061.lua index 0e537533c6..6703ecc093 100644 --- a/official/c90126061.lua +++ b/official/c90126061.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,5,2,nil,nil,99) + Xyz.AddProcedure(c,nil,5,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --atk local e1=Effect.CreateEffect(c) @@ -84,4 +84,4 @@ function s.retop(e,tp,eg,ep,ev,re,r,rp) if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c90664857.lua b/official/c90664857.lua index 9af552cffc..c28655f86e 100644 --- a/official/c90664857.lua +++ b/official/c90664857.lua @@ -6,7 +6,7 @@ function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Xyz summon procedure - Xyz.AddProcedure(c,nil,3,2,nil,nil,99) + Xyz.AddProcedure(c,nil,3,2,nil,nil,Xyz.InfiniteMats) --Targeted monster cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -69,4 +69,4 @@ function s.rmop(e,tp,eg,ep,ev,re,r,rp) if tc and tc:IsRelateToBattle() and tc:IsControler(1-tp) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c9272381.lua b/official/c9272381.lua index f388ab08f8..f5f72f64d8 100644 --- a/official/c9272381.lua +++ b/official/c9272381.lua @@ -3,7 +3,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT),5,3,s.ovfilter,aux.Stringid(id,0),99) + Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT),5,3,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats) c:EnableReviveLimit() -- local e1=Effect.CreateEffect(c) @@ -46,7 +46,7 @@ function s.initial_effect(c) c:RegisterEffect(e4,false,REGISTER_FLAG_DETACH_XMAT) end function s.ovfilter(c,tp,xyzc) - return c:IsFaceup() and c:IsSetCard(SET_TELLARKNIGHT,xyzc,SUMMON_TYPE_XYZ,tp) and c:IsType(TYPE_XYZ,xyzc,SUMMON_TYPE_XYZ,tp) + return c:IsFaceup() and c:IsSetCard(SET_TELLARKNIGHT,xyzc,SUMMON_TYPE_XYZ,tp) and c:IsType(TYPE_XYZ,xyzc,SUMMON_TYPE_XYZ,tp) and not c:IsSummonCode(xyzc,SUMMON_TYPE_XYZ,tp,id) and Duel.IsPhase(PHASE_MAIN2) end function s.effcon(e) @@ -66,4 +66,4 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c9453320.lua b/official/c9453320.lua index 15140b76ac..561d1d8bf7 100644 --- a/official/c9453320.lua +++ b/official/c9453320.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 7 WATER monsters - Xyz.AddProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER),7,2,nil,nil,99) + Xyz.AddProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER),7,2,nil,nil,Xyz.InfiniteMats) --WATER monsters you control gain 300 ATK/DEF for each material attached to this card local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -71,4 +71,4 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp) if #g>0 then Duel.SSet(tp,g) end -end \ No newline at end of file +end diff --git a/official/c9486959.lua b/official/c9486959.lua index c03fa429d6..1598092718 100644 --- a/official/c9486959.lua +++ b/official/c9486959.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) --Xyz Summon - Xyz.AddProcedure(c,nil,2,2,nil,nil,99) + Xyz.AddProcedure(c,nil,2,2,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --Banish until the opponent's End Phase local e1=Effect.CreateEffect(c) diff --git a/official/c95134948.lua b/official/c95134948.lua index 4e135b5552..0d10703957 100644 --- a/official/c95134948.lua +++ b/official/c95134948.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,12,3,nil,nil,99,nil,false) + Xyz.AddProcedure(c,nil,12,3,nil,nil,Xyz.InfiniteMats) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) diff --git a/official/c95243515.lua b/official/c95243515.lua index 86428caa47..924804270b 100644 --- a/official/c95243515.lua +++ b/official/c95243515.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure - Xyz.AddProcedure(c,nil,9,2,nil,nil,99) + Xyz.AddProcedure(c,nil,9,2,nil,nil,Xyz.InfiniteMats) --Negate the effects of 2 monsters on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -83,4 +83,4 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp) tc:RegisterEffect(e2) end end -end \ No newline at end of file +end diff --git a/official/c9940036.lua b/official/c9940036.lua index faa902fdcb..f212a66545 100644 --- a/official/c9940036.lua +++ b/official/c9940036.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,9,2,nil,nil,99) + Xyz.AddProcedure(c,nil,9,2,nil,nil,Xyz.InfiniteMats) --Send 1 monster from the Extra Deck to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -73,7 +73,7 @@ function s.atchop(e,tp,eg,ep,ev,re,r,rp) local oct=#c:GetOverlayGroup() local ct=e:GetLabel() if oct==0 or oct0 then Duel.Overlay(c,tg) @@ -115,4 +115,4 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp) tc:RegisterEffect(e3) end end -end \ No newline at end of file +end diff --git a/unofficial/c511001363.lua b/unofficial/c511001363.lua index 1ec4d8a040..7b78fb445e 100644 --- a/unofficial/c511001363.lua +++ b/unofficial/c511001363.lua @@ -4,7 +4,7 @@ local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,7,3,nil,nil,99) + Xyz.AddProcedure(c,nil,7,3,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) diff --git a/unofficial/c511009002.lua b/unofficial/c511009002.lua index 5c460df470..58335d2b5d 100644 --- a/unofficial/c511009002.lua +++ b/unofficial/c511009002.lua @@ -6,7 +6,7 @@ function s.initial_effect(c) alias=c:GetOriginalCodeRule() --xyz summon c:EnableReviveLimit() - Xyz.AddProcedure(c,nil,10,2,nil,nil,99) + Xyz.AddProcedure(c,nil,10,2,nil,nil,Xyz.InfiniteMats) --Gain LP local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(alias,0)) diff --git a/unofficial/c511010205.lua b/unofficial/c511010205.lua index bb9a1a1ae4..b02ebcce1f 100644 --- a/unofficial/c511010205.lua +++ b/unofficial/c511010205.lua @@ -5,7 +5,7 @@ Duel.LoadCardScript("c69757518.lua") local s,id=GetID() function s.initial_effect(c) --xyz summon - Xyz.AddProcedure(c,nil,6,3,nil,nil,99) + Xyz.AddProcedure(c,nil,6,3,nil,nil,Xyz.InfiniteMats) c:EnableReviveLimit() --Rank Up Check aux.EnableCheckRankUp(c,nil,nil,90126061) From ad2415ba75e5d2380d46fd1be207f70b2bc85d9e Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Sun, 14 Apr 2024 20:14:32 +0200 Subject: [PATCH 14/19] Xyz proc: Reorder functions --- proc_xyz.lua | 96 +++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index 5b73e43a50..989eb30eda 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -117,12 +117,55 @@ function Xyz.CheckValidMultiXyzMaterial(effs,xyz) end return false end +function Xyz.MatNumChk(matct,ct,comp) + if (comp&0x1)==0x1 and matct>ct then return true end + if (comp&0x2)==0x2 and matct==ct then return true end + if (comp&0x4)==0x4 and matct>16)&0xffff + if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then return false end + end + end + return true +end +function Xyz.MatNumChkF2(tg,lv,xyz) + for chkc in tg:Iter() do + local rev={} + for _,te in ipairs({chkc:GetCardEffect(EFFECT_SATELLARKNIGHT_CAPELLA)}) do + local rct=te:GetValue()&0xffff + local comp=(te:GetValue()>>16)&0xffff + if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then + local con=te:GetLabelObject():GetCondition() + if not con then con=aux.TRUE end + if not rev[te] then + table.insert(rev,te) + rev[te]=con + te:GetLabelObject():SetCondition(aux.FALSE) + end + end + end + if #rev>0 then + local islv=chkc:IsXyzLevel(xyz,lv) + for _,te in ipairs(rev) do + local con=rev[te] + te:GetLabelObject():SetCondition(con) + end + if not islv then return false end + end + end + return true +end function Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) if not matg:Includes(mustg) then return false end - if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) and not Xyz.MatNumChkF(matg) then + if not Xyz.MatNumChkF(matg) then return false end - if lv and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) and not Xyz.MatNumChkF2(matg,lv,xyz) then + if lv and not Xyz.MatNumChkF2(matg,lv,xyz) then return false end if exchk and #matg>0 and not exchk(matg,tp,xyz) then @@ -130,9 +173,8 @@ function Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv) end if xyz:IsLocation(LOCATION_EXTRA) then return Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0 - else - return Duel.GetMZoneCount(tp,matg,tp)>0 end + return Duel.GetMZoneCount(tp,matg,tp)>0 end function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) local addToMatg=true @@ -206,52 +248,6 @@ function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbem mg:Merge(rg) return res end -function Xyz.MatNumChkF(tg) - local chkg=tg:Filter(Card.IsHasEffect,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) - for chkc in aux.Next(chkg) do - for _,te in ipairs({chkc:GetCardEffect(EFFECT_STAR_SERAPH_SOVEREIGNTY)}) do - local rct=te:GetValue()&0xffff - local comp=te:GetValue()>>16 - if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then return false end - end - end - return true -end -function Xyz.MatNumChk(matct,ct,comp) - local ok=false - if not ok and comp&0x1==0x1 and matct>ct then ok=true end - if not ok and comp&0x2==0x2 and matct==ct then ok=true end - if not ok and comp&0x4==0x4 and matct>16 - if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then - local con=te:GetLabelObject():GetCondition() - if not con then con=aux.TRUE end - if not rev[te] then - table.insert(rev,te) - rev[te]=con - te:GetLabelObject():SetCondition(aux.FALSE) - end - end - end - if #rev>0 then - local islv=chkc:IsXyzLevel(xyz,lv) - for _,te in ipairs(rev) do - local con=rev[te] - te:GetLabelObject():SetCondition(con) - end - if not islv then return false end - end - end - return true -end function Auxiliary.HarmonizingMagFilterXyz(c,e,f) return not f or f(e,c) or c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) or c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end From dad869c26b3200ae990af63a3b22e4379e22f594 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Sun, 19 May 2024 11:26:48 +0200 Subject: [PATCH 15/19] Xyz proc: Add count limit support to EFFECT_DOUBLE_XYZ_MATERIAL Also reapply 27b135c829b762de847ecf450824893057c16f8d --- official/c60268386.lua | 24 ++----------- official/c81096431.lua | 26 ++------------ proc_xyz.lua | 78 ++++++++++++++++++++++++------------------ 3 files changed, 50 insertions(+), 78 deletions(-) diff --git a/official/c60268386.lua b/official/c60268386.lua index 9be705b55a..3da5347821 100644 --- a/official/c60268386.lua +++ b/official/c60268386.lua @@ -1,7 +1,6 @@ --紋章獣グリフォン --Heraldic Beast Gryphon --scripted by Naim -local EFFECT_DOUBLE_XYZ_MATERIAL=511001225 --to be removed when the procedure is updated local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand @@ -20,18 +19,9 @@ function s.initial_effect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DOUBLE_XYZ_MATERIAL) e2:SetValue(1) - e2:SetCondition(function(e) return not Duel.HasFlagEffect(e:GetHandlerPlayer(),id) end) - e2:SetOperation(function(e,c,matg) return c:IsSetCard(SET_NUMBER) and c.minxyzct and c.minxyzct>=3 and matg:FilterCount(s.gryphonhoptfilter,nil)<2 end) + e2:SetCountLimit(1,{id,1}) + e2:SetOperation(function(e,c) return c.minxyzct and c.minxyzct>=3 and c:IsSetCard(SET_NUMBER) end) c:RegisterEffect(e2) - --HOPT workaround for having already used the double material effect earlier in that turn - aux.GlobalCheck(s,function() - local ge1=Effect.CreateEffect(c) - ge1:SetType(EFFECT_TYPE_FIELD) - ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE) - ge1:SetCode(EFFECT_MATERIAL_CHECK) - ge1:SetValue(s.valcheck) - Duel.RegisterEffect(ge1,0) - end) end s.listed_series={SET_HERALDIC_BEAST} s.listed_names={id} @@ -76,13 +66,3 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end -function s.gryphonhoptfilter(c) - return c:IsCode(id) and c:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) -end -function s.valcheck(e,c) - if not (c:IsType(TYPE_XYZ) and c:IsSetCard(SET_NUMBER) and c.minxyzct and c.minxyzct>=3) then return end - local g=c:GetMaterial() - if #g=3 and matg:FilterCount(s.drakesharkhoptfilter,nil)<2 end) + e2:SetCountLimit(1,{id,1}) + e2:SetOperation(function(e,c) return c.minxyzct and c.minxyzct>=3 and c:IsAttribute(ATTRIBUTE_WATER) end) c:RegisterEffect(e2) --Provide an effect to a "Shark Drake" Xyz Monster that this card as Xyz material local e3=Effect.CreateEffect(c) @@ -35,27 +34,8 @@ function s.initial_effect(c) e3:SetTarget(s.attachtg) e3:SetOperation(s.attachop) c:RegisterEffect(e3) - --HOPT workaround for having already used the double material effect earlier in that turn - aux.GlobalCheck(s,function() - local ge1=Effect.CreateEffect(c) - ge1:SetType(EFFECT_TYPE_FIELD) - ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE) - ge1:SetCode(EFFECT_MATERIAL_CHECK) - ge1:SetValue(s.valcheck) - Duel.RegisterEffect(ge1,0) - end) end s.listed_series={SET_SHARK_DRAKE} -function s.drakesharkhoptfilter(c) - return c:IsCode(id) and c:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL) -end -function s.valcheck(e,c) - if not (c:IsType(TYPE_XYZ) and c:IsAttribute(ATTRIBUTE_WATER) and c.minxyzct and c.minxyzct>=3) then return end - local g=c:GetMaterial() - if #g0 @@ -84,4 +64,4 @@ function s.attachop(e,tp,eg,ep,ev,re,r,rp) if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and c:IsType(TYPE_XYZ) then Duel.Overlay(c,tc) end -end \ No newline at end of file +end diff --git a/proc_xyz.lua b/proc_xyz.lua index 989eb30eda..94d15abc41 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -110,10 +110,10 @@ function Xyz.SubMatFilter(c,lv,xyz,tp) end return true end -function Xyz.CheckValidMultiXyzMaterial(effs,xyz) +function Xyz.CheckValidMultiXyzMaterial(effs,xyz,matg) for i,te in ipairs(effs) do local tgf=te:GetOperation() - if not tgf or tgf(te,xyz) then return true end + if not tgf or tgf(te,xyz,matg) then return true end end return false end @@ -224,15 +224,16 @@ function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbem if mg:IsExists(Xyz.RecursionChk,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) then return true end if not mustbemat then local retchknum={} - for i,te in ipairs({c:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)}) do + for i,te in ipairs({c:IsHasEffect(EFFECT_DOUBLE_XYZ_MATERIAL,tp)}) do local tgf=te:GetOperation() local val=te:GetValue() - if val>0 and not retchknum[val] and (not maxc or xmatct+val<=maxc) and (not tgf or tgf(te,xyz)) then + if val>0 and not retchknum[val] and (not maxc or xmatct+val<=maxc) and (not tgf or tgf(te,xyz,matg)) then retchknum[val]=true - if (xct+val>=min and xmatct+val>=minc and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv)) - or mg:IsExists(Xyz.RecursionChk,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) then - return true - end + te:UseCountLimit(tp) + local chk=(xct+val>=min and xmatct+val>=minc and Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv)) + or mg:IsExists(Xyz.RecursionChk,1,sg,mg,xyz,tp,min,max,minc,maxc,sg,matg,xct,xmatct+val,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) + te:RestoreCountLimit(tp) + if chk then return true end end end end @@ -345,7 +346,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) min=min or 0 local matg=Group.CreateGroup() local sg=Group.CreateGroup() - local tab={} + local multiXyzSelectedCards={} local finishable=false while true do local ct=#matg @@ -365,37 +366,46 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) if equips_inverse and equips_inverse[sc] then mg:Merge(equips_inverse[sc]) end - local multiXyz={sc:GetCardEffect(EFFECT_DOUBLE_XYZ_MATERIAL)} - if #multiXyz>0 and Xyz.CheckValidMultiXyzMaterial(multiXyz,c) and ct0 and Xyz.CheckValidMultiXyzMaterial(multiXyz,c,matg) and ct0 and (not tgf or tgf(te,c)) then + if val>0 and (not tgf or tgf(te,c,matg)) then local newCount=matct+1+val - if (minc<=newCount and newCount<=maxc) - or mg:IsExists(Xyz.RecursionChk,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct,newCount,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) then - table.insert(multi,1+val) + te:UseCountLimit(tp) + local chk=(minc<=newCount and newCount<=maxc) + or mg:IsExists(Xyz.RecursionChk,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct+1,newCount,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) + if chk then + if not multi[1+val] then + multi[1+val]={} + end + table.insert(multi[1+val],te) end + te:RestoreCountLimit(tp) end end - if #multi==1 then - if multi[1]>1 then - extra_mats=extra_mats+multi[1]-1 - tab[sc]=multi[1] + local availableNumbers={} + for k in ipairs(multi) do + table.insert(availableNumbers,k) + end + if #availableNumbers>0 then + local chosen=availableNumbers[1] + if #availableNumbers~=1 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) + chosen=Duel.AnnounceNumber(tp,availableNumbers) end - else - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local num=Duel.AnnounceNumber(tp,table.unpack(multi)) - if num>1 then - extra_mats=extra_mats+num-1 - tab[sc]=num + if chosen>1 then + local eff=multi[chosen][1] + extra_mats=extra_mats+chosen-1 + eff:UseCountLimit(tp) + multiXyzSelectedCards[sc]={eff,chosen} end end elseif sc:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) then @@ -416,9 +426,11 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) extra_mats=extra_mats-1 else matg:RemoveCard(sc) - local num=tab[sc] - if num then - tab[sc]=nil + local multiXyzSelection=multiXyzSelectedCards[sc] + if multiXyzSelection then + multiXyzSelectedCards[sc]=nil + local eff,num=table.unpack(multiXyzSelection) + eff:RestoreCountLimit(tp) extra_mats=extra_mats-(num-1) end end From da374771238486aeded3816226de0c810ae26c86 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Tue, 14 Jan 2025 22:31:52 +0100 Subject: [PATCH 16/19] Xyz proc: Fix material selection if the first selected card had EFFECT_DOUBLE_XYZ_MATERIAL --- proc_xyz.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index 94d15abc41..811afa389a 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -392,12 +392,13 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) end end local availableNumbers={} - for k in ipairs(multi) do + for k in pairs(multi) do table.insert(availableNumbers,k) end if #availableNumbers>0 then local chosen=availableNumbers[1] if #availableNumbers~=1 then + table.sort(availableNumbers) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) chosen=Duel.AnnounceNumber(tp,availableNumbers) end From 2cc71942eb2df8150259c30befc96ec1e56a68c4 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Tue, 14 Jan 2025 22:46:04 +0100 Subject: [PATCH 17/19] Xyz proc: Fix forced material selection being skipped if cards with EFFECT_DOUBLE_XYZ_MATERIAL were selected --- proc_xyz.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index 811afa389a..e9af60bf9b 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -380,7 +380,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk) if val>0 and (not tgf or tgf(te,c,matg)) then local newCount=matct+1+val te:UseCountLimit(tp) - local chk=(minc<=newCount and newCount<=maxc) + local chk=(minc<=newCount and newCount<=maxc and sg:Includes(mustg)) or mg:IsExists(Xyz.RecursionChk,1,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct+1,newCount,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse) if chk then if not multi[1+val] then From 631c9aa590626ffc3c73eb72237fd973c5447136 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Sat, 19 Apr 2025 10:46:59 +0200 Subject: [PATCH 18/19] Xyz proc: deprecate usage of 99 as "infinite mats" --- proc_xyz.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/proc_xyz.lua b/proc_xyz.lua index e9af60bf9b..99d1b5184e 100644 --- a/proc_xyz.lua +++ b/proc_xyz.lua @@ -5,10 +5,8 @@ end if not Xyz then Xyz = aux.XyzProcedure end --- TODO: Update when we make using '99' deprecated --- local infToken={} --- Xyz.InfiniteMats=infToken -Xyz.InfiniteMats=99 +local infToken={} +Xyz.InfiniteMats=infToken Xyz.ProcCancellable=false function Xyz.EffectXyzMaterialChk(c,xyz,tp) local eff_xyzmat={c:GetCardEffect(EFFECT_XYZ_MATERIAL)} @@ -33,12 +31,11 @@ function Xyz.AddProcedure(c,f,lv,ct,alterf,desc,maxct,op,mustbemat,exchk) --exchk for special xyz, checking other materials --mustbemat for Startime Magician if not maxct then maxct=ct end - -- TODO: Update when we make using '99' deprecated - --[[if maxct==99 then + if maxct==99 then maxct=Xyz.InfiniteMats Debug.PrintStacktrace() Debug.Message("Using 99 to represent any number of Xyz materials is deprecated, use the value Xyz.InfiniteMats instead") - end--]] + end if c.xyz_filter==nil then local mt=c:GetMetatable() mt.xyz_filter=function(mc,ignoretoken,xyz,tp) return mc and (not f or f(mc,xyz,SUMMON_TYPE_XYZ|MATERIAL_XYZ,tp)) and (not lv or mc:IsXyzLevel(c,lv)) and (not mc:IsType(TYPE_TOKEN) or ignoretoken) end From ddbbd3b1854253dd3d7f93a6b8b519d6ad059f4d Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Sat, 19 Apr 2025 10:51:11 +0200 Subject: [PATCH 19/19] Update new cards not using the Xyz.InfiniteMats constant --- pre-release/c101301046.lua | 4 ++-- pre-release/c101301047.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pre-release/c101301046.lua b/pre-release/c101301046.lua index ce0c4a6066..d67eceb3a6 100644 --- a/pre-release/c101301046.lua +++ b/pre-release/c101301046.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 4 "Vanquish Soul" monsters - Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_VANQUISH_SOUL),4,2,s.ovfilter,aux.Stringid(id,0),99,s.xyzop) + Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_VANQUISH_SOUL),4,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --All monsters your opponent controls lose 800 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) @@ -77,4 +77,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/pre-release/c101301047.lua b/pre-release/c101301047.lua index cd7656884c..c9088c6131 100644 --- a/pre-release/c101301047.lua +++ b/pre-release/c101301047.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 6 monsters OR 1 Rank 5 or 7 Xyz Monster you control - Xyz.AddProcedure(c,nil,6,2,s.ovfilter,aux.Stringid(id,0),99,s.xyzop) + Xyz.AddProcedure(c,nil,6,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --Cannot be used as material for an Xyz Summon the turn it was Xyz Summoned local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) @@ -57,4 +57,4 @@ function s.detachop(e,tp,eg,ep,ev,re,r,rp) if c:IsRelateToEffect(e) and c:GetOverlayCount()>0 then c:RemoveOverlayCard(tp,1,1,REASON_EFFECT) end -end \ No newline at end of file +end