Skip to content

Commit 1da3c90

Browse files
committed
Reorder functions
1 parent 8689419 commit 1da3c90

File tree

1 file changed

+46
-50
lines changed

1 file changed

+46
-50
lines changed

proc_xyz.lua

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,64 @@ function Xyz.CheckValidMultiXyzMaterial(effs,xyz)
113113
end
114114
return false
115115
end
116+
function Xyz.MatNumChk(matct,ct,comp)
117+
if (comp&0x1)==0x1 and matct>ct then return true end
118+
if (comp&0x2)==0x2 and matct==ct then return true end
119+
if (comp&0x4)==0x4 and matct<ct then return true end
120+
return false
121+
end
122+
function Xyz.MatNumChkF(tg)
123+
for chkc in tg:Iter() do
124+
for _,te in ipairs({chkc:GetCardEffect(EFFECT_STAR_SERAPH_SOVEREIGNTY)}) do
125+
local rct=te:GetValue()&0xffff
126+
local comp=(te:GetValue()>>16)&0xffff
127+
if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then return false end
128+
end
129+
end
130+
return true
131+
end
132+
function Xyz.MatNumChkF2(tg,lv,xyz)
133+
for chkc in tg:Iter() do
134+
local rev={}
135+
for _,te in ipairs({chkc:GetCardEffect(EFFECT_SATELLARKNIGHT_CAPELLA)}) do
136+
local rct=te:GetValue()&0xffff
137+
local comp=(te:GetValue()>>16)&0xffff
138+
if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then
139+
local con=te:GetLabelObject():GetCondition()
140+
if not con then con=aux.TRUE end
141+
if not rev[te] then
142+
table.insert(rev,te)
143+
rev[te]=con
144+
te:GetLabelObject():SetCondition(aux.FALSE)
145+
end
146+
end
147+
end
148+
if #rev>0 then
149+
local islv=chkc:IsXyzLevel(xyz,lv)
150+
for _,te in ipairs(rev) do
151+
local con=rev[te]
152+
te:GetLabelObject():SetCondition(con)
153+
end
154+
if not islv then return false end
155+
end
156+
end
157+
return true
158+
end
116159
function Xyz.CheckMaterialSet(matg,xyz,tp,exchk,mustg,lv)
117160
if not matg:Includes(mustg) then return false end
118-
if matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY) and not Xyz.MatNumChkF(matg) then
161+
if not Xyz.MatNumChkF(matg) then
119162
return false
120163
end
121-
if lv and matg:IsExists(Card.IsHasEffect,1,nil,EFFECT_SATELLARKNIGHT_CAPELLA) and not Xyz.MatNumChkF2(matg,lv,xyz) then
164+
if lv and not Xyz.MatNumChkF2(matg,lv,xyz) then
122165
return false
123166
end
124167
if exchk and #matg>0 and not exchk(matg,tp,xyz) then
125168
return false
126169
end
127170
if xyz:IsLocation(LOCATION_EXTRA) then
128171
return Duel.GetLocationCountFromEx(tp,tp,matg,xyz)>0
129-
else
130-
return Duel.GetMZoneCount(tp,matg,tp)>0
131172
end
173+
return Duel.GetMZoneCount(tp,matg,tp)>0
132174
end
133175
function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbemat,exchk,f,mustg,lv,eqmg,equips_inverse)
134176
local addToMatg=true
@@ -202,52 +244,6 @@ function Xyz.RecursionChk(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbem
202244
mg:Merge(rg)
203245
return res
204246
end
205-
function Xyz.MatNumChkF(tg)
206-
local chkg=tg:Filter(Card.IsHasEffect,nil,EFFECT_STAR_SERAPH_SOVEREIGNTY)
207-
for chkc in aux.Next(chkg) do
208-
for _,te in ipairs({chkc:GetCardEffect(EFFECT_STAR_SERAPH_SOVEREIGNTY)}) do
209-
local rct=te:GetValue()&0xffff
210-
local comp=te:GetValue()>>16
211-
if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then return false end
212-
end
213-
end
214-
return true
215-
end
216-
function Xyz.MatNumChk(matct,ct,comp)
217-
local ok=false
218-
if not ok and comp&0x1==0x1 and matct>ct then ok=true end
219-
if not ok and comp&0x2==0x2 and matct==ct then ok=true end
220-
if not ok and comp&0x4==0x4 and matct<ct then ok=true end
221-
return ok
222-
end
223-
function Xyz.MatNumChkF2(tg,lv,xyz)
224-
local chkg=tg:Filter(Card.IsHasEffect,nil,EFFECT_SATELLARKNIGHT_CAPELLA)
225-
for chkc in aux.Next(chkg) do
226-
local rev={}
227-
for _,te in ipairs({chkc:GetCardEffect(EFFECT_SATELLARKNIGHT_CAPELLA)}) do
228-
local rct=te:GetValue()&0xffff
229-
local comp=te:GetValue()>>16
230-
if not Xyz.MatNumChk(tg:FilterCount(Card.IsMonster,nil),rct,comp) then
231-
local con=te:GetLabelObject():GetCondition()
232-
if not con then con=aux.TRUE end
233-
if not rev[te] then
234-
table.insert(rev,te)
235-
rev[te]=con
236-
te:GetLabelObject():SetCondition(aux.FALSE)
237-
end
238-
end
239-
end
240-
if #rev>0 then
241-
local islv=chkc:IsXyzLevel(xyz,lv)
242-
for _,te in ipairs(rev) do
243-
local con=rev[te]
244-
te:GetLabelObject():SetCondition(con)
245-
end
246-
if not islv then return false end
247-
end
248-
end
249-
return true
250-
end
251247
function Auxiliary.HarmonizingMagFilterXyz(c,e,f)
252248
return not f or f(e,c) or c:IsHasEffect(EFFECT_ORICHALCUM_CHAIN) or c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT)
253249
end

0 commit comments

Comments
 (0)