name: Imperial
card_text: Negate all Spell effects on the field. Once per turn, during the Standby Phase, you must pay 700 LP (this is not optional), or this card is destroyed.
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)
  	--disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_DISABLE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(LOCATION_SZONE, LOCATION_SZONE)
  	e2:SetTarget(s.distarget)
  	c:RegisterEffect(e2)
  	--disable effect
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_CHAIN_SOLVING)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetOperation(s.disoperation)
  	c:RegisterEffect(e3)
  	--maintain
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e4:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCountLimit(1)
  	e4:SetOperation(s.mtop)
  	c:RegisterEffect(e4)
  end
  function s.distarget(e, c)
  	return c ~= e:GetHandler() and c:IsType(TYPE_SPELL)
  end
  function s.disoperation(e, tp, eg, ep, ev, re, r, rp)
  	local tl = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_LOCATION)
  	if bit.band(tl, LOCATION_SZONE) ~= 0 and re:IsActiveType(TYPE_SPELL) then
  		Duel.NegateEffect(ev)
  	end
  end
  function s.mtop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.CheckLPCost(tp, 700) then
  		Duel.PayLPCost(tp, 700)
  	else
  		Duel.Destroy(e:GetHandler(), REASON_COST)
  	end
  end
  
  
source_text: Imperial
  Negate all Spell effects on the field. Once per turn, during the Standby Phase, you must pay 700 LP (this is not optional), or this card is destroyed.
target_text: -- Imperial
  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)
  	--disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_DISABLE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(LOCATION_SZONE, LOCATION_SZONE)
  	e2:SetTarget(s.distarget)
  	c:RegisterEffect(e2)
  	--disable effect
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_CHAIN_SOLVING)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetOperation(s.disoperation)
  	c:RegisterEffect(e3)
  	--maintain
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e4:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCountLimit(1)
  	e4:SetOperation(s.mtop)
  	c:RegisterEffect(e4)
  end
  function s.distarget(e, c)
  	return c ~= e:GetHandler() and c:IsType(TYPE_SPELL)
  end
  function s.disoperation(e, tp, eg, ep, ev, re, r, rp)
  	local tl = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_LOCATION)
  	if bit.band(tl, LOCATION_SZONE) ~= 0 and re:IsActiveType(TYPE_SPELL) then
  		Duel.NegateEffect(ev)
  	end
  end
  function s.mtop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.CheckLPCost(tp, 700) then
  		Duel.PayLPCost(tp, 700)
  	else
  		Duel.Destroy(e:GetHandler(), REASON_COST)
  	end
  end
  
  