--created by Lyris / NovaTsukimori, coded by Lyris, art from Yu-Gi-Oh! 5D's Episode 5 --襲原野 local s,id,o=GetID() function s.initial_effect(c) local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_DESTROYED) e4:SetCategory(CATEGORY_DESTROY) e4:SetCountLimit(1,id-142) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_FZONE) e1:SetCountLimit(1,id) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetCost(s.hcost) e1:SetTarget(s.tg1) e1:SetOperation(s.op1) e1:SetDescription(1109) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,id) e2:SetCategory(CATEGORY_DESTROY) e2:SetCost(s.hcost) e2:SetTarget(s.tg2) e2:SetOperation(s.op2) e2:SetDescription(1100) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1,id) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_TODECK) e3:SetCost(s.hcost) e3:SetTarget(s.tg3) e3:SetOperation(s.op3) e3:SetDescription(1105) c:RegisterEffect(e3) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,0,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,0,nil) Duel.Destroy(g,REASON_EFFECT) end function s.hcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_OPSELECTED,0,e:GetDescription()) end function s.cfilter(c) return (c:IsFaceup() or c:IsLocation(LOCATION_HAND)) and c:IsSetCard(0x7c4) and c:IsType(TYPE_MONSTER) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(s.cfilter,aux.FilterBoolFunction(Card.IsDestructable)),tp,LOCATION_MZONE+LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,aux.AND(s.cfilter,aux.FilterBoolFunction(Card.IsDestructable)),tp,LOCATION_MZONE+LOCATION_HAND,0,1,1,nil) if #g==0 then return false end Duel.Destroy(g,REASON_EFFECT) return true end function s.filter1(c,tp) return s.cfilter(c) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_DECK,0,1,nil,c:GetCode()) end function s.filter2(c,code) return c:IsSetCard(0x7c4) and c:IsType(TYPE_MONSTER) and not c:IsCode(code) and c:IsAbleToHand() end function s.tg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_HAND+LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.op1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) or not s.cost(e,tp,eg,ep,ev,re,r,rp,1) then return end local tc=Duel.GetOperatedGroup():GetFirst() if not tc then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_DECK,0,1,1,nil,tc:GetCode()) if #g>0 then Duel.BreakEffect() Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.tg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s.cost(e,tp,eg,ep,ev,re,r,rp,chk) and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,TYPE_SPELL+TYPE_TRAP) end local g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,TYPE_SPELL+TYPE_TRAP) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,tp,LOCATION_HAND+LOCATION_MZONE) end function s.op2(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) or not s.cost(e,tp,eg,ep,ev,re,r,rp,1) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsType,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,TYPE_SPELL+TYPE_TRAP) if #g>0 then Duel.BreakEffect() Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end function s.tg3(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s.cost(e,tp,eg,ep,ev,re,r,rp,chk) and Duel.IsExistingMatchingCard(aux.AND(s.cfilter,aux.FilterBoolFunction(Card.IsAbleToDeck)),tp,LOCATION_REMOVED,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_HAND+LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_REMOVED) end function s.op3(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) or not s.cost(e,tp,eg,ep,ev,re,r,rp,1) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,aux.AND(s.cfilter,aux.FilterBoolFunction(Card.IsAbleToDeck)),tp,LOCATION_REMOVED,0,1,1,nil) if #g>0 then Duel.BreakEffect() Duel.SendtoDeck(g,nil,2,REASON_EFFECT) end end