These logs are available in the actions.tree logger. They'll print a helpful
list of actions and their results in a tree-like way.
For example:
```
2022-05-12 08:57:57 actions.tree: Processing Hero Actions
2022-05-12 08:57:57 actions.tree: |-> @[(x:4, y:6)][30/30]
2022-05-12 08:57:57 actions.tree: | |-> BumpAction toward (δx:-1, δy:1) by @[(x:4, y:6)][30/30] => success=False done=False alternate=WalkAction[@]
2022-05-12 08:57:57 actions.tree: | `-> WalkAction toward (δx:-1, δy:1) by @[(x:3, y:7)][30/30] => success=True done=True alternate=None
2022-05-12 08:57:57 actions.tree: Processing Entity Actions
2022-05-12 08:57:57 actions.tree: |-> Orc with 10/10 hp at (x:4, y:5)
2022-05-12 08:57:57 actions.tree: | |-> BumpAction toward (δx:-1, δy:1) by Orc with 10/10 hp at (x:4, y:5) => success=False done=False alternate=WalkAction[o]
2022-05-12 08:57:57 actions.tree: | `-> WalkAction toward (δx:-1, δy:1) by Orc with 10/10 hp at (x:3, y:6) => success=True done=True alternate=None
2022-05-12 08:57:57 actions.tree: |-> Orc with 10/10 hp at (x:5, y:5)
2022-05-12 08:57:57 actions.tree: | |-> BumpAction toward (δx:-1, δy:1) by Orc with 10/10 hp at (x:5, y:5) => success=False done=False alternate=WalkAction[o]
2022-05-12 08:57:57 actions.tree: | `-> WalkAction toward (δx:-1, δy:1) by Orc with 10/10 hp at (x:4, y:6) => success=True done=True alternate=None
```
- Sort entities by their Euclidean distance to the hero so actions from entities
near the hero are processed first
- Fewer local variables for cleaner reading
- Pass hero into the RegerateRoomsAction, which was causing a pylint error
Move all the event handling code from Engine to EventHandler. EventHandler has a
reference to Engine and can deal with entities from its methods.
Refactor Action to take an optional Entity in its initializer. Some actions
don't require an Entity, but many do/will.
Refactor MovePlayerAction into a few different Action subclasses. Move direction
to a parent MoveAction, and create three new subclasses of MoveAction:
- BumpAction: perform the test that an action can be performed in the given direction
- WalkAction, take a step in the given direction
- MeleeAction, attack another Entity in the given direction
Add an ActionResult class that communicates the result of performing an Action.
- ActionResult.succeeded indicates whether the action succeeded.
- ActionResult.done indicates if the action is fully complete or requires followup.
- ActionResult.alternate specifies the follow-up action to perform.
Convert all the key handling actions to BumpActions.
In the Engine's event handler method, loop until an action is completed,
performing specified alternate actions until the result object indicates the
action is done.