From 4290aaf8652481e2a4e0d55f7421c57fdcad5007 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Sun, 28 Aug 2022 16:03:07 +0200 Subject: [PATCH] Support for proficiency-like modifiers --- example.json | 4 +++- main.go | 5 +++++ sheetContent.go | 12 +++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/example.json b/example.json index 38f35f6..5a8681c 100644 --- a/example.json +++ b/example.json @@ -4,7 +4,9 @@ "name": "Bob", "race": "Human", "class": "Fighter", - "background": "Generic" + "background": "Generic", + "reliableTalent": false, + "jackOfAllTrades": false }, "stats":[ {"statName":"strength", "score":20, "proficient":false }, diff --git a/main.go b/main.go index c843959..8c2aebf 100644 --- a/main.go +++ b/main.go @@ -250,6 +250,9 @@ func savingThrow(stat Stat) (int, int, error) { func skillCheck(skill Skill) (int, int, error) { die := rollDice() + if char.Misc.ReliableTalent && skill.Proficient && die < 10 { + die = 10 + } planeDie := die die += getModifier(getStat(skill.BaseStat)) @@ -259,6 +262,8 @@ func skillCheck(skill Skill) (int, int, error) { die += getProficiency() * 2 case skill.Proficient: die += getProficiency() + case !skill.Proficient && char.Misc.JackOfAllTrades: + die += (getProficiency() / 2) } return die, planeDie, skillErrorCheck() } diff --git a/sheetContent.go b/sheetContent.go index e1f2cb8..5788732 100644 --- a/sheetContent.go +++ b/sheetContent.go @@ -7,11 +7,13 @@ type Character struct { } type Misc struct { - Level int `json:"level"` - Name string `json:"name"` - Race string `json:"race"` - Class string `json:"class"` - Background string `json:"background"` + Level int `json:"level"` + Name string `json:"name"` + Race string `json:"race"` + Class string `json:"class"` + Background string `json:"background"` + ReliableTalent bool `json:"reliableTalent"` + JackOfAllTrades bool `json:"jackOfAllTrades"` } type Skill struct { SkillName string `json:"skillName"`