mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
.
This commit is contained in:
parent
e139cd4dae
commit
9e50f2b008
4 changed files with 8 additions and 36 deletions
|
|
@ -597,7 +597,7 @@ export default class DhpActor extends Actor {
|
|||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, updates);
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, updates) === false) return null;
|
||||
|
||||
return updates;
|
||||
}
|
||||
|
|
@ -647,7 +647,8 @@ export default class DhpActor extends Actor {
|
|||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates);
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates) === false) return null;
|
||||
|
||||
return updates;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,41 +133,12 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
});
|
||||
|
||||
html.querySelectorAll('.token-target-container').forEach(element => {
|
||||
element.addEventListener('pointerover', this._onTokenTargetHoverIn.bind(this));
|
||||
element.addEventListener('pointerout', this._onTokenTargetHoverOut.bind(this));
|
||||
element.addEventListener('click', this._onTokenTargetClick.bind(this));
|
||||
element.addEventListener('pointerover', this.hoverTarget);
|
||||
element.addEventListener('pointerout', this.unhoverTarget);
|
||||
element.addEventListener('click', this.clickTarget);
|
||||
});
|
||||
}
|
||||
|
||||
async _onTokenTargetHoverIn(event) {
|
||||
const { tokenUuid } = event.target.dataset;
|
||||
if (!canvas.ready || !tokenUuid) return;
|
||||
|
||||
const token = await foundry.utils.fromUuid(tokenUuid);
|
||||
if (token?.object && token.object._canHover(game.user, event) && token.object.visible) {
|
||||
token.object._onHoverIn(event, { hoverOutOthers: true });
|
||||
}
|
||||
}
|
||||
|
||||
async _onTokenTargetHoverOut(event) {
|
||||
const { tokenUuid } = event.target.dataset;
|
||||
if (!canvas.ready || !tokenUuid) return;
|
||||
|
||||
const token = await foundry.utils.fromUuid(tokenUuid);
|
||||
if (token?.object) token.object._onHoverOut(event);
|
||||
}
|
||||
|
||||
async _onTokenTargetClick(event) {
|
||||
const { tokenUuid } = event.target.dataset;
|
||||
if (!canvas.ready || !tokenUuid) return;
|
||||
|
||||
const token = await foundry.utils.fromUuid(tokenUuid);
|
||||
if (token?.object) {
|
||||
const { _x: x, _y: y } = token.object.position;
|
||||
game.canvas.pan({ x, y });
|
||||
}
|
||||
}
|
||||
|
||||
getTargetList() {
|
||||
const targets = this.system.hitTargets ?? [];
|
||||
return targets.map(target => game.canvas.tokens.documentCollection.find(t => t.actor?.uuid === target.actorId));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<ul class="daggerheart chat damage-summary">
|
||||
{{#each targets}}
|
||||
<li class="token-target-container" data-token-uuid="{{this.token.uuid}}">
|
||||
<li class="token-target-container" data-token="{{this.token.id}}">
|
||||
<header>
|
||||
<img src="{{this.token.texture.src}}" />
|
||||
<h2 class="actor-name">{{this.token.name}}</h2>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
<div class="targets-container">
|
||||
{{#each targets}}
|
||||
<div class="token-target-container" data-token-uuid="{{this.uuid}}">
|
||||
<div class="token-target-container" data-token="{{this.id}}">
|
||||
<img src="{{this.texture.src}}" />
|
||||
<h2 class="title">{{this.name}}</h2>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue