Refactor of skills and start of dice module
This commit is contained in:
parent
554a26fff6
commit
f12134bf55
8 changed files with 104 additions and 54 deletions
|
@ -10,6 +10,8 @@ module DND.Sheet.Content
|
|||
, Spell(..)
|
||||
, SpellComponent(..)
|
||||
, Feature(..)
|
||||
, FeatInfo(..)
|
||||
, fiets
|
||||
) where
|
||||
|
||||
import Data.Aeson ( FromJSON, ToJSON )
|
||||
|
@ -36,6 +38,12 @@ instance ToJSON ScoreMod
|
|||
instance FromJSON Spell
|
||||
instance ToJSON Spell
|
||||
|
||||
instance FromJSON Feature
|
||||
instance ToJSON Feature
|
||||
|
||||
instance FromJSON FeatInfo
|
||||
instance ToJSON FeatInfo
|
||||
|
||||
instance FromJSON SpellComponent
|
||||
instance ToJSON SpellComponent
|
||||
|
||||
|
@ -48,8 +56,9 @@ data Character = Character
|
|||
{ preamble :: Preamble
|
||||
, trivia :: Trivia
|
||||
, stats :: [Stat]
|
||||
, skills :: [Skill]
|
||||
, spells :: Maybe [Spell]
|
||||
--, feats :: [Feat]
|
||||
, feats :: Maybe [Feature]
|
||||
} deriving ( Show, Eq, Ord, Generic)
|
||||
|
||||
data Preamble = Preamble
|
||||
|
@ -72,13 +81,18 @@ data Trivia = Trivia
|
|||
data Skill = Skill
|
||||
{ skillName :: String
|
||||
, skillMod :: ScoreMod
|
||||
, relatedStat :: String
|
||||
} deriving ( Show, Eq, Ord, Generic)
|
||||
|
||||
fiets = Skill { skillName = "Stuff"
|
||||
, skillMod = None
|
||||
, relatedStat = "Strength"
|
||||
}
|
||||
|
||||
data Stat = Stat
|
||||
{ stat :: String
|
||||
{ statName :: String
|
||||
, score :: Int
|
||||
, proficient :: Bool
|
||||
, skills :: [Skill]
|
||||
} deriving ( Show, Eq, Ord, Generic)
|
||||
|
||||
data Spell = Spell
|
||||
|
@ -100,21 +114,25 @@ data SpellComponent = Verbal
|
|||
| Material
|
||||
deriving ( Show, Eq, Ord, Generic)
|
||||
|
||||
data FeatInfo = FeatInfo { featName :: String
|
||||
, featDescription :: String
|
||||
} deriving ( Show, Eq, Ord, Generic)
|
||||
|
||||
data Feature = StatIncrease
|
||||
{ increase :: [Stat] }
|
||||
{ featInfo :: FeatInfo
|
||||
, increase :: [Stat] }
|
||||
| SetProficiency
|
||||
{ changeModState :: [ScoreMod]
|
||||
, featDescription :: String
|
||||
{ featInfo :: FeatInfo
|
||||
, changeModState :: [ScoreMod]
|
||||
}
|
||||
| SetExpertise
|
||||
{ changeModState :: [ScoreMod]
|
||||
, featDescription :: String
|
||||
{ featInfo :: FeatInfo
|
||||
, changeModState :: [ScoreMod]
|
||||
}
|
||||
| AddSpell
|
||||
{ addSpell :: [Spell]
|
||||
, featDescription :: String
|
||||
{ featInfo :: FeatInfo
|
||||
, addSpell :: [Spell]
|
||||
}
|
||||
| Roleplay
|
||||
{ featDescription :: String
|
||||
}
|
||||
{ featInfo :: FeatInfo }
|
||||
deriving ( Show, Eq, Ord, Generic)
|
||||
|
|
|
@ -4,6 +4,7 @@ module DND.Sheet.Parser
|
|||
, listSkills
|
||||
, createExample
|
||||
, getName
|
||||
, getStat
|
||||
, listSkillNames
|
||||
) where
|
||||
|
||||
|
@ -34,3 +35,6 @@ createExample = flip encodeFile bob
|
|||
|
||||
getName :: Character -> String
|
||||
getName = charName . preamble
|
||||
|
||||
getStat :: Character -> String -> Stat
|
||||
getStat char s = head . filter (\a -> statName a == s) . stats $ char
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue