mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Feature/247 auto add yope fear clear stress (#285)
* cleanup * test * Step 1 * #2 * Fix Effect Action & Add Hope tumation settings to hook * remove circular dependency * Snuck in some localization fixes I noticed * Remove success condition for duality roll gain * Changed config.roll.type logic --------- Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
parent
ee4a5d17a6
commit
52be430eff
21 changed files with 187 additions and 160 deletions
|
|
@ -3,38 +3,16 @@ 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 trigger(event, data) {
|
||||
if(this.effects.length) {
|
||||
const cls = getDocumentClass('ChatMessage'),
|
||||
msg = {
|
||||
type: 'applyEffect',
|
||||
user: game.user.id,
|
||||
system: data
|
||||
};
|
||||
|
||||
async chatApplyEffects(event, data) {
|
||||
const cls = getDocumentClass('ChatMessage'),
|
||||
systemData = {
|
||||
title: game.i18n.format('DAGGERHEART.UI.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';
|
||||
return await cls.create(msg);
|
||||
} else this.toChat(this.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue