mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
[V14] 1743 - Damage Update Error (#1746)
* Fixed DamageParts causing errors on update * Fixed ActionBaseConfig error when no damage present on the action * Fix removal of damage field * Removed unneccessary default value function for parts --------- Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
This commit is contained in:
parent
f119daff07
commit
64ce615116
3 changed files with 25 additions and 18 deletions
|
|
@ -154,8 +154,13 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
context.openSection = this.openSection;
|
||||
context.tabs = this._getTabs(this.constructor.TABS);
|
||||
context.config = CONFIG.DH;
|
||||
if (this.action.damage?.hasOwnProperty('includeBase') && this.action.type === 'attack')
|
||||
context.hasBaseDamage = !!this.action.parent.attack;
|
||||
if (this.action.hasDamage) {
|
||||
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
|
||||
|
||||
if (this.action.damage.hasOwnProperty('includeBase') && this.action.type === 'attack')
|
||||
context.hasBaseDamage = !!this.action.parent.attack;
|
||||
}
|
||||
|
||||
context.costOptions = this.getCostOptions();
|
||||
context.getRollTypeOptions = this.getRollTypeOptions();
|
||||
context.disableOption = this.disableOption.bind(this);
|
||||
|
|
@ -173,7 +178,6 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
revealed: this.openTrigger === index
|
||||
};
|
||||
});
|
||||
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
|
||||
|
||||
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
|
||||
context.tierOptions = [
|
||||
|
|
@ -312,8 +316,8 @@ 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 = this.action.schema.fields.damage.fields.parts.element.getInitialValue();
|
||||
part.applyTo = type;
|
||||
data.damage.parts[type] = part;
|
||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ export class ActionField extends foundry.data.fields.ObjectField {
|
|||
/** @override */
|
||||
_cleanType(value, options, _state) {
|
||||
if (!(typeof value === 'object')) value = {};
|
||||
value = super._cleanType(value, options, _state);
|
||||
const cls = this.getModel(value);
|
||||
if (cls) return cls.cleanData(value, options, _state);
|
||||
return value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue