Armor functional to be hit

This commit is contained in:
Nikhil Nagarajan 2025-11-08 17:36:04 -05:00
parent 3334baef11
commit 7ac9e3cec1
2 changed files with 25 additions and 10 deletions

View file

@ -21,6 +21,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
rollAttribute: CharacterSheet.#rollAttribute, rollAttribute: CharacterSheet.#rollAttribute,
toggleHitPoints: CharacterSheet.#toggleHitPoints, toggleHitPoints: CharacterSheet.#toggleHitPoints,
toggleStress: CharacterSheet.#toggleStress, toggleStress: CharacterSheet.#toggleStress,
toggleArmor: CharacterSheet.#toggleArmor,
toggleHope: CharacterSheet.#toggleHope, toggleHope: CharacterSheet.#toggleHope,
toggleLoadoutView: CharacterSheet.#toggleLoadoutView, toggleLoadoutView: CharacterSheet.#toggleLoadoutView,
openPack: CharacterSheet.#openPack, openPack: CharacterSheet.#openPack,
@ -749,6 +750,16 @@ export default class CharacterSheet extends DHBaseActorSheet {
await this.document.update({ 'system.resources.stress.value': newValue }); await this.document.update({ 'system.resources.stress.value': newValue });
} }
/**
* Toggles ArmorScore resource value.
* @type {ApplicationClickAction}
*/
static async #toggleArmor(_, button,element) {
const ArmorValue = Number.parseInt(button.dataset.value);
const newValue = this.document.system.armor.system.marks.value >= ArmorValue ? ArmorValue - 1 : ArmorValue;
await this.document.system.armor.update({ 'system.marks.value': newValue });
}
/** /**
* Toggles a hope resource value. * Toggles a hope resource value.
* @type {ApplicationClickAction} * @type {ApplicationClickAction}

View file

@ -62,19 +62,23 @@
</div> </div>
{{#if document.system.armor.system.marks}} {{#if document.system.armor.system.marks}}
<div class="status-bar armor-slots"> <div class="status-bar">
<div class='status-value'> <div class='status-value'>
<p><input class="bar-input armor-marks-input" value="{{document.system.armor.system.marks.value}}" type="number"></p> <div class="slot-bar">
<p>/</p> {{#times document.system.armorScore}}
<p class="bar-label">{{document.system.armorScore}}</p> <a class='armor-slot' data-action='toggleArmor' data-value="{{add this 1}}">
{{#if (gte ../document.system.armor.system.marks.value (add this 1))}}
<i class="fa-solid fa-shield"></i>
{{else}}
<i class="fa-solid fa-shield-halved"></i>
{{/if}}
</a>
{{/times}}
</div>
</div> </div>
<progress <div class="progress-bar"></div>
class='progress-bar stress-color'
value='{{document.system.armor.system.marks.value}}'
max='{{document.system.armorScore}}'
></progress>
<div class="status-label"> <div class="status-label">
<h4>{{localize "DAGGERHEART.GENERAL.armorSlots"}}</h4> <h4>{{localize "DAGGERHEART.GENERAL.armorSlots"}}|<span>{{document.system.armor.system.marks.value}} / {{document.system.armorScore}}</span></h4>
</div> </div>
</div> </div>
{{else}} {{else}}