Gestion des signes draconiques #455

Closed
vincent.vandeme wants to merge 233 commits from v1.4-signes-draconiques into master
Showing only changes of commit 3e5e745067 - Show all commits

View File

@ -1,7 +1,7 @@
import { Misc } from "./misc.js";
import { RdDUtility } from "./rdd-utility.js";
const typesObjetsEquipement = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson"];
const typesObjetsEquipement = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"];
const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"];
/* -------------------------------------------- */
export class RdDItem extends Item {
@ -15,15 +15,19 @@ export class RdDItem extends Item {
prepareDerivedData() {
super.prepareDerivedData();
const itemData = this.data;
const tplData = itemData.data;
if (RdDItem.getTypeObjetsEquipement().includes(itemData.type)) {
const quantite = itemData.type == 'conteneur' ? 1 : (tplData.quantite ?? 0);
if (tplData.encombrement != undefined) {
tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite;
}
if (tplData.cout != undefined) {
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
}
this._calculsEquipement(itemData);
}
}
_calculsEquipement(itemData) {
const tplData = itemData.data;
const quantite = itemData.type == 'conteneur' ? 1 : (tplData.quantite ?? 0);
if (tplData.encombrement != undefined) {
tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite;
}
if (tplData.cout != undefined) {
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
}
}