Skip to content

Commit 6ddae97

Browse files
committed
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
1 parent cc85c7c commit 6ddae97

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

proc_xyz.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ end
55
if not Xyz then
66
Xyz = aux.XyzProcedure
77
end
8+
-- TODO: Update when we make using '99' deprecated
9+
-- local infToken={}
10+
-- Xyz.InfiniteMats=infToken
11+
Xyz.InfiniteMats=99
812
Xyz.ProcCancellable=false
913
function Xyz.EffectXyzMaterialChk(c,xyz,tp)
1014
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)
2933
--exchk for special xyz, checking other materials
3034
--mustbemat for Startime Magician
3135
if not maxct then maxct=ct end
36+
-- TODO: Update when we make using '99' deprecated
37+
--[[if maxct==99 then
38+
maxct=Xyz.InfiniteMats
39+
Debug.PrintStacktrace()
40+
Debug.Message("Using 99 to represent any number of Xyz materials is deprecated, use the value Xyz.InfiniteMats instead")
41+
end--]]
3242
if c.xyz_filter==nil then
3343
local mt=c:GetMetatable()
3444
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
155165
end
156166
end
157167
end
158-
if (max and xct>max) or (xmatct and xmatct>maxc) then mg:Merge(rg) return false end
168+
if (max and xct>max) or (maxc~=infToken and xmatct>maxc) then mg:Merge(rg) return false end
159169
if addToMatg then
160170
matg:AddCard(c)
161171
end
@@ -338,7 +348,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk)
338348
while true do
339349
local ct=#matg
340350
local matct=ct+extra_mats
341-
if not ((not max or #matg<max) and (not maxc or matct<maxc)) then break end
351+
if not ((not max or #matg<max) and (maxc==infToken or matct<maxc)) then break end
342352
local selg=mg:Filter(Xyz.RecursionChk,sg,mg,c,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse)
343353
if #selg==0 then break end
344354
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)

0 commit comments

Comments
 (0)