Skip to content

Commit

Permalink
Xyz procedure update
Browse files Browse the repository at this point in the history
Rudimentary handling for HOPT on double Xyz Material effects.
  • Loading branch information
pyrQ authored May 17, 2024
1 parent 36c2fd2 commit 27b135c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions proc_xyz.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ 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)
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
local te=eff[i]
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
Expand Down Expand Up @@ -195,7 +195,7 @@ function Xyz.RecursionChk1(c,mg,xyz,tp,min,max,minc,maxc,sg,matg,ct,matct,mustbe
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 not redun and val>0 and (not tgf or tgf(te,xyz,matg)) 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
Expand Down Expand Up @@ -301,7 +301,7 @@ 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)) and not redun then
if val>0 and (not tgf or tgf(te,xyz,matg)) 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
Expand Down Expand Up @@ -463,7 +463,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk)
elseif sc:IsHasEffect(511001225) then
matg:AddCard(sc)
ct=ct+1
if not Xyz.CheckValidMultiXyzMaterial(sc,c) or (min>=ct and minc>=matct+1) then
if not Xyz.CheckValidMultiXyzMaterial(sc,c,matg) or (min>=ct and minc>=matct+1) then
matct=matct+1
else
local multi={}
Expand All @@ -475,7 +475,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk)
local te=eff[i]
local tgf=te:GetOperation()
local val=te:GetValue()
if val>0 and (not tgf or tgf(te,c)) then
if val>0 and (not tgf or tgf(te,c,matg)) 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)
Expand Down Expand Up @@ -580,7 +580,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk)
matg:AddCard(sc)
end
ct=ct+1
if Xyz.CheckValidMultiXyzMaterial(sc,c) and ct<minc then
if Xyz.CheckValidMultiXyzMaterial(sc,c,matg) and ct<minc then
local multi={}
if mg:IsExists(Xyz.RecursionChk2,1,sg,mg,c,tp,minc,maxc,sg,matg,ct,mustbemat,exchk,f,mustg,lv) then
table.insert(multi,1)
Expand All @@ -590,7 +590,7 @@ function Xyz.Target(f,lv,minc,maxc,mustbemat,exchk)
local te=eff[i]
local tgf=te:GetOperation()
local val=te:GetValue()
if val>0 and (not tgf or tgf(te,c)) then
if val>0 and (not tgf or tgf(te,c,matg)) 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)
Expand Down

0 comments on commit 27b135c

Please sign in to comment.