isfighting
isfighting <creature>
Whether a creature is in combat — that is, whether it currently has at least one living opponent.
Arguments
<creature>— the creature to test. A null value or a non-creature yields false.
Returns
A bool — true 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
fighting— the iterable of a creature's living combatants.isholding,iswearing— other creature-state predicates.- Handlers, events, and phases — the
combatevent.