--created by Eaden, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x1ead),4,2) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(s.eqcon) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsCanOverlay() end if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingTarget(Card.IsCanOverlay,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.SelectTarget(tp,Card.IsCanOverlay,tp,0,LOCATION_ONFIELD,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then Duel.SendtoGrave(tc:GetOverlayGroup(),REASON_RULE) Duel.Overlay(c,Group.FromCards(tc)) end end function s.eqcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetBattleTarget() if not c:IsRelateToBattle() or c:IsFacedown() then return false end e:SetLabelObject(tc) return tc:IsLocation(LOCATION_GRAVE) and tc:IsReason(REASON_BATTLE) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local tc=e:GetLabelObject() Duel.SetTargetCard(tc) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,tc,1,0,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then Duel.Overlay(c,Group.FromCards(tc)) if not tc:IsLocation(LOCATION_OVERLAY) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=c:GetOverlayGroup():FilterSelect(tp,Card.IsAbleToDeck,1,1,nil) if #g>0 then Duel.BreakEffect() Duel.SendtoDeck(g,nil,1,REASON_EFFECT) end end end