isfighting

isfighting <creature>

Whether a creature is in combat — that is, whether it currently has at least one living opponent.

Arguments

Returns

A booltrue if the creature has a living opponent, false otherwise.

Examples

after command (say) {
  do "say isfighting self=[isfighting $self]."
}

When the owner is not in combat, [isfighting $self] is false.

handle combat {
  require [isfighting $self]
  emit room "$self presses the attack!"
}

In a combat handler the guard confirms the owner still has a living opponent before reacting; if the fight has ended the script advances instead (see require).

See also