sheet-parser-hs/lib/DND/Sheet/Pretty.hs

37 lines
959 B
Haskell
Raw Normal View History

2024-12-01 17:35:24 +01:00
module DND.Sheet.Pretty
( getName
, getTrivia
, statFunctions
, getStats
) where
import DND.Sheet.Content
getName :: Character -> String
getName = charName . preamble
getTrivia :: Character -> [String]
getTrivia char = map (\a -> a $ trivia char) functions
where functions = [ background
, personalityTrait
, ideals
, bonds
, flaws
, quirk
]
--getStats :: Character -> [String]
--getStats =
getStats :: Character -> [String]
getStats char = let
statList = map (\a -> map a (stats char)) statFunctions
name = head statList
score = statList !! 1
proficiency = statList !! 2
in zipWith3 format name score proficiency
where format a b c = a ++ " score: " ++ b ++ " Proficient: " ++ c
statFunctions :: [Stat -> String]
statFunctions = [ statName, show . statScore, show . statProf ]