name: Scareclaw
card_text: Once per turn: You can target 1 "Scareclaw" monster or "Visas Starfrost" you control; it can attack while in face-up Defense Position this turn. If it does, apply its ATK or DEF (whichever is higher) for damage calculation. When your opponent activates a card or effect, while you control a "Scareclaw" monster in the Extra Monster Zone: You can send this face-up card to the GY; negate that effect. You can only use this effect of "Scareclaw Sclash" once per turn.
external_ids: local CARD_ID_0 = 56099748 --Visas Starfrost
  local SETCARD_ID_0 = 0x17a --Scareclaw
  
lua: local CARD_ID_0 = 56099748 --Visas Starfrost
  local SETCARD_ID_0 = 0x17a --Scareclaw
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--able to be DefensePos attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.adatktg)
  	e2:SetOperation(s.adatkop)
  	c:RegisterEffect(e2)
  	--negate
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_DISABLE)
  	e4:SetType(EFFECT_TYPE_QUICK_O)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetRange(LOCATION_SZONE)
  	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.filter(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsCode(CARD_ID_0)) and c:IsFaceup() and not c:IsType(TYPE_LINK)
  end
  function s.adatktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetTurnPlayer() == tp and aux.bpcon(e, tp, eg, ep, ev, re, r, rp) and Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  end
  function s.adatkop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not tc:IsRelateToEffect(e) or tc:IsFacedown() then
  		return
  	end
  	--defense attack
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_DEFENSE_ATTACK)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	e1:SetValue(s.adaval)
  	tc:RegisterEffect(e1)
  end
  function s.adaval(e)
  	local c = e:GetHandler()
  	return c:GetAttack() > c:GetDefense() and 0 or 1
  end
  function s.exfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetSequence() >= 5
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsChainDisablable(ev) and Duel.IsExistingMatchingCard(s.exfilter, tp, LOCATION_MZONE, 0, 1, nil) and rp == 1 - tp
  end
  function s.discost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsAbleToGraveAsCost() and c:IsStatus(STATUS_EFFECT_ENABLED)
  	end
  	Duel.SendtoGrave(c, REASON_COST)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateEffect(ev)
  end
  
  
source_text: Scareclaw
  Once per turn: You can target 1 "Scareclaw" monster or "Visas Starfrost" you control; it can attack while in face-up Defense Position this turn. If it does, apply its ATK or DEF (whichever is higher) for damage calculation. When your opponent activates a card or effect, while you control a "Scareclaw" monster in the Extra Monster Zone: You can send this face-up card to the GY; negate that effect. You can only use this effect of "Scareclaw Sclash" once per turn.
target_text: -- Scareclaw
  local CARD_ID_0 = 56099748 --Visas Starfrost
  local SETCARD_ID_0 = 0x17a --Scareclaw
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--able to be DefensePos attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.adatktg)
  	e2:SetOperation(s.adatkop)
  	c:RegisterEffect(e2)
  	--negate
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_DISABLE)
  	e4:SetType(EFFECT_TYPE_QUICK_O)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetRange(LOCATION_SZONE)
  	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.filter(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsCode(CARD_ID_0)) and c:IsFaceup() and not c:IsType(TYPE_LINK)
  end
  function s.adatktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetTurnPlayer() == tp and aux.bpcon(e, tp, eg, ep, ev, re, r, rp) and Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  end
  function s.adatkop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not tc:IsRelateToEffect(e) or tc:IsFacedown() then
  		return
  	end
  	--defense attack
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_DEFENSE_ATTACK)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	e1:SetValue(s.adaval)
  	tc:RegisterEffect(e1)
  end
  function s.adaval(e)
  	local c = e:GetHandler()
  	return c:GetAttack() > c:GetDefense() and 0 or 1
  end
  function s.exfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetSequence() >= 5
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsChainDisablable(ev) and Duel.IsExistingMatchingCard(s.exfilter, tp, LOCATION_MZONE, 0, 1, nil) and rp == 1 - tp
  end
  function s.discost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsAbleToGraveAsCost() and c:IsStatus(STATUS_EFFECT_ENABLED)
  	end
  	Duel.SendtoGrave(c, REASON_COST)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateEffect(ev)
  end
  
  