Improve how capacity consumption calculations are performed

This commit is contained in:
Oliver-Akins 2024-03-20 17:56:41 -06:00
parent cf109a6ed1
commit aa5c6d5aba
6 changed files with 38 additions and 2 deletions

View file

@ -1 +1,12 @@
export class DotDungeonItem extends Item {};
export class DotDungeonItem extends Item {
get usedCapacity() {
let capacity = 0;
if (this.system.uses_inventory_slot && this.system.quantity > 0) {
capacity++;
};
if (this.system.quantity_affects_used_capacity) {
capacity *= this.system.quantity;
};
return capacity;
};
};

View file

@ -0,0 +1,9 @@
import { DotDungeonItem } from "./GenericItem.mjs";
export class Material extends DotDungeonItem {
get usedCapacity() {
let affects = game.settings.get(`dotdungeon`, `materialsAffectCapacity`);
console.log(`materialsAffectCapacity =`, affects)
return affects ? super.usedCapacity : 0;
};
};

View file

@ -1,8 +1,10 @@
import { DotDungeonItem } from "./GenericItem.mjs";
import { Aspect } from "./Aspect.mjs";
import { Material } from "./Material.mjs";
const classes = {
aspect: Aspect,
material: Material,
};
const defaultClass = DotDungeonItem;