--Masjetic-Angel Knight function c249000785.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(59251766,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_GRAVE) e1:SetCost(aux.bfgcost) e1:SetTarget(c249000785.target) e1:SetOperation(c249000785.operation) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_HAND) e2:SetCondition(c249000785.spcon) e2:SetTarget(c249000785.sptg) e2:SetOperation(c249000785.spop) c:RegisterEffect(e2) --draw local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e3:SetCode(EVENT_REMOVE) e3:SetCountLimit(1,249000785) e3:SetCondition(c249000785.drcon) e3:SetTarget(c249000785.drtg) e3:SetOperation(c249000785.drop) c:RegisterEffect(e3) end function c249000785.filter(c) return c:IsFaceup() and c:IsSetCard(0x103F) end function c249000785.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c249000785.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c249000785.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,c249000785.filter,tp,LOCATION_MZONE,0,1,1,nil) end function c249000785.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCountLimit(1) e1:SetValue(c249000785.valcon) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end function c249000785.valcon(e,re,r,rp) return bit.band(r,REASON_BATTLE+REASON_EFFECT)~=0 end function c249000785.spcon(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() return at:GetControler()~=tp end function c249000785.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c249000785.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) then Duel.NegateAttack() end end function c249000785.drfilter(c) return c:IsFaceup() and c:IsSetCard(0x3F) end function c249000785.drcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsFaceup() and Duel.IsExistingMatchingCard(c249000785.drfilter,tp,LOCATION_ONFIELD,0,1,nil) end function c249000785.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c249000785.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end