Commit 673accbe authored by mercury233's avatar mercury233 Committed by GitHub

xyz summon using alter mat can be canceled (#2044)

parent 45f4ef3e
...@@ -686,7 +686,8 @@ function Auxiliary.TuneMagicianCheckAdditionalX(ecode) ...@@ -686,7 +686,8 @@ function Auxiliary.TuneMagicianCheckAdditionalX(ecode)
end end
end end
function Auxiliary.XyzAlterFilter(c,alterf,xyzc,e,tp,alterop) function Auxiliary.XyzAlterFilter(c,alterf,xyzc,e,tp,alterop)
return alterf(c) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0 and Auxiliary.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and (not alterop or alterop(e,tp,0,c)) return alterf(c) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0
and Auxiliary.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and (not alterop or alterop(e,tp,0,c))
end end
--Xyz monster, lv k*n --Xyz monster, lv k*n
function Auxiliary.AddXyzProcedure(c,f,lv,ct,alterf,alterdesc,maxct,alterop) function Auxiliary.AddXyzProcedure(c,f,lv,ct,alterf,alterdesc,maxct,alterop)
...@@ -816,14 +817,19 @@ function Auxiliary.XyzTargetAlter(f,lv,minc,maxc,alterf,alterdesc,alterop) ...@@ -816,14 +817,19 @@ function Auxiliary.XyzTargetAlter(f,lv,minc,maxc,alterf,alterdesc,alterop)
else else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end end
local altg=mg:Filter(Auxiliary.XyzAlterFilter,nil,alterf,c,e,tp,alterop)
local b1=Duel.CheckXyzMaterial(c,f,lv,minc,maxc,og) local b1=Duel.CheckXyzMaterial(c,f,lv,minc,maxc,og)
local b2=(not min or min<=1) and mg:IsExists(Auxiliary.XyzAlterFilter,1,nil,alterf,c,e,tp,alterop) local b2=(not min or min<=1) and #altg>0
local g=nil local g=nil
local cancel=Duel.IsSummonCancelable()
if b2 and (not b1 or Duel.SelectYesNo(tp,alterdesc)) then if b2 and (not b1 or Duel.SelectYesNo(tp,alterdesc)) then
e:SetLabel(1) e:SetLabel(1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
g=mg:FilterSelect(tp,Auxiliary.XyzAlterFilter,1,1,nil,alterf,c,e,tp,alterop) local tc=altg:SelectUnselect(nil,tp,false,cancel,1,1)
if alterop then alterop(e,tp,1,g:GetFirst()) end if tc then
g=Group.FromCards(tc)
if alterop then alterop(e,tp,1,tc) end
end
else else
e:SetLabel(0) e:SetLabel(0)
g=Duel.SelectXyzMaterial(tp,c,f,lv,minc,maxc,og) g=Duel.SelectXyzMaterial(tp,c,f,lv,minc,maxc,og)
...@@ -1003,7 +1009,7 @@ function Auxiliary.XyzLevelFreeConditionAlter(f,gf,minct,maxct,alterf,alterdesc, ...@@ -1003,7 +1009,7 @@ function Auxiliary.XyzLevelFreeConditionAlter(f,gf,minct,maxct,alterf,alterdesc,
else else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end end
local altg=mg:Filter(Auxiliary.XyzAlterFilter,nil,alterf,c,e,tp,alterop):Filter(Auxiliary.MustMaterialCheck,nil,tp,EFFECT_MUST_BE_XMATERIAL) local altg=mg:Filter(Auxiliary.XyzAlterFilter,nil,alterf,c,e,tp,alterop)
if (not min or min<=1) and altg:GetCount()>0 then if (not min or min<=1) and altg:GetCount()>0 then
return true return true
end end
...@@ -1042,21 +1048,25 @@ function Auxiliary.XyzLevelFreeTargetAlter(f,gf,minct,maxct,alterf,alterdesc,alt ...@@ -1042,21 +1048,25 @@ function Auxiliary.XyzLevelFreeTargetAlter(f,gf,minct,maxct,alterf,alterdesc,alt
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end end
local sg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_XMATERIAL) local sg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_XMATERIAL)
local altg=mg:Filter(Auxiliary.XyzAlterFilter,nil,alterf,c,e,tp,alterop)
local mg2=mg:Filter(Auxiliary.XyzLevelFreeFilter,nil,c,f) local mg2=mg:Filter(Auxiliary.XyzLevelFreeFilter,nil,c,f)
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
local b1=mg2:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf) local b1=mg2:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf)
local b2=(not min or min<=1) and mg:IsExists(Auxiliary.XyzAlterFilter,1,nil,alterf,c,e,tp,alterop) local b2=(not min or min<=1) and #altg>0
local g=nil local g=nil
local cancel=Duel.IsSummonCancelable()
if b2 and (not b1 or Duel.SelectYesNo(tp,alterdesc)) then if b2 and (not b1 or Duel.SelectYesNo(tp,alterdesc)) then
e:SetLabel(1) e:SetLabel(1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
g=mg:FilterSelect(tp,Auxiliary.XyzAlterFilter,1,1,nil,alterf,c,e,tp,alterop) local tc=altg:SelectUnselect(nil,tp,false,cancel,1,1)
if alterop then alterop(e,tp,1,g:GetFirst()) end if tc then
g=Group.FromCards(tc)
if alterop then alterop(e,tp,1,tc) end
end
else else
e:SetLabel(0) e:SetLabel(0)
Duel.SetSelectedCard(sg) Duel.SetSelectedCard(sg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local cancel=Duel.IsSummonCancelable()
Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X) Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
g=mg2:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,cancel,minc,maxc,tp,c,gf) g=mg2:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,cancel,minc,maxc,tp,c,gf)
Auxiliary.GCheckAdditional=nil Auxiliary.GCheckAdditional=nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment