Les services sont inquantifiables

Ne pas décrémenter leur quantité, et leur quantite disponible est
undefined (ie: infinie)
This commit is contained in:
Vincent Vandemeulebrouck
2023-01-03 13:38:04 +01:00
parent 5bddc548de
commit 2e0abaa284
3 changed files with 15 additions and 10 deletions

View File

@ -2,7 +2,7 @@ import { Misc } from "../misc.js";
import { RdDBaseActor } from "./base-actor.js";
export class RdDCommerce extends RdDBaseActor {
static get defaultIcon() {
return "systems/foundryvtt-reve-de-dragon/icons/services/commerce.webp";
}
@ -15,16 +15,16 @@ export class RdDCommerce extends RdDBaseActor {
}
canReceive(item) {
if (item.isInventaire('all')) {
if (item.isInventaire('all')) {
return true;
}
return super.canReceive(item);
}
getQuantiteDisponible(item) {
return this.system.illimite ? undefined : item.getQuantite();
return this.system.illimite || item.isService() ? undefined : item.getQuantite();
}
verifierFortune(cout) {
return this.system.illimite || super.verifierFortune(cout);
}
@ -43,11 +43,11 @@ export class RdDCommerce extends RdDBaseActor {
if (this.system.illimite) {
return;
}
await super.decrementerQuantiteItem(itemVendu, quantite, {supprimerSiZero: false});
await super.decrementerQuantiteItem(itemVendu, quantite, { supprimerSiZero: false });
}
calculerPrix(item) {
const pourcentage = this.system.pourcentage ?? 100;
return Misc.keepDecimals(Math.ceil(item.system.cout * pourcentage)/100, 2);
return Misc.keepDecimals(Math.ceil(item.system.cout * pourcentage) / 100, 2);
}
}