From dc48f08203a4d93a6d56597a35202792a9398cb8 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 4 Apr 2021 23:07:13 +0200 Subject: [PATCH] #171 - Gestion potion de soins (WIP) --- module/actor.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/module/actor.js b/module/actor.js index 7e93497d..3b85a032 100644 --- a/module/actor.js +++ b/module/actor.js @@ -348,6 +348,7 @@ export class RdDActor extends Actor { await this._recupereChance(); await this.transformerStress(); await this.retourSeuilDeReve(message); + this.bonusRecuperationPotion= 0; // Reset potion message.content = `A la fin Chateau Dormant, ${message.content}
Un nouveau jour se lève`; ChatMessage.create(message); } @@ -363,12 +364,13 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async _recupererBlessures(message, type, liste, moindres) { + if (!this.bonusRecuperationPotion) this.bonusRecuperationPotion = 0; let count = 0; const definitions = RdDUtility.getDefinitionsBlessures(); let definition = definitions.find(d => d.type == type); for (let blessure of liste) { if (blessure.jours >= definition.facteur) { - let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets), message); + let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets)+this.bonusRecuperationPotion, message); blessure.soins_complets = 0; if (rolled.isSuccess && this._retrograderBlessure(type, blessure, moindres)) { message.content += ` -- une blessure ${type} cicatrise`; @@ -3085,6 +3087,7 @@ export class RdDActor extends Actor { let pvManquants = myData.sante.vie.max - myData.sante.vie.value; let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2 )); + pointsGuerison -= pvSoignees*2; guerisonData.list.push( pvSoignees + " Points de Vie soignés"); await this.santeIncDec('vie', +pvSoignees, false); guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison; @@ -3094,9 +3097,10 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async consommerPotionSoin(potionData) { + potionData.alias = this.name; + if (potionData.data.categorie.includes('Enchante')) { potionData.pointsGuerison = RdDHerbes.calculePointsGuerison( potionData.data); - potionData.alias = this.name; potionData.enchanteTexte = "enchantée"; potionData.isEnchante = true; ChatMessage.create({ @@ -3122,7 +3126,13 @@ export class RdDActor extends Actor { }); } } else { - + potionData.enchanteTexte = ""; + potionData.isEnchante = false; + ChatMessage.create({ + whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name), + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-appliquer-potion-soin.html`, potionData ) + }); + this.bonusRecuperationPotion = potionData.data.herbeBonus; } }