--Mage-Guild Destructor function c249000863.initial_effect(c) --destroy monster local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCondition(c249000863.descon) e1:SetTarget(c249000863.destg) e1:SetOperation(c249000863.desop) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(70074904,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BATTLED) e2:SetCondition(c249000863.condition) e2:SetTarget(c249000863.target) e2:SetOperation(c249000863.operation) c:RegisterEffect(e2) end function c249000863.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPosition(POS_FACEUP_ATTACK) end function c249000863.filter(c) return c:IsType(TYPE_MONSTER) and c:IsDestructable() end function c249000863.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c249000863.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c249000863.filter,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c249000863.filter,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c249000863.desop(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_COPY_INHERIT) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_SELF_TURN,2) c:RegisterEffect(e1) end end function c249000863.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsStatus(STATUS_BATTLE_DESTROYED) and c:IsStatus(STATUS_OPPO_BATTLE) end function c249000863.target(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local a=Duel.GetAttacker() local t=Duel.GetAttackTarget() if chk==0 then return (t==c and a:IsAbleToRemove()) or (a==c and t~=nil and t:IsAbleToRemove()) end local g=Group.CreateGroup() if a:IsRelateToBattle() then g:AddCard(a) end if t~=nil and t:IsRelateToBattle() then g:AddCard(t) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0) end function c249000863.operation(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() local g=Group.FromCards(a,d) local rg=g:Filter(Card.IsRelateToBattle,nil) Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) end