diff --git a/module/applications/settings/homebrewSettings.mjs b/module/applications/settings/homebrewSettings.mjs index 2d916824..1b73747c 100644 --- a/module/applications/settings/homebrewSettings.mjs +++ b/module/applications/settings/homebrewSettings.mjs @@ -136,7 +136,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli ...move, name: game.i18n.localize(move.name), description: game.i18n.localize(move.description), - actions: Object.keys(move.actions).reduce((acc, key) => { + actions: move.actions.reduce((acc, key) => { const action = move.actions[key]; acc[key] = { ...action, diff --git a/module/data/item/weapon.mjs b/module/data/item/weapon.mjs index 71d1e08d..96c0eeba 100644 --- a/module/data/item/weapon.mjs +++ b/module/data/item/weapon.mjs @@ -63,6 +63,19 @@ export default class DHWeapon extends AttachableItem { ] } } + }), + rules: new fields.SchemaField({ + attack: new fields.SchemaField({ + roll: new fields.SchemaField({ + trait: new fields.StringField({ + required: true, + choices: CONFIG.DH.ACTOR.abilities, + nullable: true, + initial: null, + label: 'DAGGERHEART.GENERAL.Rules.attack.roll.trait.label' + }) + }) + }) }) }; } @@ -77,6 +90,10 @@ export default class DHWeapon extends AttachableItem { ); } + prepareDerivedData() { + this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait; + } + async _preUpdate(changes, options, user) { const allowed = await super._preUpdate(changes, options, user); if (allowed === false) return false;