Tweak displayed info

This commit is contained in:
2023-01-11 23:22:59 +00:00
parent f2f414cee6
commit 94c0af97fd
8 changed files with 149 additions and 120 deletions
+31 -2
View File
@@ -1,7 +1,36 @@
module Dodge.Creature.Info where
module Dodge.Creature.Info (
yourInfo,
) where
import Dodge.Data.Creature
import LensHelp
yourInfo :: Creature -> String
yourInfo cr = "You can carry a maximum of " ++ show (cr ^. crInvCapacity) ++ " individual items. "
yourInfo cr =
yourStatsInfo cr
++ " You can carry a maximum of " ++ show (cr ^. crInvCapacity) ++ " individual items. "
++ " You can't remember your name."
statsModifier :: Int -> String -> String -> String -> String
statsModifier x s1 s2 s3
| x < 15 = "extremely " ++ s1
| x < 30 = "very " ++ s1
| x < 45 = "quite " ++ s1
| x < 55 = "of average " ++ s2
| x < 70 = "quite " ++ s3
| x < 85 = "very " ++ s3
| x < 100 = "extremely " ++ s3
| otherwise = "super-humanly " ++ s3
yourStatsInfo :: Creature -> String
yourStatsInfo cr =
"You are " ++ statsModifier str "weak" "strength" "strong" ++ conj
++ statsModifier dex "clumsy." "dexterity." "dexterous."
where
str = cr ^. crStatistics . strength
dex = cr ^. crStatistics . dexterity
conj
| (str < 45 && dex < 45) || (str > 55 && dex > 55) || (mid str && mid dex) =
" and "
| otherwise = " but "
mid x = x > 45 && x < 55