mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
Merge branch 'main' into rework/chat-message-damage
This commit is contained in:
commit
c90c6afc19
46 changed files with 775 additions and 466 deletions
|
|
@ -276,10 +276,18 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string} the formula associated with this damage field
|
||||
*/
|
||||
getFormula() {
|
||||
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`,
|
||||
bonus = this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : '';
|
||||
return this.custom.enabled ? this.custom.formula : `${multiplier ?? 1}${this.dice}${bonus}`;
|
||||
if (this.custom.enabled) return this.custom.formula;
|
||||
|
||||
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`;
|
||||
if (!multiplier) return String(this.bonus || 0);
|
||||
|
||||
const dice = `${multiplier ?? 1}${this.dice}`;
|
||||
const sign = this.bonus < 0 ? ' - ' : ' + ';
|
||||
return this.bonus ? `${dice} ${sign} ${Math.abs(this.bonus)}` : dice;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
super(summonFields, options, context);
|
||||
}
|
||||
|
||||
static async execute() {
|
||||
static async execute(config) {
|
||||
if (!canvas.scene) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.ACTIONS.TYPES.summon.error'));
|
||||
return;
|
||||
|
|
@ -36,6 +36,7 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
|
||||
const rolls = [];
|
||||
const summonData = [];
|
||||
const chatMessageData = [];
|
||||
for (const summon of this.summon) {
|
||||
const roll = new Roll(itemAbleRollParse(summon.count, this.actor, this.item));
|
||||
await roll.evaluate();
|
||||
|
|
@ -54,17 +55,18 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
tokenPreviewName: `${actor.prototypeToken.name}${remaining > 1 ? ` (${remaining}x)` : ''}`
|
||||
});
|
||||
}
|
||||
|
||||
chatMessageData.push({
|
||||
data: actor,
|
||||
quantity: countNumber
|
||||
});
|
||||
}
|
||||
|
||||
if (rolls.length) await triggerChatRollFx(rolls);
|
||||
|
||||
this.actor.sheet?.minimize();
|
||||
DHSummonField.handleSummon(summonData, this.actor);
|
||||
}
|
||||
|
||||
static async handleSummon(summonData, actionActor) {
|
||||
await CONFIG.ux.TokenManager.createTokensWithPreview(summonData, { elevation: actionActor.token?.elevation });
|
||||
|
||||
return actionActor.sheet?.maximize();
|
||||
await CONFIG.ux.TokenManager.createTokensWithPreview(summonData, { elevation: this.actor.token?.elevation });
|
||||
this.actor.sheet?.maximize();
|
||||
config.summonData = chatMessageData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,10 +269,7 @@ export function ActionMixin(Base) {
|
|||
return this.delete();
|
||||
}
|
||||
|
||||
async toChat(origin) {
|
||||
const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
|
||||
.expandRollMessage?.desc;
|
||||
|
||||
async toChat(origin, config) {
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
title: game.i18n.localize('DAGGERHEART.CONFIG.FeatureForm.action'),
|
||||
|
|
@ -282,7 +279,7 @@ export function ActionMixin(Base) {
|
|||
img: this.baseAction ? this.parent.parent.img : this.img,
|
||||
tags: this.tags ? this.tags : ['Spell', 'Arcana', 'Lv 10'],
|
||||
areas: this.areas,
|
||||
summon: this.summon
|
||||
summon: config?.summonData
|
||||
},
|
||||
source: {
|
||||
actor: this.actor.uuid,
|
||||
|
|
@ -307,7 +304,7 @@ export function ActionMixin(Base) {
|
|||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/action.hbs',
|
||||
{ ...systemData, open: autoExpandDescription ? 'open' : '' }
|
||||
systemData
|
||||
),
|
||||
flags: {
|
||||
daggerheart: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue