Fixed so Adversary features can be sent to chat. Fixed so ability-card.hbs works again

This commit is contained in:
WBHarry 2025-08-02 18:35:02 +02:00
parent 73a19fc0bb
commit 2c58ab3fb0
7 changed files with 28 additions and 26 deletions

View file

@ -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);
}
/**

View file

@ -126,9 +126,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 => {
@ -255,9 +253,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',
@ -272,12 +270,10 @@ 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);
});
}
/**
@ -294,9 +290,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
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) {