name: Scareclaw
card_text: You can Special Summon this card (from your hand) to your Main Monster Zone, adjacent to a "Scareclaw" monster you control or in its column. You can only Special Summon "Scareclaw Acro" once per turn this way. Your "Scareclaw" monsters in the Extra Monster Zone(s) gain 300 ATK for each Defense Position monster you control.
external_ids: local SETCARD_ID_0 = 0x17a --Scareclaw
  
lua: local SETCARD_ID_0 = 0x17a --Scareclaw
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.hspcon)
  	e1:SetValue(s.hspval)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(s.atktg)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup()
  end
  function s.getzone(tp)
  	local zone = 0
  	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_MZONE, 0, nil)
  	for tc in aux.Next(g) do
  		local seq = tc:GetSequence()
  		if seq == 5 or seq == 6 then
  			zone = zone | (1 << aux.MZoneSequence(seq))
  		else
  			if seq > 0 then
  				zone = zone | (1 << (seq - 1))
  			end
  			if seq < 4 then
  				zone = zone | (1 << (seq + 1))
  			end
  		end
  	end
  	return zone
  end
  function s.hspcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local zone = s.getzone(tp)
  	return Duel.GetLocationCount(tp, LOCATION_MZONE, tp, LOCATION_REASON_TOFIELD, zone) > 0
  end
  function s.hspval(e, c)
  	local tp = c:GetControler()
  	return 0, s.getzone(tp)
  end
  function s.atktg(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetSequence() >= 5
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(Card.IsDefensePos, c:GetControler(), LOCATION_MZONE, 0, nil) * 300
  end
  
  
source_text: Scareclaw
  You can Special Summon this card (from your hand) to your Main Monster Zone, adjacent to a "Scareclaw" monster you control or in its column. You can only Special Summon "Scareclaw Acro" once per turn this way. Your "Scareclaw" monsters in the Extra Monster Zone(s) gain 300 ATK for each Defense Position monster you control.
target_text: -- Scareclaw
  local SETCARD_ID_0 = 0x17a --Scareclaw
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.hspcon)
  	e1:SetValue(s.hspval)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(s.atktg)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup()
  end
  function s.getzone(tp)
  	local zone = 0
  	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_MZONE, 0, nil)
  	for tc in aux.Next(g) do
  		local seq = tc:GetSequence()
  		if seq == 5 or seq == 6 then
  			zone = zone | (1 << aux.MZoneSequence(seq))
  		else
  			if seq > 0 then
  				zone = zone | (1 << (seq - 1))
  			end
  			if seq < 4 then
  				zone = zone | (1 << (seq + 1))
  			end
  		end
  	end
  	return zone
  end
  function s.hspcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local zone = s.getzone(tp)
  	return Duel.GetLocationCount(tp, LOCATION_MZONE, tp, LOCATION_REASON_TOFIELD, zone) > 0
  end
  function s.hspval(e, c)
  	local tp = c:GetControler()
  	return 0, s.getzone(tp)
  end
  function s.atktg(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetSequence() >= 5
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(Card.IsDefensePos, c:GetControler(), LOCATION_MZONE, 0, nil) * 300
  end
  
  