Savesrolls + HP

This commit is contained in:
2022-08-03 09:34:33 +02:00
parent 13646814ba
commit cb3f555a4e
29 changed files with 109 additions and 140 deletions

View File

@@ -271,15 +271,23 @@ export class CrucibleUtility {
let actor = game.actors.get(rollData.actorId)
// stat => 0
let diceFormula = String(rollData.ability.value) + "d6cs>=5"
// ability/save => 0
let diceFormula
let startFormula = "0d6cs>=5"
if ( rollData.ability) {
startFormula = String(rollData.ability.value) + "d6cs>=5"
}
if ( rollData.save) {
startFormula = String(rollData.save.value) + "d6cs>=5"
}
diceFormula = startFormula
// skill => 2
// feat => 4
// bonus => 6
if (rollData.skill) {
let level = rollData.skill.data.level
if (level == 0 && rollData.skill.data.isfeatdie ) {
if (rollData.skill.data.issl2 ) {
rollData.hasSLBonus = true
level += 2
if (level > 7) { level = 7}
@@ -292,7 +300,7 @@ export class CrucibleUtility {
rollData.rollAdvantage = "roll-disadvantage"
}
if (rollData.skill.data.level > 0 && rollData.skill.data.isfeatdie) {
if (rollData.skill.data.isfeatdie) {
rollData.hasFeatDie = true
diceFormula += "+ 1d10cs>=5"
} else {
@@ -341,6 +349,7 @@ export class CrucibleUtility {
}
// Performs roll
console.log("Roll formula", diceFormula)
let myRoll = rollData.roll
if (!myRoll) { // New rolls only of no rerolls
myRoll = new Roll(diceFormula).roll({ async: false })