--Moonvale Apostle function c10505084.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,10505084) e1:SetTarget(c10505084.regtg) e1:SetOperation(c10505084.regop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(10505084,1)) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCost(c10505084.descost) e4:SetTarget(c10505084.destg) e4:SetOperation(c10505084.desop) c:RegisterEffect(e4) end function c10505084.regtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,0x1a5) end end function c10505084.regop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetCondition(c10505084.thcon) e1:SetTarget(c10505084.settg) e1:SetOperation(c10505084.setop) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function c10505084.filter(c) return c:IsSetCard(0x1a5) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable() end function c10505084.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(c10505084.filter,tp,LOCATION_DECK,0,1,nil) end function c10505084.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(c10505084.filter,tp,LOCATION_DECK,0,1,nil) end end function c10505084.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,10505084) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,c10505084.filter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SSet(tp,g:GetFirst()) end end function c10505084.filter1(c) return c:IsFaceup() and c:IsSetCard(0x1a5) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToGraveAsCost() and Duel.IsExistingTarget(c10505084.filter2,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end function c10505084.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c10505084.filter1,tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c10505084.filter1,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function c10505084.filter2(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) end function c10505084.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and c10505084.filter2(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,c10505084.filter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g2,1,0,0) end function c10505084.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end