--created by Hoshi, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) aux.AddCodeList(c,id-2) local e1=Effect.CreateEffect(c) e1:SetDescription(1109) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_DECK) e2:SetRange(LOCATION_HAND+LOCATION_GRAVE) e2:SetCountLimit(1,id+100) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP) e2:SetCondition(function(e,tp,eg) return eg:IsExists(s.cfilter,1,nil,tp) end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget():IsCode(id-2) end) e3:SetValue(500) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BATTLE_START) e4:SetRange(LOCATION_MZONE) e4:SetCategory(CATEGORY_TOGRAVE+CATEGORY_ATKCHANGE) e4:SetTarget(s.tgtg) e4:SetOperation(s.tgop) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e5:SetRange(LOCATION_SZONE) e5:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e5:SetTarget(s.tg) e5:SetLabelObject(e4) c:RegisterEffect(e5) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() end Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD) end function s.filter(c) return c:IsCode(id-2) and (c:IsLocation(LOCATION_DECK) and c:IsAbleToHand() or (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsAbleToDeck()) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_REMOVED,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil):GetFirst() if tg and tg:IsLocation(LOCATION_DECK) then Duel.SendtoHand(tg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tg) elseif tg then Duel.SendtoDeck(tg,nil,2,REASON_EFFECT) end end function s.cfilter(c,tp) return c:GetPreviousCodeOnField()==id-2 and c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetPreviousControler()==tp end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) if e:GetHandler():IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end if Duel.IsPlayerAffectedByEffect(tp,id+12) then Duel.SetChainLimit(function(e,rpr,p) return rpr==p end) end end function s.spfilter(c,e,tp) return c:IsCode(id-2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then if not Duel.Equip(tp,c,tc) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(function(ef,cc) return tc==cc end) c:RegisterEffect(e1) end end function s.tg(e,c) return c==e:GetHandler():GetEquipTarget() and c:IsCode(id-2) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_DAMAGE,0,1) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgfilter(c) return c:IsLevelBelow(3) and c:IsSetCard(0xcda) and c:IsAbleToGrave() end function s.tgop(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.tgfilter,tp,LOCATION_DECK,0,1,1,nil) local tc=g:GetFirst() if Duel.SendtoGrave(g,REASON_EFFECT)==0 or not tc or not tc:IsLocation(LOCATION_GRAVE) or not c:IsRelateToEffect(e) or c:IsFacedown() then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END) e1:SetValue(tc:GetLevel()*200) c:RegisterEffect(e1) end