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.
This commit is contained in:
Griffin Smith 2019-10-06 12:50:29 -04:00
parent 262fc7fb41
commit de8052cef8
16 changed files with 289 additions and 73 deletions

View file

@ -16,6 +16,7 @@ data Command
| PickUp
| Open
| Wait
| Eat
-- | TODO replace with `:` commands
| ToggleRevealAll
@ -27,6 +28,7 @@ commandFromKey (KChar (directionFromChar -> Just dir)) [] = Just $ Move dir
commandFromKey (KChar 'p') [MCtrl] = Just PreviousMessage
commandFromKey (KChar ',') [] = Just PickUp
commandFromKey (KChar 'o') [] = Just Open
commandFromKey (KChar 'e') [] = Just Eat
commandFromKey (KChar 'r') [MMeta] = Just ToggleRevealAll
commandFromKey _ _ = Nothing