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
This commit is contained in:
Dapoulp 2025-08-30 17:44:16 +02:00 committed by GitHub
parent ef4d37d725
commit 31238113c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 8 deletions

View file

@ -32,7 +32,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
actionType: new fields.StringField({ actionType: new fields.StringField({
choices: CONFIG.DH.ITEM.actionTypes, choices: CONFIG.DH.ITEM.actionTypes,
initial: 'action', initial: 'action',
nullable: true nullable: false,
required: true
}) })
}; };

View file

@ -22,10 +22,18 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
multiplier: new fields.StringField({ multiplier: new fields.StringField({
choices: CONFIG.DH.GENERAL.multiplierTypes, choices: CONFIG.DH.GENERAL.multiplierTypes,
initial: 'prof', initial: 'prof',
label: 'Multiplier' label: 'Multiplier',
nullable: false,
required: true
}), }),
flatMultiplier: new fields.NumberField({ nullable: true, initial: 1, label: 'Flat Multiplier' }), 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' }), bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }),
custom: new fields.SchemaField({ custom: new fields.SchemaField({
enabled: new fields.BooleanField({ label: 'Custom Formula' }), enabled: new fields.BooleanField({ label: 'Custom Formula' }),

View file

@ -10,13 +10,17 @@ export class DHActionRollData extends foundry.abstract.DataModel {
bonus: new fields.NumberField({ nullable: true, initial: null, integer: true }), bonus: new fields.NumberField({ nullable: true, initial: null, integer: true }),
advState: new fields.StringField({ advState: new fields.StringField({
choices: CONFIG.DH.ACTIONS.advantageState, choices: CONFIG.DH.ACTIONS.advantageState,
initial: 'neutral' initial: 'neutral',
nullable: false,
required: true
}), }),
diceRolling: new fields.SchemaField({ diceRolling: new fields.SchemaField({
multiplier: new fields.StringField({ multiplier: new fields.StringField({
choices: CONFIG.DH.GENERAL.diceSetNumbers, choices: CONFIG.DH.GENERAL.diceSetNumbers,
initial: 'prof', initial: 'prof',
label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.multiplier' label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.multiplier',
nullable: false,
required: true
}), }),
flatMultiplier: new fields.NumberField({ flatMultiplier: new fields.NumberField({
nullable: true, nullable: true,
@ -26,7 +30,9 @@ export class DHActionRollData extends foundry.abstract.DataModel {
dice: new fields.StringField({ dice: new fields.StringField({
choices: CONFIG.DH.GENERAL.diceTypes, choices: CONFIG.DH.GENERAL.diceTypes,
initial: CONFIG.DH.GENERAL.diceTypes.d6, 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({ compare: new fields.StringField({
choices: CONFIG.DH.ACTIONS.diceCompare, choices: CONFIG.DH.ACTIONS.diceCompare,

View file

@ -11,7 +11,9 @@ export default class SaveField extends fields.SchemaField {
difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }), difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }),
damageMod: new fields.StringField({ damageMod: new fields.StringField({
initial: CONFIG.DH.ACTIONS.damageOnSave.none.id, 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); super(saveFields, options, context);

View file

@ -6,7 +6,8 @@ export default class TargetField extends fields.SchemaField {
type: new fields.StringField({ type: new fields.StringField({
choices: CONFIG.DH.GENERAL.targetTypes, choices: CONFIG.DH.GENERAL.targetTypes,
initial: CONFIG.DH.GENERAL.targetTypes.any.id, 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 }) amount: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 })
}; };