diff options
author | Griffin Smith <root@gws.fyi> | 2019-12-23T15·59-0500 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-12-23T15·59-0500 |
commit | bf7d139c1a17fe55921fb807aa249e93288d3e4d (patch) | |
tree | a91dd3b91d4ca4e70b800d684b5dd1faffaaee6c /src/Xanthous/App.hs | |
parent | 8ecefddbd4cc9c79478003781877d37b3c80fcc4 (diff) |
Use attack messages when attacking
When attacking, use either: - the message defined on the entity raw of the wielded item, if any - the generic attack message, if an item without an attack message is wielded - the fists attack message, if no item is wielded
Diffstat (limited to 'src/Xanthous/App.hs')
-rw-r--r-- | src/Xanthous/App.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Xanthous/App.hs b/src/Xanthous/App.hs index b278eec2379f..6b1c2413c62e 100644 --- a/src/Xanthous/App.hs +++ b/src/Xanthous/App.hs @@ -49,7 +49,7 @@ import Xanthous.Entities.Environment (Door, open, locked, GroundMessage(..)) import Xanthous.Entities.RawTypes ( edible, eatMessage, hitpointsHealed - , wieldable + , wieldable, attackMessage ) import Xanthous.Generators import qualified Xanthous.Generators.CaveAutomata as CaveAutomata @@ -439,10 +439,17 @@ attackAt pos = say ["combat", "killed"] msgParams entities . at creatureID .= Nothing else do - -- TODO attack messages - say ["combat", "hit", "generic"] msgParams + msg <- uses character getAttackMessage + message msg msgParams entities . ix creatureID . positioned .= SomeEntity creature' stepGame -- TODO + getAttackMessage chr = + case chr ^? inventory . wielded . wieldedItems . wieldableItem of + Just wi -> + fromMaybe (Messages.lookup ["combat", "hit", "generic"]) + $ wi ^. attackMessage + Nothing -> + Messages.lookup ["combat", "hit", "fists"] entityMenu_ :: (Comonad w, Entity entity) @@ -462,7 +469,6 @@ entityMenuChar entity then ec else 'a' - -- entityMenu :: Entity entity => [entity] -> Map Char (MenuOption entity) -- entityMenu = map (map runIdentity) . entityMenu_ . fmap Identity |