diff --git a/module/applications/dialogs/tagTeamDialog.mjs b/module/applications/dialogs/tagTeamDialog.mjs index bc35f360..10cb9750 100644 --- a/module/applications/dialogs/tagTeamDialog.mjs +++ b/module/applications/dialogs/tagTeamDialog.mjs @@ -108,9 +108,7 @@ 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?.roll?.isCritical ?? false); + const critSelected = !selectedRoll ? undefined : (selectedRoll?.rollData?.options?.isCritical ?? false); partContext.members = {}; for (const actorId in this.party.system.tagTeam.members) { @@ -155,7 +153,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio damage: damage, critDamage: critHitPointsDamage, useCritDamage: - critSelected || (critSelected === undefined && data.rollData?.options?.roll?.isCritical) + critSelected || (critSelected === undefined && data.rollData?.options?.isCritical) }; } @@ -344,7 +342,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio if (!actor) return; const memberData = this.party.system.tagTeam.members[memberKey]; - return await actor.rollTrait(memberData.rollChoice, { + return await actor.traitDiceRoll(memberData.rollChoice, { skips: { createMessage: true, resources: true, @@ -392,7 +390,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio }); } - static async #makeDamageRoll(event, button) { + static async #makeDamageRoll(_, button) { const { memberKey } = button.dataset; const actor = game.actors.find(x => x.id === memberKey); if (!actor) return; @@ -401,9 +399,6 @@ 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, @@ -414,7 +409,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio await action.workflow.get('damage').execute(config, null, true); if (!config.damage) return; - // const damage = config.roll.isCritical ? await this.getNonCriticalDamage(config, actor) : config.damage; + const damage = config.isCritical ? await this.getNonCriticalDamage(config, actor) : config.damage; const current = this.party.system.tagTeam.members[memberKey].rollData; await this.updatePartyData({ @@ -422,7 +417,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio ...current, options: { ...current.options, - damage: config.damage + damage: damage } } }); diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index db236197..86ce4233 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -719,8 +719,8 @@ export default class CharacterSheet extends DHBaseActorSheet { * Rolls an attribute check based on the clicked button's dataset attribute. * @type {ApplicationClickAction} */ - static async #rollAttribute(_event, button) { - const result = await this.document.rollTrait(button.dataset.attribute); + static async #rollAttribute(event, button) { + const result = await this.document.traitDiceRoll(button.dataset.attribute); if (!result) return; /* This could be avoided by baking config.costs into config.resourceUpdates. Didn't feel like messing with it at the time */ diff --git a/module/data/fields/action/damageField.mjs b/module/data/fields/action/damageField.mjs index b7ef852e..e79a91a2 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 8cd3caac..e095ca5f 100644 --- a/module/dice/damageRoll.mjs +++ b/module/dice/damageRoll.mjs @@ -1,5 +1,6 @@ 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/documents/actor.mjs b/module/documents/actor.mjs index 6c434007..0ad5b836 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -510,7 +510,7 @@ export default class DhpActor extends Actor { return await rollClass.build(config); } - async rollTrait(trait, options = {}) { + async traitDiceRoll(trait, options = {}) { const abilityLabel = game.i18n.localize(abilities[trait].label); const config = { event: event, diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index 59ebbbb3..bb05fc39 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -528,8 +528,7 @@ export function expireActiveEffects(actor, allowedTypes = null) { export async function getCritDamageBonus(formula) { const critRoll = new Roll(formula); - await critRoll.evaluate(); - return critRoll.dice.reduce((acc, dice) => acc + dice.faces * dice.results.filter(r => r.active).length, 0); + return critRoll.dice.reduce((acc, dice) => acc + dice.faces * dice.number, 0); } export function htmlToText(html) { diff --git a/module/systemRegistration/handlebars.mjs b/module/systemRegistration/handlebars.mjs index 4ad98b06..f51e1035 100644 --- a/module/systemRegistration/handlebars.mjs +++ b/module/systemRegistration/handlebars.mjs @@ -39,7 +39,6 @@ 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/initialization.less b/styles/less/dialog/tag-team-dialog/initialization.less index 30676f82..ef120a00 100644 --- a/styles/less/dialog/tag-team-dialog/initialization.less +++ b/styles/less/dialog/tag-team-dialog/initialization.less @@ -24,7 +24,7 @@ } } - .initiator-container { + .intiator-container { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; diff --git a/styles/less/dialog/tag-team-dialog/sheet.less b/styles/less/dialog/tag-team-dialog/sheet.less index 23526172..635a7425 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%, light-dark(@dark-blue, @golden) 100%); + background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, @golden 100%); } &::after { - background: linear-gradient(90deg, light-dark(@dark-blue, @golden) 0%, rgba(0, 0, 0, 0) 100%); + background: linear-gradient(90deg, @golden 0%, rgba(0, 0, 0, 0) 100%); } } @@ -104,6 +104,37 @@ filter: drop-shadow(0 0 8px var(--golden)); } } + + // width: 100%; + // display: flex; + // align-items: center; + // justify-content: space-evenly; + + // .roll-button { + // position: relative; + // display: flex; + // justify-content: center; + + // .roll-label { + // position: absolute; + // top: 8px; + // width: 60px; + // text-align: center; + // padding: 2px; + // background: light-dark(darkblue, gold); + // color: light-dark(white, black); + // border-radius: 6px; + // border: 1px solid light-dark(white, black); + // } + + // img { + // height: 80px; + // } + // } + + // .delete-button i { + // font-size: 40px; + // } } .roll-data { diff --git a/templates/dialogs/tagTeamDialog/initialization.hbs b/templates/dialogs/tagTeamDialog/initialization.hbs index 60b11c7e..9079f468 100644 --- a/templates/dialogs/tagTeamDialog/initialization.hbs +++ b/templates/dialogs/tagTeamDialog/initialization.hbs @@ -12,7 +12,7 @@ {{/each}} -
+
diff --git a/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs b/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs deleted file mode 100644 index 058777a5..00000000 --- a/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs +++ /dev/null @@ -1,25 +0,0 @@ -{{#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 b44aca7f..5ac6796b 100644 --- a/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs +++ b/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs @@ -107,11 +107,31 @@
{{#if damage}} - {{#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}} + {{#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}} {{else}} {{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.makeYourRoll"}} {{/if}}