fixes #620

Merged
uberwald merged 3 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-02-02 08:55:24 +01:00
Showing only changes of commit ab4c118d12 - Show all commits

View File

@ -1722,16 +1722,17 @@ export class RdDActor extends RdDBaseActor {
async manger(item, doses, options = { diminuerQuantite: true }) {
const sust = item.system.sust
if (sust > 0) {
await this.updateCompteurValue('sust', Misc.keepDecimals(this.system.compteurs.sust.value + sust * doses, 1));
await this.updateCompteurValue('sust', RdDActor.$calculNewSust(this.system.compteurs.sust.value, sust, doses));
}
await item.diminuerQuantite(doses, options);
}
/* -------------------------------------------- */
async boire(item, doses, options = { diminuerQuantite: true }) {
const desaltere = item.system.desaltere;
if (desaltere > 0) {
await this.updateCompteurValue('eau', Misc.keepDecimals(this.system.compteurs.eau.value + desaltere * doses, 1));
await this.updateCompteurValue('eau', RdDActor.$calculNewSust(this.system.compteurs.eau.value, desaltere, doses));
}
if (item.isAlcool()) {
for (let i = 0; i < doses; i++) {
@ -1740,6 +1741,10 @@ export class RdDActor extends RdDBaseActor {
}
await item.diminuerQuantite(doses, options);
}
static $calculNewSust(value, sust, doses) {
return Misc.keepDecimals(Number(value) + Number(sust) * Number(doses), 1);
}
/* -------------------------------------------- */
async saouler(forceAlcool, alcool = undefined) {