Commit 7fbf0605 authored by Chen Bill's avatar Chen Bill

add aux.BecomeOriginalCode

parent 2db3cea8
......@@ -38,15 +38,9 @@ function c30312361.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)==1 and c:IsRelateToEffect(e) and c:IsFaceup() then
--copy name, base atk
local code=tc:GetOriginalCodeRule()
local code=tc:GetOriginalCode()
local ba=tc:GetBaseAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(code)
c:RegisterEffect(e1)
local e1=aux.BecomeOriginalCode(c,tc)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
......
......@@ -28,6 +28,7 @@ function c50584941.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,c50584941.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp)
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetLabel(g:GetFirst():GetOriginalCode())
e:SetLabelObject(g:GetFirst())
end
function c50584941.filter(c,code)
return c:IsFaceup() and c:IsSetCard(0x1045) and c:IsType(TYPE_SYNCHRO) and not c:IsCode(code)
......@@ -37,6 +38,7 @@ function c50584941.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then
if e:GetLabel()~=1 then return false end
e:SetLabel(0)
e:SetLabelObject(nil)
return true
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
......@@ -46,14 +48,9 @@ function c50584941.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
local code=e:GetLabel()
local source=e:GetLabelObject()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(code)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
aux.BecomeOriginalCode(c,source,RESET_EVENT+RESETS_STANDARD)
tc:ReplaceEffect(code,RESET_EVENT+RESETS_STANDARD)
end
end
......@@ -1776,3 +1776,20 @@ end
function Auxiliary.MimighoulFlipCondition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsMainPhase()
end
---The name of `c` becomes the original name of `tc`
---@param c Card
---@param tc Card
---@param reset? integer defult: RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END
---@return Effect
function Auxiliary.BecomeOriginalCode(c,tc,reset)
reset=reset or (RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
local code=tc:GetOriginalCodeRule()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(code)
e1:SetReset(reset)
c:RegisterEffect(e1)
return e1
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