Engine > Models > Entity Model

Base class for all entities in the game. Holds the shared stat and identity data used by units. Status flags such as isDazed are derived from runtime counters rather than configuration.

hasApAvailable

Returns true if the entity has any AP remaining this turn.

hasAttackApAvailable

Returns true if the entity has enough AP to perform an attack.

hasMoveApAvailable

Returns true if the entity has enough AP to perform a move.

spendAp

Deducts the given amount from the entity's AP, floored at zero.

resetAp

Resets the entity's AP to its maximum. Called at the start of the human turn.

isDazed

Returns true if the entity currently has a daze counter above zero.

isIncapacitated

Returns true if the entity is prevented from acting this turn by any status effect. Currently covers dazed. Additional incapacitating statuses should be added here as they are introduced.

hasAttackAvailable

Returns true if the entity has at least one attack remaining this turn. Returns false if the entity does not track attacks (null).

useAttack

Decrements the remaining attack count by one. No-ops if the entity does not track attacks.

resetAttacks

Resets the remaining attack count to the entity's maximum. No-ops if the entity does not track attacks.

daze

Sets the daze counter to the given number of turns. Defaults to 1.

decrementDaze

Decrements the daze counter by one, floored at zero. The entity is considered undazed once the counter reaches zero.

regenHealth

Restores health by the given amount, capped at the entity's maximum health. Uses a null check rather than a truthiness check so that entities at 0 health can still regen. No-ops if the entity has no health stat assigned, as some entity types do not track health at all.

takeDamage

Reduces health by the given amount, floored at zero. The truthiness guard covers entities with no health pool (null) and those already at 0 health, neither of which should take further damage.




© Gamesanova 2026