name: Terrifying
card_text: If your opponent has Special Summoned a monster(s) this turn: Target 1 monster your opponent controls with 2000 or more ATK; destroy it, then if you have a "Hole" Normal Trap in your GY, you can banish 1 monster from your opponent's GY. You can only activate 1 "Terrifying Trap Hole Nightmare" per turn.
external_ids: local SETCARD_ID_0 = 0x4c --Trap
  
lua: local SETCARD_ID_0 = 0x4c --Trap
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_REMOVE + CATEGORY_GRAVE_ACTION)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetActivityCount(1 - tp, ACTIVITY_SPSUMMON) > 0
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsAttackAbove(2000)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) and chkc:IsControler(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.cfilter(c)
  	return c:GetType() == TYPE_TRAP and c:IsSetCard(SETCARD_ID_0, 0x89)
  end
  function s.rmfilter(c)
  	return c:IsAbleToRemove() and c:IsType(TYPE_MONSTER)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) > 0 then
  		local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_GRAVE, 0, nil)
  		local rg = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.rmfilter), tp, 0, LOCATION_GRAVE, nil)
  		if #g > 0 and #rg > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  			local mg = rg:Select(tp, 1, 1, nil)
  			Duel.Remove(mg, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Terrifying
  If your opponent has Special Summoned a monster(s) this turn: Target 1 monster your opponent controls with 2000 or more ATK; destroy it, then if you have a "Hole" Normal Trap in your GY, you can banish 1 monster from your opponent's GY. You can only activate 1 "Terrifying Trap Hole Nightmare" per turn.
target_text: -- Terrifying
  local SETCARD_ID_0 = 0x4c --Trap
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_REMOVE + CATEGORY_GRAVE_ACTION)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetActivityCount(1 - tp, ACTIVITY_SPSUMMON) > 0
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsAttackAbove(2000)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) and chkc:IsControler(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.cfilter(c)
  	return c:GetType() == TYPE_TRAP and c:IsSetCard(SETCARD_ID_0, 0x89)
  end
  function s.rmfilter(c)
  	return c:IsAbleToRemove() and c:IsType(TYPE_MONSTER)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) > 0 then
  		local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_GRAVE, 0, nil)
  		local rg = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.rmfilter), tp, 0, LOCATION_GRAVE, nil)
  		if #g > 0 and #rg > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  			local mg = rg:Select(tp, 1, 1, nil)
  			Duel.Remove(mg, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  end
  
  