UωU -- Initial commit

This commit is contained in:
Nox Sluijtman 2023-11-09 22:44:20 +01:00
commit 4c46789ae4
13 changed files with 1364 additions and 0 deletions

7
lib/DND.hs Normal file
View file

@ -0,0 +1,7 @@
module DND
( module DND.Sheet
, module DND.Bob
) where
import DND.Sheet
import DND.Bob

79
lib/DND/Bob.hs Normal file
View file

@ -0,0 +1,79 @@
module DND.Bob (bob) where
import DND.Sheet
bob :: Character
bob = Character testPreamble testTrivia testStats (Just testSpells)
testStats :: [Stat]
testStats = [strStat,dexStat,conStat,intStat,wisStat,chaStat]
testPreamble :: Preamble
testPreamble = Preamble 1 "Bob" "Elf" "Fighter" False
testTrivia :: Trivia
testTrivia = Trivia "farmer" "none" "I me likey fun things" "yay" "all" "idk"
strStat :: Stat
strStat = Stat "Strength" 10 False strSkills
strSkills :: [Skill]
strSkills = [ Skill "Athletics" None ]
dexStat :: Stat
dexStat = Stat "Dexterity" 10 False dexSkills
dexSkills :: [Skill]
dexSkills = [ Skill "Acrobatics" None
, Skill "Sleight of Hand" None
, Skill "Stealth" None
]
conStat :: Stat
conStat = Stat "Constitution" 10 False []
intStat :: Stat
intStat = Stat "Intelligence" 10 False intSkills
intSkills :: [Skill]
intSkills = [ Skill "Arcana" None
, Skill "History" None
, Skill "Investigation" None
, Skill "Nature" None
, Skill "Religion" None
]
wisStat :: Stat
wisStat = Stat "Wisdom" 10 False wisSkills
wisSkills :: [Skill]
wisSkills = [ Skill "Animal Handling" None
, Skill "Insight" None
, Skill "Medicine" None
, Skill "Perception" None
, Skill "Survival" None
]
chaStat :: Stat
chaStat = Stat "Charisma" 10 False chaSkills
chaSkills :: [Skill]
chaSkills = [ Skill "Deception" None
, Skill "Intimidation" None
, Skill "Performance" None
, Skill "Persuasion" None
]
testSpells :: [Spell]
testSpells = [ Spell "Firetesticle" -- spellName
3 -- spellLevel
"3 Minutes" -- castingTime
50 -- range
[Verbal, Somatic] -- components
"Instant" -- duration
"Dexterity" -- attackSave
"Fire" -- damge/effect
"Shoots a huge testicle shaped fireball" -- description
"Conjuration" -- school
"Cast more of the sodding things" -- atHighLevel
]

121
lib/DND/Sheet.hs Normal file
View file

@ -0,0 +1,121 @@
{-# 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)