name: Royal
card_text: Either player can pay 800 Life Points to negate the Special Summon of a monster(s), and/or an effect that Special Summons a monster(s), and destroy those cards.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--instant
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetProperty(EFFECT_FLAG_BOTH_SIDE)
  	e3:SetCode(EVENT_SPSUMMON)
  	e3:SetCondition(aux.NegateSummonCondition)
  	e3:SetCost(s.cost2)
  	e3:SetTarget(s.target2)
  	e3:SetOperation(s.activate2)
  	c:RegisterEffect(e3)
  	--instant(chain)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_QUICK_O)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetProperty(EFFECT_FLAG_BOTH_SIDE)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetCondition(s.condition3)
  	e4:SetCost(s.cost3)
  	e4:SetTarget(s.target3)
  	e4:SetOperation(s.activate3)
  	c:RegisterEffect(e4)
  end
  function s.cost2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 800)
  	end
  	Duel.PayLPCost(tp, 800)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE_SUMMON, eg, eg:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, eg:GetCount(), 0, 0)
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateSummon(eg)
  	Duel.Destroy(eg, REASON_EFFECT)
  end
  function s.condition3(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasCategory(CATEGORY_SPECIAL_SUMMON) and Duel.IsChainDisablable(ev)
  end
  function s.cost3(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 800)
  	end
  	Duel.PayLPCost(tp, 800)
  end
  function s.target3(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)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate3(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  
source_text: Royal
  Either player can pay 800 Life Points to negate the Special Summon of a monster(s), and/or an effect that Special Summons a monster(s), and destroy those cards.
target_text: -- Royal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--instant
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetProperty(EFFECT_FLAG_BOTH_SIDE)
  	e3:SetCode(EVENT_SPSUMMON)
  	e3:SetCondition(aux.NegateSummonCondition)
  	e3:SetCost(s.cost2)
  	e3:SetTarget(s.target2)
  	e3:SetOperation(s.activate2)
  	c:RegisterEffect(e3)
  	--instant(chain)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_QUICK_O)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetProperty(EFFECT_FLAG_BOTH_SIDE)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetCondition(s.condition3)
  	e4:SetCost(s.cost3)
  	e4:SetTarget(s.target3)
  	e4:SetOperation(s.activate3)
  	c:RegisterEffect(e4)
  end
  function s.cost2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 800)
  	end
  	Duel.PayLPCost(tp, 800)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE_SUMMON, eg, eg:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, eg:GetCount(), 0, 0)
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateSummon(eg)
  	Duel.Destroy(eg, REASON_EFFECT)
  end
  function s.condition3(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasCategory(CATEGORY_SPECIAL_SUMMON) and Duel.IsChainDisablable(ev)
  end
  function s.cost3(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 800)
  	end
  	Duel.PayLPCost(tp, 800)
  end
  function s.target3(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)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate3(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  