122 lines
3 KiB
Haskell
122 lines
3 KiB
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
|
|
module DND.Sheet
|
|
( Character (..)
|
|
, Preamble (..)
|
|
, Trivia (..)
|
|
, Skill (..)
|
|
, Stat (..)
|
|
, ScoreMod(..)
|
|
, Spell(..)
|
|
, SpellComponent(..)
|
|
, Feature(..)
|
|
)
|
|
where
|
|
|
|
import Data.Aeson
|
|
import GHC.Generics
|
|
|
|
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 SpellComponent
|
|
instance ToJSON SpellComponent
|
|
|
|
data ScoreMod = None
|
|
| Proficient
|
|
| Expertise
|
|
deriving (Show, Eq, Ord, Generic)
|
|
|
|
data Character = Character
|
|
{ preamble :: Preamble
|
|
, trivia :: Trivia
|
|
, stats :: [Stat]
|
|
, spells :: Maybe [Spell]
|
|
--, feats :: [Feat]
|
|
} 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
|
|
} deriving ( Show, Eq, Ord, Generic)
|
|
|
|
data Stat = Stat
|
|
{ stat :: String
|
|
, score :: Int
|
|
, proficient :: Bool
|
|
, skills :: [Skill]
|
|
} 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 Feature = StatIncrease
|
|
{ increase :: [Stat] }
|
|
| SetProficiency
|
|
{ changeModState :: [ScoreMod]
|
|
, featDescription :: String
|
|
}
|
|
| SetExpertise
|
|
{ changeModState :: [ScoreMod]
|
|
, featDescription :: String
|
|
}
|
|
| AddSpell
|
|
{ addSpell :: [Spell]
|
|
, featDescription :: String
|
|
}
|
|
| Roleplay
|
|
{ featDescription :: String
|
|
}
|
|
deriving ( Show, Eq, Ord, Generic)
|