name: Inspector
card_text: Cannot be Normal or Special Summoned if you control a monster. Neither player can activate monster effects unless the number of monster effects that player has previously activated that turn is less than the number of monster card types currently on the field (Ritual, Fusion, Synchro, Xyz, Pendulum, and Link). (If an effect's activation was negated, it still counts toward the total for that turn. Only count effects that were activated while this monster was face-up on the field.)
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon limit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetCondition(s.sumcon)
  	c:RegisterEffect(e1)
  	--spsummon limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e2:SetValue(s.sumlimit)
  	c:RegisterEffect(e2)
  	--activate limit
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetCode(EVENT_CHAINING)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetOperation(s.counterop)
  	c:RegisterEffect(e3)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(1, 1)
  	e4:SetValue(s.elimit)
  	c:RegisterEffect(e4)
  end
  function s.sumcon(e)
  	return Duel.GetFieldGroupCount(e:GetHandler():GetControler(), LOCATION_MZONE, 0) > 0
  end
  function s.sumlimit(e, se, sp, st, pos, tp)
  	return Duel.GetFieldGroupCount(sp, LOCATION_MZONE, 0) == 0
  end
  function s.counterop(e, tp, eg, ep, ev, re, r, rp)
  	if not re:IsActiveType(TYPE_MONSTER) then
  		return
  	end
  	e:GetHandler():RegisterFlagEffect(id + ep, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.cfilter(c, type)
  	return c:IsFaceup() and c:IsType(type)
  end
  function s.elimit(e, re, tp)
  	if not re:IsActiveType(TYPE_MONSTER) then
  		return false
  	end
  	local ct = 0
  	for i, type in ipairs({ TYPE_FUSION, TYPE_RITUAL, TYPE_SYNCHRO, TYPE_XYZ, TYPE_PENDULUM, TYPE_LINK }) do
  		if Duel.IsExistingMatchingCard(s.cfilter, 0, LOCATION_MZONE, LOCATION_MZONE, 1, nil, type) then
  			ct = ct + 1
  		end
  	end
  	return e:GetHandler():GetFlagEffect(id + tp) >= ct
  end
  
  
source_text: Inspector
  Cannot be Normal or Special Summoned if you control a monster. Neither player can activate monster effects unless the number of monster effects that player has previously activated that turn is less than the number of monster card types currently on the field (Ritual, Fusion, Synchro, Xyz, Pendulum, and Link). (If an effect's activation was negated, it still counts toward the total for that turn. Only count effects that were activated while this monster was face-up on the field.)
target_text: -- Inspector
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon limit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetCondition(s.sumcon)
  	c:RegisterEffect(e1)
  	--spsummon limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e2:SetValue(s.sumlimit)
  	c:RegisterEffect(e2)
  	--activate limit
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetCode(EVENT_CHAINING)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetOperation(s.counterop)
  	c:RegisterEffect(e3)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(1, 1)
  	e4:SetValue(s.elimit)
  	c:RegisterEffect(e4)
  end
  function s.sumcon(e)
  	return Duel.GetFieldGroupCount(e:GetHandler():GetControler(), LOCATION_MZONE, 0) > 0
  end
  function s.sumlimit(e, se, sp, st, pos, tp)
  	return Duel.GetFieldGroupCount(sp, LOCATION_MZONE, 0) == 0
  end
  function s.counterop(e, tp, eg, ep, ev, re, r, rp)
  	if not re:IsActiveType(TYPE_MONSTER) then
  		return
  	end
  	e:GetHandler():RegisterFlagEffect(id + ep, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.cfilter(c, type)
  	return c:IsFaceup() and c:IsType(type)
  end
  function s.elimit(e, re, tp)
  	if not re:IsActiveType(TYPE_MONSTER) then
  		return false
  	end
  	local ct = 0
  	for i, type in ipairs({ TYPE_FUSION, TYPE_RITUAL, TYPE_SYNCHRO, TYPE_XYZ, TYPE_PENDULUM, TYPE_LINK }) do
  		if Duel.IsExistingMatchingCard(s.cfilter, 0, LOCATION_MZONE, LOCATION_MZONE, 1, nil, type) then
  			ct = ct + 1
  		end
  	end
  	return e:GetHandler():GetFlagEffect(id + tp) >= ct
  end
  
  