mirror of
https://gitlab.com/EternalWanderer/sheet-parser.git
synced 2024-11-28 21:13:51 +01:00
Added percpetion skill and some more cleanup
This commit is contained in:
parent
67d8e210f8
commit
417762a74d
18
main.go
18
main.go
|
@ -76,6 +76,7 @@ func main() {
|
|||
}
|
||||
|
||||
func getProficiency() int {
|
||||
// https://worldbuildersjunction.com/what-is-proficiency-bonus-in-dd-5e-how-it-works-calculated/
|
||||
return (char.Misc.Level-1)/4 + 2
|
||||
}
|
||||
|
||||
|
@ -88,6 +89,7 @@ func getStat(statName string) Stat {
|
|||
}
|
||||
|
||||
func getModifier(stat Stat) int {
|
||||
// https://worldbuildersjunction.com/dungeon-and-dragons-ability-scores-explained-for-beginners/
|
||||
return (stat.Score - 10) / 2
|
||||
}
|
||||
|
||||
|
@ -114,22 +116,14 @@ func savingThrow(stat Stat) int {
|
|||
die := rollDice()
|
||||
|
||||
if stat.Proficient {
|
||||
die += getModifier(stat)
|
||||
die += getProficiency()
|
||||
}
|
||||
return die
|
||||
return die + getModifier(stat)
|
||||
}
|
||||
|
||||
func skillCheck(skill Skill) int {
|
||||
var die, x, y int
|
||||
switch {
|
||||
case advantage:
|
||||
die, x, y = Dice.Advantage()
|
||||
case disadvantage:
|
||||
die, x, y = Dice.Disadvantage()
|
||||
default:
|
||||
die = Dice.SimpleCast()
|
||||
}
|
||||
fmt.Printf("%s%d%s\tx: %d\ty: %d\n", Colors.ColorGreen, die, Colors.ColorReset, x, y)
|
||||
var die int
|
||||
die = rollDice()
|
||||
|
||||
die += getModifier(getStat(skill.BaseStat))
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"misc":{
|
||||
"level": 13,
|
||||
"level": 1,
|
||||
"name": "Bob"
|
||||
},
|
||||
"stats":[
|
||||
{"statName":"strength", "score":20, "proficient":false },
|
||||
{"statName":"dexterity", "score":10, "proficient":false },
|
||||
{"statName":"dexterity", "score":1, "proficient":false },
|
||||
{"statName":"constitution", "score":15, "proficient":false },
|
||||
{"statName":"intelligence", "score":10, "proficient":false },
|
||||
{"statName":"wisdom", "score":10, "proficient":false },
|
||||
{"statName":"charisma", "score":10, "proficient":false }
|
||||
],
|
||||
"skills":[
|
||||
{"skillName":"athletics", "proficient":false, "expertise":false, "baseStat":"strength"},
|
||||
{"skillName":"athletics", "proficient":true, "expertise":false, "baseStat":"strength"},
|
||||
{"skillName":"acrobatics", "proficient":false, "expertise":false, "baseStat":"dexterity"},
|
||||
{"skillName":"sleight_of_hand", "proficient":false, "expertise":false, "baseStat":"dexterity"},
|
||||
{"skillName":"stealth", "proficient":false, "expertise":false, "baseStat":"dexterity"},
|
||||
|
@ -24,6 +24,7 @@
|
|||
{"skillName":"animal_handling", "proficient":false, "expertise":false, "baseStat":"wisdom"},
|
||||
{"skillName":"insight", "proficient":false, "expertise":false, "baseStat":"wisdom"},
|
||||
{"skillName":"medicine", "proficient":false, "expertise":false, "baseStat":"wisdom"},
|
||||
{"skillName":"perception", "proficient":false, "expertise":false, "baseStat":"wisdom"},
|
||||
{"skillName":"survival", "proficient":false, "expertise":false, "baseStat":"wisdom"},
|
||||
{"skillName":"deception", "proficient":false, "expertise":false, "baseStat":"charisma"},
|
||||
{"skillName":"intimidation", "proficient":false, "expertise":true, "baseStat":"charisma"},
|
||||
|
|
Loading…
Reference in a new issue