Correction message min/max de race

This commit is contained in:
Vincent Vandemeulebrouck 2025-02-02 00:05:53 +01:00
parent 069fef4720
commit 78e30b5503

View File

@ -19,11 +19,13 @@ export class RdDItemRace extends RdDItem {
return false
}
}
if (code == LIST_CARAC_PERSONNAGE.taille.code) {
const carac = RdDCarac.carac(code)
if (race.isMax(actor, code, value - 1)) {
ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`)
return false
}
}
return true
}
@ -59,7 +61,8 @@ export class RdDItemRace extends RdDItem {
if (code == LIST_CARAC_PERSONNAGE.force.code) {
return value >= this.getForceMax(actor)
}
const max = foundry.utils.getProperty(this, path) ?? -1
const pathMax = path.replace(".value", ".max");
const max = foundry.utils.getProperty(this, pathMax) ?? -1
return (max > 0 && value >= max)
}