DIvers petites corrections pour les specialités et les competences
All checks were successful
Release Creation / build (release) Successful in 54s

This commit is contained in:
2026-01-18 18:39:51 +01:00
parent d3c24e44d8
commit f445741eda
66 changed files with 277 additions and 238 deletions

View File

@@ -277,7 +277,7 @@ export class HeritiersActor extends Actor {
let comp = {}
for (let key in game.system.lesheritiers.config.competenceProfil) {
if (game.system.lesheritiers.config.competenceProfil[key].kind == kind)
comp[key] = { skills: [], niveau: this.system.competences[key].niveau }
comp[key] = { skills: [], niveau: this.system.competences[key].niveau, rang: this.system.competences[key].rang }
}
for (let item of this.items) {
if (item.type == "competence") {
@@ -394,6 +394,34 @@ export class HeritiersActor extends Actor {
}
if (this.type == 'personnage') {
// Calculate rang for each competence profile
let competencesRangs = {
aventurier: 0,
combattant: 0,
erudit: 0,
gentleman: 0,
roublard: 0,
savant: 0
}
// Sum up niveau for each profil
for (let item of this.items) {
if (item.type == "competence" && item.system.profil) {
let profil = item.system.profil.toLowerCase()
if (competencesRangs.hasOwnProperty(profil)) {
competencesRangs[profil] += item.system.niveau
}
}
}
// Calculate rang (total / 4, rounded down) for each competence
for (let profil in competencesRangs) {
let total = competencesRangs[profil]
let rang = Math.floor(total / 4)
if (this.system.competences[profil]) {
this.system.competences[profil].rang = rang
}
}
}
super.prepareDerivedData()
@@ -431,6 +459,8 @@ export class HeritiersActor extends Actor {
if (dataType) {
if (dataType.toLowerCase() == "number") {
value = Number(value)
} else if (dataType.toLowerCase() == "boolean") {
value = Boolean(value)
} else {
value = String(value)
}