Some granted dice/favor fixes
All checks were successful
Release Creation / build (release) Successful in 2m48s
All checks were successful
Release Creation / build (release) Successful in 2m48s
This commit is contained in:
@@ -358,7 +358,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
],
|
||||
actions: {
|
||||
"selectGranted": (event, button, dialog) => {
|
||||
hasGrantedDice = true
|
||||
hasGrantedDice = event.target.checked
|
||||
},
|
||||
"selectBeyondSkill": (event, button, dialog) => {
|
||||
beyondSkill = button.checked
|
||||
@@ -502,15 +502,17 @@ export default class LethalFantasyRoll extends Roll {
|
||||
if (rollContext.favor === "favor") {
|
||||
rollFavor = new this(baseFormula, options.data, rollData)
|
||||
await rollFavor.evaluate()
|
||||
console.log("Rolling with favor", rollFavor)
|
||||
if (game?.dice3d) {
|
||||
game.dice3d.showForRoll(rollFavor, game.user, true)
|
||||
}
|
||||
if (rollFavor.result > rollBase.result) {
|
||||
if (Number(rollFavor.result) > Number(rollBase.result)) {
|
||||
badResult = rollBase.result
|
||||
rollBase = rollFavor
|
||||
} else {
|
||||
badResult = rollFavor.result
|
||||
}
|
||||
rollFavor = null
|
||||
}
|
||||
|
||||
if (rollContext.favor === "disfavor") {
|
||||
@@ -519,12 +521,13 @@ export default class LethalFantasyRoll extends Roll {
|
||||
if (game?.dice3d) {
|
||||
game.dice3d.showForRoll(rollFavor, game.user, true)
|
||||
}
|
||||
if (rollFavor.result < rollBase.result) {
|
||||
if (Number(rollFavor.result) < Number(rollBase.result)) {
|
||||
badResult = rollBase.result
|
||||
rollBase = rollFavor
|
||||
} else {
|
||||
badResult = rollFavor.result
|
||||
}
|
||||
rollFavor = null
|
||||
}
|
||||
|
||||
if (hasD30) {
|
||||
@@ -535,7 +538,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
options.D30result = rollD30.total
|
||||
}
|
||||
|
||||
let rollTotal = -1
|
||||
let rollTotal = 0
|
||||
let diceResults = []
|
||||
let resultType
|
||||
let diceSum = 0
|
||||
@@ -560,7 +563,8 @@ export default class LethalFantasyRoll extends Roll {
|
||||
}
|
||||
}
|
||||
|
||||
if (hasGrantedDice) {
|
||||
if (hasGrantedDice && options.rollTarget.grantedDice && options.rollTarget.grantedDice !== "") {
|
||||
titleFormula += ` + ${options.rollTarget.grantedDice.toUpperCase()}`
|
||||
let grantedRoll = new Roll(options.rollTarget.grantedDice)
|
||||
await grantedRoll.evaluate()
|
||||
if (game?.dice3d) {
|
||||
@@ -573,12 +577,12 @@ export default class LethalFantasyRoll extends Roll {
|
||||
if (fullModifier !== 0) {
|
||||
diceResults.push({ dice: `${rollModifier.formula.toUpperCase()}`, value: rollModifier.total })
|
||||
if (fullModifier < 0) {
|
||||
rollTotal = Math.max(diceSum - rollModifier.total, 0)
|
||||
rollTotal += Math.max(diceSum - rollModifier.total, 0)
|
||||
} else {
|
||||
rollTotal = diceSum + rollModifier.total
|
||||
rollTotal += diceSum + rollModifier.total
|
||||
}
|
||||
} else {
|
||||
rollTotal = diceSum
|
||||
rollTotal += diceSum
|
||||
}
|
||||
|
||||
rollBase.options.resultType = resultType
|
||||
|
||||
Reference in New Issue
Block a user