--Elron, Guidance of the Divine Blade function c88567315.initial_effect(c) --link summon aux.AddLinkProcedure(c,c88567315.matfilter,1,1) c:EnableReviveLimit() --remove local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(88567315,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLED) e1:SetCondition(c88567315.condition) e1:SetTarget(c88567315.target) e1:SetOperation(c88567315.operation) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(88567315,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,88567315) e2:SetCondition(c88567315.spcon) e2:SetCost(c88567315.spcost) e2:SetTarget(c88567315.sptg) e2:SetOperation(c88567315.spop) c:RegisterEffect(e2) end function c88567315.matfilter(c) return c:IsLinkSetCard(0x1bc2) and not c:IsLinkCode(88567315) end function c88567315.condition(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetBattleTarget() return bc and bc:IsStatus(STATUS_BATTLE_DESTROYED) end function c88567315.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local bc=e:GetHandler():GetBattleTarget() Duel.SetOperationInfo(0,CATEGORY_REMOVE,bc,1,0,0) end function c88567315.operation(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetBattleTarget() if bc:IsRelateToBattle() then Duel.Remove(bc,POS_FACEUP,REASON_EFFECT) end end function c88567315.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function c88567315.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) end function c88567315.spfilter(c,e,tp) return c:IsSetCard(0x1bc2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c88567315.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c88567315.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c88567315.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c88567315.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end