diff --git a/module/actor.js b/module/actor.js index 3ff85b7a..8d335b59 100644 --- a/module/actor.js +++ b/module/actor.js @@ -3589,17 +3589,17 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async accorder(entite, when = 'avant-encaissement') { if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar") + || entite == undefined || !entite.isEntite([ENTITE_INCARNE]) || entite.isEntiteAccordee(this)) { return true; } - const tplData = this.system; - let rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(entite.system.carac.niveau.value)); + const rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(entite.system.carac.niveau.value)); const rollData = { alias: this.name, rolled: rolled, entite: entite.name, - selectedCarac: tplData.carac.reve + selectedCarac: this.system.carac.reve }; if (rolled.isSuccess) { diff --git a/module/rdd-combat.js b/module/rdd-combat.js index c5579338..9dd406f2 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -767,7 +767,7 @@ export class RdDCombat { // whisper: ChatMessage.getWhisperRecipients("GM")}) // } - if (!await this.accorderEntite('avant-attaque')) { + if (!await this.attacker.accorder(this.defender, 'avant-attaque')) { return; } if (arme.system.cac == 'empoignade' && this.attacker.isCombatTouche()) { @@ -886,7 +886,7 @@ export class RdDCombat { } await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html'); - if (!await this.accorderEntite('avant-defense')) { + if (!await this.attacker.accorder(this.defender, 'avant-defense')) { return; } @@ -1319,35 +1319,6 @@ export class RdDCombat { this.removeChatMessageActionsPasseArme(attackerRoll.passeArme); } - /* -------------------------------------------- */ - /* retourne true si on peut continuer, false si on ne peut pas continuer */ - async accorderEntite(when = 'avant-encaissement') { - if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar") - || this.defender == undefined - || !this.defender.isEntite([ENTITE_INCARNE]) - || this.defender.isEntiteAccordee(this.attacker)) { - return true; - } - - let rolled = await RdDResolutionTable.roll(this.attacker.getReveActuel(), - Number(this.defender.system.carac.niveau.value)); - - let message = { - content: "Jet de points actuels de rêve à " + rolled.finalLevel + RdDResolutionTable.explain(rolled) + "
", - whisper: ChatMessage.getWhisperRecipients(this.attacker.name) - }; - - if (rolled.isSuccess) { - await this.defender.setEntiteReveAccordee(this.attacker); - message.content += this.attacker.name + " s'est accordé avec " + this.defender.name; - } - else { - message.content += this.attacker.name + " n'est pas accordé avec " + this.defender.name; - } - - ChatMessage.create(message); - return rolled.isSuccess; - } - /* -------------------------------------------- */ static async displayActorCombatStatus(combat, actor) { let formData = {