2023-11-10 16:38:49 +01:00
|
|
|
{-# LANGUAGE DeriveGeneric #-}
|
|
|
|
|
|
|
|
module DND.Sheet.Content
|
|
|
|
( Character (..)
|
|
|
|
, Preamble (..)
|
|
|
|
, Trivia (..)
|
|
|
|
, Skill (..)
|
|
|
|
, Stat (..)
|
|
|
|
, ScoreMod(..)
|
|
|
|
, Spell(..)
|
|
|
|
, SpellComponent(..)
|
|
|
|
, Feature(..)
|
2024-11-18 17:09:16 +01:00
|
|
|
, FeatInfo(..)
|
2023-11-10 16:38:49 +01:00
|
|
|
) where
|
|
|
|
|
2024-11-18 17:24:26 +01:00
|
|
|
import Data.Aeson (FromJSON, ToJSON)
|
|
|
|
import GHC.Generics (Generic)
|
2023-11-10 16:38:49 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-11-18 17:09:16 +01:00
|
|
|
instance FromJSON Feature
|
|
|
|
instance ToJSON Feature
|
|
|
|
|
|
|
|
instance FromJSON FeatInfo
|
|
|
|
instance ToJSON FeatInfo
|
|
|
|
|
2023-11-10 16:38:49 +01:00
|
|
|
instance FromJSON SpellComponent
|
|
|
|
instance ToJSON SpellComponent
|
|
|
|
|
|
|
|
data ScoreMod = None
|
|
|
|
| Proficient
|
|
|
|
| Expertise
|
2024-11-19 10:40:42 +01:00
|
|
|
| Half
|
2023-11-10 16:38:49 +01:00
|
|
|
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]
|
2023-11-10 16:38:49 +01:00
|
|
|
} deriving ( Show, Eq, Ord, Generic)
|
|
|
|
|
|
|
|
data Preamble = Preamble
|
2024-11-18 17:24:26 +01:00
|
|
|
{ charLevel :: Int
|
|
|
|
, charName :: String
|
|
|
|
, charRace :: String
|
|
|
|
, charClass :: String
|
2023-11-10 16:38:49 +01:00
|
|
|
, jackOfAllTrades :: Bool
|
|
|
|
} deriving ( Show, Eq, Ord, Generic)
|
|
|
|
|
|
|
|
data Trivia = Trivia
|
2024-11-18 17:24:26 +01:00
|
|
|
{ background :: String
|
2023-11-10 16:38:49 +01:00
|
|
|
, personalityTrait :: String
|
2024-11-18 17:24:26 +01:00
|
|
|
, ideals :: String
|
|
|
|
, bonds :: String
|
|
|
|
, flaws :: String
|
|
|
|
, quirk :: String
|
2023-11-10 16:38:49 +01:00
|
|
|
} deriving ( Show, Eq, Ord, Generic)
|
|
|
|
|
|
|
|
data Skill = Skill
|
2024-11-19 10:40:42 +01:00
|
|
|
{ skillName :: String
|
|
|
|
, skillMod :: ScoreMod
|
|
|
|
, skillStat :: String
|
2023-11-10 16:38:49 +01:00
|
|
|
} 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
|
2023-11-10 16:38:49 +01:00
|
|
|
, 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
|
2023-11-10 16:38:49 +01:00
|
|
|
, damageEffect :: String
|
2024-11-18 17:24:26 +01:00
|
|
|
, description :: String
|
|
|
|
, school :: String
|
|
|
|
, atHighLevel :: String
|
2023-11-10 16:38:49 +01:00
|
|
|
} 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
|
2024-11-18 17:09:16 +01:00
|
|
|
, featDescription :: String
|
|
|
|
} deriving ( Show, Eq, Ord, Generic)
|
|
|
|
|
2023-11-10 16:38:49 +01:00
|
|
|
data Feature = StatIncrease
|
2024-11-18 17:09:16 +01:00
|
|
|
{ featInfo :: FeatInfo
|
|
|
|
, increase :: [Stat] }
|
2024-11-18 17:24:26 +01:00
|
|
|
| SetProficiency
|
|
|
|
{ featInfo :: FeatInfo
|
2024-11-18 17:09:16 +01:00
|
|
|
, changeModState :: [ScoreMod]
|
2023-11-10 16:38:49 +01:00
|
|
|
}
|
|
|
|
| SetExpertise
|
2024-11-18 17:24:26 +01:00
|
|
|
{ featInfo :: FeatInfo
|
2024-11-18 17:09:16 +01:00
|
|
|
, changeModState :: [ScoreMod]
|
2023-11-10 16:38:49 +01:00
|
|
|
}
|
|
|
|
| AddSpell
|
2024-11-18 17:09:16 +01:00
|
|
|
{ featInfo :: FeatInfo
|
|
|
|
, addSpell :: [Spell]
|
2023-11-10 16:38:49 +01:00
|
|
|
}
|
2024-11-18 09:20:17 +01:00
|
|
|
| Roleplay
|
2024-11-18 17:09:16 +01:00
|
|
|
{ featInfo :: FeatInfo }
|
2024-11-18 09:20:17 +01:00
|
|
|
deriving ( Show, Eq, Ord, Generic)
|