Minor ActionConfig improvements

This commit is contained in:
WBHarry 2026-03-25 16:36:36 +01:00
parent 931217577a
commit e3e1395de6
2 changed files with 8 additions and 7 deletions

View file

@ -318,6 +318,9 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
const type = choices[button.form.elements.type.value].value; const type = choices[button.form.elements.type.value].value;
const part = this.action.schema.fields.damage.fields.parts.element.getInitialValue(); const part = this.action.schema.fields.damage.fields.parts.element.getInitialValue();
part.applyTo = type; part.applyTo = type;
if (type === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
part.type = this.action.schema.fields.damage.fields.parts.element.fields.type.element.initial;
data.damage.parts[type] = part; data.damage.parts[type] = part;
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) }); this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
}; };

View file

@ -24,15 +24,13 @@ export default class DHActionConfig extends DHActionBaseConfig {
const effectData = this._addEffectData.bind(this)(); const effectData = this._addEffectData.bind(this)();
const data = this.action.toObject(); const data = this.action.toObject();
const created = await game.system.api.documents.DhActiveEffect.createDialog(effectData, { const created = await this.action.item.createEmbeddedDocuments('ActiveEffect', [
parent: this.action.item, game.system.api.data.activeEffects.BaseEffect.getDefaultObject()
render: false ]);
});
if (!created) return;
data.effects.push({ _id: created._id }); data.effects.push({ _id: created[0]._id });
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) }); this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
this.action.item.effects.get(created._id).sheet.render(true); this.action.item.effects.get(created[0]._id).sheet.render(true);
} }
/** /**