Possibilité d'accorder un personnage

Le drag&drop d'un acteur depuis la liste des acteurs sur la fiche
d'une entité incarnée permet d'accorder le personnage
This commit is contained in:
2024-08-31 00:21:24 +02:00
parent b9e8c24461
commit ba8276ef37
5 changed files with 16 additions and 35 deletions

View File

@ -67,7 +67,7 @@ export class RdDEntite extends RdDBaseActorReve {
if (this.isNonIncarnee()) {
return
}
await RdDEncaisser.encaisser(this)
await RdDEncaisser.encaisser(this)
}
isEffectAllowed(effectId) {
@ -91,20 +91,16 @@ export class RdDEntite extends RdDBaseActorReve {
}
/* -------------------------------------------- */
async setEntiteReveAccordee(attacker) {
async setEntiteReveAccordee(actor) {
if (this.isEntite([ENTITE_INCARNE])) {
let resonnance = foundry.utils.duplicate(this.system.sante.resonnance);
if (resonnance.actors.find(it => it == attacker.id)) {
if (this.system.sante.resonnance.actors.find(it => it == actor.id)) {
// déjà accordé
return;
return
}
resonnance.actors.push(attacker.id);
await this.update({ "system.sante.resonnance": resonnance });
await this.update({ "system.sante.resonnance.actors": [...this.system.sante.resonnance.actors, actor.id] })
}
else {
super.setEntiteReveAccordee(attacker)
super.setEntiteReveAccordee(actor)
}
}
}