Minor fixes

This commit is contained in:
2024-12-17 07:09:20 +01:00
parent 4e6abebd70
commit 9dfe08b8a4
1402 changed files with 333918 additions and 140 deletions

View File

@@ -0,0 +1,23 @@
import { DICE_VALUES } from "./config/system.mjs"
export default class LethalFantasyUtils {
// Return the maximum damage limited by the maximum damage of the character
static maxDamage(damage, damageMax) {
const damageIndex = DICE_VALUES.indexOf(damage)
const damageMaxIndex = DICE_VALUES.indexOf(damageMax)
// If damage exceeds damageMax, return damageMax
if (damageIndex > damageMaxIndex) {
return damageMax
}
// Otherwise, return damage (as it is less than or equal to damageMax)
return damage
}
// Used when a ressource is lost to find the next lower dice
static findLowerDice(dice) {
let index = DICE_VALUES.indexOf(dice)
return DICE_VALUES[index - 1]
}
}