Commit 50106859 authored by nekrozar's avatar nekrozar Committed by mercury233

update aux.AddXyzProcedureLevelFree (#923)

parent 03834b9f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
function c43490025.initial_effect(c) function c43490025.initial_effect(c)
--xyz summon --xyz summon
c:EnableReviveLimit() c:EnableReviveLimit()
aux.AddXyzProcedureLevelFree(c,c43490025.mfilter,c43490025.xyzcheck,1,2) aux.AddXyzProcedureLevelFree(c,c43490025.mfilter,c43490025.xyzcheck,2,2,c43490025.ovfilter,aux.Stringid(43490025,1))
--atkup --atkup
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
...@@ -31,18 +31,13 @@ function c43490025.initial_effect(c) ...@@ -31,18 +31,13 @@ function c43490025.initial_effect(c)
end end
c43490025.xyz_number=0 c43490025.xyz_number=0
function c43490025.mfilter(c,xyzc) function c43490025.mfilter(c,xyzc)
return (not c:IsSetCard(0x48) and c:IsXyzType(TYPE_XYZ)) or (c:IsSetCard(0x107f) or c:IsCode(65305468)) return c:IsXyzType(TYPE_XYZ) and not c:IsSetCard(0x48)
end
function c43490025.gfilter(c)
return c:IsSetCard(0x48) or not c:IsXyzType(TYPE_XYZ)
end end
function c43490025.xyzcheck(g,xyzc) function c43490025.xyzcheck(g,xyzc)
if g:GetCount()==1 then return g:GetClassCount(Card.GetRank)==1
local tc=g:GetFirst() end
return tc:IsSetCard(0x107f) or tc:IsCode(65305468) function c43490025.ovfilter(c)
else return c:IsFaceup() and (c:IsSetCard(0x107f) or c:IsCode(65305468))
return g:GetClassCount(Card.GetRank)==1 and not g:IsExists(c43490025.gfilter,1,nil)
end
end end
function c43490025.atkfilter(c) function c43490025.atkfilter(c)
return c:IsType(TYPE_XYZ) and c:IsSetCard(0x48) return c:IsType(TYPE_XYZ) and c:IsSetCard(0x48)
......
...@@ -2,15 +2,7 @@ ...@@ -2,15 +2,7 @@
function c52653092.initial_effect(c) function c52653092.initial_effect(c)
--xyz summon --xyz summon
c:EnableReviveLimit() c:EnableReviveLimit()
local e1=Effect.CreateEffect(c) aux.AddXyzProcedureLevelFree(c,c52653092.mfilter,c52653092.xyzcheck,3,3,c52653092.ovfilter,aux.Stringid(52653092,0),c52653092.xyzop)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c52653092.xyzcon)
e1:SetOperation(c52653092.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
--cannot disable spsummon --cannot disable spsummon
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
...@@ -50,99 +42,21 @@ function c52653092.initial_effect(c) ...@@ -50,99 +42,21 @@ function c52653092.initial_effect(c)
c:RegisterEffect(e6) c:RegisterEffect(e6)
end end
c52653092.xyz_number=0 c52653092.xyz_number=0
function c52653092.mfilter(c,xyzc)
return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:IsSetCard(0x48)
end
function c52653092.xyzcheck(g,xyzc)
return g:GetClassCount(Card.GetRank)==1
end
function c52653092.cfilter(c) function c52653092.cfilter(c)
return c:IsSetCard(0x95) and c:GetType()==TYPE_SPELL and c:IsDiscardable() return c:IsSetCard(0x95) and c:GetType()==TYPE_SPELL and c:IsDiscardable()
end end
function c52653092.ovfilter(c) function c52653092.ovfilter(c)
return c:IsFaceup() and c:IsSetCard(0x107f) return c:IsFaceup() and c:IsSetCard(0x107f)
end end
function c52653092.mfilter(c,xyzc) function c52653092.xyzop(e,tp,chk)
return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:IsSetCard(0x48) and c:IsCanBeXyzMaterial(xyzc) if chk==0 then return Duel.IsExistingMatchingCard(c52653092.cfilter,tp,LOCATION_HAND,0,1,nil) end
end Duel.DiscardHand(tp,c52653092.cfilter,1,1,REASON_COST+REASON_DISCARD,nil)
function c52653092.xyzfilter1(c,g)
return g:IsExists(c52653092.xyzfilter2,2,c,c:GetRank())
end
function c52653092.xyzfilter2(c,rk)
return c:GetRank()==rk
end
function c52653092.xyzcon(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
if 3<=ct then return false end
if min and (min>3 or max<3) then return false end
local altmg=nil
if og then
altmg=og
else
altmg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
if ct<1 and (not min or min<=1) and altmg:IsExists(aux.XyzAlterFilter,1,nil,c52653092.ovfilter,c)
and Duel.IsExistingMatchingCard(c52653092.cfilter,tp,LOCATION_HAND,0,1,nil) then
return true
end
local mg=nil
if og then
mg=og:Filter(c52653092.mfilter,nil,c)
else
mg=Duel.GetMatchingGroup(c52653092.mfilter,tp,LOCATION_MZONE,0,nil,c)
end
return mg:IsExists(c52653092.xyzfilter1,1,nil,mg)
end
function c52653092.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
sg:Merge(tc:GetOverlayGroup())
tc=og:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(og)
Duel.Overlay(c,og)
return
end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft
local mg=nil
local altmg=nil
if og then
mg=og:Filter(c52653092.mfilter,nil,c)
altmg=og
else
mg=Duel.GetMatchingGroup(c52653092.mfilter,tp,LOCATION_MZONE,0,nil,c)
altmg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
end
local b1=mg:IsExists(c52653092.xyzfilter1,1,nil,mg)
local b2=ct<1 and (not min or min<=1) and altmg:IsExists(aux.XyzAlterFilter,1,nil,c52653092.ovfilter,c)
and Duel.IsExistingMatchingCard(c52653092.cfilter,tp,LOCATION_HAND,0,1,nil)
if b2 and (not b1 or Duel.SelectYesNo(tp,aux.Stringid(52653092,0))) then
Duel.DiscardHand(tp,c52653092.cfilter,1,1,REASON_COST+REASON_DISCARD,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=altmg:FilterSelect(tp,aux.XyzAlterFilter,1,1,nil,c52653092.ovfilter,c)
local g2=g:GetFirst():GetOverlayGroup()
if g2:GetCount()~=0 then
Duel.Overlay(c,g2)
end
c:SetMaterial(g)
Duel.Overlay(c,g)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g1=mg:FilterSelect(tp,c52653092.xyzfilter1,1,1,nil,mg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g2=mg:FilterSelect(tp,c52653092.xyzfilter2,2,2,g1:GetFirst(),g1:GetFirst():GetRank())
g1:Merge(g2)
local sg=Group.CreateGroup()
local tc=g1:GetFirst()
while tc do
sg:Merge(tc:GetOverlayGroup())
tc=g1:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(g1)
Duel.Overlay(c,g1)
end
end end
function c52653092.effcon(e) function c52653092.effcon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ) return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
......
This diff is collapsed.
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