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 });
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);
//}
}
/* -------------------------------------------- */