ENH: Attack counters reset
parent
0a81e46725
commit
29d2f0528e
|
@ -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);
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
<div class="item-name">{{localize 'OSE.panel.abilities'}} & {{localize 'OSE.panel.equipment'}}</div>
|
||||
<div class="item-controls">
|
||||
{{#if owner}}
|
||||
<a class="item-control item-reset" title='{{localize "OSE.Reset"}}'><i class="fas fa-sync"></i></a>
|
||||
<a class="item-control item-create" title='{{localize "OSE.Add"}}' data-type="choice"
|
||||
data-choices="weapon,ability,armor,item"><i class="fas fa-plus"></i></a>
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in New Issue