name: Verdict
card_text: When your opponent activates a Spell/Trap Card, while you control 3 or more other Spells/Traps: Negate the activation, and if you do, destroy that card, then if you control "Temple of the Kings", you can destroy as many monsters your opponent controls as possible, then inflict damage to your opponent equal to half the total original ATK of those destroyed monsters. You can only activate 1 "Verdict of Anubis" per turn.
external_ids: local CARD_ID_0 = 29762407 --Temple of the Kings
  
lua: local CARD_ID_0 = 29762407 --Temple of the Kings
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	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.IsExistingMatchingCard(Card.IsType, tp, LOCATION_ONFIELD, 0, 3, e:GetHandler(), TYPE_SPELL + TYPE_TRAP)
  		and rp == 1 - tp
  		and re:IsHasType(EFFECT_TYPE_ACTIVATE)
  		and Duel.IsChainNegatable(ev)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg, REASON_EFFECT) ~= 0 then
  		local sg = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  		if #sg > 0 and Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup, Card.IsCode), tp, LOCATION_ONFIELD, 0, 1, nil, CARD_ID_0) and Duel.SelectYesNo(tp, aux.Stringid(id, 1)) then
  			Duel.BreakEffect()
  			if Duel.Destroy(sg, REASON_EFFECT) ~= 0 then
  				local og = Duel.GetOperatedGroup()
  				local atk = math.ceil(og:GetSum(Card.GetTextAttack) / 2)
  				Duel.Damage(1 - tp, atk, REASON_EFFECT)
  			end
  		end
  	end
  end
  
  
source_text: Verdict
  When your opponent activates a Spell/Trap Card, while you control 3 or more other Spells/Traps: Negate the activation, and if you do, destroy that card, then if you control "Temple of the Kings", you can destroy as many monsters your opponent controls as possible, then inflict damage to your opponent equal to half the total original ATK of those destroyed monsters. You can only activate 1 "Verdict of Anubis" per turn.
target_text: -- Verdict
  local CARD_ID_0 = 29762407 --Temple of the Kings
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	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.IsExistingMatchingCard(Card.IsType, tp, LOCATION_ONFIELD, 0, 3, e:GetHandler(), TYPE_SPELL + TYPE_TRAP)
  		and rp == 1 - tp
  		and re:IsHasType(EFFECT_TYPE_ACTIVATE)
  		and Duel.IsChainNegatable(ev)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg, REASON_EFFECT) ~= 0 then
  		local sg = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  		if #sg > 0 and Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup, Card.IsCode), tp, LOCATION_ONFIELD, 0, 1, nil, CARD_ID_0) and Duel.SelectYesNo(tp, aux.Stringid(id, 1)) then
  			Duel.BreakEffect()
  			if Duel.Destroy(sg, REASON_EFFECT) ~= 0 then
  				local og = Duel.GetOperatedGroup()
  				local atk = math.ceil(og:GetSum(Card.GetTextAttack) / 2)
  				Duel.Damage(1 - tp, atk, REASON_EFFECT)
  			end
  		end
  	end
  end
  
  