name: Mystic
card_text: If your opponent controls more monsters than you do, your opponent cannot activate monster effects or declare an attack. If you control more monsters than your opponent does, you cannot activate monster effects or declare an attack. Once per turn, during the End Phase, if both players control the same number of monsters: Destroy this card.
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)
  	--activate limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetCondition(s.actcona)
  	e2:SetValue(s.actlimit)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetTargetRange(0, 1)
  	e3:SetCondition(s.actcona)
  	c:RegisterEffect(e3)
  	--activate limit
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetTargetRange(1, 0)
  	e4:SetCondition(s.actconb)
  	e4:SetValue(s.actlimit)
  	c:RegisterEffect(e4)
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_FIELD)
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
  	e5:SetRange(LOCATION_FZONE)
  	e5:SetTargetRange(1, 0)
  	e5:SetCondition(s.actconb)
  	c:RegisterEffect(e5)
  	--destroy
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 0))
  	e6:SetCategory(CATEGORY_DESTROY)
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e6:SetCode(EVENT_PHASE + PHASE_END)
  	e6:SetRange(LOCATION_FZONE)
  	e6:SetCountLimit(1)
  	e6:SetCondition(s.descon)
  	e6:SetTarget(s.destg)
  	e6:SetOperation(s.desop)
  	c:RegisterEffect(e6)
  end
  function s.actcona(e)
  	local tp = e:GetHandler():GetControler()
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) < Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  end
  function s.actconb(e)
  	local tp = e:GetHandler():GetControler()
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  end
  function s.actlimit(e, re, tp)
  	return re:IsActiveType(TYPE_MONSTER)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, e:GetHandler(), 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.Destroy(c, REASON_EFFECT)
  	end
  end
  
  
source_text: Mystic
  If your opponent controls more monsters than you do, your opponent cannot activate monster effects or declare an attack. If you control more monsters than your opponent does, you cannot activate monster effects or declare an attack. Once per turn, during the End Phase, if both players control the same number of monsters: Destroy this card.
target_text: -- Mystic
  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)
  	--activate limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetCondition(s.actcona)
  	e2:SetValue(s.actlimit)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetTargetRange(0, 1)
  	e3:SetCondition(s.actcona)
  	c:RegisterEffect(e3)
  	--activate limit
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetTargetRange(1, 0)
  	e4:SetCondition(s.actconb)
  	e4:SetValue(s.actlimit)
  	c:RegisterEffect(e4)
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_FIELD)
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
  	e5:SetRange(LOCATION_FZONE)
  	e5:SetTargetRange(1, 0)
  	e5:SetCondition(s.actconb)
  	c:RegisterEffect(e5)
  	--destroy
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 0))
  	e6:SetCategory(CATEGORY_DESTROY)
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e6:SetCode(EVENT_PHASE + PHASE_END)
  	e6:SetRange(LOCATION_FZONE)
  	e6:SetCountLimit(1)
  	e6:SetCondition(s.descon)
  	e6:SetTarget(s.destg)
  	e6:SetOperation(s.desop)
  	c:RegisterEffect(e6)
  end
  function s.actcona(e)
  	local tp = e:GetHandler():GetControler()
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) < Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  end
  function s.actconb(e)
  	local tp = e:GetHandler():GetControler()
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  end
  function s.actlimit(e, re, tp)
  	return re:IsActiveType(TYPE_MONSTER)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, e:GetHandler(), 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.Destroy(c, REASON_EFFECT)
  	end
  end
  
  