Skip to content

Commit cc85c7c

Browse files
committed
Xyz proc: update alternate xyz summon
1 parent 58732d2 commit cc85c7c

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

proc_xyz.lua

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Xyz.AlterFilter(c,alterf,xyzc,e,tp,op)
2121
if xyzc:IsLocation(LOCATION_EXTRA) then
2222
return Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0
2323
else
24-
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or c:GetSequence()<5
24+
return Duel.GetMZoneCount(tp,c,tp)>0
2525
end
2626
end
2727
--Xyz monster, lv k*n
@@ -452,35 +452,29 @@ function Xyz.Condition2(alterf,op)
452452
end
453453
function Xyz.Target2(alterf,op)
454454
return function(e,tp,eg,ep,ev,re,r,rp,chk,c,must,og,min,max)
455-
local cancel=not og and Duel.IsSummonCancelable()
456-
Xyz.ProcCancellable=cancel
457-
if og and not min then
458-
e:SetLabelObject(og:GetFirst())
459-
if op then op(e,tp,1,og:GetFirst()) end
460-
return true
455+
local cancelable=not og and Duel.IsSummonCancelable()
456+
Xyz.ProcCancellable=cancelable
457+
local mg=nil
458+
if og then
459+
mg=og
461460
else
462-
local mg=nil
463-
if og then
464-
mg=og
465-
else
466-
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,LOCATION_MZONE)
467-
end
468-
local mustg=Auxiliary.GetMustBeMaterialGroup(tp,og,tp,c,mg,REASON_XYZ)
469-
if must then mustg:Merge(must) end
470-
local oc
471-
if #mustg>0 then
472-
oc=mustg:GetFirst()
473-
else
474-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
475-
oc=mg:Filter(Xyz.AlterFilter,nil,alterf,c,e,tp,op):SelectUnselect(Group.CreateGroup(),tp,false,cancel)
476-
end
477-
if not oc then return false end
478-
local ok=true
479-
if op then ok=op(e,tp,1,oc) end
480-
if not ok then return false end
481-
e:SetLabelObject(oc)
482-
return true
461+
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,LOCATION_MZONE)
462+
end
463+
local mustg=Auxiliary.GetMustBeMaterialGroup(tp,og,tp,c,mg,REASON_XYZ)
464+
if must then mustg:Merge(must) end
465+
local oc
466+
if #mustg>0 then
467+
oc=mustg:GetFirst()
468+
else
469+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
470+
oc=mg:FilterSelect(tp,Xyz.AlterFilter,1,1,cancelable,nil,alterf,c,e,tp,op):GetFirst()
483471
end
472+
if not oc then return false end
473+
local ok=true
474+
if op then ok=op(e,tp,1,oc) end
475+
if not ok then return false end
476+
e:SetLabelObject(oc)
477+
return true
484478
end
485479
end
486480
function Xyz.Operation2(alterf,op)

0 commit comments

Comments
 (0)