Commit graph

74 commits

Author SHA1 Message Date
Griffin Smith
8a4220df83 Implement speed and ticks
Gormlaks now move 1/8th the speed of the character, which means we can
run away from them - yay!

Unfortunately this also introduces a bug where they'll eventually get
stuck and not do anything, so I'll be tackling that next.
2019-10-13 12:37:08 -04:00
Griffin Smith
8d36fb4af2 Make the positionedCharacter test run more quickly
Dial down the quickcheck size and num tests on this
2019-10-12 15:17:22 -04:00
Griffin Smith
0837df2a72 Step the game *before* updating vision
Stepping the game after updating the vision could allow creatures like
gormlaks to move *out* of the character's pre-calculated lines of sight,
causing gormlaks right next to the character to be invisible.
2019-10-12 13:28:10 -04:00
Griffin Smith
f1197be186 Allow specifying seed on startup
Allow specifying the seed for the game's global RNG on startup, and
print the seed when the game exits. This'll allow us to more reliably
reproduce bugs - yay!
2019-10-12 12:59:42 -04:00
Griffin Smith
d2b81df6b8 Actually heal the character when they eat food 2019-10-12 12:23:41 -04:00
Griffin Smith
2d72c0e413 Export unexported lens 2019-10-06 13:13:54 -04:00
Griffin Smith
6ab7cdfdc9 Only allow adjacent gormlaks to attack
Previously the isUnit function was falsely returning `True` for
positions that were one tile off in *either* direction from the
character, when it should've been *both*. Oops.
2019-10-06 13:13:00 -04:00
Griffin Smith
a57e36dca8 Fix underflow when damaging character
Fix underflow that could happen when multiple gormlaks attack the
character in a single turn
2019-10-06 12:59:53 -04:00
Griffin Smith
bf92a370a5 Remove circleci config
github-actions seems to be working quite well, so no more circle for now
2019-10-06 12:53:15 -04: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
262fc7fb41 Don't move creatures when they're attacking
This may have resulted in a double-attack per turn
2019-10-05 16:25:52 -04:00
Griffin Smith
5c6ba40019 Display multiple messages per turn
When tracking message history, save messages associated with the turn
they were displayed on, which allows us to have the notion of the
"current turn's" messages (provided via a MonoComonad instance).
2019-10-05 16:25:27 -04:00
Griffin Smith
272ff5b3e6 Use nix-build in github-actions 2019-09-29 11:14:38 -04:00
Griffin Smith
05da490185 Gormlaks attack back
When gormlaks see the character, they step towards them and attack
dealing 1 damage when adjacent. Characters have hitpoints now, displayed
at the bottom of the game screen, and when the game is over they die.
2019-09-29 10:54:52 -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
abea2dcfac Add debug command to reveal the game
Add a (debug) command to reveal all tiles on the game regardless of the
character's vision, which'll make it easier to debug creature's behavior
while they're not visible.
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
915264acae
Add Github Actions config 2019-09-25 14:27:44 -04:00
Griffin Smith
d632a30d05 Implement combat
Put a bunch of gormlaks randomly on the level, and implement combat via
damaging those gormlaks by one point.
2019-09-21 12:43:54 -04:00
Griffin Smith
dd16166665 Describe what you see when you walk over items
Every step the character takes, describe the entities at that position
excluding the character.
2019-09-20 19:38:46 -04:00
Griffin Smith
4db3a68efe Add doors and an open command
Add a Door entity and an Open command, which necessitated supporting the
direction prompt. Currently nothing actually puts doors on the map,
which puts a slight damper on actually testing this out.
2019-09-20 19:38:46 -04:00
Griffin Smith
7770ed0548 Add the beginnings of a prompt system
Add the beginnings of a generic prompt system, with exclusive support
atm for string prompts, and test it out by asking the character for
their name at startup
2019-09-20 12:03:30 -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
15895c69fe Remove all but the largest region in caves
When generating cave levels, remove all but the largest contiguous
region from the resulting level.
2019-09-15 17:30:57 -04:00
Griffin Smith
2604341c2f Scroll the viewport around the character
Scroll the viewport so that the character is never less than 5 away from
the edge of the screen.

