mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 13:41:07 +01:00
Fixed weapon useage in Character
This commit is contained in:
parent
b4fff7b9e6
commit
216f24d777
2 changed files with 12 additions and 13 deletions
|
|
@ -48,8 +48,8 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
htmlElement.querySelectorAll('.mini-countdown-container').forEach(element => {
|
htmlElement.querySelectorAll('.mini-countdown-container').forEach(element => {
|
||||||
element.addEventListener('click', event => this.updateCountdownValue.bind(this)(event, true));
|
element.addEventListener('click', event => this.updateCountdownValue.bind(this)(event, false));
|
||||||
element.addEventListener('contextmenu', event => this.updateCountdownValue.bind(this)(event, false));
|
element.addEventListener('contextmenu', event => this.updateCountdownValue.bind(this)(event, true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
toggleStress: this.toggleStress,
|
toggleStress: this.toggleStress,
|
||||||
toggleHope: this.toggleHope,
|
toggleHope: this.toggleHope,
|
||||||
toggleGold: this.toggleGold,
|
toggleGold: this.toggleGold,
|
||||||
attackRoll: this.attackRoll,
|
toggleLoadoutView: this.toggleLoadoutView,
|
||||||
useDomainCard: this.useDomainCard,
|
useDomainCard: this.useDomainCard,
|
||||||
removeCard: this.removeDomainCard,
|
removeCard: this.removeDomainCard,
|
||||||
selectClass: this.selectClass,
|
selectClass: this.selectClass,
|
||||||
|
|
@ -547,14 +547,10 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
await this.document.update({ [update]: newValue });
|
await this.document.update({ [update]: newValue });
|
||||||
}
|
}
|
||||||
|
|
||||||
static async attackRoll(event, button) {
|
static async toggleLoadoutView(_, button) {
|
||||||
const weapon = await fromUuid(button.dataset.weapon);
|
const newAbilityView = !(button.dataset.value === 'true');
|
||||||
if (!weapon) return;
|
await game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList, newAbilityView);
|
||||||
|
this.render();
|
||||||
const wasUsed = await weapon.use(event);
|
|
||||||
if (wasUsed) {
|
|
||||||
Hooks.callAll(SYSTEM.HOOKS.characterAttack, {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static levelManagement() {
|
static levelManagement() {
|
||||||
|
|
@ -644,10 +640,13 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
(await game.packs.get('daggerheart.communities'))?.render(true);
|
(await game.packs.get('daggerheart.communities'))?.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static useItem(element, button) {
|
static async useItem(element, button) {
|
||||||
const id = (button ?? element).closest('a').id,
|
const id = (button ?? element).closest('a').id,
|
||||||
item = this.document.items.get(id);
|
item = this.document.items.get(id);
|
||||||
item.use({});
|
const wasUsed = await item.use({});
|
||||||
|
if (wasUsed && item.type === 'weapon') {
|
||||||
|
Hooks.callAll(SYSTEM.HOOKS.characterAttack, {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async viewObject(element, button) {
|
static async viewObject(element, button) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue