Constructs encounter using given configuration
Schedule action for current round.
id of character for which action should be registered
action to be perfomed
Gets logs for current state of encounter
array of messages contains information about battle
Resets actions planned for current round. This function does not affect potential actions from controllerCallback.
Performs single encouter round. Invoke repeatedly to schedule battle.
logs for performed round or undefined if battle is over
Generated using TypeDoc
Overview
Encapsulates battle logic. Each instance of class represents single, independent battle between two teams.
General rules
Encounters are round based - calling method tick triggers simulation of single round. Encounter lasts as long as there is at least one member with some hit points in both teams. When battle is over, tick starts to return
undefined.Logic
Encounter's tick is performing the following scenario:
Round order
Order of battle participants is determined in each turn, characters with more initiative are more likely to start first (see [[EngineStats]]).
Controlling characters
There are two ways of controling how characters acts during encounter:
Gathering output
Information about encounter is stored in encounter log which is array of IEncounterLogEntry. There are several types of messages generated during battle:
These are ways to get encounter log messages:
undefinedif one of parties win)