mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 07:23:37 +02:00
Fixed DamageParts causing errors on update
This commit is contained in:
parent
7a7940aa04
commit
2388fe1fac
3 changed files with 43 additions and 15 deletions
|
|
@ -312,8 +312,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
const callback = (_, button) => {
|
||||
const data = this.action.toObject();
|
||||
const type = choices[button.form.elements.type.value].value;
|
||||
const part = { applyTo: type };
|
||||
if (this.action.actor?.isNPC) part.value = { multiplier: 'flat' };
|
||||
const part = game.system.api.fields.ActionFields.DamageField.getDefaultDamagePart(type);
|
||||
data.damage.parts[type] = part;
|
||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,6 +23,33 @@ export default class DamageField extends fields.SchemaField {
|
|||
super(damageFields, options, context);
|
||||
}
|
||||
|
||||
static getDefaultDamagePart(applyTo) {
|
||||
return {
|
||||
applyTo: applyTo,
|
||||
base: false,
|
||||
resultBased: false,
|
||||
type: 'physical',
|
||||
value: {
|
||||
dice: 'd6',
|
||||
multiplier: 'prof',
|
||||
flatMultiplier: 1,
|
||||
custom: {
|
||||
enabled: false,
|
||||
formula: ''
|
||||
}
|
||||
},
|
||||
valueAlt: {
|
||||
dice: 'd6',
|
||||
multiplier: 'prof',
|
||||
flatMultiplier: 1,
|
||||
custom: {
|
||||
enabled: false,
|
||||
formula: ''
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll Damage/Healing Action Workflow part.
|
||||
* Must be called within Action context or similar.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue