--Creatrice di Speranza della Untergang, Julia --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkAttribute,ATTRIBUTE_WATER),3,3,s.lcheck) c:EnableReviveLimit() --cannot be link material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) --target protection local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCondition(s.tgcond) e2:SetTarget(s.tgtg) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --destruction protection local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetCondition(s.indcon) e3:SetTarget(s.indtg) e3:SetValue(1) c:RegisterEffect(e3) --negate local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetRange(LOCATION_MZONE) e4:SetCode(EVENT_CHAINING) e4:SetCountLimit(1,id) e4:SetCondition(s.discon) e4:SetCost(s.discost) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) end function s.lcheck(g) return g:GetClassCount(Card.GetLinkRace)==1 end function s.tgcond(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function s.tgtg(e,c) return c:IsLevelBelow(4) and c:HasLevel() and c:IsAttribute(ATTRIBUTE_WATER) end function s.filter(c,cc) return c:IsFaceup() and c:IsCode(400008) and c:GetLinkedGroup():IsContains(cc) end function s.indcon(e,tp) local c=e:GetHandler() return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,c) end function s.indtg(e,c) return c:IsAttribute(ATTRIBUTE_WATER) and c:GetLinkedGroupCount()>0 end function s.discon(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsMainPhase() or e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end return rp==1-tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and Duel.IsChainNegatable(ev) end function s.cfilter(c) return c:GetType()&(TYPE_SPELL+TYPE_QUICKPLAY)==TYPE_SPELL+TYPE_QUICKPLAY and c:IsSetCard(0x246) and c:IsDiscardable() end function s.discost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST+REASON_DISCARD) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable(e) and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end