about summary refs log tree commit diff
path: root/src/Xanthous/AI/Gormlak.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-10-06T16·59-0400
committerGriffin Smith <root@gws.fyi>2019-10-06T16·59-0400
commita57e36dca81274dea015c9fbdac680b44ef5576e (patch)
tree7bdb94c622e7a582d5474178728e2c397114fde3 /src/Xanthous/AI/Gormlak.hs
parentbf92a370a5ad215fff3e2f692da981c95175b2f3 (diff)
Fix underflow when damaging character
Fix underflow that could happen when multiple gormlaks attack the
character in a single turn
Diffstat (limited to 'src/Xanthous/AI/Gormlak.hs')
-rw-r--r--src/Xanthous/AI/Gormlak.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Xanthous/AI/Gormlak.hs b/src/Xanthous/AI/Gormlak.hs
index 68feb67ac227..db504c1e7d3a 100644
--- a/src/Xanthous/AI/Gormlak.hs
+++ b/src/Xanthous/AI/Gormlak.hs
@@ -14,7 +14,8 @@ import           Xanthous.Data (Positioned(..), diffPositions, stepTowards, isUn
 import           Xanthous.Data.EntityMap
 import qualified Xanthous.Entities.Creature as Creature
 import           Xanthous.Entities.Creature (Creature)
-import           Xanthous.Entities.Character (Character, characterHitpoints)
+import           Xanthous.Entities.Character (Character)
+import qualified Xanthous.Entities.Character as Character
 import qualified Xanthous.Entities.RawTypes as Raw
 import           Xanthous.Entities (Entity(..), Brain(..), brainVia)
 import           Xanthous.Game.State (entities, GameState, entityIs)
@@ -54,7 +55,7 @@ stepGormlak pe@(Positioned pos creature) = do
     vision = Creature.visionRadius creature
     attackCharacter = do
       say ["combat", "creatureAttack"] $ object [ "creature" A..= creature ]
-      character . characterHitpoints -= 1
+      character %= Character.damage 1
 
 newtype GormlakBrain = GormlakBrain Creature