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 Reichheart" once per turn this way. If this card is Normal or Special Summoned: You can add 1 "Scareclaw" Spell/Trap from your Deck to your hand, then, if 3 or more Defense Position monsters are on the field, you can draw 1 card. You can only use this effect of "Scareclaw Reichheart" once per turn.
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)
  	--tohand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_DRAW)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + o)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  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.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if #g > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  		if Duel.IsPlayerCanDraw(tp, 1) and Duel.GetMatchingGroupCount(Card.IsDefensePos, tp, LOCATION_MZONE, LOCATION_MZONE, nil) >= 3 and Duel.SelectYesNo(tp, aux.Stringid(id, 1)) then
  			Duel.BreakEffect()
  			Duel.ShuffleDeck(tp)
  			Duel.Draw(tp, 1, REASON_EFFECT)
  		end
  	end
  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 Reichheart" once per turn this way. If this card is Normal or Special Summoned: You can add 1 "Scareclaw" Spell/Trap from your Deck to your hand, then, if 3 or more Defense Position monsters are on the field, you can draw 1 card. You can only use this effect of "Scareclaw Reichheart" once per turn.
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)
  	--tohand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_DRAW)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + o)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  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.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if #g > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  		if Duel.IsPlayerCanDraw(tp, 1) and Duel.GetMatchingGroupCount(Card.IsDefensePos, tp, LOCATION_MZONE, LOCATION_MZONE, nil) >= 3 and Duel.SelectYesNo(tp, aux.Stringid(id, 1)) then
  			Duel.BreakEffect()
  			Duel.ShuffleDeck(tp)
  			Duel.Draw(tp, 1, REASON_EFFECT)
  		end
  	end
  end
  
  