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

134 lines
3.5 KiB
Haskell
Raw Normal View History

{-# LANGUAGE DeriveGeneric #-}
module DND.Sheet.Content
( Character (..)
, Preamble (..)
, Trivia (..)
, Skill (..)
, Stat (..)
, ScoreMod(..)
, Spell(..)
, SpellComponent(..)
, Feature(..)
, FeatInfo(..)
) where
2024-11-18 17:24:26 +01:00
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
2024-11-19 10:40:42 +01:00
| Half
deriving (Show, Eq, Ord, Generic, Enum)
data Character = Character
{ preamble :: Preamble
2024-11-18 17:24:26 +01:00
, trivia :: Trivia
, stats :: [Stat]
, skills :: [Skill]
, spells :: Maybe [Spell]
, feats :: Maybe [Feature]
} deriving ( Show, Eq, Ord, Generic)
data Preamble = Preamble
2024-11-18 17:24:26 +01:00
{ charLevel :: Int
, charName :: String
, charRace :: String
, charClass :: String
, jackOfAllTrades :: Bool
} deriving ( Show, Eq, Ord, Generic)
data Trivia = Trivia
2024-11-18 17:24:26 +01:00
{ background :: String
, personalityTrait :: String
2024-11-18 17:24:26 +01:00
, ideals :: String
, bonds :: String
, flaws :: String
, quirk :: String
} deriving ( Show, Eq, Ord, Generic)
data Skill = Skill
2024-11-19 10:40:42 +01:00
{ skillName :: String
, skillMod :: ScoreMod
, skillStat :: String
} deriving ( Show, Eq, Ord, Generic)
data Stat = Stat
2024-11-18 17:24:26 +01:00
{ statName :: String
2024-11-19 10:40:42 +01:00
, statScore :: Int
, proficient :: Bool
} deriving ( Show, Eq, Ord, Generic)
data Spell = Spell
2024-11-18 17:24:26 +01:00
{ spellName :: String
, spellLevel :: Int
, castingTime :: String
, range :: Int
, components :: [SpellComponent]
, duration :: String
, attackSave :: String
, damageEffect :: String
2024-11-18 17:24:26 +01:00
, description :: String
, school :: String
, atHighLevel :: String
} deriving ( Show, Eq, Ord, Generic)
data SpellComponent = Verbal
| Somatic
| Material
deriving ( Show, Eq, Ord, Generic)
2024-11-18 17:24:26 +01:00
data FeatInfo = FeatInfo { featName :: String
, featDescription :: String
} deriving ( Show, Eq, Ord, Generic)
data Feature = StatIncrease
{ featInfo :: FeatInfo
, increase :: [Stat] }
2024-11-18 17:24:26 +01:00
| SetProficiency
{ featInfo :: FeatInfo
, changeModState :: [ScoreMod]
}
| SetExpertise
2024-11-18 17:24:26 +01:00
{ featInfo :: FeatInfo
, changeModState :: [ScoreMod]
}
| AddSpell
{ featInfo :: FeatInfo
, addSpell :: [Spell]
}
2024-11-18 09:20:17 +01:00
| Roleplay
{ featInfo :: FeatInfo }
2024-11-18 09:20:17 +01:00
deriving ( Show, Eq, Ord, Generic)