about summary refs log tree commit diff
path: root/users/grfn/xanthous/src/Xanthous/Entities/Character.hs
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2022-05-14T15·49-0400
committerclbot <clbot@tvl.fyi>2022-05-14T16·02+0000
commitaf31da8cfc9caee8c2cd44df5ee5c1ed3a9b3ed7 (patch)
treedaaa748bfd7e9fb57aac37b1f2213fbef378b343 /users/grfn/xanthous/src/Xanthous/Entities/Character.hs
parent194007b02069d2be0c283825aa1e1a4426b641a2 (diff)
feat(grfn/xanthous): Use dual-wielding to calculate damage r/4073
When dual-wielding weapons, do damage from both weapons and use both
weapons' attack messages.

Change-Id: I3c404946d0167c9b5c2bcf58ab5c3429cc5269fc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5605
Autosubmit: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'users/grfn/xanthous/src/Xanthous/Entities/Character.hs')
-rw-r--r--users/grfn/xanthous/src/Xanthous/Entities/Character.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/users/grfn/xanthous/src/Xanthous/Entities/Character.hs b/users/grfn/xanthous/src/Xanthous/Entities/Character.hs
index 0a993a2f479c..c8153086f1ac 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