diff --git a/module/applications/dialogs/tagTeamDialog.mjs b/module/applications/dialogs/tagTeamDialog.mjs index 10cb9750..d6f678ef 100644 --- a/module/applications/dialogs/tagTeamDialog.mjs +++ b/module/applications/dialogs/tagTeamDialog.mjs @@ -108,7 +108,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio partContext.traitOptions = CONFIG.DH.ACTOR.abilities; const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected); - const critSelected = !selectedRoll ? undefined : (selectedRoll?.rollData?.options?.isCritical ?? false); + const critSelected = !selectedRoll + ? undefined + : (selectedRoll?.rollData?.options?.roll?.isCritical ?? false); partContext.members = {}; for (const actorId in this.party.system.tagTeam.members) { @@ -153,7 +155,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio damage: damage, critDamage: critHitPointsDamage, useCritDamage: - critSelected || (critSelected === undefined && data.rollData?.options?.isCritical) + critSelected || (critSelected === undefined && data.rollData?.options?.roll?.isCritical) }; } @@ -390,7 +392,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio }); } - static async #makeDamageRoll(_, button) { + static async #makeDamageRoll(event, button) { const { memberKey } = button.dataset; const actor = game.actors.find(x => x.id === memberKey); if (!actor) return; @@ -399,6 +401,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio const action = await foundry.utils.fromUuid(memberData.rollChoice); const config = { ...memberData.rollData.options, + dialog: { + configure: !event.shiftKey + }, skips: { createMessage: true, resources: true, @@ -409,7 +414,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio await action.workflow.get('damage').execute(config, null, true); if (!config.damage) return; - const damage = config.isCritical ? await this.getNonCriticalDamage(config, actor) : config.damage; + // const damage = config.roll.isCritical ? await this.getNonCriticalDamage(config, actor) : config.damage; const current = this.party.system.tagTeam.members[memberKey].rollData; await this.updatePartyData({ @@ -417,7 +422,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio ...current, options: { ...current.options, - damage: damage + damage: config.damage } } }); diff --git a/module/data/fields/action/damageField.mjs b/module/data/fields/action/damageField.mjs index e79a91a2..b7ef852e 100644 --- a/module/data/fields/action/damageField.mjs +++ b/module/data/fields/action/damageField.mjs @@ -50,9 +50,9 @@ export default class DamageField extends fields.SchemaField { formulas = DamageField.formatFormulas.call(this, formulas, config); const damageConfig = { + dialog: {}, ...config, roll: formulas, - dialog: {}, data: this.getRollData() }; delete damageConfig.evaluate; diff --git a/module/dice/damageRoll.mjs b/module/dice/damageRoll.mjs index e095ca5f..8cd3caac 100644 --- a/module/dice/damageRoll.mjs +++ b/module/dice/damageRoll.mjs @@ -1,6 +1,5 @@ import DamageDialog from '../applications/dialogs/damageDialog.mjs'; import { parseRallyDice } from '../helpers/utils.mjs'; -import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs'; import DHRoll from './dhRoll.mjs'; export default class DamageRoll extends DHRoll { diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index bb05fc39..59ebbbb3 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -528,7 +528,8 @@ export function expireActiveEffects(actor, allowedTypes = null) { export async function getCritDamageBonus(formula) { const critRoll = new Roll(formula); - return critRoll.dice.reduce((acc, dice) => acc + dice.faces * dice.number, 0); + await critRoll.evaluate(); + return critRoll.dice.reduce((acc, dice) => acc + dice.faces * dice.results.filter(r => r.active).length, 0); } export function htmlToText(html) { diff --git a/module/systemRegistration/handlebars.mjs b/module/systemRegistration/handlebars.mjs index f51e1035..4ad98b06 100644 --- a/module/systemRegistration/handlebars.mjs +++ b/module/systemRegistration/handlebars.mjs @@ -39,6 +39,7 @@ export const preloadHandlebarsTemplates = async function () { 'systems/daggerheart/templates/ui/tooltip/parts/tooltipChips.hbs', 'systems/daggerheart/templates/ui/tooltip/parts/tooltipTags.hbs', 'systems/daggerheart/templates/dialogs/downtime/activities.hbs', + 'systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs', 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs', 'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs', 'systems/daggerheart/templates/ui/chat/parts/description-part.hbs', diff --git a/styles/less/dialog/tag-team-dialog/sheet.less b/styles/less/dialog/tag-team-dialog/sheet.less index 635a7425..afee2020 100644 --- a/styles/less/dialog/tag-team-dialog/sheet.less +++ b/styles/less/dialog/tag-team-dialog/sheet.less @@ -78,11 +78,11 @@ } &::before { - background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, @golden 100%); + background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, light-dark(@dark-blue, @golden) 100%); } &::after { - background: linear-gradient(90deg, @golden 0%, rgba(0, 0, 0, 0) 100%); + background: linear-gradient(90deg, light-dark(@dark-blue, @golden) 0%, rgba(0, 0, 0, 0) 100%); } } diff --git a/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs b/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs new file mode 100644 index 00000000..058777a5 --- /dev/null +++ b/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs @@ -0,0 +1,25 @@ +{{#each damage as |damage key|}} +
+
+ {{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}: + {{damage.total}} +
+ {{#each damage.parts as |part|}} +
+ {{#each part.dice as |dice index|}} + + {{dice.total}} + + + {{#unless @last}} + + + {{/unless}} + {{/each}} + {{#if part.modifierTotal}} + {{#if (gte part.modifierTotal 0)}}+{{else}}-{{/if}} + {{positive part.modifierTotal}} + {{/if}} +
+ {{/each}} +
+{{/each}} \ No newline at end of file diff --git a/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs b/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs index 5ac6796b..b44aca7f 100644 --- a/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs +++ b/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs @@ -107,31 +107,11 @@ {{#if damage}} - {{#each damage as |damage key|}} -
-
- {{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}: - {{#if ../useCritDamage}}{{lookup (lookup ../critDamage key) 'total'}}{{else}}{{damage.total}}{{/if}} -
- {{#each damage.parts as |part|}} -
- {{#each part.dice as |dice index|}} - - {{dice.total}} - - - {{#unless @last}} - + - {{/unless}} - {{/each}} - {{#if part.modifierTotal}} - {{#if (gte part.modifierTotal 0)}}+{{else}}-{{/if}} - {{positive part.modifierTotal}} - {{/if}} -
- {{/each}} -
- {{/each}} + {{#if useCritDamage}} + {{> "systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs" damage=critDamage isCritical=true }} + {{else}} + {{> "systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs" damage=damage }} + {{/if}} {{else}} {{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.makeYourRoll"}} {{/if}}