Fix ActiveEffect demi-rêve
L'ActiveEffect demi-rêve n'était plus supprimé
This commit is contained in:
parent
3735377a20
commit
049b46e3cc
@ -3063,7 +3063,8 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
enleverTousLesEffets() {
|
enleverTousLesEffets() {
|
||||||
this.deleteEmbeddedEntity('ActiveEffect', Array.from(this.effects?.keys() ?? []));
|
const ids = Array.from(this.effects?.keys() ?? []);
|
||||||
|
this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -3102,41 +3103,37 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
deleteStatusEffectById(id, options = { renderSheet: true }) {
|
deleteStatusEffectById(id) {
|
||||||
const effects = Array.from(this.effects?.values())
|
const effects = Array.from(this.effects?.values())
|
||||||
.filter(it => it.data.flags.core?.statusId == id);
|
.filter(it => it.data.flags.core?.statusId == id);
|
||||||
this._deleteStatusEffects(effects, options);
|
this._deleteStatusEffects(effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
deleteStatusEffect(effect, options = { renderSheet: true }) {
|
deleteStatusEffect(effect) {
|
||||||
const toDelete = Array.from(this.effects?.values())
|
const toDelete = Array.from(this.effects?.values())
|
||||||
.filter(it => StatusEffects.statusId(it.data) == StatusEffects.statusId(effect));
|
.filter(it => StatusEffects.statusId(it.data) == StatusEffects.statusId(effect));
|
||||||
this._deleteStatusEffects(toDelete, options);
|
this._deleteStatusEffects(toDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_deleteStatusEffects(effects, options) {
|
_deleteStatusEffects(effects) {
|
||||||
this._deleteStatusEffectsByIds(effects.map(it => it.id), options);
|
const ids = effects.map(it => it.id);
|
||||||
|
this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_deleteStatusEffectsByIds(effectIds, options) {
|
async addStatusEffectById(id) {
|
||||||
this.deleteEmbeddedDocuments('ActiveEffect', [effectIds], options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async addStatusEffectById(id, options = { renderSheet: false }) {
|
|
||||||
const statusEffect = CONFIG.statusEffects.find(it => it.id == id);
|
const statusEffect = CONFIG.statusEffects.find(it => it.id == id);
|
||||||
await this.addStatusEffect(statusEffect, options);
|
await this.addStatusEffect(statusEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async addStatusEffect(statusEffect, options = { renderSheet: false }) {
|
async addStatusEffect(statusEffect) {
|
||||||
this.deleteStatusEffectById(statusEffect.id, options);
|
this.deleteStatusEffectById(statusEffect.id);
|
||||||
const effet = duplicate(statusEffect);
|
const effet = duplicate(statusEffect);
|
||||||
effet["flags.core.statusId"] = effet.id;
|
effet["flags.core.statusId"] = effet.id;
|
||||||
await this.createEmbeddedEntity('ActiveEffect', effet, options);
|
await this.createEmbeddedDocuments('ActiveEffect', [effet]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user