Enhance roll result colors

This commit is contained in:
2025-01-07 22:22:15 +01:00
parent 44842ff655
commit adb4923d00
12 changed files with 119 additions and 67 deletions

View File

@ -79,6 +79,18 @@ export default class CthulhuEternalRoll extends Roll {
return this.options.weapon
}
get isLowWP() {
return this.options.isLowWP
}
get isZeroWP() {
return this.options.isZeroWP
}
get isExhausted() {
return this.options.isExhausted
}
/**
* Prompt the user with a dialog to configure and execute a roll.
*
@ -165,6 +177,7 @@ export default class CthulhuEternalRoll extends Roll {
targetScore: options.initialScore,
isLowWP: options.isLowWP,
isZeroWP: options.isZeroWP,
isExhausted: options.isExhausted,
rollModes,
fieldRollMode,
choiceModifier,
@ -211,7 +224,7 @@ export default class CthulhuEternalRoll extends Roll {
// Update target score
console.log(rollData)
rollData.targetScore = Math.min( Math.max(options.initialScore + Number(rollData.modifier), 0), 100)
if ( rollData.isLowWP ) {
if ( rollData.isLowWP || rollData.isExhausted) {
rollData.targetScore -= 20
}
if ( rollData.isZeroWP ) {
@ -248,6 +261,9 @@ export default class CthulhuEternalRoll extends Roll {
roll.options.isSuccess = resultType === "success" || resultType === "successCritical"
roll.options.isFailure = resultType === "failure" || resultType === "failureCritical"
roll.options.isCritical = resultType === "successCritical" || resultType === "failureCritical"
roll.options.isLowWP = rollData.isLowWP
roll.options.isZeroWP = rollData.isZeroWP
roll.options.isExhausted = rollData.isExhausted
/**
* A hook event that fires after the roll has been made.
@ -327,6 +343,10 @@ export default class CthulhuEternalRoll extends Roll {
cardData.realDamage = this.realDamage
cardData.isPrivate = isPrivate
cardData.weapon = this.weapon
cardData.isLowWP = this.isLowWP
cardData.isZeroWP = this.isZeroWP
cardData.isExhausted = this.isExhausted
console.log(cardData)