--Automate ID local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(54895237,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e1:SetCost(s.gspcost) e1:SetTarget(s.gsptg) e1:SetOperation(s.gspop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) 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+EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e2) end function s.gspcfilter(c,tp) return c:IsFaceup() and c:IsSetCard(0x301) and c:IsAbleToGrave() and ((Duel.GetLocationCount(tp,LOCATION_MZONE)>0) or (c:GetSequence()<5)) end function s.gspcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.gspcfilter,tp,LOCATION_MZONE,0,1,nil,tp) end end function s.gsptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>-1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.gspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.gspcfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) if Duel.SendtoGrave(g,REASON_EFFECT)==0 then return end if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) 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) and r&REASON_EFFECT==REASON_EFFECT end function s.filter1(c) return c:IsSetCard(0x301) and c:IsAbleToGrave() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsOnField() and Card.IsAbleToRemove(chkc) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler()) and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,nil) and Duel.IsPlayerCanDiscardDeck(tp,2) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,2) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local g=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil) if #g==0 then return end if Duel.SendtoGrave(g,REASON_EFFECT)~=0 and tc:IsRelateToEffect(e) then if Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)==0 then return end Duel.DiscardDeck(tp,2,REASON_EFFECT) end end