Commit graph

12 commits

Author SHA1 Message Date
Griffin Smith
97a5c61f28 Fix an injectivity issue with saving the game
Fix an injectivity issue with JSON-encoding the entity map that was
causing the game saving to not properly round-trip. As part of this,
there's a refactor to the internals of the entity map to use sets
instead of vectors, which should also get us a nice perf boost.
2019-11-30 15:00:39 -05:00
Griffin Smith
8a1235c3dc Use menus for combat and picking up items
Refactor a bunch of stuff around to allow for polymorphically surfacing
an EntityChar for all entities, and use this to write a generic
`entityMenu` function, which generates a menu from the chars of a list
of entities - and use that to fully implement (removing `undefined`)
menus for both attacking and picking things up when there are multiple
entities on the relevant tile.
2019-11-29 22:59:15 -05:00
Griffin Smith
f37d0f75c0 Implement saving+loading the game
Implement ToJSON and FromJSON for all of the various pieces of the game
state, and add a pair of functions saveGame/loadGame implementing a
prism to save the game as zlib-compressed JSON. To test this, there's
now Arbitrary, CoArbitrary, and Function instances for all the parts of
the game state - to get around circular imports with the concrete
entities this unfortunately is happening via orphan instances, plus an
hs-boot file to break a circular import that was just a little too hard
to remove by moving things around. Ugh.
2019-11-29 14:33:52 -05:00
Griffin Smith
de8052cef8 Allow eating edible items
Add menu support to the prompt system, and an "Eat" command that prompts
for an item to eat and eats the item the character specifies, restoring
an amount of hitpoints configurable via the item raw type.
2019-10-06 12:50:29 -04:00
Griffin Smith
ec39dc0a5b Tweak gormlak movement slightly
- Don't let gormlaks run into things like walls or each other
- Add a small element of randomness to gormlaks' motion
- Increase gormlaks' vision by a large amount
2019-09-28 15:03:36 -04:00
Griffin Smith
1a0f618a82 Implement the start of creature AI
Add a Brain class, which determines for an entity the set of moves it
makes every step of the game, and begin to implement that for gormlaks.
The idea here is that every step of the game, a gormlak will move
towards the furthest-away wall it can see.
2019-09-28 15:03:36 -04:00
Griffin Smith
62a2e05ef2 Add items and inventory
Add a new "Item" entity, which pulls from the previously-existent
ItemType raw, and add a "PickUp" command which takes the (currently
*only*) item off the ground and puts it into the inventory.
2019-09-19 13:56:14 -04:00
Griffin Smith
f03ad6bbd6 Add cellular-automata cave generator
Add a cellular-automata-based cave level generator, plus an
optparse-applicative-based CLI for invoking level generators in general.
2019-09-07 14:52:37 -04:00
Griffin Smith
4d270712ae Add raws, loaded statically from a folder
Add raw types with support for both creatures and items, loaded
statically from a "raws" folder just like in the Rust version.
2019-09-02 13:59:28 -04:00
Griffin Smith
2fd3e4c9ad Implement messages
Implement messages almost the same as in the Rust version, only with
YAML instead of TOML this time, and a regular old mustache template
instead of something handrolled. Besides that, pretty much everything
here is the same.
2019-09-01 13:54:27 -04:00
Griffin Smith
4ef19aa35a Add entities, and allow walking around
Add support for entities via a port of the EntityMap type, and implement
command support starting at basic hjkl.
2019-08-31 13:18:51 -04:00
Griffin Smith
d3f3890dc5 An @-sign in a box, in haskell
Initial commit of a Haskell version of Xanthous, written using Brick and
built with Nix.

This is so much nicer and so much easier
2019-08-25 13:28:10 -04:00