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 => {
|
||||
|
|
@ -169,9 +167,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
|
||||
async onRollSimple(event, message) {
|
||||
const buttonType = event.target.dataset.type ?? 'damage',
|
||||
total = message.rolls.reduce((a,c) => a + Roll.fromJSON(c).total, 0),
|
||||
total = message.rolls.reduce((a, c) => a + Roll.fromJSON(c).total, 0),
|
||||
damages = {
|
||||
'hitPoints': {
|
||||
hitPoints: {
|
||||
parts: [
|
||||
{
|
||||
applyTo: 'hitPoints',
|
||||
|
|
@ -186,20 +184,18 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
if (targets.length === 0)
|
||||
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);
|
||||
})
|
||||
targets.forEach(target => {
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue