Commit graph

23 commits

Author SHA1 Message Date
7820adf057 Generate entities in rooms at different locations
Prior to this change, entities in rooms would always be spawned on the
same tile.
2022-05-11 07:57:28 -07:00
cef1ad25cb Small cleanup of log statement 2022-05-08 23:42:36 -07:00
ee0e4b1dba Instantiate Monsters with a HostileEnemy AI 2022-05-08 09:55:10 -07:00
427e7c8e84 Remove some unused imports 2022-05-07 12:28:02 -07:00
8b3c0137a5 Refactor event handling into EventHandler
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.
2022-05-07 12:25:46 -07:00
d75c9faea3 Little bits of cleanup 2022-05-07 12:25:44 -07:00
04aa61fe4b Doc strings and import reordering per pylint 2022-05-07 11:42:48 -07:00
4002b64640 Attack!!!
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.
2022-05-07 11:16:17 -07:00
7720bc525a Address some linter issues; add doc strings
- Clean up some import ordering
- Write some Numpy style doc strings for classes and functions
2022-05-07 08:55:10 -07:00
16b4b64099 Clean up the logging; use % formats instead of f-strings 2022-05-07 08:53:58 -07:00
d99c97408c Generate orcs and trolls randomly throughout the dungeon 2022-05-06 21:16:39 -07:00
00462f6005 Change Engine.Configuration to a clas and convert moved_entities to a set 2022-05-06 14:34:26 -07:00
1d4882a8ac Do not allow entities to move into squares previously moved entities have moved to 2022-05-05 08:45:30 -07:00
a43e403e9c Let NPCs randomly walk 2022-05-05 08:38:06 -07:00
084385f8f2 Add a map shroud over tiles and compute field of view based on player position!!! 2022-05-04 09:22:40 -07:00
09bdf8a7a6 Place NPCs randomly in a generated room 2022-05-03 19:00:45 -07:00
a072ad507e Move map generation into a new MapGenerator subclass; add RoomsAndCorridorsGenerator to uses BSP 2022-05-01 10:46:30 -07:00
a54828c7fb Fix up all the runtime errors caused by the previous refactoring 2022-05-01 09:51:22 -07:00
f1b95a697e Remove the commented out RegenerateRoomsAction handling
It still is not implemented but RegenerateRoomsAction will handle it when I
bring it back.
2022-05-01 09:29:58 -07:00
5ce26e310b Move the action perform logic to Action.perform() on each Action subclass
Rename Object to Entity to avoid name clashes with Python.object
2022-05-01 09:29:30 -07:00
7f225e9e01 Start the player in the middle of the first room 2022-05-01 00:09:45 -07:00
5302b5cf5e Redo tiles to use numpy datatypes
This gives us some nice optimizations when splatting the map to the console.
2022-05-01 00:09:12 -07:00
d56bcc7b4a Add an Engine class and move all the engine-y bits over there from main 2022-04-30 23:30:23 -07:00