Convert max loadout to use data prep

This commit is contained in:
Carlos Fernandez 2026-04-23 22:00:31 -04:00
parent 07f8eb8f09
commit b68697e4ae
2 changed files with 4 additions and 6 deletions

View file

@ -410,14 +410,11 @@ export default class DhCharacter extends DhCreature {
} }
get loadoutSlot() { get loadoutSlot() {
const loadoutCount = this.domainCards.loadout?.length ?? 0, const loadoutCount = this.domainCards.loadout?.length ?? 0;
worldSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout, const worldSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout;
max = !worldSetting ? null : worldSetting + this.bonuses.maxLoadout;
return { return {
current: loadoutCount, current: loadoutCount,
available: !max ? true : Math.max(max - loadoutCount, 0), available: loadoutCount < worldSetting
max
}; };
} }

View file

@ -199,6 +199,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
_initialize(options) { _initialize(options) {
super._initialize(options); super._initialize(options);
this.maxDomains ||= Infinity; this.maxDomains ||= Infinity;
this.maxLoadout ||= Infinity;
} }
/** Invoked by the setting when data changes */ /** Invoked by the setting when data changes */