mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 23:43:37 +02:00
Added ArmorChange DamageThresholds
This commit is contained in:
parent
482fb33a67
commit
f751c0ed41
8 changed files with 162 additions and 75 deletions
|
|
@ -154,6 +154,10 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
htmlElement
|
||||
.querySelector('.armor-change-checkbox')
|
||||
?.addEventListener('change', this.armorChangeToggle.bind(this));
|
||||
|
||||
htmlElement
|
||||
.querySelector('.armor-damage-thresholds-checkbox')
|
||||
?.addEventListener('change', this.armorDamageThresholdToggle.bind(this));
|
||||
}
|
||||
|
||||
async _prepareContext(options) {
|
||||
|
|
@ -229,6 +233,19 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
return this.submit({ updateData: { system: { changes } } });
|
||||
}
|
||||
|
||||
armorDamageThresholdToggle(event) {
|
||||
const submitData = this._processFormData(null, this.form, new FormDataExtended(this.form));
|
||||
const changes = Object.values(submitData.system?.changes ?? {});
|
||||
const index = Number(event.target.dataset.index);
|
||||
if (event.target.checked) {
|
||||
changes[index].value.damageThresholds = { major: 0, severe: 0 };
|
||||
} else {
|
||||
changes[index].value.damageThresholds = null;
|
||||
}
|
||||
|
||||
return this.submit({ updateData: { system: { changes } } });
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
_renderChange(context) {
|
||||
const { change, index, defaultPriority } = context;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue