From 207d0d63350c1f2cf4429e566d45c1e56a4c5f0b Mon Sep 17 00:00:00 2001 From: Dapoulp <74197441+Dapoulp@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:51:56 +0200 Subject: [PATCH] Fix/929 flat modifier disappears (#936) * Temp ActionField attack type missing * Move missing attack type to getModel --- module/data/fields/action/damageField.mjs | 2 +- module/data/fields/actionField.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/data/fields/action/damageField.mjs b/module/data/fields/action/damageField.mjs index 9e9e4b16..810b6e76 100644 --- a/module/data/fields/action/damageField.mjs +++ b/module/data/fields/action/damageField.mjs @@ -29,7 +29,7 @@ export class DHActionDiceData extends foundry.abstract.DataModel { bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }), custom: new fields.SchemaField({ enabled: new fields.BooleanField({ label: 'Custom Formula' }), - formula: new FormulaField({ label: 'Formula' }) + formula: new FormulaField({ label: 'Formula', initial: "" }) }) }; } diff --git a/module/data/fields/actionField.mjs b/module/data/fields/actionField.mjs index a8b01e37..4ae436de 100644 --- a/module/data/fields/actionField.mjs +++ b/module/data/fields/actionField.mjs @@ -82,6 +82,7 @@ export class ActionsField extends MappingField { */ export class ActionField extends foundry.data.fields.ObjectField { getModel(value) { + if(value && !value.type) value.type = 'attack'; return ( game.system.api.models.actions.actionsTypes[value.type] ?? null @@ -102,7 +103,6 @@ export class ActionField extends foundry.data.fields.ObjectField { /** @override */ initialize(value, model, options = {}) { - if(value && !value.type) value.type = 'attack'; const cls = this.getModel(value); if (cls) return new cls(value, { parent: model, ...options }); return foundry.utils.deepClone(value);