mirror of
https://gitlab.com/EternalWanderer/sheet-parser.git
synced 2024-11-28 21:13:51 +01:00
Support for proficiency-like modifiers
This commit is contained in:
parent
537da340d2
commit
4290aaf865
|
@ -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 },
|
||||
|
|
5
main.go
5
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()
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ type Misc struct {
|
|||
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"`
|
||||
|
|
Loading…
Reference in a new issue