name: Solemn
card_text: If this is the only Set card in your Spell & Trap Zone, when a monster would be Summoned, OR a Spell Card, Trap Card, or monster effect is activated: Pay 3000 LP; negate the Summon or activation, and if you do, destroy that card.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate(summon)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DISABLE_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_SUMMON)
  	e1:SetCondition(s.condition1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target1)
  	e1:SetOperation(s.activate1)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_FLIP_SUMMON)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EVENT_SPSUMMON)
  	c:RegisterEffect(e3)
  	--Activate(effect)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e4:SetType(EFFECT_TYPE_ACTIVATE)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetCondition(s.condition2)
  	e4:SetCost(s.cost)
  	e4:SetTarget(s.target2)
  	e4:SetOperation(s.activate2)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c)
  	return c:IsFacedown() and c:GetSequence() < 5
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsLocation(LOCATION_SZONE) and c:IsFacedown() and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 1, c)
  end
  function s.condition1(e, tp, eg, ep, ev, re, r, rp)
  	return aux.NegateSummonCondition() and s.condition(e, tp, eg, ep, ev, re, r, rp)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 3000)
  	end
  	Duel.PayLPCost(tp, 3000)
  end
  function s.target1(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.activate1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateSummon(eg)
  	Duel.Destroy(eg, REASON_EFFECT)
  end
  function s.condition2(e, tp, eg, ep, ev, re, r, rp)
  	return (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev) and s.condition(e, tp, eg, ep, ev, re, r, rp)
  end
  function s.target2(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():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  
source_text: Solemn
  If this is the only Set card in your Spell & Trap Zone, when a monster would be Summoned, OR a Spell Card, Trap Card, or monster effect is activated: Pay 3000 LP; negate the Summon or activation, and if you do, destroy that card.
target_text: -- Solemn
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate(summon)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DISABLE_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_SUMMON)
  	e1:SetCondition(s.condition1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target1)
  	e1:SetOperation(s.activate1)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_FLIP_SUMMON)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EVENT_SPSUMMON)
  	c:RegisterEffect(e3)
  	--Activate(effect)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e4:SetType(EFFECT_TYPE_ACTIVATE)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetCondition(s.condition2)
  	e4:SetCost(s.cost)
  	e4:SetTarget(s.target2)
  	e4:SetOperation(s.activate2)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c)
  	return c:IsFacedown() and c:GetSequence() < 5
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsLocation(LOCATION_SZONE) and c:IsFacedown() and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 1, c)
  end
  function s.condition1(e, tp, eg, ep, ev, re, r, rp)
  	return aux.NegateSummonCondition() and s.condition(e, tp, eg, ep, ev, re, r, rp)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 3000)
  	end
  	Duel.PayLPCost(tp, 3000)
  end
  function s.target1(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.activate1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateSummon(eg)
  	Duel.Destroy(eg, REASON_EFFECT)
  end
  function s.condition2(e, tp, eg, ep, ev, re, r, rp)
  	return (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev) and s.condition(e, tp, eg, ep, ev, re, r, rp)
  end
  function s.target2(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():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  