feat(cd): journal enrichi avec stress, perte enchantements, moral

This commit is contained in:
fabres
2026-07-22 00:29:56 +02:00
parent 8e748a1d94
commit 8c9c8f3345
+11 -4
View File
@@ -244,7 +244,7 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async $perteReveEnchantementsChateauDormants() {
async $perteReveEnchantementsChateauDormants(message = undefined) {
const toUpdate = this.items.filter(it => [ITEM_TYPES.potion, ITEM_TYPES.gemme].includes(it.type))
.map(it => it.perteReveChateauDormant())
.filter(it => it != undefined)
@@ -257,6 +257,9 @@ export class RdDActor extends RdDBaseActorSang {
whisper: ChatUtility.getOwners(this),
content: messageUpdates.reduce(Misc.joining('<br>'))
})
if (message) {
message.content += messageUpdates.reduce(Misc.joining(' ')) + ' '
}
await this.updateEmbeddedDocuments('Item', toUpdate.map(it => it.update));
}
}
@@ -370,11 +373,11 @@ export class RdDActor extends RdDBaseActorSang {
await this._recuperationSante(message)
await this._recupereMoralChateauDormant(message)
await this._recupereChance()
await this.transformerStress()
await this.transformerStress(message)
await this.retourSeuilDeReve(message)
await this.setBonusPotionSoin(0)
await this.retourSust(message)
await this.$perteReveEnchantementsChateauDormants()
await this.$perteReveEnchantementsChateauDormants(message)
await this.$suppressionLancementsSort()
await RdDCoeur.applyCoeurChateauDormant(this, message)
if (message.content != "") {
@@ -1555,7 +1558,7 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async transformerStress() {
async transformerStress(message = undefined) {
if (!ReglesOptionnelles.isUsing("transformation-stress")) { return }
const fromStress = Number(this.system.compteurs.stress.value);
if (this.system.sommeil?.insomnie || fromStress <= 0) {
@@ -1589,6 +1592,10 @@ export class RdDActor extends RdDBaseActorSang {
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-transformer-stress.hbs`, stressRollData)
});
if (message) {
message.content += `Transformation de ${stressRollData.stress} points de stress : perte de ${stressRollData.perte}, conversion de ${stressRollData.convertis} en expérience. `
}
const toStress = Math.max(fromStress - stressRollData.perte - 1, 0);
const fromXpSress = Number(this.system.compteurs.experience.value);
const toXpStress = fromXpSress + Number(stressRollData.xp);