Compare commits
No commits in common. "7d8bf5d857444becad609365d713964d92223955" and "56b29314adb88905acb247202bdb23b3fc7f8caf" have entirely different histories.
7d8bf5d857
...
56b29314ad
12
flake.lock
12
flake.lock
|
@ -5,11 +5,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731533236,
|
"lastModified": 1694529238,
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1704290814,
|
"lastModified": 1699169573,
|
||||||
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
|
"narHash": "sha256-cvUb1xZkvOp3W2SzylStrTirhVd9zCeo5utJl9nSIhw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
|
"rev": "aeefe2054617cae501809b82b44a8e8f7be7cc4b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
haskellPackages.haskell-language-server # you must build it with your ghc to work
|
haskellPackages.haskell-language-server # you must build it with your ghc to work
|
||||||
ghcid
|
ghcid
|
||||||
cabal-install
|
cabal-install
|
||||||
stylish-haskell
|
|
||||||
];
|
];
|
||||||
inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system});
|
inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system});
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,10 +2,8 @@ module DND
|
||||||
( module DND.Sheet.Content
|
( module DND.Sheet.Content
|
||||||
, module DND.Sheet.Parser
|
, module DND.Sheet.Parser
|
||||||
, module DND.Bob
|
, module DND.Bob
|
||||||
, module DND.Dice
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import DND.Bob
|
import DND.Sheet.Content
|
||||||
import DND.Dice
|
import DND.Sheet.Parser
|
||||||
import DND.Sheet.Content
|
import DND.Bob
|
||||||
import DND.Sheet.Parser
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
module DND.Bob (bob) where
|
module DND.Bob (bob) where
|
||||||
|
|
||||||
import DND.Sheet.Content
|
import DND.Sheet.Content
|
||||||
|
|
||||||
bob :: Character
|
bob :: Character
|
||||||
bob = Character {skills = testSkills, trivia = testTrivia, stats = testStats, spells = Just testSpells, preamble = testPreamble, feats = Just testFeatures}
|
bob = Character testPreamble testTrivia testStats (Just testSpells)
|
||||||
|
|
||||||
testStats :: [Stat]
|
testStats :: [Stat]
|
||||||
testStats = [strStat, dexStat, conStat, intStat, wisStat, chaStat]
|
testStats = [strStat,dexStat,conStat,intStat,wisStat,chaStat]
|
||||||
|
|
||||||
testPreamble :: Preamble
|
testPreamble :: Preamble
|
||||||
testPreamble = Preamble 1 "Bob" "Elf" "Fighter" False
|
testPreamble = Preamble 1 "Bob" "Elf" "Fighter" False
|
||||||
|
@ -15,72 +15,65 @@ testTrivia :: Trivia
|
||||||
testTrivia = Trivia "farmer" "none" "I me likey fun things" "yay" "all" "idk"
|
testTrivia = Trivia "farmer" "none" "I me likey fun things" "yay" "all" "idk"
|
||||||
|
|
||||||
strStat :: Stat
|
strStat :: Stat
|
||||||
strStat = Stat "Strength" 10 False
|
strStat = Stat "Strength" 10 False strSkills
|
||||||
|
|
||||||
strSkills :: [Skill]
|
strSkills :: [Skill]
|
||||||
strSkills = [ Skill "Athletics" None "Strength" ]
|
strSkills = [ Skill "Athletics" None ]
|
||||||
|
|
||||||
dexStat :: Stat
|
dexStat :: Stat
|
||||||
dexStat = Stat "Dexterity" 10 False
|
dexStat = Stat "Dexterity" 10 False dexSkills
|
||||||
|
|
||||||
dexSkills :: [Skill]
|
dexSkills :: [Skill]
|
||||||
dexSkills = [ Skill "Acrobatics" None "Dexterity"
|
dexSkills = [ Skill "Acrobatics" None
|
||||||
, Skill "Sleight of Hand" None "Dexterity"
|
, Skill "Sleight of Hand" None
|
||||||
, Skill "Stealth" None "Dexterity"
|
, Skill "Stealth" None
|
||||||
]
|
]
|
||||||
|
|
||||||
conStat :: Stat
|
conStat :: Stat
|
||||||
conStat = Stat "Constitution" 10 False
|
conStat = Stat "Constitution" 10 False []
|
||||||
|
|
||||||
intStat :: Stat
|
intStat :: Stat
|
||||||
intStat = Stat "Intelligence" 10 False
|
intStat = Stat "Intelligence" 10 False intSkills
|
||||||
|
|
||||||
intSkills :: [Skill]
|
intSkills :: [Skill]
|
||||||
intSkills = [ Skill "Arcana" None "Intelligence"
|
intSkills = [ Skill "Arcana" None
|
||||||
, Skill "History" None "Intelligence"
|
, Skill "History" None
|
||||||
, Skill "Investigation" None "Intelligence"
|
, Skill "Investigation" None
|
||||||
, Skill "Nature" None "Intelligence"
|
, Skill "Nature" None
|
||||||
, Skill "Religion" None "Intelligence"
|
, Skill "Religion" None
|
||||||
]
|
]
|
||||||
|
|
||||||
wisStat :: Stat
|
wisStat :: Stat
|
||||||
wisStat = Stat "Wisdom" 10 False
|
wisStat = Stat "Wisdom" 10 False wisSkills
|
||||||
|
|
||||||
wisSkills :: [Skill]
|
wisSkills :: [Skill]
|
||||||
wisSkills = [ Skill "Animal Handling" None "Wisdom"
|
wisSkills = [ Skill "Animal Handling" None
|
||||||
, Skill "Insight" None "Wisdom"
|
, Skill "Insight" None
|
||||||
, Skill "Medicine" None "Wisdom"
|
, Skill "Medicine" None
|
||||||
, Skill "Perception" None "Wisdom"
|
, Skill "Perception" None
|
||||||
, Skill "Survival" None "Wisdom"
|
, Skill "Survival" None
|
||||||
]
|
]
|
||||||
|
|
||||||
chaStat :: Stat
|
chaStat :: Stat
|
||||||
chaStat = Stat "Charisma" 10 False
|
chaStat = Stat "Charisma" 10 False chaSkills
|
||||||
|
|
||||||
chaSkills :: [Skill]
|
chaSkills :: [Skill]
|
||||||
chaSkills = [ Skill "Deception" None "Charisma"
|
chaSkills = [ Skill "Deception" None
|
||||||
, Skill "Intimidation" None "Charisma"
|
, Skill "Intimidation" None
|
||||||
, Skill "Performance" None "Charisma"
|
, Skill "Performance" None
|
||||||
, Skill "Persuasion" None "Charisma"
|
, Skill "Persuasion" None
|
||||||
]
|
]
|
||||||
|
|
||||||
testSkills :: [Skill]
|
|
||||||
testSkills = strSkills ++ dexSkills ++ intSkills ++ wisSkills ++ chaSkills
|
|
||||||
|
|
||||||
testSpells :: [Spell]
|
testSpells :: [Spell]
|
||||||
testSpells = [ Spell { spellName = "Firetesticle"
|
testSpells = [ Spell "Firetesticle" -- spellName
|
||||||
, spellLevel = 3
|
3 -- spellLevel
|
||||||
, castingTime = "3 Minutes"
|
"3 Minutes" -- castingTime
|
||||||
, range = 50
|
50 -- range
|
||||||
, components = [Verbal, Somatic]
|
[Verbal, Somatic] -- components
|
||||||
, duration = "Instant"
|
"Instant" -- duration
|
||||||
, attackSave = "Dexterity"
|
"Dexterity" -- attackSave
|
||||||
, damageEffect = "Fire"
|
"Fire" -- damge/effect
|
||||||
, description = "Shoots a huge testicle shaped fireball"
|
"Shoots a huge testicle shaped fireball" -- description
|
||||||
, school = "Conjuration"
|
"Conjuration" -- school
|
||||||
, atHighLevel = "Cast more of the sodding things"
|
"Cast more of the sodding things" -- atHighLevel
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
testFeatures :: [Feature]
|
|
||||||
testFeatures = [ Roleplay FeatInfo { featName = "fiets", featDescription = "allows you to ride a 'fiets'" } ]
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
module DND.Dice
|
|
||||||
( rolls
|
|
||||||
, d20
|
|
||||||
, advantage
|
|
||||||
) where
|
|
||||||
|
|
||||||
import System.Random
|
|
||||||
|
|
||||||
rolls :: RandomGen a => Int -> Int -> a -> [Int]
|
|
||||||
rolls x y = take x . randomRs (1, y)
|
|
||||||
|
|
||||||
d20 :: RandomGen a => a -> Int
|
|
||||||
d20 = minimum . rolls 1 20
|
|
||||||
|
|
||||||
advantage :: RandomGen a => a -> Int
|
|
||||||
advantage = maximum . rolls 2 20
|
|
|
@ -3,5 +3,5 @@ module DND.Sheet
|
||||||
, module DND.Sheet.Parser
|
, module DND.Sheet.Parser
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import DND.Sheet.Content
|
import DND.Sheet.Content
|
||||||
import DND.Sheet.Parser
|
import DND.Sheet.Parser
|
||||||
|
|
|
@ -10,11 +10,10 @@ module DND.Sheet.Content
|
||||||
, Spell(..)
|
, Spell(..)
|
||||||
, SpellComponent(..)
|
, SpellComponent(..)
|
||||||
, Feature(..)
|
, Feature(..)
|
||||||
, FeatInfo(..)
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.Aeson (FromJSON, ToJSON)
|
import Data.Aeson ( FromJSON, ToJSON )
|
||||||
import GHC.Generics (Generic)
|
import GHC.Generics ( Generic )
|
||||||
|
|
||||||
instance FromJSON Character
|
instance FromJSON Character
|
||||||
instance ToJSON Character
|
instance ToJSON Character
|
||||||
|
@ -37,12 +36,6 @@ instance ToJSON ScoreMod
|
||||||
instance FromJSON Spell
|
instance FromJSON Spell
|
||||||
instance ToJSON Spell
|
instance ToJSON Spell
|
||||||
|
|
||||||
instance FromJSON Feature
|
|
||||||
instance ToJSON Feature
|
|
||||||
|
|
||||||
instance FromJSON FeatInfo
|
|
||||||
instance ToJSON FeatInfo
|
|
||||||
|
|
||||||
instance FromJSON SpellComponent
|
instance FromJSON SpellComponent
|
||||||
instance ToJSON SpellComponent
|
instance ToJSON SpellComponent
|
||||||
|
|
||||||
|
@ -53,54 +46,53 @@ data ScoreMod = None
|
||||||
|
|
||||||
data Character = Character
|
data Character = Character
|
||||||
{ preamble :: Preamble
|
{ preamble :: Preamble
|
||||||
, trivia :: Trivia
|
, trivia :: Trivia
|
||||||
, stats :: [Stat]
|
, stats :: [Stat]
|
||||||
, skills :: [Skill]
|
, spells :: Maybe [Spell]
|
||||||
, spells :: Maybe [Spell]
|
--, feats :: [Feat]
|
||||||
, feats :: Maybe [Feature]
|
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Preamble = Preamble
|
data Preamble = Preamble
|
||||||
{ charLevel :: Int
|
{ charLevel :: Int
|
||||||
, charName :: String
|
, charName :: String
|
||||||
, charRace :: String
|
, charRace :: String
|
||||||
, charClass :: String
|
, charClass :: String
|
||||||
, jackOfAllTrades :: Bool
|
, jackOfAllTrades :: Bool
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Trivia = Trivia
|
data Trivia = Trivia
|
||||||
{ background :: String
|
{ background :: String
|
||||||
, personalityTrait :: String
|
, personalityTrait :: String
|
||||||
, ideals :: String
|
, ideals :: String
|
||||||
, bonds :: String
|
, bonds :: String
|
||||||
, flaws :: String
|
, flaws :: String
|
||||||
, quirk :: String
|
, quirk :: String
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Skill = Skill
|
data Skill = Skill
|
||||||
{ skillName :: String
|
{ skillName :: String
|
||||||
, skillMod :: ScoreMod
|
, skillMod :: ScoreMod
|
||||||
, relatedStat :: String
|
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Stat = Stat
|
data Stat = Stat
|
||||||
{ statName :: String
|
{ stat :: String
|
||||||
, score :: Int
|
, score :: Int
|
||||||
, proficient :: Bool
|
, proficient :: Bool
|
||||||
|
, skills :: [Skill]
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Spell = Spell
|
data Spell = Spell
|
||||||
{ spellName :: String
|
{ spellName :: String
|
||||||
, spellLevel :: Int
|
, spellLevel :: Int
|
||||||
, castingTime :: String
|
, castingTime :: String
|
||||||
, range :: Int
|
, range :: Int
|
||||||
, components :: [SpellComponent]
|
, components :: [SpellComponent]
|
||||||
, duration :: String
|
, duration :: String
|
||||||
, attackSave :: String
|
, attackSave :: String
|
||||||
, damageEffect :: String
|
, damageEffect :: String
|
||||||
, description :: String
|
, description :: String
|
||||||
, school :: String
|
, school :: String
|
||||||
, atHighLevel :: String
|
, atHighLevel :: String
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data SpellComponent = Verbal
|
data SpellComponent = Verbal
|
||||||
|
@ -108,25 +100,21 @@ data SpellComponent = Verbal
|
||||||
| Material
|
| Material
|
||||||
deriving ( Show, Eq, Ord, Generic)
|
deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data FeatInfo = FeatInfo { featName :: String
|
|
||||||
, featDescription :: String
|
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
|
||||||
|
|
||||||
data Feature = StatIncrease
|
data Feature = StatIncrease
|
||||||
{ featInfo :: FeatInfo
|
{ increase :: [Stat] }
|
||||||
, increase :: [Stat] }
|
| SetProficiency
|
||||||
| SetProficiency
|
{ changeModState :: [ScoreMod]
|
||||||
{ featInfo :: FeatInfo
|
, featDescription :: String
|
||||||
, changeModState :: [ScoreMod]
|
|
||||||
}
|
}
|
||||||
| SetExpertise
|
| SetExpertise
|
||||||
{ featInfo :: FeatInfo
|
{ changeModState :: [ScoreMod]
|
||||||
, changeModState :: [ScoreMod]
|
, featDescription :: String
|
||||||
}
|
}
|
||||||
| AddSpell
|
| AddSpell
|
||||||
{ featInfo :: FeatInfo
|
{ addSpell :: [Spell]
|
||||||
, addSpell :: [Spell]
|
, featDescription :: String
|
||||||
}
|
}
|
||||||
| Roleplay
|
| Roleplay
|
||||||
{ featInfo :: FeatInfo }
|
{ featDescription :: String
|
||||||
deriving ( Show, Eq, Ord, Generic)
|
}
|
||||||
|
deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
|
@ -4,17 +4,16 @@ module DND.Sheet.Parser
|
||||||
, listSkills
|
, listSkills
|
||||||
, createExample
|
, createExample
|
||||||
, getName
|
, getName
|
||||||
, getStat
|
|
||||||
, listSkillNames
|
, listSkillNames
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad
|
import Data.Aeson
|
||||||
import Data.Aeson
|
import DND.Sheet.Content
|
||||||
import qualified Data.ByteString.Lazy as B
|
import DND.Bob(bob)
|
||||||
|
import Control.Monad
|
||||||
|
import qualified Data.ByteString.Lazy as B
|
||||||
import qualified Data.ByteString.Lazy.UTF8 as BSU
|
import qualified Data.ByteString.Lazy.UTF8 as BSU
|
||||||
import Data.Maybe (fromJust)
|
import Data.Maybe (fromJust)
|
||||||
import DND.Bob (bob)
|
|
||||||
import DND.Sheet.Content
|
|
||||||
|
|
||||||
--getSheet :: FilePath -> IO B.ByteString
|
--getSheet :: FilePath -> IO B.ByteString
|
||||||
--getSheet = B.readFile
|
--getSheet = B.readFile
|
||||||
|
@ -35,6 +34,3 @@ createExample = flip encodeFile bob
|
||||||
|
|
||||||
getName :: Character -> String
|
getName :: Character -> String
|
||||||
getName = charName . preamble
|
getName = charName . preamble
|
||||||
|
|
||||||
getStat :: Character -> String -> Stat
|
|
||||||
getStat char s = head . filter (\a -> statName a == s) . stats $ char
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ library
|
||||||
|
|
||||||
exposed-modules: DND
|
exposed-modules: DND
|
||||||
, DND.Bob
|
, DND.Bob
|
||||||
, DND.Dice
|
|
||||||
, DND.Sheet
|
, DND.Sheet
|
||||||
, DND.Sheet.Content
|
, DND.Sheet.Content
|
||||||
, DND.Sheet.Parser
|
, DND.Sheet.Parser
|
||||||
|
@ -67,7 +66,6 @@ library
|
||||||
, aeson
|
, aeson
|
||||||
, bytestring
|
, bytestring
|
||||||
, utf8-string
|
, utf8-string
|
||||||
, random
|
|
||||||
|
|
||||||
hs-source-dirs: lib
|
hs-source-dirs: lib
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue