Fix accorder entite de cauchemar

A priori vieille régression, pas vue depuis.

attaquant._id est devenu attaquant.id
This commit is contained in:
Vincent Vandemeulebrouck 2022-07-22 00:31:27 +02:00
parent c3c42bdb21
commit 16ce6a58dd

View File

@ -98,7 +98,6 @@ export class RdDActor extends Actor {
* @param {Object} options (Unused) Additional options which customize the creation workflow.
*
*/
static async create(actorData, options) {
// Case of compendium global import
if (actorData instanceof Array) {
@ -135,13 +134,6 @@ export class RdDActor extends Actor {
this.encTotal = 0;
this.prixTotalEquipement = 0;
/*
// Auto-resize token
if (this.isToken) {
let tokenSize = actorData.data.carac.taille.value/10;
this.token.update({height: tokenSize, width: tokenSize } );
}*/
// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
if (actorData.type === 'personnage') this._prepareCharacterData(actorData);
@ -3593,7 +3585,7 @@ export class RdDActor extends Actor {
isEntiteCauchemarAccordee(attaquant) {
if (!this.isEntiteCauchemar()) { return true; }
let resonnance = Misc.templateData(this).sante.resonnance;
return (resonnance.actors.find(it => it == attaquant._id));
return (resonnance.actors.find(it => it == attaquant.id));
}
/* -------------------------------------------- */
@ -3603,11 +3595,11 @@ export class RdDActor extends Actor {
return;
}
let resonnance = duplicate(Misc.templateData(this).sante.resonnance);
if (resonnance.actors.find(it => it == attaquant._id)) {
if (resonnance.actors.find(it => it == attaquant.id)) {
// déjà accordé
return;
}
resonnance.actors.push(attaquant._id);
resonnance.actors.push(attaquant.id);
await this.update({ "data.sante.resonnance": resonnance });
return;
}