This was super easy, thanks Brick!
2019-09-15 17:30:57 -04:00
Griffin Smith
58fce2ec19 Progressively reveal the map to the player
As the character walks around the map, progressively reveal the entities
on the map to them, using an algorithm based on well known
circle-rasterizing and line-rasterizing algorithms to calculate lines of
sight that are potentially obscured by walls.
2019-09-15 17:30:57 -04:00
Griffin Smith
6678ac986c Fill the outer edges of generated levels
To avoid the character being able to go OOB.

This is something we had in the Rust version but I hadn't ported over yet
2019-09-14 15:16:27 -04:00
Griffin Smith
33c831d23d Implement collision
Check if there's a wall or other entity where the character is going,
and stop the character from going there
2019-09-14 15:10:51 -04:00
Griffin Smith
c06edf3cc6 Place the chacracter in the level at startup time
Randomly select a position in the largest contiguous region of the
generated level in which to place the character at startup time.
2019-09-13 15:24:05 -04:00
Griffin Smith
9ebdc6fbb4 Convert generated levels to walls
Add support for converting generated levels to walls, and merge one into
the entity map at the beginning of the game.

There's nothing here that guarantees the character ends up *inside* the
level though (they almost always don't) so that'll have to be slotted
into the level generation process.
2019-09-09 20:54:33 -04:00
Griffin Smith
e01cf9b056 gitignore debug.log 2019-09-07 14:52:37 -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
73a52e531d Put a test gormlak on the screen
Implement a concrete "Creature" entity, and place one on the screen at
the game startup for testing.

This revealed a bug with drawing when getting the maximum entity
position, but that appears to be fixed now (yay)
2019-09-02 14:45:36 -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
243104c410 Add commands for diagonal movement
That Was Easy (tm)!
2019-09-02 10:54:52 -04:00
Griffin Smith
18551cdf30 Add a previous message command
Add a "previous message" command, triggered via ctrl+p.

I attempted here to get the message area to still take up a row of space
post-hiding the message, but failed - should revisit that at some point
2019-09-02 10:52:03 -04:00
Griffin Smith
adb3b74c0c Link up messages to the overall game
Add a "say" function for saying messages within an app monad to the
user, and link everything up to display them and track their history
2019-09-02 10:52:01 -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
6eba471e24 Use haskellSrc2nix over explicit cabal2nix
Use the (undocumented!) helper function haskellSrc2nix over having to
explicitly run cabal2nix all the time when rebuilding
2019-08-31 13:15:17 -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
Griffin Smith
fb0d1b3e66 Wipe Rust project
Sorry rust, but you're just not fun to write
2019-08-25 13:25:13 -04:00
Griffin Smith
e2d2f011c6 Add method for writing option menus to viewport
Add a method for writing single-choice menus to the viewport, within a
box. Unused for now.
2019-08-03 20:31:42 -04:00
Griffin Smith
48fb3f6624 Add inventory, and the ability to pick up items
Add inventory as a basic vector of items attached to the character, and
the ability to pick up a single item where the character stands
2019-08-03 20:31:42 -04:00
Griffin Smith
82cefedab9 Fix a bunch more Clippy lints, but disable in Circle
The unused error is causing more trouble than it's worth at this
point
2019-08-03 20:31:42 -04:00
Griffin Smith
929dac06d0 Clear messages every turn
Clear messgaes every turn, preserving the ability to ^P to get the
previous message
2019-08-03 12:48:38 -04:00
Griffin Smith
7138d9a0b6 Add clippy to circleCI and fix all lints 2019-08-03 12:41:40 -04:00
Griffin Smith
9db5fad2f9 Describe what you see when you walk over it
If the character walks over any number of entities, describe those
entities to the character.
2019-07-29 11:22:39 -04:00
Griffin Smith
34b20b7786 Add functions for making sentences from lists
This seems like something I keep having to write
2019-07-28 22:31:07 -04:00
Griffin Smith
ba7bec9a3e Re-draw entities when you walk over them
This also required making the noodles character not actually the emoji,
since the emoji being double-width means it still gets overwritten when
you walk to the right of it (D:)
2019-07-28 21:32:24 -04:00