--Automate ID local s,id=GetID() function s.initial_effect(c) --send local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.tgcost) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) e1:SetCountLimit(1,id) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) e2:SetCountLimit(1,id+1000) c:RegisterEffect(e2) end function s.costfilter(c) return c:IsSetCard(0x301) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(Card.IsAttribute,0,LOCATION_MZONE,LOCATION_MZONE,1,nil,c:GetAttribute()) end function s.tgcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) e:SetLabel(rg:GetFirst():GetAttribute()) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local attr=e:GetLabel() local tc=Duel.SelectMatchingCard(tp,Card.IsAttribute,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,attr) if tc then Duel.SendtoGrave(tc,REASON_EFFECT) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return re and re:GetHandler():IsSetCard(0x301) and not re:GetHandler():IsCode(id) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if Duel.DiscardHand(p,nil,1,1,REASON_EFFECT+REASON_DISCARD)>0 then local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end end