mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Update armor slot handling
This commit is contained in:
parent
4bdafeff6d
commit
af3a415e56
10 changed files with 56 additions and 72 deletions
|
|
@ -134,11 +134,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
element.addEventListener('change', this.updateItemQuantity.bind(this));
|
||||
element.addEventListener('click', e => e.stopPropagation());
|
||||
});
|
||||
|
||||
// Add listener for armor marks input
|
||||
htmlElement.querySelectorAll('.armor-marks-input').forEach(element => {
|
||||
element.addEventListener('change', this.updateArmorMarks.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
|
|
@ -581,15 +576,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
this.render();
|
||||
}
|
||||
|
||||
async updateArmorMarks(event) {
|
||||
const armor = this.document.system.armor;
|
||||
if (!armor) return;
|
||||
|
||||
const maxMarks = this.document.system.armorScore;
|
||||
const value = Math.min(Math.max(Number(event.currentTarget.value), 0), maxMarks);
|
||||
await armor.update({ 'system.marks.value': value });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -702,6 +688,19 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
}
|
||||
|
||||
await item.update({ 'system.equipped': true });
|
||||
|
||||
if(this.document.system.resources.armor.value > 0) {
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.localize('DAGGERHEART.ITEMS.Armor.switch.title')
|
||||
},
|
||||
content: game.i18n.localize('DAGGERHEART.ITEMS.Armor.switch.content')
|
||||
});
|
||||
|
||||
if (confirmed)
|
||||
await this.document.update({'system.resources.armor.value': 0});
|
||||
}
|
||||
|
||||
break;
|
||||
case 'weapon':
|
||||
if (this.document.effects.find(x => !x.disabled && x.type === 'beastform')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue