forked from public/foundryvtt-reve-de-dragon
Fix: deprecation effects flags.core.statusId
Remplacement de la logique basée sur les flags par le set de "statuses"
This commit is contained in:
@ -180,32 +180,32 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
isEffectAllowed(statusId) { return true }
|
||||
isEffectAllowed(effectId) { return true }
|
||||
|
||||
getEffects(filter = e => true) {
|
||||
return this.getEmbeddedCollection("ActiveEffect").filter(filter);
|
||||
}
|
||||
|
||||
getEffect(statusId) {
|
||||
return this.getEmbeddedCollection("ActiveEffect").find(it => it.flags?.core?.statusId == statusId);
|
||||
getEffect(effectId) {
|
||||
return this.getEmbeddedCollection("ActiveEffect").find(it => it.statuses?.has(effectId));
|
||||
}
|
||||
|
||||
async setEffect(statusId, status) {
|
||||
if (this.isEffectAllowed(statusId)) {
|
||||
const effect = this.getEffect(statusId);
|
||||
|
||||
async setEffect(effectId, status) {
|
||||
if (this.isEffectAllowed(effectId)) {
|
||||
const effect = this.getEffect(effectId);
|
||||
if (!status && effect) {
|
||||
await this.deleteEmbeddedDocuments('ActiveEffect', [effect.id]);
|
||||
}
|
||||
if (status && !effect) {
|
||||
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.status(statusId)]);
|
||||
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.prepareActiveEffect(effectId)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async removeEffect(statusId) {
|
||||
const effect = this.getEffect(statusId);
|
||||
|
||||
async removeEffect(id) {
|
||||
const effect = this.getEmbeddedCollection("ActiveEffect").find(it => it.id == id);
|
||||
if (effect) {
|
||||
await this.deleteEmbeddedDocuments('ActiveEffect', [effect.id]);
|
||||
await this.deleteEmbeddedDocuments('ActiveEffect', [id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ export class RdDCreature extends RdDBaseActorSang {
|
||||
}
|
||||
}
|
||||
|
||||
isEffectAllowed(statusId) {
|
||||
return [STATUSES.StatusComma].includes(statusId);
|
||||
isEffectAllowed(effectId) {
|
||||
return [STATUSES.StatusComma].includes(effectId);
|
||||
}
|
||||
|
||||
isEntiteAccordee(attacker) {
|
||||
|
@ -70,8 +70,8 @@ export class RdDEntite extends RdDBaseActorReve {
|
||||
await RdDEncaisser.encaisser(this)
|
||||
}
|
||||
|
||||
isEffectAllowed(statusId) {
|
||||
return [STATUSES.StatusComma].includes(statusId);
|
||||
isEffectAllowed(effectId) {
|
||||
return [STATUSES.StatusComma].includes(effectId);
|
||||
}
|
||||
|
||||
async onAppliquerJetEncaissement(encaissement, attacker) {
|
||||
|
Reference in New Issue
Block a user