--Oracle-Mage Invoker function c249000745.initial_effect(c) --summon & set with no tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(75498415,0)) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(c249000745.ntcon) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_PROC) c:RegisterEffect(e2) --destroy battle related local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(19221310,1)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetCondition(aux.bdcon) e3:SetTarget(c249000745.destg) e3:SetOperation(c249000745.desop) c:RegisterEffect(e3) --discard to destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(91998119,0)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCost(c249000745.descost) e4:SetTarget(c249000745.destg2) e4:SetOperation(c249000745.desop2) c:RegisterEffect(e4) --draw local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(80794697,0)) e5:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_LEAVE_FIELD) e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e5:SetCountLimit(1,249000745) e5:SetCondition(c249000745.condition) e5:SetTarget(c249000745.target) e5:SetOperation(c249000745.operation) c:RegisterEffect(e5) end function c249000745.ntcon(e,c,minc) if c==nil then return true end return minc==0 and c:IsLevelAbove(5) and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0) < Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE) end function c249000745.spfilter(c) return c:IsSetCard(0x1ED) and c:IsType(TYPE_MONSTER) end function c249000745.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0 and Duel.IsExistingMatchingCard(c249000745.spfilter,c:GetControler(),LOCATION_GRAVE,0,2,nil) end function c249000745.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c249000745.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,1,nil) if g:GetCount()>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end function c249000745.descost(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 c249000745.destg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c249000745.desop2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function c249000745.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousPosition(POS_FACEUP) end function c249000745.tgfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x1ED) and c:IsDiscardable() end function c249000745.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c249000745.tgfilter,tp,LOCATION_HAND,0,1,nil) and Duel.IsPlayerCanDraw(tp,2) end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function c249000745.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.DiscardHand(tp,c249000745.tgfilter,1,1,REASON_EFFECT+REASON_DISCARD)~=0 then Duel.Draw(tp,2,REASON_EFFECT) end end