From be1ad028a7f11cd751271a53dd59e662adbc7af5 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Fri, 28 May 2021 08:28:14 +0200 Subject: [PATCH] Fix TMR up/down --- module/actor.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/module/actor.js b/module/actor.js index fa4ae020..5dea3ff1 100644 --- a/module/actor.js +++ b/module/actor.js @@ -793,6 +793,8 @@ export class RdDActor extends Actor { await this.update({ [`data.carac.${caracName}.xp`]: caracXP ?? 0 }); this.checkCaracXP(caracName); } + + /* -------------------------------------------- */ async updateCaracXPAuto(caracName) { if (caracName == 'Taille') { return; @@ -809,8 +811,11 @@ export class RdDActor extends Actor { carac.xp = xp; carac.value = value; await this.update({ [`data.carac.${caracName}`]: carac }); + this.updateExperienceLog("Carac +", xp, caracName + " passée à " + value); } } + + /* -------------------------------------------- */ async updateCompetenceXPAuto(compName) { let competence = this.getCompetence(compName); if (competence) { @@ -825,6 +830,7 @@ export class RdDActor extends Actor { "data.xp": xp, "data.niveau": niveau, }); + this.updateExperienceLog("Compétence +", xp, compName + " passée à " + niveau); } } @@ -1268,6 +1274,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async ajouterSouffle(options = { chat: false }) { let souffle = await RdDRollTables.getSouffle(); + souffle._id = undefined; //TBC await this.createEmbeddedDocuments('Item', [souffle]); if (options.chat) { ChatMessage.create({ @@ -3970,13 +3977,13 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async addStatusEffect(statusEffect) { const effet = Misc.data(statusEffect); - //await this.deleteStatusEffectById(effet.id); - //effet.flags = effet.flags ?? { core: {} }; - //effet.flags.core.statusId = effet.id; + await this.deleteStatusEffectById(effet.id); + effet.flags = effet.flags ?? { core: {} }; + effet.flags.core.statusId = effet.id; let effectArray = await this.createEmbeddedDocuments('ActiveEffect', [effet]); - if (effectArray[0]) { - await effectArray[0].setFlag('core', 'statusId', effet.id); - } + //if (effectArray[0]) { + //await effectArray[0].setFlag('core', 'statusId', effet.id); + //} } /* -------------------------------------------- */