fighting
fighting <creature>
A creature's current combatants, as an iterable of the living creatures it is fighting.
Arguments
<creature>— the creature whose opponents to list. Only living opponents are included.
Returns
An iterable whose elements are creatures. A creature not in
combat yields an empty iterable. An unresolved argument yields null.
Consume it with each, count,
first, select, or another iterable consumer.
Examples
after command (say) {
do "say I am fighting [count [fighting $self]] foe(s)."
}
[fighting $self] lists the owner's living opponents. Out of combat in
the debug world this evaluates to 0, so the mob says "I am fighting 0
foe(s)."
combat {
each [fighting $self] { <foe>
do "say I will not yield to [name $foe]!"
}
}
In a combat handler the mob addresses each of its living
opponents in turn. The block parameter <foe> is declared inside the
braces, right after {.
See also
isfighting— a quick present-or-not combat test (true when this iterable is non-empty).creatures— every living creature in the room, not just opponents.first,count,each— consumers for the iterable.- Handlers, events, and phases — the
combatevent · Iterables and iterables · Types