Files
loop/src/Dodge/Creature/Info.hs
T
2023-01-11 23:22:59 +00:00

37 lines
1.1 KiB
Haskell

module Dodge.Creature.Info (
yourInfo,
) where
import Dodge.Data.Creature
import LensHelp
yourInfo :: Creature -> String
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