Fix and +/-

This commit is contained in:
LeRatierBretonnien 2023-03-18 13:51:46 +01:00
parent 83d3f17dd0
commit ba7e25e8c7
4 changed files with 19 additions and 4 deletions

View File

@ -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) => {

View File

@ -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

View File

@ -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",

View File

@ -50,6 +50,10 @@
<div class="resource stat flex1 flex-group-center">
<label class="stat-label">{{localize label}}</label><br/>
<input class="stat-value resources-value" type="text" name="system.resources.{{key}}.value" value="{{numberFormat value decimals=0 sign=false}}" data-dtype="Number"/>
<a class="inc-dec-btns-resource" data-target="{{key}}" data-incr="-1"><i class="fas fa-minus-square"></i></a>&nbsp;
<a class="inc-dec-btns-resource" data-target="{{key}}" data-incr="1"><i class="fas fa-plus-square"></i></a>&nbsp;
{{#if (eq @root.charType 'player')}}
{{#if (exists bonus)}}
<span class="flexrow"><label class="stat-max bonus-text">Bonus</label><input class="resource-bonus resources-value" type="text" name="system.resources.{{key}}.bonus" value="{{numberFormat bonus decimals=0 sign=false}}" data-dtype="Number"/></span>