about summary refs log tree commit diff
path: root/users/grfn/xanthous/src/Xanthous/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/xanthous/src/Xanthous/Entities')
-rw-r--r--users/grfn/xanthous/src/Xanthous/Entities/Character.hs4
-rw-r--r--users/grfn/xanthous/src/Xanthous/Entities/RawTypes.hs9
-rw-r--r--users/grfn/xanthous/src/Xanthous/Entities/Raws/broken-dagger.yaml4
-rw-r--r--users/grfn/xanthous/src/Xanthous/Entities/Raws/rock.yaml2
-rw-r--r--users/grfn/xanthous/src/Xanthous/Entities/Raws/stick.yaml6
5 files changed, 18 insertions, 7 deletions
diff --git a/users/grfn/xanthous/src/Xanthous/Entities/Character.hs b/users/grfn/xanthous/src/Xanthous/Entities/Character.hs
index 0a993a2f47..c8153086f1 100644
--- a/users/grfn/xanthous/src/Xanthous/Entities/Character.hs
+++ b/users/grfn/xanthous/src/Xanthous/Entities/Character.hs
@@ -218,7 +218,9 @@ defaultCharacterDamage = 1
 characterDamage :: Character -> Hitpoints
 characterDamage
   = fromMaybe defaultCharacterDamage
-  . preview (inventory . wielded . wieldedItems . wieldableItem . Raw.damage)
+  . filter (/= 0)
+  . Just
+  . sumOf (inventory . wielded . wieldedItems . wieldableItem . Raw.damage)
 
 -- | Is the character fully healed up to or past their initial hitpoints?
 isFullyHealed :: Character -> Bool
diff --git a/users/grfn/xanthous/src/Xanthous/Entities/RawTypes.hs b/users/grfn/xanthous/src/Xanthous/Entities/RawTypes.hs
index 9f5cabecdc..a7021d76cf 100644
--- a/users/grfn/xanthous/src/Xanthous/Entities/RawTypes.hs
+++ b/users/grfn/xanthous/src/Xanthous/Entities/RawTypes.hs
@@ -200,6 +200,15 @@ makeFieldsNoPrefix ''EdibleItem
 
 data WieldableItem = WieldableItem
   { _damage :: !Hitpoints
+    -- | Message to use when the character is using this item to attack a
+    --  creature.
+    --
+    -- Grammatically, this should be of the form "slash at the
+    -- {{creature.creatureType.name}} with your dagger"
+    --
+    -- = Parameters
+    --
+    -- [@creature@ (type: 'Creature')] The creature being attacked
   , _attackMessage :: !(Maybe Message)
     -- | Message to use when a creature is using this item to attack the
     -- character.
diff --git a/users/grfn/xanthous/src/Xanthous/Entities/Raws/broken-dagger.yaml b/users/grfn/xanthous/src/Xanthous/Entities/Raws/broken-dagger.yaml
index 2d30e6986b..12c76fc14b 100644
--- a/users/grfn/xanthous/src/Xanthous/Entities/Raws/broken-dagger.yaml
+++ b/users/grfn/xanthous/src/Xanthous/Entities/Raws/broken-dagger.yaml
@@ -9,8 +9,8 @@ Item:
   wieldable:
     damage: 3
     attackMessage:
-      - You slash at the {{creature.creatureType.name}} with your dagger.
-      - You stab the {{creature.creatureType.name}} with your dagger.
+      - slash at the {{creature.creatureType.name}} with your dagger
+      - stab the {{creature.creatureType.name}} with your dagger
     creatureAttackMessage:
       - The {{creature.creatureType.name}} slashes at you with its dagger.
       - The {{creature.creatureType.name}} stabs you with its dagger.
diff --git a/users/grfn/xanthous/src/Xanthous/Entities/Raws/rock.yaml b/users/grfn/xanthous/src/Xanthous/Entities/Raws/rock.yaml
index e7492bf5fb..3f4e133fe2 100644
--- a/users/grfn/xanthous/src/Xanthous/Entities/Raws/rock.yaml
+++ b/users/grfn/xanthous/src/Xanthous/Entities/Raws/rock.yaml
@@ -5,6 +5,6 @@ Item:
   char: .
   wieldable:
     damage: 1
-    attackMessage: you hit the {{creature.creatureType.name}} in the head with your rock.
+    attackMessage: hit the {{creature.creatureType.name}} in the head with your rock
   density: [ 1500000, 2500000 ]
   volume: [ 0.000125, 0.001 ]
diff --git a/users/grfn/xanthous/src/Xanthous/Entities/Raws/stick.yaml b/users/grfn/xanthous/src/Xanthous/Entities/Raws/stick.yaml
index a7eae9c366..7f9e1faffe 100644
--- a/users/grfn/xanthous/src/Xanthous/Entities/Raws/stick.yaml
+++ b/users/grfn/xanthous/src/Xanthous/Entities/Raws/stick.yaml
@@ -9,9 +9,9 @@ Item:
   wieldable:
     damage: 2
     attackMessage:
-      - You bonk the {{creature.creatureType.name}} over the head with your stick.
-      - You bash the {{creature.creatureType.name}} on the noggin with your stick.
-      - You whack the {{creature.creatureType.name}} with your stick.
+      - bonk the {{creature.creatureType.name}} over the head with your stick
+      - bash the {{creature.creatureType.name}} on the noggin with your stick
+      - whack the {{creature.creatureType.name}} with your stick
     creatureAttackMessage:
       - The {{creature.creatureType.name}} bonks you over the head with its stick.
       - The {{creature.creatureType.name}} bashes you on the noggin with its stick.