Commit 1703cd05 authored by nanahira's avatar nanahira Committed by mercury233

update alter xyz procedure (#894)

added the material as a parameter to support cards like No.21
parent 02669299
...@@ -2,16 +2,7 @@ ...@@ -2,16 +2,7 @@
function c57707471.initial_effect(c) function c57707471.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--xyz summon --xyz summon
local e1=Effect.CreateEffect(c) aux.AddXyzProcedure(c,nil,6,2,c57707471.ovfilter,aux.Stringid(57707471,0),2,c57707471.xyzop)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c57707471.xyzcon)
e1:SetTarget(c57707471.xyztg)
e1:SetOperation(c57707471.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
--atk --atk
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
...@@ -32,74 +23,12 @@ function c57707471.initial_effect(c) ...@@ -32,74 +23,12 @@ function c57707471.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
c57707471.xyz_number=21 c57707471.xyz_number=21
function c57707471.ovfilter(c,tp,xyzc) function c57707471.ovfilter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:GetRank()==5 and c:IsCanBeXyzMaterial(xyzc) return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:GetRank()==5
and c:CheckRemoveOverlayCard(tp,1,REASON_COST)
end end
function c57707471.xyzcon(e,c,og,min,max) function c57707471.xyzop(e,tp,chk,mc)
if c==nil then return true end if chk==0 then return mc:CheckRemoveOverlayCard(tp,1,REASON_COST) end
local tp=c:GetControler() mc:RemoveOverlayCard(tp,1,1,REASON_COST)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
if 2<=ct then return false end
if min and (min>2 or max<2) then return false end
local mg=nil
if og then
mg=og
else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
if ct<1 and (not min or min<=1) and mg:IsExists(c57707471.ovfilter,1,nil,tp,c) then
return true
end
return Duel.CheckXyzMaterial(c,nil,6,2,2,og)
end
function c57707471.xyztg(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
if og and not min then
return true
end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
local mg=nil
if og then
mg=og
else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
local b1=Duel.CheckXyzMaterial(c,nil,6,2,2,og)
local b2=ct<1 and (not min or min<=1) and mg:IsExists(c57707471.ovfilter,1,nil,tp,c)
local g=nil
if b2 and (not b1 or Duel.SelectYesNo(tp,aux.Stringid(57707471,0))) then
e:SetLabel(1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
g=mg:FilterSelect(tp,c57707471.ovfilter,1,1,nil,tp,c)
g:GetFirst():RemoveOverlayCard(tp,1,1,REASON_COST)
else
e:SetLabel(0)
g=Duel.SelectXyzMaterial(tp,c,nil,6,2,2,og)
end
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else return false end
end
function c57707471.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
Duel.Overlay(c,mg2)
end
end
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end end
function c57707471.atkval(e,c) function c57707471.atkval(e,c)
return c:GetOverlayCount()*1000 return c:GetOverlayCount()*1000
......
...@@ -2,16 +2,7 @@ ...@@ -2,16 +2,7 @@
function c58600555.initial_effect(c) function c58600555.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--xyz summon --xyz summon
local e1=Effect.CreateEffect(c) aux.AddXyzProcedure(c,c58600555.mfilter,5,2,c58600555.ovfilter,aux.Stringid(58600555,2),99,c58600555.xyzop)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c58600555.xyzcon)
e1:SetTarget(c58600555.xyztg)
e1:SetOperation(c58600555.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
--Back to Deck --Back to Deck
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(58600555,0)) e2:SetDescription(aux.Stringid(58600555,0))
...@@ -37,88 +28,15 @@ function c58600555.initial_effect(c) ...@@ -37,88 +28,15 @@ function c58600555.initial_effect(c)
e3:SetOperation(c58600555.operation) e3:SetOperation(c58600555.operation)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c58600555.ovfilter(c,tp,xyzc) function c58600555.ovfilter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and (c:GetRank()==3 or c:GetRank()==4) and c:IsRace(RACE_INSECT) and c:IsCanBeXyzMaterial(xyzc) return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and (c:GetRank()==3 or c:GetRank()==4) and c:IsRace(RACE_INSECT)
and c:CheckRemoveOverlayCard(tp,2,REASON_COST)
end end
function c58600555.mfilter(c) function c58600555.mfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAttribute(ATTRIBUTE_LIGHT) return c:IsRace(RACE_INSECT) and c:IsAttribute(ATTRIBUTE_LIGHT)
end end
function c58600555.xyzcon(e,c,og,min,max) function c58600555.xyzop(e,tp,chk,mc)
if c==nil then return true end if chk==0 then return mc:CheckRemoveOverlayCard(tp,2,REASON_COST) end
local tp=c:GetControler() mc:RemoveOverlayCard(tp,2,2,REASON_COST)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
local mg=nil
if og then
mg=og
else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
if ct<1 and (not min or min<=1) and mg:IsExists(c58600555.ovfilter,1,nil,tp,c) then
return true
end
local minc=2
local maxc=99
if min then
if min>minc then minc=min end
if max<maxc then maxc=max end
if minc>maxc then return false end
end
return ct<minc and Duel.CheckXyzMaterial(c,c58600555.mfilter,5,minc,maxc,og)
end
function c58600555.xyztg(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
if og and not min then
return true
end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
local minc=2
local maxc=99
if min then
if min>minc then minc=min end
if max<maxc then maxc=max end
end
local mg=nil
if og then
mg=og
else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
local b1=ct<minc and Duel.CheckXyzMaterial(c,c58600555.mfilter,5,minc,maxc,og)
local b2=ct<1 and (not min or min<=1) and mg:IsExists(c58600555.ovfilter,1,nil,tp,c)
local g=nil
if b2 and (not b1 or Duel.SelectYesNo(tp,aux.Stringid(58600555,2))) then
e:SetLabel(1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
g=mg:FilterSelect(tp,c58600555.ovfilter,1,1,nil,tp,c)
g:GetFirst():RemoveOverlayCard(tp,2,2,REASON_COST)
else
e:SetLabel(0)
g=Duel.SelectXyzMaterial(tp,c,c58600555.mfilter,5,minc,maxc,og)
end
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else return false end
end
function c58600555.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
Duel.Overlay(c,mg2)
end
end
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end end
function c58600555.tdcost(e,tp,eg,ep,ev,re,r,rp,chk) function c58600555.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
......
...@@ -2,16 +2,7 @@ ...@@ -2,16 +2,7 @@
function c85004150.initial_effect(c) function c85004150.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--xyz summon --xyz summon
local e1=Effect.CreateEffect(c) aux.AddXyzProcedure(c,c85004150.mfilter,7,2,c85004150.ovfilter,aux.Stringid(85004150,0),99,c85004150.xyzop)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c85004150.xyzcon)
e1:SetTarget(c85004150.xyztg)
e1:SetOperation(c85004150.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
--destroy --destroy
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DESTROY) e2:SetCategory(CATEGORY_DESTROY)
...@@ -30,88 +21,15 @@ function c85004150.initial_effect(c) ...@@ -30,88 +21,15 @@ function c85004150.initial_effect(c)
e3:SetCode(EFFECT_PIERCE) e3:SetCode(EFFECT_PIERCE)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c85004150.ovfilter(c,tp,xyzc) function c85004150.ovfilter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and (c:GetRank()==5 or c:GetRank()==6) and c:IsRace(RACE_INSECT) and c:IsCanBeXyzMaterial(xyzc) return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and (c:GetRank()==5 or c:GetRank()==6) and c:IsRace(RACE_INSECT)
and c:CheckRemoveOverlayCard(tp,2,REASON_COST)
end end
function c85004150.mfilter(c) function c85004150.mfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAttribute(ATTRIBUTE_LIGHT) return c:IsRace(RACE_INSECT) and c:IsAttribute(ATTRIBUTE_LIGHT)
end end
function c85004150.xyzcon(e,c,og,min,max) function c85004150.xyzop(e,tp,chk,mc)
if c==nil then return true end if chk==0 then return mc:CheckRemoveOverlayCard(tp,2,REASON_COST) end
local tp=c:GetControler() mc:RemoveOverlayCard(tp,2,2,REASON_COST)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
local mg=nil
if og then
mg=og
else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
if ct<1 and (not min or min<=1) and mg:IsExists(c85004150.ovfilter,1,nil,tp,c) then
return true
end
local minc=2
local maxc=99
if min then
if min>minc then minc=min end
if max<maxc then maxc=max end
if minc>maxc then return false end
end
return ct<minc and Duel.CheckXyzMaterial(c,c85004150.mfilter,7,minc,maxc,og)
end
function c85004150.xyztg(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
if og and not min then
return true
end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
local minc=2
local maxc=99
if min then
if min>minc then minc=min end
if max<maxc then maxc=max end
end
local mg=nil
if og then
mg=og
else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
local b1=ct<minc and Duel.CheckXyzMaterial(c,c85004150.mfilter,7,minc,maxc,og)
local b2=ct<1 and (not min or min<=1) and mg:IsExists(c85004150.ovfilter,1,nil,tp,c)
local g=nil
if b2 and (not b1 or Duel.SelectYesNo(tp,aux.Stringid(85004150,0))) then
e:SetLabel(1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
g=mg:FilterSelect(tp,c85004150.ovfilter,1,1,nil,tp,c)
g:GetFirst():RemoveOverlayCard(tp,2,2,REASON_COST)
else
e:SetLabel(0)
g=Duel.SelectXyzMaterial(tp,c,c85004150.mfilter,7,minc,maxc,og)
end
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else return false end
end
function c85004150.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
Duel.Overlay(c,mg2)
end
end
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end end
function c85004150.desfilter(c) function c85004150.desfilter(c)
return c:IsFaceup() and c:IsDefenseAbove(0) return c:IsFaceup() and c:IsDefenseAbove(0)
......
...@@ -244,8 +244,8 @@ function Auxiliary.AddSynchroProcedure2(c,f1,f2) ...@@ -244,8 +244,8 @@ function Auxiliary.AddSynchroProcedure2(c,f1,f2)
e1:SetValue(SUMMON_TYPE_SYNCHRO) e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function Auxiliary.XyzAlterFilter(c,alterf,xyzc,tp) function Auxiliary.XyzAlterFilter(c,alterf,xyzc,e,tp,op)
return alterf(c) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c),xyzc)>0 return alterf(c) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c),xyzc)>0 and (not op or op(e,tp,0,c))
end end
--Xyz monster, lv k*n --Xyz monster, lv k*n
function Auxiliary.AddXyzProcedure(c,f,lv,ct,alterf,desc,maxct,op) function Auxiliary.AddXyzProcedure(c,f,lv,ct,alterf,desc,maxct,op)
...@@ -348,8 +348,7 @@ function Auxiliary.XyzCondition2(f,lv,minc,maxc,alterf,desc,op) ...@@ -348,8 +348,7 @@ function Auxiliary.XyzCondition2(f,lv,minc,maxc,alterf,desc,op)
else else
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end end
if (not min or min<=1) and mg:IsExists(Auxiliary.XyzAlterFilter,1,nil,alterf,c,tp) if (not min or min<=1) and mg:IsExists(Auxiliary.XyzAlterFilter,1,nil,alterf,c,e,tp,op) then
and (not op or op(e,tp,0)) then
return true return true
end end
local minc=minc local minc=minc
...@@ -382,14 +381,13 @@ function Auxiliary.XyzTarget2(f,lv,minc,maxc,alterf,desc,op) ...@@ -382,14 +381,13 @@ function Auxiliary.XyzTarget2(f,lv,minc,maxc,alterf,desc,op)
mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end end
local b1=ct<minc and Duel.CheckXyzMaterial(c,f,lv,minc,maxc,og) local b1=ct<minc and Duel.CheckXyzMaterial(c,f,lv,minc,maxc,og)
local b2=(not min or min<=1) and mg:IsExists(Auxiliary.XyzAlterFilter,1,nil,alterf,c,tp) local b2=(not min or min<=1) and mg:IsExists(Auxiliary.XyzAlterFilter,1,nil,alterf,c,e,tp,op)
and (not op or op(e,tp,0))
local g=nil local g=nil
if b2 and (not b1 or Duel.SelectYesNo(tp,desc)) then if b2 and (not b1 or Duel.SelectYesNo(tp,desc)) then
e:SetLabel(1) e:SetLabel(1)
if op then op(e,tp,1) end
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,tp) g=mg:FilterSelect(tp,Auxiliary.XyzAlterFilter,1,1,nil,alterf,c,e,tp,op)
if op then op(e,tp,1,g:GetFirst()) 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)
......
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