Merge branch 'main' into group-roll-dialog

This commit is contained in:
Carlos Fernandez 2026-04-24 15:14:51 -04:00
commit 2b5b01a3a7
7 changed files with 149 additions and 276 deletions

View file

@ -391,8 +391,9 @@ export default class DhCharacter extends DhCreature {
return this.domains.map(key => {
const domain = allDomainData[key];
return {
id: key,
...domain,
label: game.i18n.localize(domain.label)
label: game.i18n.localize(domain?.label) ?? key
};
});
}
@ -410,14 +411,11 @@ export default class DhCharacter extends DhCreature {
}
get loadoutSlot() {
const loadoutCount = this.domainCards.loadout?.length ?? 0,
worldSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout,
max = !worldSetting ? null : worldSetting + this.bonuses.maxLoadout;
const loadoutCount = this.domainCards.loadout?.length ?? 0;
const worldSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout;
return {
current: loadoutCount,
available: !max ? true : Math.max(max - loadoutCount, 0),
max
available: loadoutCount < worldSetting
};
}

View file

@ -18,7 +18,7 @@ export default class DhParty extends BaseDataActor {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
partyMembers: new ForeignDocumentUUIDArrayField({ type: 'Actor' }, { prune: true }),
partyMembers: new ForeignDocumentUUIDArrayField({ type: 'Actor' }),
notes: new fields.HTMLField(),
gold: new GoldField(),
tagTeam: new fields.EmbeddedDataField(TagTeamData),

View file

@ -10,6 +10,7 @@ export default class ForeignDocumentUUIDArrayField extends foundry.data.fields.A
*/
constructor(fieldOption = {}, options = {}, context = {}) {
super(new ForeignDocumentUUIDField(fieldOption), options, context);
this.options.prune ??= true;
}
/** @inheritdoc */

View file

@ -19,7 +19,7 @@ export default class DHScene extends foundry.abstract.DataModel {
close: new fields.NumberField({ integer: true, label: 'DAGGERHEART.CONFIG.Range.close.name' }),
far: new fields.NumberField({ integer: true, label: 'DAGGERHEART.CONFIG.Range.far.name' })
}),
sceneEnvironments: new ForeignDocumentUUIDArrayField({ type: 'Actor', prune: true })
sceneEnvironments: new ForeignDocumentUUIDArrayField({ type: 'Actor' })
};
}
}

View file

@ -54,7 +54,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
maxDomains: new fields.NumberField({
required: true,
integer: true,
min: 1,
min: 0,
initial: 2,
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxDomains.label'
}),
@ -196,6 +196,12 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
return source;
}
_initialize(options) {
super._initialize(options);
this.maxDomains ||= Infinity;
this.maxLoadout ||= Infinity;
}
/** Invoked by the setting when data changes */
handleChange() {
if (this.maxFear) {