Various items fixes and enhancements

This commit is contained in:
2024-12-09 16:02:40 +01:00
parent 9775ec9fa1
commit 1de2927d93
51 changed files with 2102 additions and 574 deletions

View File

@ -1,23 +1,13 @@
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
return 0
}
// 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]
return 0
}
}