Commit 4289d4c6 authored by DailyShana's avatar DailyShana

fix #892

parent c32139e1
...@@ -17,24 +17,18 @@ function c5043010.initial_effect(c) ...@@ -17,24 +17,18 @@ function c5043010.initial_effect(c)
e1:SetOperation(c5043010.thop) e1:SetOperation(c5043010.thop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--special summon --special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_LEAVE_FIELD_P)
e2:SetOperation(c5043010.regop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(5043010,1)) e3:SetDescription(aux.Stringid(5043010,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CVAL_CHECK)
e3:SetCode(EVENT_BATTLE_DESTROYED) e3:SetCode(EVENT_BATTLE_DESTROYED)
e3:SetRange(LOCATION_MZONE) e3:SetRange(LOCATION_MZONE)
e3:SetLabelObject(e2)
e3:SetCondition(c5043010.spcon) e3:SetCondition(c5043010.spcon)
e3:SetTarget(c5043010.sptg) e3:SetTarget(c5043010.sptg)
e3:SetOperation(c5043010.spop) e3:SetOperation(c5043010.spop)
e3:SetCost(c5043010.spcost)
e3:SetValue(c5043010.valcheck)
c:RegisterEffect(e3) c:RegisterEffect(e3)
local e4=e3:Clone() local e4=e3:Clone()
e4:SetCode(EVENT_TO_GRAVE) e4:SetCode(EVENT_TO_GRAVE)
...@@ -74,20 +68,16 @@ function c5043010.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -74,20 +68,16 @@ function c5043010.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
end end
function c5043010.regop(e,tp,eg,ep,ev,re,r,rp) function c5043010.cfilter(c,tp,zone)
local g=e:GetHandler():GetLinkedGroup() local seq=c:GetPreviousSequence()
if not g then return end if c:IsControler(tp) then
local lg=g:Clone() return bit.band(zone,bit.lshift(1,seq))~=0
lg:KeepAlive() else
e:SetLabelObject(lg) return bit.band(bit.rshift(zone,16),bit.lshift(1,seq))~=0
end end
function c5043010.cfilter(c,g)
return g:IsContains(c)
end end
function c5043010.spcon(e,tp,eg,ep,ev,re,r,rp) function c5043010.spcon(e,tp,eg,ep,ev,re,r,rp)
local lg=e:GetLabelObject():GetLabelObject() return eg:IsExists(c5043010.cfilter,1,nil,tp,e:GetHandler():GetLinkedZone())
if not lg then return false end
return eg:IsExists(c5043010.cfilter,1,nil,lg)
end end
function c5043010.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function c5043010.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
...@@ -102,3 +92,16 @@ function c5043010.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -102,3 +92,16 @@ function c5043010.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end end
end end
function c5043010.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
if c:GetFlagEffect(5043010)==0 then
c:RegisterFlagEffect(5043010,RESET_CHAIN,0,1)
c5043010[c]=true
end
return c5043010[c]
end
end
function c5043010.valcheck(e)
c5043010[e:GetHandler()]=false
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