Merge branch 'main' into feature/517-action-cost-on-success

This commit is contained in:
Dapoolp 2025-08-02 22:45:29 +02:00
commit 382c17a103
33 changed files with 109 additions and 146 deletions

View file

@ -144,7 +144,7 @@ export default class DhpAdversary extends BaseDataActor {
super._onUpdate(changes, options, userId);
if (game.user.id === userId) {
if (changes.system.type) {
if (changes.system?.type) {
const existingHordeEffect = this.parent.effects.find(x => x.type === 'horde');
if (changes.system.type === CONFIG.DH.ACTOR.adversaryTypes.horde.id) {
if (!existingHordeEffect)

View file

@ -362,13 +362,12 @@ export default class DhCharacter extends BaseDataActor {
get loadoutSlot() {
const loadoutCount = this.domainCards.loadout?.length ?? 0,
max =
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout +
this.bonuses.maxLoadout;
worldSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout,
max = !worldSetting ? null : worldSetting + this.bonuses.maxLoadout;
return {
current: loadoutCount,
available: Math.max(max - loadoutCount, 0),
available: !max ? true : Math.max(max - loadoutCount, 0),
max
};
}
@ -579,7 +578,7 @@ export default class DhCharacter extends BaseDataActor {
: this.levelData.level.current * 2
};
this.resources.hope.max -= Object.keys(this.scars).length;
this.resources.hitPoints.max = this.class.value?.system?.hitPoints ?? 0;
this.resources.hitPoints.max += this.class.value?.system?.hitPoints ?? 0;
}
prepareDerivedData() {

View file

@ -19,7 +19,7 @@ export default class DHClass extends BaseDataItem {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
domains: new fields.ArrayField(new fields.StringField(), { max: 2 }),
domains: new fields.ArrayField(new fields.StringField()),
classItems: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false }),
hitPoints: new fields.NumberField({
required: true,
@ -123,6 +123,14 @@ export default class DHClass extends BaseDataItem {
const allowed = await super._preUpdate(changed, options, userId);
if (allowed === false) return false;
if (changed.system?.domains) {
const maxDomains = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxDomains;
if (changed.system.domains.length > maxDomains) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.domainMaxReached'));
return false;
}
}
const paths = [
'subclasses',
'characterGuide.suggestedPrimaryWeapon',

View file

@ -10,12 +10,6 @@ export default class DhAppearance extends foundry.abstract.DataModel {
initial: fearDisplay.token.value,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.displayFear.label'
}),
dualityColorScheme: new fields.StringField({
required: true,
choices: DualityRollColor,
initial: DualityRollColor.normal.value,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.dualityColorScheme.label'
}),
diceSoNice: new fields.SchemaField({
hope: new fields.SchemaField({
foreground: new fields.ColorField({ required: true, initial: '#ffffff' }),
@ -65,14 +59,3 @@ export default class DhAppearance extends foundry.abstract.DataModel {
};
}
}
export const DualityRollColor = {
colorful: {
value: 'colorful',
label: 'DAGGERHEART.SETTINGS.DualityRollColor.options.colorful'
},
normal: {
value: 'normal',
label: 'DAGGERHEART.SETTINGS.DualityRollColor.options.normal'
}
};

View file

@ -21,6 +21,13 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
initial: 5,
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxLoadout.label'
}),
maxDomains: new fields.NumberField({
required: true,
integer: true,
min: 1,
initial: 2,
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxDomains.label'
}),
traitArray: new fields.ArrayField(new fields.NumberField({ required: true, integer: true }), {
initial: () => [2, 1, 1, 0, 0, -1]
}),