Support for proficiency-like modifiers

This commit is contained in:
Nox Sluijtman 2022-08-28 16:03:07 +02:00
parent 537da340d2
commit 4290aaf865
3 changed files with 15 additions and 6 deletions

View file

@ -4,7 +4,9 @@
"name": "Bob", "name": "Bob",
"race": "Human", "race": "Human",
"class": "Fighter", "class": "Fighter",
"background": "Generic" "background": "Generic",
"reliableTalent": false,
"jackOfAllTrades": false
}, },
"stats":[ "stats":[
{"statName":"strength", "score":20, "proficient":false }, {"statName":"strength", "score":20, "proficient":false },

View file

@ -250,6 +250,9 @@ func savingThrow(stat Stat) (int, int, error) {
func skillCheck(skill Skill) (int, int, error) { func skillCheck(skill Skill) (int, int, error) {
die := rollDice() die := rollDice()
if char.Misc.ReliableTalent && skill.Proficient && die < 10 {
die = 10
}
planeDie := die planeDie := die
die += getModifier(getStat(skill.BaseStat)) die += getModifier(getStat(skill.BaseStat))
@ -259,6 +262,8 @@ func skillCheck(skill Skill) (int, int, error) {
die += getProficiency() * 2 die += getProficiency() * 2
case skill.Proficient: case skill.Proficient:
die += getProficiency() die += getProficiency()
case !skill.Proficient && char.Misc.JackOfAllTrades:
die += (getProficiency() / 2)
} }
return die, planeDie, skillErrorCheck() return die, planeDie, skillErrorCheck()
} }

View file

@ -12,6 +12,8 @@ type Misc struct {
Race string `json:"race"` Race string `json:"race"`
Class string `json:"class"` Class string `json:"class"`
Background string `json:"background"` Background string `json:"background"`
ReliableTalent bool `json:"reliableTalent"`
JackOfAllTrades bool `json:"jackOfAllTrades"`
} }
type Skill struct { type Skill struct {
SkillName string `json:"skillName"` SkillName string `json:"skillName"`