about summary refs log tree commit diff
path: root/src/Xanthous/App.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-11-16T02·20-0500
committerGriffin Smith <root@gws.fyi>2019-11-16T02·20-0500
commit7b90b02049f891f752fff7e0e228511077bbcb84 (patch)
tree306b998143a9b19a6ea496a8becc86a4ce0303ae /src/Xanthous/App.hs
parent87fedcb6c9bc251a5a23a632ccf985b674b84bc7 (diff)
Recover character hitpoints over time
Wrap hitpoints in a newtype, and recover character hitpoints over time
Diffstat (limited to 'src/Xanthous/App.hs')
-rw-r--r--src/Xanthous/App.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Xanthous/App.hs b/src/Xanthous/App.hs
index d3f266a1e340..2f27948cdee5 100644
--- a/src/Xanthous/App.hs
+++ b/src/Xanthous/App.hs
@@ -95,7 +95,7 @@ stepGameBy ticks = do
     pEntity' <- step ticks pEntity
     entities . ix eid .= pEntity'
 
-  whenM (uses (character . characterHitpoints) (== 0))
+  whenM (uses character isDead)
     . prompt_ @'Continue ["dead"] Uncancellable
     . const . lift . liftIO
     $ exitSuccess
@@ -186,7 +186,7 @@ handleCommand Eat = do
               in before <> fromMaybe Empty (tailMay after)
             let msg = fromMaybe (Messages.lookup ["eat", "eat"])
                       $ edibleItem ^. eatMessage
-            character . characterHitpoints +=
+            character . characterHitpoints' +=
               edibleItem ^. hitpointsHealed . to fromIntegral
             message msg $ object ["item" A..= item]
   stepGame -- TODO