diff --git a/src/module/actor/entity.js b/src/module/actor/entity.js index d71fe4b..118f59b 100644 --- a/src/module/actor/entity.js +++ b/src/module/actor/entity.js @@ -45,6 +45,7 @@ export class OseActor extends Actor { }); }); } + /* -------------------------------------------- */ /* Rolls */ /* -------------------------------------------- */ @@ -249,8 +250,11 @@ export class OseActor extends Actor { const rollParts = ["1d20"]; const dmgParts = []; - if (!attData.dmg || (!game.settings.get("ose", "variableWeaponDamage")) && - this.data.type == "character") { + if ( + !attData.dmg || + (!game.settings.get("ose", "variableWeaponDamage") && + this.data.type == "character") + ) { dmgParts.push("1d6"); } else { dmgParts.push(attData.dmg); diff --git a/src/module/actor/monster-sheet.js b/src/module/actor/monster-sheet.js index c5796ac..6f13cf5 100644 --- a/src/module/actor/monster-sheet.js +++ b/src/module/actor/monster-sheet.js @@ -80,6 +80,7 @@ export class OseActorSheetMonster extends OseActorSheet { } async _onCountChange(event) { + console.log("CHANGE", event); event.preventDefault(); const itemId = event.currentTarget.closest(".item").dataset.itemId; const item = this.actor.getOwnedItem(itemId); @@ -93,6 +94,17 @@ export class OseActorSheetMonster extends OseActorSheet { }); } } + + async _resetCounters(event) { + $(event.currentTarget).closest('.abilities').find(".item").each(async (_, el) => { + let itemId = el.dataset.itemId; + const item = this.actor.getOwnedItem(itemId); + if (item.data.type == 'weapon') { + await item.update({"data.counter.value": parseInt(item.data.data.counter.max)}); + } + }) + } + /** * Activate event listeners using the prepared sheet HTML * @param html {HTML} The prepared HTML object ready to be rendered into the DOM @@ -144,6 +156,10 @@ export class OseActorSheetMonster extends OseActorSheet { return this.actor.createOwnedItem(itemData, {}); }); + html.find('.item-reset').click(ev => { + this._resetCounters(ev); + }) + html.find(".morale-check a").click((ev) => { let actorObject = this.actor; actorObject.rollMorale({ event: event }); diff --git a/src/templates/actors/partials/monster-attributes-tab.html b/src/templates/actors/partials/monster-attributes-tab.html index 5d2ae23..d3249bb 100644 --- a/src/templates/actors/partials/monster-attributes-tab.html +++ b/src/templates/actors/partials/monster-attributes-tab.html @@ -75,6 +75,7 @@
{{localize 'OSE.panel.abilities'}} & {{localize 'OSE.panel.equipment'}}
{{#if owner}} + {{/if}}