Fix TMR up/down

This commit is contained in:
sladecraven 2021-05-28 08:28:14 +02:00
parent e0aa4ed896
commit be1ad028a7

View File

@ -793,6 +793,8 @@ export class RdDActor extends Actor {
await this.update({ [`data.carac.${caracName}.xp`]: caracXP ?? 0 }); await this.update({ [`data.carac.${caracName}.xp`]: caracXP ?? 0 });
this.checkCaracXP(caracName); this.checkCaracXP(caracName);
} }
/* -------------------------------------------- */
async updateCaracXPAuto(caracName) { async updateCaracXPAuto(caracName) {
if (caracName == 'Taille') { if (caracName == 'Taille') {
return; return;
@ -809,8 +811,11 @@ export class RdDActor extends Actor {
carac.xp = xp; carac.xp = xp;
carac.value = value; carac.value = value;
await this.update({ [`data.carac.${caracName}`]: carac }); await this.update({ [`data.carac.${caracName}`]: carac });
this.updateExperienceLog("Carac +", xp, caracName + " passée à " + value);
} }
} }
/* -------------------------------------------- */
async updateCompetenceXPAuto(compName) { async updateCompetenceXPAuto(compName) {
let competence = this.getCompetence(compName); let competence = this.getCompetence(compName);
if (competence) { if (competence) {
@ -825,6 +830,7 @@ export class RdDActor extends Actor {
"data.xp": xp, "data.xp": xp,
"data.niveau": niveau, "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 }) { async ajouterSouffle(options = { chat: false }) {
let souffle = await RdDRollTables.getSouffle(); let souffle = await RdDRollTables.getSouffle();
souffle._id = undefined; //TBC
await this.createEmbeddedDocuments('Item', [souffle]); await this.createEmbeddedDocuments('Item', [souffle]);
if (options.chat) { if (options.chat) {
ChatMessage.create({ ChatMessage.create({
@ -3970,13 +3977,13 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async addStatusEffect(statusEffect) { async addStatusEffect(statusEffect) {
const effet = Misc.data(statusEffect); const effet = Misc.data(statusEffect);
//await this.deleteStatusEffectById(effet.id); await this.deleteStatusEffectById(effet.id);
//effet.flags = effet.flags ?? { core: {} }; effet.flags = effet.flags ?? { core: {} };
//effet.flags.core.statusId = effet.id; effet.flags.core.statusId = effet.id;
let effectArray = await this.createEmbeddedDocuments('ActiveEffect', [effet]); let effectArray = await this.createEmbeddedDocuments('ActiveEffect', [effet]);
if (effectArray[0]) { //if (effectArray[0]) {
await effectArray[0].setFlag('core', 'statusId', effet.id); //await effectArray[0].setFlag('core', 'statusId', effet.id);
} //}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */