--Sverdånd Mariner --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --ss local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetCountLimit(1,id+100) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --SS local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id-2,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_CUSTOM+id) e4:SetRange(LOCATION_HAND+LOCATION_MZONE) e4:SetCountLimit(1,id+200) e4:SetCondition(s.condition) e4:SetCost(s.cost) e4:SetTarget(s.target) e4:SetOperation(s.operation) c:RegisterEffect(e4) local e4x=e4:Clone() e4x:SetDescription(aux.Stringid(id-2,2)) e4x:SetCondition(s.condition2) c:RegisterEffect(e4x) --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.RaiseEvent(eg,EVENT_CUSTOM+id,re,r,rp,ep,ev) end function s.spcfilter(c) return c:IsFaceup() and c:IsSetCard(0x24d) and c:IsType(TYPE_SPELL+TYPE_TRAP) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.spf(c) return c:IsSetCard(0x24d) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spf,tp,LOCATION_DECK,0,1,nil) and Duel.IsPlayerCanDraw(tp,1) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spf,tp,LOCATION_DECK,0,1,1,nil) if #g>0 and Duel.SendtoGrave(g,REASON_EFFECT)>0 and g:IsExists(Card.IsLocation,1,nil,LOCATION_GRAVE) then if g:IsExists(s.shufflecheck,1,nil,tp) then Duel.ShuffleDeck(tp) end Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end function s.shufflecheck(c,tp) return c:IsLocation(LOCATION_GRAVE) and c:GetPreviousLocation()==LOCATION_DECK and c:GetPreviousControler()==tp 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 e:GetHandler():IsLocation(LOCATION_MZONE) then e:SetLabel(1) end if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(0x24d) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local check=(e:GetLabel()==1) or Duel.GetLocationCount(tp,LOCATION_MZONE)>0 e:SetLabel(0) return check and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end e:SetLabel(0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 and rp==1-tp and Duel.GetCurrentPhase()~=PHASE_MAIN1 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() local ph=Duel.GetCurrentPhase() if ph>=PHASE_BATTLE_START and ph