Commit e8a6d4d4 authored by wind2009's avatar wind2009

Fix spsummon

parent 282314d3
Pipeline #43642 canceled with stages
in 2 seconds
......@@ -35,6 +35,12 @@ function s.initial_effect(c)
e3:SetOperation(s.spop3)
c:RegisterEffect(e3)
end
---The `nolimit` parameter for Special Summon effects of Phantasms cards
---@param c Card
---@return boolean
function aux.PhantasmsSpSummonType(c)
return c:IsType(TYPE_SPSUMMON)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsPublic() end
end
......@@ -44,17 +50,12 @@ function s.hfilter(c,e,tp)
end
function s.spfilter(c,e,tp)
if not c:IsSetCard(0x1144) or c:IsLevel(8) then return false end
if c:IsCode(101305005,101305006,101305007) then
return c:IsCanBeSpecialSummoned(e,0,tp,false,true,POS_FACEUP_DEFENSE)
else
return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
return c:IsCanBeSpecialSummoned(e,0,tp,false,aux.PhantasmsSpSummonType(c),POS_FACEUP_DEFENSE)
end
function s.spsummon(c,tp)
if c:IsCode(101305005,101305006,101305007) then
Duel.SpecialSummon(c,0,tp,tp,false,true,POS_FACEUP_DEFENSE)
else
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
local flag=aux.PhantasmsSpSummonType(c)
if Duel.SpecialSummon(c,0,tp,tp,false,flag,POS_FACEUP_DEFENSE) and flag then
c:CompleteProcedure()
end
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -29,6 +29,12 @@ function s.initial_effect(c)
e3:SetOperation(s.drop)
c:RegisterEffect(e3)
end
---The `nolimit` parameter for Special Summon effects of Phantasms cards
---@param c Card
---@return boolean
function aux.PhantasmsSpSummonType(c)
return c:IsType(TYPE_SPSUMMON)
end
function s.tgfilter(c)
return c:IsFaceupEx() and c:IsAbleToGrave()
end
......@@ -44,11 +50,7 @@ function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function s.spfilter(c,e,tp)
if not c:IsFaceupEx() or not c:IsSetCard(0x1144) then return false end
if c:IsCode(101305005,101305006,101305007) then
return c:IsCanBeSpecialSummoned(e,0,tp,false,true)
else
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
return c:IsCanBeSpecialSummoned(e,0,tp,false,aux.PhantasmsSpSummonType(c))
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -67,11 +69,8 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
if tc then
local res=false
if tc:IsCode(101305005,101305006,101305007) then
res=Duel.SpecialSummonStep(tc,0,tp,tp,false,true,POS_FACEUP)
else
res=Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
end
local flag=aux.PhantasmsSpSummonType(tc)
res=Duel.SpecialSummonStep(tc,0,tp,tp,false,flag,POS_FACEUP)
if res then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,3))
......@@ -83,6 +82,9 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
e1:SetValue(s.efilter)
e1:SetOwnerPlayer(tp)
tc:RegisterEffect(e1,true)
if flag then
tc:CompleteProcedure()
end
end
Duel.SpecialSummonComplete()
end
......
......@@ -25,13 +25,15 @@ function s.initial_effect(c)
e2:SetOperation(s.fspop)
c:RegisterEffect(e2)
end
---The `nolimit` parameter for Special Summon effects of Phantasms cards
---@param c Card
---@return boolean
function aux.PhantasmsSpSummonType(c)
return c:IsType(TYPE_SPSUMMON)
end
function s.spfilter(c,e,tp)
if not c:IsSetCard(0x1144) or not c:IsType(TYPE_MONSTER) then return false end
if c:IsCode(101305005,101305006,101305007) then
return c:IsCanBeSpecialSummoned(e,0,tp,false,true,POS_FACEUP_DEFENSE)
else
return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
return c:IsCanBeSpecialSummoned(e,0,tp,false,aux.PhantasmsSpSummonType(c),POS_FACEUP_DEFENSE)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......@@ -49,12 +51,10 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=g:GetFirst()
if tc then
local res=0
if tc:IsCode(101305005,101305006,101305007) then
res=Duel.SpecialSummon(tc,0,tp,tp,false,true,POS_FACEUP_DEFENSE)
else
res=Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
if res>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,2,nil)
local flag=aux.PhantasmsSpSummonType(tc)
res=Duel.SpecialSummon(tc,0,tp,tp,false,flag,POS_FACEUP_DEFENSE)
if res>0 then
if Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,2,nil)
and Duel.IsExistingMatchingCard(aux.NegateAnyFilter,tp,0,LOCATION_ONFIELD,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
Duel.BreakEffect()
......@@ -89,6 +89,10 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(nc,REASON_EFFECT)
end
end
if flag then
tc:CompleteProcedure()
end
end
end
end
function s.filter1(c,e)
......
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