Formatting and refactor

This commit is contained in:
Nox Sluijtman 2024-11-19 10:40:42 +01:00
parent 7d8bf5d857
commit e07d859fe4
Signed by: Egg
SSH key fingerprint: SHA256:2sG9X3C7Xvq2svGumz1/k7cm8l4G9+qAtAeugqB4J9M
4 changed files with 18 additions and 10 deletions

View file

@ -1,6 +1,7 @@
module Main where
import DND.Sheet.Parser
import DND.Dice
testfile :: FilePath
testfile = "./example.json"
@ -10,4 +11,4 @@ main = do
createExample testfile
sheet <- parseSheet testfile
putStrLn $ "wrote example character named \"" ++ getName sheet ++ "\" to: " ++ testfile
listSkillNames sheet
mapM_ putStrLn . getSkillNames $ sheet

View file

@ -1 +1 @@
{"preamble":{"charClass":"Fighter","charLevel":1,"charName":"Bob","charRace":"Elf","jackOfAllTrades":false},"spells":[{"atHighLevel":"Cast more of the sodding things","attackSave":"Dexterity","castingTime":"3 Minutes","components":["Verbal","Somatic"],"damageEffect":"Fire","description":"Shoots a huge testicle shaped fireball","duration":"Instant","range":50,"school":"Conjuration","spellLevel":3,"spellName":"Firetesticle"}],"stats":[{"proficient":false,"score":10,"skills":[{"skillMod":"None","skillName":"Athletics"}],"stat":"Strength"},{"proficient":false,"score":10,"skills":[{"skillMod":"None","skillName":"Acrobatics"},{"skillMod":"None","skillName":"Sleight of Hand"},{"skillMod":"None","skillName":"Stealth"}],"stat":"Dexterity"},{"proficient":false,"score":10,"skills":[],"stat":"Constitution"},{"proficient":false,"score":10,"skills":[{"skillMod":"None","skillName":"Arcana"},{"skillMod":"None","skillName":"History"},{"skillMod":"None","skillName":"Investigation"},{"skillMod":"None","skillName":"Nature"},{"skillMod":"None","skillName":"Religion"}],"stat":"Intelligence"},{"proficient":false,"score":10,"skills":[{"skillMod":"None","skillName":"Animal Handling"},{"skillMod":"None","skillName":"Insight"},{"skillMod":"None","skillName":"Medicine"},{"skillMod":"None","skillName":"Perception"},{"skillMod":"None","skillName":"Survival"}],"stat":"Wisdom"},{"proficient":false,"score":10,"skills":[{"skillMod":"None","skillName":"Deception"},{"skillMod":"None","skillName":"Intimidation"},{"skillMod":"None","skillName":"Performance"},{"skillMod":"None","skillName":"Persuasion"}],"stat":"Charisma"}],"trivia":{"background":"farmer","bonds":"yay","flaws":"all","ideals":"I me likey fun things","personalityTrait":"none","quirk":"idk"}}
{"feats":[{"featInfo":{"featDescription":"allows you to ride a 'fiets'","featName":"fiets"},"tag":"Roleplay"}],"preamble":{"charClass":"Fighter","charLevel":1,"charName":"Bob","charRace":"Elf","jackOfAllTrades":false},"skills":[{"relatedStat":"Strength","skillMod":"None","skillName":"Athletics"},{"relatedStat":"Dexterity","skillMod":"None","skillName":"Acrobatics"},{"relatedStat":"Dexterity","skillMod":"None","skillName":"Sleight of Hand"},{"relatedStat":"Dexterity","skillMod":"None","skillName":"Stealth"},{"relatedStat":"Intelligence","skillMod":"None","skillName":"Arcana"},{"relatedStat":"Intelligence","skillMod":"None","skillName":"History"},{"relatedStat":"Intelligence","skillMod":"None","skillName":"Investigation"},{"relatedStat":"Intelligence","skillMod":"None","skillName":"Nature"},{"relatedStat":"Intelligence","skillMod":"None","skillName":"Religion"},{"relatedStat":"Wisdom","skillMod":"None","skillName":"Animal Handling"},{"relatedStat":"Wisdom","skillMod":"None","skillName":"Insight"},{"relatedStat":"Wisdom","skillMod":"None","skillName":"Medicine"},{"relatedStat":"Wisdom","skillMod":"None","skillName":"Perception"},{"relatedStat":"Wisdom","skillMod":"None","skillName":"Survival"},{"relatedStat":"Charisma","skillMod":"None","skillName":"Deception"},{"relatedStat":"Charisma","skillMod":"None","skillName":"Intimidation"},{"relatedStat":"Charisma","skillMod":"None","skillName":"Performance"},{"relatedStat":"Charisma","skillMod":"None","skillName":"Persuasion"}],"spells":[{"atHighLevel":"Cast more of the sodding things","attackSave":"Dexterity","castingTime":"3 Minutes","components":["Verbal","Somatic"],"damageEffect":"Fire","description":"Shoots a huge testicle shaped fireball","duration":"Instant","range":50,"school":"Conjuration","spellLevel":3,"spellName":"Firetesticle"}],"stats":[{"proficient":false,"score":10,"statName":"Strength"},{"proficient":false,"score":10,"statName":"Dexterity"},{"proficient":false,"score":10,"statName":"Constitution"},{"proficient":false,"score":10,"statName":"Intelligence"},{"proficient":false,"score":10,"statName":"Wisdom"},{"proficient":false,"score":10,"statName":"Charisma"}],"trivia":{"background":"farmer","bonds":"yay","flaws":"all","ideals":"I me likey fun things","personalityTrait":"none","quirk":"idk"}}

View file

@ -9,7 +9,13 @@ testStats :: [Stat]
testStats = [strStat, dexStat, conStat, intStat, wisStat, chaStat]
testPreamble :: Preamble
testPreamble = Preamble 1 "Bob" "Elf" "Fighter" False
testPreamble = Preamble
{ charLevel = 5
, charName = "Bob"
, charRace = "Elf"
, charClass = "Fighter"
, jackOfAllTrades = False
}
testTrivia :: Trivia
testTrivia = Trivia "farmer" "none" "I me likey fun things" "yay" "all" "idk"
@ -44,11 +50,11 @@ intSkills = [ Skill "Arcana" None "Intelligence"
]
wisStat :: Stat
wisStat = Stat "Wisdom" 10 False
wisStat = Stat "Wisdom" 20 False
wisSkills :: [Skill]
wisSkills = [ Skill "Animal Handling" None "Wisdom"
, Skill "Insight" None "Wisdom"
wisSkills = [ Skill "Animal Handling" Proficient "Wisdom"
, Skill "Insight" Expertise "Wisdom"
, Skill "Medicine" None "Wisdom"
, Skill "Perception" None "Wisdom"
, Skill "Survival" None "Wisdom"

View file

@ -49,6 +49,7 @@ instance ToJSON SpellComponent
data ScoreMod = None
| Proficient
| Expertise
| Half
deriving (Show, Eq, Ord, Generic, Enum)
data Character = Character
@ -80,12 +81,12 @@ data Trivia = Trivia
data Skill = Skill
{ skillName :: String
, skillMod :: ScoreMod
, relatedStat :: String
, skillStat :: String
} deriving ( Show, Eq, Ord, Generic)
data Stat = Stat
{ statName :: String
, score :: Int
, statScore :: Int
, proficient :: Bool
} deriving ( Show, Eq, Ord, Generic)