mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Fixed so Adversary features can be sent to chat. Fixed so ability-card.hbs works again (#525)
This commit is contained in:
parent
1df0852df3
commit
af40f9d712
7 changed files with 28 additions and 26 deletions
|
|
@ -480,7 +480,7 @@ export default function DHApplicationMixin(Base) {
|
|||
*/
|
||||
static async #toChat(_event, target) {
|
||||
let doc = await getDocFromElement(target);
|
||||
return doc.toChat(this.document.id);
|
||||
return doc.toChat(doc.uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -117,9 +117,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
async onRollAllSave(event, message) {
|
||||
event.stopPropagation();
|
||||
if (!game.user.isGM) return;
|
||||
const targets = event.target.parentElement.querySelectorAll(
|
||||
'[data-token] .target-save'
|
||||
);
|
||||
const targets = event.target.parentElement.querySelectorAll('[data-token] .target-save');
|
||||
const actor = await this.getActor(message.system.source.actor),
|
||||
action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||
targets.forEach(async el => {
|
||||
|
|
@ -171,7 +169,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
const buttonType = event.target.dataset.type ?? 'damage',
|
||||
total = message.rolls.reduce((a, c) => a + Roll.fromJSON(c).total, 0),
|
||||
damages = {
|
||||
'hitPoints': {
|
||||
hitPoints: {
|
||||
parts: [
|
||||
{
|
||||
applyTo: 'hitPoints',
|
||||
|
|
@ -187,19 +185,17 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
|
||||
targets.forEach(target => {
|
||||
if(buttonType === 'healing')
|
||||
target.actor.takeHealing(damages);
|
||||
else
|
||||
target.actor.takeDamage(damages);
|
||||
})
|
||||
if (buttonType === 'healing') target.actor.takeHealing(damages);
|
||||
else target.actor.takeDamage(damages);
|
||||
});
|
||||
}
|
||||
|
||||
async abilityUseButton(event, message) {
|
||||
event.stopPropagation();
|
||||
|
||||
const action = message.system.actions[Number.parseInt(event.currentTarget.dataset.index)];
|
||||
const actor = game.actors.get(message.system.source.actor);
|
||||
await actor.use(action);
|
||||
const item = await foundry.utils.fromUuid(message.system.origin);
|
||||
const action = item.system.actions.get(event.currentTarget.id);
|
||||
await item.use(action);
|
||||
}
|
||||
|
||||
async actionUseButton(event, message) {
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ export default class DHItem extends foundry.documents.Item {
|
|||
|
||||
async toChat(origin) {
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const item = await foundry.utils.fromUuid(origin);
|
||||
|
||||
const systemData = {
|
||||
title:
|
||||
this.type === 'ancestry'
|
||||
|
|
@ -148,13 +150,14 @@ export default class DHItem extends foundry.documents.Item {
|
|||
img: this.img,
|
||||
tags: this._getTags()
|
||||
},
|
||||
description: this.system.description,
|
||||
actions: this.system.actions
|
||||
actions: item.system.actions,
|
||||
description: this.system.description
|
||||
};
|
||||
|
||||
const msg = {
|
||||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
actor: game.actors.get(cls.getSpeaker().actor),
|
||||
actor: item.parent,
|
||||
author: this.author,
|
||||
speaker: cls.getSpeaker(),
|
||||
system: systemData,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
title=tabs.features.label
|
||||
type='feature'
|
||||
collection=document.system.features
|
||||
hideControls=true
|
||||
hideContextMenu=true
|
||||
canCreate=true
|
||||
showActions=true
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ Parameters:
|
|||
item=item
|
||||
type=../type
|
||||
hideControls=../hideControls
|
||||
hideContextMenu=../hideContextMenu
|
||||
isActor=../isActor
|
||||
categoryAdversary=../categoryAdversary
|
||||
hideTooltip=../hideTooltip
|
||||
|
|
|
|||
|
|
@ -123,9 +123,11 @@ Parameters:
|
|||
<i class="fa-regular fa-message"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#unless hideContextMenu}}
|
||||
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
|
||||
<i class="fa-solid fa-ellipsis-vertical"></i>
|
||||
</a>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
<div class="description">{{{description}}}</div>
|
||||
</details>
|
||||
<footer class="ability-card-footer">
|
||||
{{#each actions as |action index|}}
|
||||
<button class="ability-use-button" data-index="{{index}}">
|
||||
{{#each actions as |action|}}
|
||||
<button class="ability-use-button" id="{{action.id}}">
|
||||
{{action.name}}
|
||||
</button>
|
||||
{{#if action.cost.value}}<div class="ability-card-action-cost">{{action.cost.value}} {{action.cost.type}}</div>{{/if}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue