mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-05 20:34:15 +02:00
[Fix] class domains when setting max domains to null or 0 (#1832)
* Fix class domains when setting max domains to null or 0 * Convert max loadout to use data prep
This commit is contained in:
parent
da11510e02
commit
84afec31a7
2 changed files with 10 additions and 7 deletions
|
|
@ -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
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
maxDomains: new fields.NumberField({
|
maxDomains: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
integer: true,
|
integer: true,
|
||||||
min: 1,
|
min: 0,
|
||||||
initial: 2,
|
initial: 2,
|
||||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxDomains.label'
|
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxDomains.label'
|
||||||
}),
|
}),
|
||||||
|
|
@ -196,6 +196,12 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_initialize(options) {
|
||||||
|
super._initialize(options);
|
||||||
|
this.maxDomains ||= Infinity;
|
||||||
|
this.maxLoadout ||= Infinity;
|
||||||
|
}
|
||||||
|
|
||||||
/** Invoked by the setting when data changes */
|
/** Invoked by the setting when data changes */
|
||||||
handleChange() {
|
handleChange() {
|
||||||
if (this.maxFear) {
|
if (this.maxFear) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue