getMobType

getMobType([number entity]) → integer type
Returns the mob type of the entity entity. Returns -1 if the entity is not a mob. Use the MOB_* constants to compare the result.

Returns the type of the mob entity, as one of the MOB_* constants (for example MOB_FENNEL_KING, MOB_EVIL_PUMPKIN, MOB_GRAAL...).

If entity is not given, the type of the current entity is returned. The function returns -1 if the entity exists but is not a mob, and null if no entity has that id.

Example:

var enemy = getNearestEnemy()
if (getMobType(enemy) == MOB_FENNEL_KING) {
    debug("It's the Fennel King!")
}
const enemy = Fight.getNearestEnemy()
// `type` only exists on a Mob: check the entity kind first.
if (enemy instanceof Mob && enemy.type === Mob.Type.FENNEL_KING) {
	Debug.log("It's the Fennel King!")
}
enemy = Fight.getNearestEnemy()
# `type` only exists on a Mob: check the entity kind first.
if isinstance(enemy, Mob) and enemy.type == Mob.Type.FENNEL_KING:
	Debug.log("It's the Fennel King!")
Parameters
Return