Agent

Agent

Base class for all agent types.

Agents exclusively occupy a cell. They may be animate (monsters, NPCs) or static (boulders, pillars). All callbacks are no-ops by default.

Constructor

new Agent()

Source:

Methods

canEnter()

Description:
  • Can this agent enter the destination terrain from its current cell? Mirrors Terrain.canEnter — both must return true for movement to occur.

Source:

changeHealth()

Description:
  • Apply a health change to this agent. For the player: adjusts HP and returns current HP. For other agents: used as a percentage-hit-chance adjustment; returns 0 on death.

Source:

onDie()

Description:
  • This agent has died.

Source:

onHit()

Description:
  • This agent has collided with another agent (player↔agent only; agents do not collide with each other).

Source:

onHitBy()

Description:
  • This agent has been hit by another agent. Typically cancels the mover's move event unless this agent steps aside.

Source:

onHitByItem()

Description:
  • This agent has been hit by a thrown or wielded item.

Source:

onTurn()

Description:
  • Called once per game turn so the agent can take an action (move, attack, etc.). Non-player agents implement AI here. No-op by default (static agents).

Source: