--Sverdånd Vichingo --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) --change statline local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e0:SetRange(LOCATION_MZONE) e0:SetCode(EFFECT_SET_BASE_ATTACK) e0:SetCondition(s.atkcon) e0:SetValue(2400) c:RegisterEffect(e0) local e0x=e0:Clone() e0x:SetCode(EFFECT_CHANGE_ATTRIBUTE) e0x:SetValue(ATTRIBUTE_FIRE) c:RegisterEffect(e0x) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id-1,1)) e1:SetCategory(CATEGORY_EQUIP+CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CUSTOM+id) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e1x=e1:Clone() e1x:SetDescription(aux.Stringid(id-1,2)) e1x:SetCondition(s.condition2) c:RegisterEffect(e1x) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetRange(LOCATION_HAND+LOCATION_GRAVE) e2:SetCountLimit(1,id+100) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --register damage if not s.global_check then s.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DAMAGE) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end end --register damage function s.checkop(e,tp,eg,ep,ev,re,r,rp) if not eg then eg=e:GetHandler() end if ev<=0 then return end Duel.RegisterFlagEffect(ep,id,RESET_PHASE+PHASE_END,0,1) Duel.RaiseEvent(eg,EVENT_CUSTOM+id,re,r,rp,ep,ev) end function s.atkcon(e) return Duel.GetFlagEffect(tp,id)>0 end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ep==tp and rp==tp end function s.condition2(e,tp,eg,ep,ev,re,r,rp) return ep==tp and rp==1-tp end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() end Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD) end function s.tgfilter(c,tp) return c:IsFaceup() and c:IsSetCard(0x24d) and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,nil,c,tp) end function s.eqfilter(c,ec,tp) return c:IsCode(24343171) and c:CheckEquipTarget(ec) and not c:IsForbidden() and c:CheckUniqueOnField(c,tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) and (rp~=1-tp or Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_HAND,1,nil,e)) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE) if rp~=1-tp then local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_HAND,nil,e) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.eqfilter),tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,tc,tp) local ec=g:GetFirst() if ec and Duel.Equip(tp,ec,tc) and rp==1-tp then local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_HAND,nil,e) if #g<=0 then return end local sg=g:RandomSelect(tp,1) if #sg>0 then Duel.Destroy(sg,REASON_EFFECT) end end end end function s.egf(c,r) return c:IsSetCard(0x24d) and c:IsType(TYPE_MONSTER) and (not r or c:IsReason(REASON_BATTLE)) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.egf,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and eg:IsExists(s.egf,1,nil,true) and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,0,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,0,LOCATION_MZONE,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.SendtoGrave(g,REASON_EFFECT) end end end