mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Move missing attack type to getModel
This commit is contained in:
parent
42aba217ee
commit
87236879a9
2 changed files with 2 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
|
||||||
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' }),
|
||||||
formula: new FormulaField({ label: 'Formula' })
|
formula: new FormulaField({ label: 'Formula', initial: "" })
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ export class ActionsField extends MappingField {
|
||||||
*/
|
*/
|
||||||
export class ActionField extends foundry.data.fields.ObjectField {
|
export class ActionField extends foundry.data.fields.ObjectField {
|
||||||
getModel(value) {
|
getModel(value) {
|
||||||
|
if(value && !value.type) value.type = 'attack';
|
||||||
return (
|
return (
|
||||||
game.system.api.models.actions.actionsTypes[value.type] ??
|
game.system.api.models.actions.actionsTypes[value.type] ??
|
||||||
null
|
null
|
||||||
|
|
@ -102,7 +103,6 @@ export class ActionField extends foundry.data.fields.ObjectField {
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
initialize(value, model, options = {}) {
|
initialize(value, model, options = {}) {
|
||||||
if(value && !value.type) value.type = 'attack';
|
|
||||||
const cls = this.getModel(value);
|
const cls = this.getModel(value);
|
||||||
if (cls) return new cls(value, { parent: model, ...options });
|
if (cls) return new cls(value, { parent: model, ...options });
|
||||||
return foundry.utils.deepClone(value);
|
return foundry.utils.deepClone(value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue