Commit 9859dc77 authored by DailyShana's avatar DailyShana

fix effects relate to token destroyed

parent 643ed6d2
......@@ -20,25 +20,17 @@ function c30069398.operation(e,tp,eg,ep,ev,re,r,rp)
local token=Duel.CreateToken(tp,30069399)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROYED)
e1:SetLabelObject(token)
e1:SetCondition(c30069398.damcon)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetOperation(c30069398.damop)
Duel.RegisterEffect(e1,tp)
token:RegisterEffect(e1,true)
end
Duel.SpecialSummonComplete()
end
function c30069398.damcon(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
if eg:IsContains(tok) then
return true
else
if not tok:IsLocation(LOCATION_MZONE) then e:Reset() end
return false
end
end
function c30069398.damop(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
Duel.Damage(tok:GetPreviousControler(),300,REASON_EFFECT)
local c=e:GetHandler()
if c:IsReason(REASON_DESTROY) then
Duel.Damage(c:GetPreviousControler(),300,REASON_EFFECT)
end
e:Reset()
end
......@@ -26,46 +26,21 @@ function c42956963.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
if Duel.GetLocationCount(1-tp,LOCATION_MZONE)<3 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,42956964,0x45,0x4011,2000,2000,6,RACE_FIEND,ATTRIBUTE_DARK,POS_FACEUP_ATTACK,1-tp) then return end
local g=Group.CreateGroup()
for i=1,3 do
local token=Duel.CreateToken(tp,42956964)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_ATTACK) then
g:AddCard(token)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetOperation(c42956963.damop)
token:RegisterEffect(e1,true)
end
end
g:KeepAlive()
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DESTROYED)
e2:SetLabelObject(g)
e2:SetCondition(c42956963.damcon)
e2:SetOperation(c42956963.damop)
Duel.RegisterEffect(e2,tp)
Duel.SpecialSummonComplete()
end
function c42956963.dfilter(c,g)
return g:IsContains(c)
end
function c42956963.damcon(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if eg:IsExists(c42956963.dfilter,1,nil,g) then
return true
else
if not g:IsExists(Card.IsLocation,1,nil,LOCATION_MZONE) then
g:DeleteGroup()
e:Reset()
end
return false
end
end
function c42956963.damop(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local tc=eg:GetFirst()
while tc do
if g:IsContains(tc) then
Duel.Damage(tc:GetPreviousControler(),800,REASON_EFFECT)
g:RemoveCard(tc)
end
tc=eg:GetNext()
local c=e:GetHandler()
if c:IsReason(REASON_DESTROY) then
Duel.Damage(c:GetPreviousControler(),800,REASON_EFFECT)
end
e:Reset()
end
......@@ -25,26 +25,18 @@ function c82994509.operation(e,tp,eg,ep,ev,re,r,rp)
local token=Duel.CreateToken(tp,82994510)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetLabelObject(token)
e1:SetCondition(c82994509.handcon)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetOperation(c82994509.handop)
Duel.RegisterEffect(e1,tp)
token:RegisterEffect(e1,true)
end
Duel.SpecialSummonComplete()
end
function c82994509.handcon(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
if eg:IsContains(tok) and tok:GetReasonCard():IsRace(RACE_PLANT) then
return true
else
if not tok:IsLocation(LOCATION_MZONE) then e:Reset() end
return false
end
end
function c82994509.handop(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.DiscardHand(tok:GetPreviousControler(),nil,1,1,REASON_EFFECT)
local c=e:GetHandler()
if c:IsReason(REASON_BATTLE) and c:GetBattleTarget():IsRace(RACE_PLANT) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.DiscardHand(c:GetPreviousControler(),nil,1,1,REASON_EFFECT)
end
e:Reset()
end
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