Commit 447a86c5 authored by wind2009's avatar wind2009

Merge branch 'fix-Particle-Fusion' into 'master'

Fix パーティカル・フュージョン under copy

See merge request !72
parents e79998f7 25a331ac
......@@ -5,7 +5,7 @@ function s.initial_effect(c)
local e1=FusionSpell.RegisterSummonEffect(c,{
fusfilter=s.fusfilter,
pre_select_mat_location=LOCATION_MZONE,
stage_x_operation=s.stage_x_operation
stage_x_operation=s.stage_x_operation,
})
--atk up
local e2=Effect.CreateEffect(c)
......@@ -30,12 +30,14 @@ end
--- @type FUSION_SPELL_STAGE_X_CALLBACK_FUNCTION
function s.stage_x_operation(e,tc,tp,stage)
if stage==FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then
e:SetLabelObject(tc)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetOperation(s.evop)
e1:SetLabelObject(e)
e1:SetOperation(function(ee,tpp,eg,ep,ev,re,r,rp)
-- mark the summoned monster and raise the custom event for it
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET,0,1)
Duel.RaiseEvent(tc,EVENT_CUSTOM+id,e,0,tp,tp,0)
end)
Duel.RegisterEffect(e1,tp)
end
end
......@@ -45,26 +47,32 @@ function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
end
function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemove() end
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
local tc=eg:GetFirst()
local mat=tc:GetMaterial()
if chkc then return chkc:IsSetCard(0x1047) and mat:IsContains(chkc) end
if chk==0 then return mat:IsExists(Card.IsSetCard,1,nil,0x1047) end
--- bail out if summoned monster is gone
if not (tc and tc:IsFaceup() and tc:GetFlagEffect(id)>0) then return end
local mat=tc:GetMaterial():Filter(function (mc)
return mc:IsSetCard(0x1047) and mc:IsAttackAbove(0) and mc:IsCanBeEffectTarget(e)
end,nil)
--- bail out if no valid material monster
if #mat==0 then return end
if chkc then return mat:IsContains(chkc) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1))
local g=mat:FilterSelect(tp,Card.IsSetCard,1,1,nil,0x1047)
tc:CreateEffectRelation(e)
local g=mat:Select(tp,1,1,nil)
Duel.SetTargetCard(g)
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local sc=eg:GetFirst()
if not sc:IsRelateToEffect(e) or sc:IsFacedown() then return end
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
if not (sc and sc:IsFaceup() and sc:GetFlagEffect(id)>0) then return end
local tc=Duel.GetTargetsRelateToChain():GetFirst()
if not tc then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
......@@ -72,11 +80,3 @@ function s.atkop(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
sc:RegisterEffect(e1)
end
function s.evop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
local tc=te:GetLabelObject()
Duel.RaiseEvent(tc,EVENT_CUSTOM+id,te,0,tp,tp,0)
te:SetLabelObject(nil)
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