Skip to main content

Module undo

Module undo 

Source
Expand description

Undoing a command.

The log is append-only, so an undo never removes anything: it appends an CombatEvent::Undone marker followed by events that put back what the undone command changed. Everyone sees the correction like any other change, and the log still shows both the mistake and its undo.

Later commands by other people are kept. Only what the undone command itself changed is reverted:

  • Hit points move back by the amount the command changed them, so 7 damage undone after someone else’s 2 leaves the 2.
  • Initiative goes back unless someone has changed it since.
  • Combatants and effects the command added are taken out again; ones it removed or ended come back. An effect isn’t brought back if its source has started concentrating on something else since.
  • Round, turn and status (from start, next_turn, pause, end, a removal passing the turn) go back only if nothing has moved them since; otherwise the undo is refused, as the turn has moved on.

An ended combat accepts only the undo of the command that ended it.

Spells and features are spent on character sheets, outside the combat: undoing a cast ends the effect it put into play, and the combat service gives the slot back to the sheet.

Functions§

undo
The events that undo target (or, if None, the latest command for which mine holds that isn’t undone yet), given the combat’s full log. mine says whether a command was sent by whoever is undoing.