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"); const li = $(ev.currentTarget).parents(".item");
this.actor.spendAlchemyPoint(li.data("itemId"), 1) 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 // Incr./Decr. career ranks
html.find(".inc-dec-btns").click((ev) => { html.find(".inc-dec-btns").click((ev) => {

View File

@ -761,7 +761,7 @@ export class BoLActor extends Actor {
async displayRecuperation() { async displayRecuperation() {
let previousHP = this.getFlag("world", "vitalite-before-combat") let previousHP = this.getFlag("world", "vitalite-before-combat")
let lossHP = previousHP.value - this.system.resources.hp.value 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) { if (previousHP && lossHP > 0 && this.system.resources.hp.value > 0) {
let msg = await ChatMessage.create({ let msg = await ChatMessage.create({
alias: this.name, alias: this.name,
@ -770,7 +770,7 @@ export class BoLActor extends Actor {
name: this.name, name: this.name,
actorId: this.id, actorId: this.id,
lossHP: lossHP, 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 }); 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) { async sufferDamage(damage) {
let newHP = this.system.resources.hp.value - damage let newHP = this.system.resources.hp.value - damage

View File

@ -14,7 +14,7 @@
], ],
"url": "https://www.uberwald.me/gitea/public/bol", "url": "https://www.uberwald.me/gitea/public/bol",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"version": "10.5.9", "version": "10.5.10",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "10" "verified": "10"
@ -202,7 +202,7 @@
], ],
"socket": true, "socket": true,
"manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json", "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", "background": "systems/bol/ui/page_accueil.webp",
"gridDistance": 1.5, "gridDistance": 1.5,
"gridUnits": "m", "gridUnits": "m",

View File

@ -50,6 +50,10 @@
<div class="resource stat flex1 flex-group-center"> <div class="resource stat flex1 flex-group-center">
<label class="stat-label">{{localize label}}</label><br/> <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"/> <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 (eq @root.charType 'player')}}
{{#if (exists bonus)}} {{#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> <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>