Commit 78797832 authored by VanillaSalt's avatar VanillaSalt

fix

parent d2afc0ae
......@@ -25,25 +25,27 @@ function c79766336.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
local te=e:GetLabelObject()
local tg=te:GetTarget()
return tg and tg(e,tp,eg,ep,ev,re,r,rp,1,true)
return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc)
end
if chk==0 then return Duel.IsExistingTarget(c79766336.filter,tp,LOCATION_GRAVE,0,1,nil) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(79766336,0))
local g=Duel.SelectTarget(tp,c79766336.filter,tp,LOCATION_GRAVE,0,1,1,nil)
local te,eg,ep,ev,re,r,rp=g:GetFirst():CheckActivateEffect(false,true,true)
e:SetLabelObject(te)
local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(false,true,true)
Duel.ClearTargetCard()
g:GetFirst():CreateEffectRelation(e)
local tg=te:GetTarget()
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end
if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end
te:SetLabelObject(e:GetLabelObject())
e:SetLabelObject(te)
end
function c79766336.operation(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if not te:GetHandler():IsRelateToEffect(e) then return end
if not te then return end
if not te:GetHandler():IsRelateToEffect(e) then return end
e:SetLabelObject(te:GetLabelObject())
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
Duel.Remove(te:GetHandler(),POS_FACEUP,REASON_EFFECT)
......
......@@ -2,10 +2,11 @@
function c89567993.initial_effect(c)
--to deck
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLED)
e1:SetCondition(c89567993.tdcon)
e1:SetOperation(c89567993.tdop)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_BATTLE_DESTROY_REDIRECT)
e1:SetValue(LOCATION_DECKBOT)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
......@@ -17,31 +18,6 @@ function c89567993.initial_effect(c)
e2:SetOperation(c89567993.atkop)
c:RegisterEffect(e2)
end
function c89567993.tdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end
local bc=c:GetBattleTarget()
return bc and bc:IsStatus(STATUS_BATTLE_DESTROYED) and not bc:IsType(TYPE_TOKEN) and bc:GetLeaveFieldDest()==0
end
function c89567993.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_SEND_REPLACE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetTarget(c89567993.reptg)
e1:SetOperation(c89567993.repop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE)
bc:RegisterEffect(e1)
end
function c89567993.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetDestination()==LOCATION_GRAVE and c:IsReason(REASON_BATTLE) end
return true
end
function c89567993.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoDeck(e:GetHandler(),nil,1,REASON_EFFECT)
end
function c89567993.atkcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsFaceup() and e:GetHandler():IsRelateToBattle()
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