--Resistenza Sverdånd --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.chcon) e1:SetOperation(s.chop) c:RegisterEffect(e1) --SS local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DRAW+CATEGORY_DESTROY) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DAMAGE) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.condition) e2:SetCost(aux.bfgcost) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) local e2x=e2:Clone() e2x:SetDescription(aux.Stringid(id,2)) e2x:SetCondition(s.condition2) c:RegisterEffect(e2x) --act in hand local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_TRAP_ACT_IN_HAND) e3:SetCondition(s.handcon) 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.chcon(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetCurrentChain() if ct<2 then return end local te=Duel.GetChainInfo(ct-1,CHAININFO_TRIGGERING_EFFECT) return te and te:GetHandler():IsSetCard(0x24d) and rp==1-tp end function s.chop(e,tp,eg,ep,ev,re,r,rp) local g=Group.CreateGroup() Duel.ChangeTargetCard(ev,g) Duel.ChangeChainOperation(ev,s.repop) --set again local c=e:GetHandler() if Duel.GetFlagEffect(tp,id)>0 and c:IsRelateToEffect(e) and c:IsSSetable(true) and e:IsHasType(EFFECT_TYPE_ACTIVATE) then Duel.BreakEffect() c:CancelToGrave() Duel.ChangePosition(c,POS_FACEDOWN) Duel.RaiseEvent(c,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end end function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Damage(1-tp,500,REASON_EFFECT) 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.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and (rp~=1-tp or Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil)) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) if rp==1-tp then local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)>0 and rp==1-tp then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.BreakEffect() Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end end function s.cf(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsSetCard(0x24d) and c:IsAttackAbove(2000) end function s.handcon(e) return Duel.IsExistingMatchingCard(s.cf,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end