name: Nephthys,
card_text: 2+ monsters, including a Ritual Monster
  While this card is in the Extra Monster Zone, monsters your opponent controls cannot target "Nephthys" monsters in the Main Monster Zones for attacks. This card gains effects based on the number of Ritual Monsters used for its Link Summon.
  ● 1+: Cannot be destroyed by battle.
  ● 2+: Cannot be destroyed by card effects, also it gains 1200 ATK.
  ● 3: Neither player can target this card with card effects, also it gains another 1200 ATK.
external_ids: local SETCARD_ID_0 = 0x11f --Nephthys
  
lua: local SETCARD_ID_0 = 0x11f --Nephthys
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, nil, 2, nil, s.lcheck)
  	c:EnableReviveLimit()
  	--effect gain
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCondition(s.regcon)
  	e1:SetOperation(s.regop)
  	c:RegisterEffect(e1)
  	--cannot select battle target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, LOCATION_MZONE)
  	e2:SetCondition(s.atcon)
  	e2:SetValue(s.atlimit)
  	c:RegisterEffect(e2)
  end
  function s.lcheck(g, lc)
  	return g:IsExists(Card.IsLinkType, 1, nil, TYPE_RITUAL)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = c:GetMaterial():FilterCount(Card.IsLinkType, nil, TYPE_RITUAL)
  	if ct >= 1 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e1)
  		c:RegisterFlagEffect(0, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 0))
  	end
  	if ct >= 2 then
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e2:SetCode(EFFECT_UPDATE_ATTACK)
  		e2:SetRange(LOCATION_MZONE)
  		e2:SetValue(1200)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e2)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_SINGLE)
  		e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  		e3:SetValue(1)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e3)
  		c:RegisterFlagEffect(0, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 1))
  	end
  	if ct == 3 then
  		local e4 = Effect.CreateEffect(c)
  		e4:SetType(EFFECT_TYPE_SINGLE)
  		e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e4:SetCode(EFFECT_UPDATE_ATTACK)
  		e4:SetRange(LOCATION_MZONE)
  		e4:SetValue(1200)
  		e4:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e4)
  		local e5 = Effect.CreateEffect(c)
  		e5:SetType(EFFECT_TYPE_SINGLE)
  		e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e5:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  		e5:SetRange(LOCATION_MZONE)
  		e5:SetValue(1)
  		e5:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e5)
  		c:RegisterFlagEffect(0, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 2))
  	end
  end
  function s.atcon(e)
  	return e:GetHandler():GetSequence() > 4
  end
  function s.atlimit(e, c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetSequence() < 5
  end
  
  
source_text: Nephthys,
  2+ monsters, including a Ritual Monster
  While this card is in the Extra Monster Zone, monsters your opponent controls cannot target "Nephthys" monsters in the Main Monster Zones for attacks. This card gains effects based on the number of Ritual Monsters used for its Link Summon.
  ● 1+: Cannot be destroyed by battle.
  ● 2+: Cannot be destroyed by card effects, also it gains 1200 ATK.
  ● 3: Neither player can target this card with card effects, also it gains another 1200 ATK.
target_text: -- Nephthys,
  local SETCARD_ID_0 = 0x11f --Nephthys
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, nil, 2, nil, s.lcheck)
  	c:EnableReviveLimit()
  	--effect gain
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCondition(s.regcon)
  	e1:SetOperation(s.regop)
  	c:RegisterEffect(e1)
  	--cannot select battle target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, LOCATION_MZONE)
  	e2:SetCondition(s.atcon)
  	e2:SetValue(s.atlimit)
  	c:RegisterEffect(e2)
  end
  function s.lcheck(g, lc)
  	return g:IsExists(Card.IsLinkType, 1, nil, TYPE_RITUAL)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = c:GetMaterial():FilterCount(Card.IsLinkType, nil, TYPE_RITUAL)
  	if ct >= 1 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e1)
  		c:RegisterFlagEffect(0, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 0))
  	end
  	if ct >= 2 then
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e2:SetCode(EFFECT_UPDATE_ATTACK)
  		e2:SetRange(LOCATION_MZONE)
  		e2:SetValue(1200)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e2)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_SINGLE)
  		e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  		e3:SetValue(1)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e3)
  		c:RegisterFlagEffect(0, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 1))
  	end
  	if ct == 3 then
  		local e4 = Effect.CreateEffect(c)
  		e4:SetType(EFFECT_TYPE_SINGLE)
  		e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e4:SetCode(EFFECT_UPDATE_ATTACK)
  		e4:SetRange(LOCATION_MZONE)
  		e4:SetValue(1200)
  		e4:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e4)
  		local e5 = Effect.CreateEffect(c)
  		e5:SetType(EFFECT_TYPE_SINGLE)
  		e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e5:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  		e5:SetRange(LOCATION_MZONE)
  		e5:SetValue(1)
  		e5:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e5)
  		c:RegisterFlagEffect(0, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 2))
  	end
  end
  function s.atcon(e)
  	return e:GetHandler():GetSequence() > 4
  end
  function s.atlimit(e, c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetSequence() < 5
  end
  
  