Commit db00eaf9 authored by salix5's avatar salix5

fix: CPD1

parent 7c2f4507
......@@ -86,6 +86,7 @@ function c10960419.rmop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetCondition(c10960419.retcon)
e2:SetOperation(c10960419.retop)
Duel.RegisterEffect(e2,tp)
tc:RegisterFlagEffect(1082946,RESET_PHASE+RESET_STANDBY,0,ct)
......@@ -99,6 +100,19 @@ function c10960419.turnop(e,tp,eg,ep,ev,re,r,rp)
local ct=tc:GetTurnCounter()
ct=ct+1
tc:SetTurnCounter(ct)
if ct>e:GetLabel() then
tc:ResetFlagEffect(1082946)
e:Reset()
end
end
function c10960419.retcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetTurnCounter()>e:GetLabel() then
e:Reset()
return false
else
return true
end
end
function c10960419.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
......@@ -106,7 +120,4 @@ function c10960419.retop(e,tp,eg,ep,ev,re,r,rp)
if ct==e:GetLabel() then
Duel.ReturnToField(tc)
end
if ct>=e:GetLabel() then
tc:ResetFlagEffect(1082946)
end
end
......@@ -30,22 +30,26 @@ end
function c72621670.tfilter(c,e)
return c:IsRelateToEffect(e) and c:IsFaceup()
end
function c72621670.tfilter2(c,e)
return not c:IsImmuneToEffect(e) and c:IsAbleToChangeControler()
end
function c72621670.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(c72621670.tfilter,nil,e)
if g:GetCount()<2 then return end
local ct=Duel.GetLocationCount(tp,LOCATION_MZONE,1-tp,LOCATION_REASON_CONTROL)
local sg=g
if ct==1 then
local sg=Group.CreateGroup()
local dg=Group.CreateGroup()
if ct==1 and g:FilterCount(c72621670.tfilter2,nil,e)>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
sg=g:Select(tp,1,1,nil)
sg=g:FilterSelect(tp,c72621670.tfilter2,1,1,nil,e)
dg=g:Sub(sg)
else
sg=g:Filter(c72621670.tfilter2,nil,e)
end
local tc=g:GetFirst()
local tc=sg:GetFirst()
while tc do
if not sg:IsContains(tc) or not Duel.GetControl(tc,tp,PHASE_END,1) then
if not tc:IsImmuneToEffect(e) and tc:IsAbleToChangeControler() then
Duel.Destroy(tc,REASON_EFFECT)
end
end
tc=g:GetNext()
Duel.GetControl(tc,tp,PHASE_END,1)
tc=sg:GetNext()
end
if dg:GetCount()>0 then Duel.Destroy(dg,REASON_RULE) end
end
......@@ -13,46 +13,54 @@ function c94997874.initial_effect(c)
e1:SetTarget(c94997874.postg)
e1:SetOperation(c94997874.posop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
local e2=e1:Clone()
e2:SetDescription(aux.Stringid(94997874,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c94997874.spcon)
e2:SetTarget(c94997874.sptg)
e2:SetOperation(c94997874.spop)
e2:SetTarget(c94997874.postg2)
e2:SetOperation(c94997874.posop2)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(94997874,2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c94997874.spcon)
e3:SetTarget(c94997874.sptg)
e3:SetOperation(c94997874.spop)
c:RegisterEffect(e3)
end
function c94997874.posfilter(c)
if c:IsFaceup() then
return c:IsCanTurnSet()
else
return true
function c94997874.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFacedown() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFacedown,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,Card.IsFacedown,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c94997874.posop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEUP_ATTACK)
end
end
function c94997874.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
function c94997874.posfilter(c)
return c:IsFaceup() and c:IsCanTurnSet()
end
function c94997874.postg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c94997874.posfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c94997874.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,c94997874.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
if g:GetFirst():IsFacedown() then
e:SetLabel(0)
else
e:SetLabel(1)
end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function c94997874.posop(e,tp,eg,ep,ev,re,r,rp)
function c94997874.posop2(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
if e:GetLabel()==0 then
Duel.ChangePosition(tc,POS_FACEUP_ATTACK)
elseif e:GetLabel()==1 then
Duel.ChangePosition(tc,POS_FACEDOWN_DEFENCE)
end
Duel.ChangePosition(tc,POS_FACEDOWN_DEFENCE)
end
end
function c94997874.spcon(e,tp,eg,ep,ev,re,r,rp)
......@@ -65,6 +73,7 @@ end
function c94997874.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c94997874.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c94997874.spop(e,tp,eg,ep,ev,re,r,rp)
......
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