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

134 lines
3.5 KiB
Haskell

{-# LANGUAGE DeriveGeneric #-}
module DND.Sheet.Content
( Character (..)
, Preamble (..)
, Trivia (..)
, Skill (..)
, Stat (..)
, ScoreMod(..)
, Spell(..)
, SpellComponent(..)
, Feature(..)
, FeatInfo(..)
) where
import Data.Aeson (FromJSON, ToJSON)
import GHC.Generics (Generic)
instance FromJSON Character
instance ToJSON Character
instance FromJSON Preamble
instance ToJSON Preamble
instance FromJSON Trivia
instance ToJSON Trivia
instance FromJSON Stat
instance ToJSON Stat
instance FromJSON Skill
instance ToJSON Skill
instance FromJSON ScoreMod
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
data ScoreMod = None
| Proficient
| Expertise
| Half
deriving (Show, Eq, Ord, Generic, Enum)
data Character = Character
{ preamble :: Preamble
, trivia :: Trivia
, stats :: [Stat]
, skills :: [Skill]
, spells :: Maybe [Spell]
, feats :: Maybe [Feature]
} deriving ( Show, Eq, Ord, Generic)
data Preamble = Preamble
{ charLevel :: Int
, charName :: String
, charRace :: String
, charClass :: String
, jackOfAllTrades :: Bool
} deriving ( Show, Eq, Ord, Generic)
data Trivia = Trivia
{ background :: String
, personalityTrait :: String
, ideals :: String
, bonds :: String
, flaws :: String
, quirk :: String
} deriving ( Show, Eq, Ord, Generic)
data Skill = Skill
{ skillName :: String
, skillMod :: ScoreMod
, skillStat :: String
} deriving ( Show, Eq, Ord, Generic)
data Stat = Stat
{ statName :: String
, statScore :: Int
, proficient :: Bool
} deriving ( Show, Eq, Ord, Generic)
data Spell = Spell
{ spellName :: String
, spellLevel :: Int
, castingTime :: String
, range :: Int
, components :: [SpellComponent]
, duration :: String
, attackSave :: String
, damageEffect :: String
, description :: String
, school :: String
, atHighLevel :: String
} deriving ( Show, Eq, Ord, Generic)
data SpellComponent = Verbal
| Somatic
| Material
deriving ( Show, Eq, Ord, Generic)
data FeatInfo = FeatInfo { featName :: String
, featDescription :: String
} deriving ( Show, Eq, Ord, Generic)
data Feature = StatIncrease
{ featInfo :: FeatInfo
, increase :: [Stat] }
| SetProficiency
{ featInfo :: FeatInfo
, changeModState :: [ScoreMod]
}
| SetExpertise
{ featInfo :: FeatInfo
, changeModState :: [ScoreMod]
}
| AddSpell
{ featInfo :: FeatInfo
, addSpell :: [Spell]
}
| Roleplay
{ featInfo :: FeatInfo }
deriving ( Show, Eq, Ord, Generic)