Résistance: dérivation automatique depuis les seuils de spécialisation

- Ajout resThreshold par domaine dans SKILLS (config/system.mjs)
  ame: artifice=5, attraction=2, coercition=3, faveur=6
  corps: echauffouree=6, effacement=3, mobilite=2, prouesse=5
  coeur: appreciation=6, arts=2, inspiration=3, traque=5
  esprit: instruction=2, mtechnologique=6, raisonnement=5, traitement=3
- prepareDerivedData() calcule stats.{stat}.res = +2 par seuil atteint
- Template: résistance non-éditable (span uniquement, valeur dérivée)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-29 22:55:27 +02:00
parent 56620f31de
commit df2ed14f34
3 changed files with 28 additions and 21 deletions

View File

@@ -164,6 +164,17 @@ export default class CelestopolCharacter extends foundry.abstract.TypeDataModel
}
}
// Calcul automatique de la Résistance par stat = +2 par domaine atteignant son seuil
for (const [statId, statData] of Object.entries(this.stats)) {
let res = 0
for (const [skillId, skill] of Object.entries(statData)) {
if (typeof skill !== "object" || !("value" in skill)) continue
const threshold = SYSTEM.SKILLS[statId]?.[skillId]?.resThreshold
if (threshold !== undefined && skill.value >= threshold) res += 2
}
statData.res = res
}
// Calcul automatique de la valeur de chaque faction = nombre de cases cochées
for (const faction of Object.values(this.factions)) {
if (typeof faction !== "object" || !("level1" in faction)) continue