--Kamissekai of Magical Mastery - Numair function c249001274.initial_effect(c) c:SetUniqueOnField(1,0,249001274) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --immune spell local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(c249001274.efilter) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(1124) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(c249001274.destg) e3:SetOperation(c249001274.desop) c:RegisterEffect(e3) --set local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(90925163,0)) e4:SetCategory(CATEGORY_LEAVE_GRAVE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_PHASE+PHASE_STANDBY) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1249001274) e4:SetTarget(c249001274.settg) e4:SetOperation(c249001274.setop) c:RegisterEffect(e4) end function c249001274.efilter(e,te) return te:IsActiveType(TYPE_SPELL) and te:GetOwnerPlayer()~=e:GetHandlerPlayer() end function c249001274.ctfilter(c) return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsSetCard(0x238) end function c249001274.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c249001274.ctfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) and Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c249001274.desop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetMatchingGroupCount(c249001274.ctfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil) local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) if ct>0 and g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=g:Select(tp,1,ct,nil) Duel.HintSelection(dg) Duel.Destroy(dg,REASON_EFFECT) end end function c249001274.setfilter(c,tp) return c:IsType(TYPE_SPELL) and c:IsSSetable(true) and (c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) end function c249001274.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_GRAVE) and c249001274.setfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(c249001274.setfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectTarget(tp,c249001274.setfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function c249001274.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SSet(tp,tc)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_DECKSHF) tc:RegisterEffect(e1,true) end end