fixes #620
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user