daggerheart/module/data/action/effectAction.mjs
WBHarry 9d76405221
File Structure Rework (#262)
* Restructured all the files

* Moved build/daggerheart.js to ./daggerheart.js. Changed rollup to use the css file instead of the less

* Restored build/ folder

* Mvoed config out form under application

* Moved roll.mjs to module/dice and renamed to dhRolls.mjs

* Update module/canvas/placeables/_module.mjs

Co-authored-by: joaquinpereyra98 <24190917+joaquinpereyra98@users.noreply.github.com>

* Le massive export update

* Removed unncessary import

---------

Co-authored-by: joaquinpereyra98 <24190917+joaquinpereyra98@users.noreply.github.com>
2025-07-05 00:26:33 +02:00

40 lines
1.4 KiB
JavaScript

import DHBaseAction from './baseAction.mjs';
export default class DHEffectAction extends DHBaseAction {
static extraSchemas = ['effects', 'target'];
async use(event, ...args) {
const config = await super.use(event, args);
if (['error', 'warning'].includes(config.type)) return;
return await this.chatApplyEffects(event, config);
}
async chatApplyEffects(event, data) {
const cls = getDocumentClass('ChatMessage'),
systemData = {
title: game.i18n.format('DAGGERHEART.Chat.ApplyEffect.Title', { name: this.name }),
origin: this.actor._id,
description: '',
targets: data.targets.map(x => ({ id: x.id, name: x.name, img: x.img, hit: true })),
action: {
itemId: this.item._id,
actionId: this._id
}
},
msg = new cls({
type: 'applyEffect',
user: game.user.id,
system: systemData,
content: await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/ui/chat/apply-effects.hbs',
systemData
)
});
cls.create(msg.toObject());
}
get chatTemplate() {
return 'systems/daggerheart/templates/ui/chat/apply-effects.hbs';
}
}