Correction sur les mise à jour en cascade + correction sur le force rendering après un changement de competence

This commit is contained in:
LeRatierBretonnien 2025-04-06 23:13:59 +02:00
parent 9b8a600e22
commit f32b6af7b6

View File

@ -668,19 +668,23 @@ export class RdDActor extends RdDBaseActorSang {
if (!RdDItemRace.checkRacialMax(this, caracName, to)) { if (!RdDItemRace.checkRacialMax(this, caracName, to)) {
return return
} }
let updates = {};
if (caracName == LIST_CARAC_PERSONNAGE.reve.code) { if (caracName == LIST_CARAC_PERSONNAGE.reve.code) {
if (to > Misc.toInt(this.system.reve.seuil.value)) { if (to > Misc.toInt(this.system.reve.seuil.value)) {
this.setPointsDeSeuil(to); updates[`system.reve.seuil.value`] = to; // SFA : Direct and packed changes
} //this.setPointsDeSeuil(to);
}
} }
if (caracName == LIST_CARAC_PERSONNAGE.chance.code) { if (caracName == LIST_CARAC_PERSONNAGE.chance.code) {
if (to > Misc.toInt(this.system.compteurs.chance.value)) { if (to > Misc.toInt(this.system.compteurs.chance.value)) {
this.setPointsDeChance(to); updates[`system.compteurs.chance.value`] = to; // SFA : Direct and packed changes
//this.setPointsDeChance(to);
} }
} }
let selectedCarac = this.findCaracByName(caracName); let selectedCarac = this.findCaracByName(caracName);
const from = selectedCarac.value const from = selectedCarac.value
await this.update({ [`system.carac.${caracName}.value`]: to }); updates[`system.carac.${caracName}.value`] = to;
await this.update(updates);
await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName); await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName);
} }
@ -784,7 +788,7 @@ export class RdDActor extends RdDBaseActorSang {
const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories()); const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories());
this.notifyCompetencesTronc(competence, toNiveau); this.notifyCompetencesTronc(competence, toNiveau);
const fromNiveau = competence.system.niveau; const fromNiveau = competence.system.niveau;
await competence.update({ 'system.niveau': toNiveau }, { render: false }) await competence.update({ 'system.niveau': toNiveau }, { render: true })
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true); await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
} }
} }