From ba7e25e8c7a3001f9d419f783c2a1c7ca04a2a8b Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Sat, 18 Mar 2023 13:51:46 +0100 Subject: [PATCH] Fix and +/- --- module/actor/actor-sheet.js | 6 ++++++ module/actor/actor.js | 9 +++++++-- system.json | 4 ++-- templates/actor/parts/tabs/actor-stats.hbs | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 7360b54..b188998 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -60,6 +60,12 @@ export class BoLActorSheet extends ActorSheet { const li = $(ev.currentTarget).parents(".item"); this.actor.spendAlchemyPoint(li.data("itemId"), 1) }) + html.find(".inc-dec-btns-resource").click((ev) => { + const dataset = ev.currentTarget.dataset; + const target = dataset.target + const incr = parseInt(dataset.incr) + this.actor.incDecResources(target, incr) + }) // Incr./Decr. career ranks html.find(".inc-dec-btns").click((ev) => { diff --git a/module/actor/actor.js b/module/actor/actor.js index 79bfa83..cdcb25d 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -761,7 +761,7 @@ export class BoLActor extends Actor { async displayRecuperation() { let previousHP = this.getFlag("world", "vitalite-before-combat") let lossHP = previousHP.value - this.system.resources.hp.value - console.log(">>>>> RECUP INFO", previousHP, this.system.resources.hp.value) + //console.log(">>>>> RECUP INFO", previousHP, this.system.resources.hp.value) if (previousHP && lossHP > 0 && this.system.resources.hp.value > 0) { let msg = await ChatMessage.create({ alias: this.name, @@ -770,7 +770,7 @@ export class BoLActor extends Actor { name: this.name, actorId: this.id, lossHP: lossHP, - recupHP: Math.floor(lossHP / 2) + recupHP: Math.ceil(lossHP / 2) }) }) } @@ -861,6 +861,11 @@ export class BoLActor extends Actor { await this.update({ 'system.resources.hero.value': newHeroP }); } + /*-------------------------------------------- */ + incDecResources(target, value) { + let newValue = this.system.resources[target].value + value + this.update({ [`system.resources.${target}.value`]: newValue }) + } /*-------------------------------------------- */ async sufferDamage(damage) { let newHP = this.system.resources.hp.value - damage diff --git a/system.json b/system.json index 2cd653b..c4ad482 100644 --- a/system.json +++ b/system.json @@ -14,7 +14,7 @@ ], "url": "https://www.uberwald.me/gitea/public/bol", "license": "LICENSE.txt", - "version": "10.5.9", + "version": "10.5.10", "compatibility": { "minimum": "10", "verified": "10" @@ -202,7 +202,7 @@ ], "socket": true, "manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json", - "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.5.9.zip", + "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.5.10.zip", "background": "systems/bol/ui/page_accueil.webp", "gridDistance": 1.5, "gridUnits": "m", diff --git a/templates/actor/parts/tabs/actor-stats.hbs b/templates/actor/parts/tabs/actor-stats.hbs index 5ee9b1d..fd05479 100644 --- a/templates/actor/parts/tabs/actor-stats.hbs +++ b/templates/actor/parts/tabs/actor-stats.hbs @@ -50,6 +50,10 @@

+ +   +   + {{#if (eq @root.charType 'player')}} {{#if (exists bonus)}}