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:
parent
262fc7fb41
commit
de8052cef8
16 changed files with 289 additions and 73 deletions
|
|
@ -5,6 +5,7 @@ module Xanthous.Entities.Item
|
|||
( Item(..)
|
||||
, itemType
|
||||
, newWithType
|
||||
, isEdible
|
||||
) where
|
||||
--------------------------------------------------------------------------------
|
||||
import Xanthous.Prelude
|
||||
|
|
@ -12,7 +13,7 @@ import Test.QuickCheck
|
|||
import Data.Aeson (ToJSON, FromJSON)
|
||||
import Data.Aeson.Generic.DerivingVia
|
||||
--------------------------------------------------------------------------------
|
||||
import Xanthous.Entities.RawTypes hiding (Item, description)
|
||||
import Xanthous.Entities.RawTypes hiding (Item, description, isEdible)
|
||||
import qualified Xanthous.Entities.RawTypes as Raw
|
||||
import Xanthous.Entities
|
||||
( Draw(..)
|
||||
|
|
@ -47,3 +48,6 @@ instance Entity Item where
|
|||
|
||||
newWithType :: ItemType -> Item
|
||||
newWithType = Item
|
||||
|
||||
isEdible :: Item -> Bool
|
||||
isEdible = Raw.isEdible . view itemType
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue