diff --git a/module/actor-entite-sheet.js b/module/actor-entite-sheet.js index 789a2bb9..ea5a1e23 100644 --- a/module/actor-entite-sheet.js +++ b/module/actor-entite-sheet.js @@ -1,11 +1,9 @@ - /** * Extend the basic ActorSheet with some very simple modifications * @extends {ActorSheet} */ import { HtmlUtility } from "./html-utility.js"; -import { RdDUtility } from "./rdd-utility.js"; /* -------------------------------------------- */ export class RdDActorEntiteSheet extends ActorSheet { @@ -55,7 +53,7 @@ export class RdDActorEntiteSheet extends ActorSheet { /** @override */ activateListeners(html) { super.activateListeners(html); - + HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM); // Everything below here is only needed if the sheet is editable @@ -119,7 +117,6 @@ export class RdDActorEntiteSheet extends ActorSheet { this.actor.remiseANeuf(); } }); - } diff --git a/module/actor-humanoide-sheet.js b/module/actor-humanoide-sheet.js index aee867bd..3a9c9679 100644 --- a/module/actor-humanoide-sheet.js +++ b/module/actor-humanoide-sheet.js @@ -1,12 +1,12 @@ - /** * Extend the basic ActorSheet with some very simple modifications * @extends {ActorSheet} - */ + */ +import { HtmlUtility } from "./html-utility.js"; import { RdDUtility } from "./rdd-utility.js"; -/* -------------------------------------------- */ +/* -------------------------------------------- */ export class RdDActorHumanoideSheet extends ActorSheet { /** @override */ @@ -64,7 +64,9 @@ export class RdDActorHumanoideSheet extends ActorSheet { /** @override */ activateListeners(html) { super.activateListeners(html); - + + HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM); + // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; @@ -147,6 +149,16 @@ export class RdDActorHumanoideSheet extends ActorSheet { this.actor.santeIncDec("endurance", -1); this.render(true); }); + + html.find('#encaisser-direct').click(ev => { + this.actor.encaisser() + }); + + html.find('#remise-a-neuf').click(ev => { + if (game.user.isGM) { + this.actor.remiseANeuf(); + } + }); } diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 2d758c19..2c8d182c 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -130,7 +130,7 @@ export class RdDActorSheet extends ActorSheet { return data; } - + /* -------------------------------------------- */ async _onDrop(event) { await RdDUtility.processItemDropEvent(this, event); diff --git a/module/actor.js b/module/actor.js index e2a7dfda..80c7fe3e 100644 --- a/module/actor.js +++ b/module/actor.js @@ -309,7 +309,11 @@ export class RdDActor extends Actor { whisper: ChatUtility.getWhisperRecipientsAndGMs( this.name ), content : "Remise à neuf de " + this.name }; - if (!this.isEntiteCauchemar()) { + if (this.isEntiteCauchemar()) { + await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value); + } + else { + if (this.data.data.blessures){ const blessures = duplicate(this.data.data.blessures); for (let listeBlessures of [blessures.legeres.liste, blessures.graves.liste, blessures.critiques.liste]) { @@ -322,9 +326,7 @@ export class RdDActor extends Actor { await this.update({ "data.compteurs.ethylisme.value": 0 }); await this.update({ "data.compteurs.ethylisme.nb_doses": 0 }); await this.santeIncDec("vie", this.data.data.sante.vie.max - this.data.data.sante.vie.value); - } - await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value); - if (!this.isEntiteCauchemar()) { + await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value); if (this.data.data.sante.fatigue){ let fatigue = duplicate(this.data.data.sante.fatigue) fatigue.value = 0; @@ -1760,6 +1762,13 @@ export class RdDActor extends Actor { new RdDEncaisser(html, this ).render(true); } + /* -------------------------------------------- */ + async encaisser( ) { + let data = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() }; + let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data ); + new RdDEncaisser(html, this).render(true); + } + /* -------------------------------------------- */ async encaisserDommages( attackerRoll, attacker = undefined ) { if (attacker && !await attacker.accorder(this, 'avant-encaissement')) { diff --git a/templates/actor-humanoide-sheet.html b/templates/actor-humanoide-sheet.html index 137f9936..40e946cc 100644 --- a/templates/actor-humanoide-sheet.html +++ b/templates/actor-humanoide-sheet.html @@ -4,7 +4,15 @@
-

+
+

+
+
+
+ Encaisser des dommages + Remise à neuf +
+
{{data.blessures.resume}}