From ec6a1b23bc33cc7f4b8b5a20579a4828320c1c25 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Fri, 18 Feb 2022 22:15:46 +0100 Subject: [PATCH] Ehance rols --- module/actor/actor.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/module/actor/actor.js b/module/actor/actor.js index fd9eff6..60627e0 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -1,4 +1,5 @@ import { BoLDefaultRoll } from "../controllers/bol-rolls.js"; +import { BoLUtility } from "../system/bol-utility.js"; /** * Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system. @@ -310,9 +311,14 @@ export class BoLActor extends Actor { } /*-------------------------------------------- */ - manageHealthState() { - if (this.data.data.resources.hp.value == 0 ) { - // TODO : Message pour depense heroisme + async manageHealthState() { + if (this.data.data.resources.hp.value <= 0 && this.data.lastHP != this.data.data.resources.hp.value) { + this.data.lastHP = this.data.data.resources.hp.value + ChatMessage.create({ + alias: this.name, + whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name), + content: await renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, hp: this.data.lastHP} ) + }) } }