--Sverdånd Berserker --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) --damage trigger local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RECOVER+CATEGORY_DRAW+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DAMAGE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.con) e1:SetCost(s.cost) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) --spsum local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,id) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --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 ev<=0 then return end Duel.RegisterFlagEffect(ep,id,RESET_PHASE+PHASE_END,0,1) end function s.atkcon(e) return Duel.GetFlagEffect(tp,id)>0 end function s.con(e,tp,eg,ep,ev,re,r,rp) return ep==tp and rp==1-tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_DISCARD+REASON_COST) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,1000) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.op(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Recover(p,1000,REASON_EFFECT)>0 then Duel.BreakEffect() if Duel.Draw(p,d,REASON_EFFECT)>0 and r&REASON_BATTLE>0 then local g=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,0,nil) local tc=g:GetFirst() while tc do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(1000) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) tc=g:GetNext() end end end end function s.atkfilter(c) return c:IsFaceup() and c:IsSetCard(0x24d) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return r&(REASON_EFFECT+REASON_BATTLE)~=0 end function s.spfilter1(c,e,tp) return c:IsType(TYPE_TUNER) and c:IsSetCard(0x24d) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.spfilter2,tp,LOCATION_GRAVE,0,1,c,e,tp) end function s.spfilter2(c,e,tp) return not c:IsType(TYPE_TUNER) and c:IsSetCard(0x24d) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>2 and Duel.IsExistingTarget(s.spfilter1,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectTarget(tp,aux.NecroValleyFilter(s.spfilter1),tp,LOCATION_GRAVE,0,2,2,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=Duel.SelectTarget(tp,aux.NecroValleyFilter(s.spfilter2),tp,LOCATION_GRAVE,0,1,1,g1,e,tp) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,#g1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=Duel.GetTargetCards(e) if #g==0 or #g>ft then return end Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end