From 31238113c994c5c0aa81af25aa8de6333db3ad6b Mon Sep 17 00:00:00 2001 From: Dapoulp <74197441+Dapoulp@users.noreply.github.com> Date: Sat, 30 Aug 2025 17:44:16 +0200 Subject: [PATCH] Fix/1116 fix action nullable fields (#1117) * Temp ActionField attack type missing * Move missing attack type to getModel * Damage/Healing fields nullable fix * Fix TargetField null value * Other fixes * Fix Action type to be not nullable --- module/data/action/baseAction.mjs | 3 ++- module/data/fields/action/damageField.mjs | 12 ++++++++++-- module/data/fields/action/rollField.mjs | 12 +++++++++--- module/data/fields/action/saveField.mjs | 4 +++- module/data/fields/action/targetField.mjs | 3 ++- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index 2f5935da..7ea7331a 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -32,7 +32,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel actionType: new fields.StringField({ choices: CONFIG.DH.ITEM.actionTypes, initial: 'action', - nullable: true + nullable: false, + required: true }) }; diff --git a/module/data/fields/action/damageField.mjs b/module/data/fields/action/damageField.mjs index 810b6e76..e870e229 100644 --- a/module/data/fields/action/damageField.mjs +++ b/module/data/fields/action/damageField.mjs @@ -22,10 +22,18 @@ export class DHActionDiceData extends foundry.abstract.DataModel { multiplier: new fields.StringField({ choices: CONFIG.DH.GENERAL.multiplierTypes, initial: 'prof', - label: 'Multiplier' + label: 'Multiplier', + nullable: false, + required: true }), flatMultiplier: new fields.NumberField({ nullable: true, initial: 1, label: 'Flat Multiplier' }), - dice: new fields.StringField({ choices: CONFIG.DH.GENERAL.diceTypes, initial: 'd6', label: 'Dice' }), + dice: new fields.StringField({ + choices: CONFIG.DH.GENERAL.diceTypes, + initial: 'd6', + label: 'Dice', + nullable: false, + required: true + }), bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }), custom: new fields.SchemaField({ enabled: new fields.BooleanField({ label: 'Custom Formula' }), diff --git a/module/data/fields/action/rollField.mjs b/module/data/fields/action/rollField.mjs index a4df2a9e..07a113d3 100644 --- a/module/data/fields/action/rollField.mjs +++ b/module/data/fields/action/rollField.mjs @@ -10,13 +10,17 @@ export class DHActionRollData extends foundry.abstract.DataModel { bonus: new fields.NumberField({ nullable: true, initial: null, integer: true }), advState: new fields.StringField({ choices: CONFIG.DH.ACTIONS.advantageState, - initial: 'neutral' + initial: 'neutral', + nullable: false, + required: true }), diceRolling: new fields.SchemaField({ multiplier: new fields.StringField({ choices: CONFIG.DH.GENERAL.diceSetNumbers, initial: 'prof', - label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.multiplier' + label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.multiplier', + nullable: false, + required: true }), flatMultiplier: new fields.NumberField({ nullable: true, @@ -26,7 +30,9 @@ export class DHActionRollData extends foundry.abstract.DataModel { dice: new fields.StringField({ choices: CONFIG.DH.GENERAL.diceTypes, initial: CONFIG.DH.GENERAL.diceTypes.d6, - label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.dice' + label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.dice', + nullable: false, + required: true }), compare: new fields.StringField({ choices: CONFIG.DH.ACTIONS.diceCompare, diff --git a/module/data/fields/action/saveField.mjs b/module/data/fields/action/saveField.mjs index e93a82a9..23378e05 100644 --- a/module/data/fields/action/saveField.mjs +++ b/module/data/fields/action/saveField.mjs @@ -11,7 +11,9 @@ export default class SaveField extends fields.SchemaField { difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }), damageMod: new fields.StringField({ initial: CONFIG.DH.ACTIONS.damageOnSave.none.id, - choices: CONFIG.DH.ACTIONS.damageOnSave + choices: CONFIG.DH.ACTIONS.damageOnSave, + nullable: false, + required: true }) }; super(saveFields, options, context); diff --git a/module/data/fields/action/targetField.mjs b/module/data/fields/action/targetField.mjs index bfb01db9..9dbf1ed9 100644 --- a/module/data/fields/action/targetField.mjs +++ b/module/data/fields/action/targetField.mjs @@ -6,7 +6,8 @@ export default class TargetField extends fields.SchemaField { type: new fields.StringField({ choices: CONFIG.DH.GENERAL.targetTypes, initial: CONFIG.DH.GENERAL.targetTypes.any.id, - nullable: true + nullable: true, + blank: true }), amount: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }) };