diff options
author | Griffin Smith <root@gws.fyi> | 2019-11-16T02·20-0500 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-11-16T02·20-0500 |
commit | 7b90b02049f891f752fff7e0e228511077bbcb84 (patch) | |
tree | 306b998143a9b19a6ea496a8becc86a4ce0303ae /src/Xanthous/Entities/Creature.hs | |
parent | 87fedcb6c9bc251a5a23a632ccf985b674b84bc7 (diff) |
Recover character hitpoints over time
Wrap hitpoints in a newtype, and recover character hitpoints over time
Diffstat (limited to 'src/Xanthous/Entities/Creature.hs')
-rw-r--r-- | src/Xanthous/Entities/Creature.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Xanthous/Entities/Creature.hs b/src/Xanthous/Entities/Creature.hs index 4ad751a58240..11cad1ce6b8b 100644 --- a/src/Xanthous/Entities/Creature.hs +++ b/src/Xanthous/Entities/Creature.hs @@ -78,7 +78,7 @@ initialHippocampus = Hippocampus Nothing data Creature = Creature { _creatureType :: !CreatureType - , _hitpoints :: !Word + , _hitpoints :: !Hitpoints , _hippocampus :: !Hippocampus } deriving stock (Eq, Show, Generic) @@ -99,7 +99,7 @@ newWithType _creatureType = _hippocampus = initialHippocampus in Creature {..} -damage :: Word -> Creature -> Creature +damage :: Hitpoints -> Creature -> Creature damage amount = hitpoints %~ \hp -> if hp <= amount then 0 |