From 2b1535333a3e2623a9b51e2ec3334b952de7b933 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Mon, 8 Dec 2025 21:01:29 +0100 Subject: [PATCH] . --- module/applications/ui/combatTracker.mjs | 4 +-- module/config/encounterConfig.mjs | 2 +- module/documents/tooltipManager.mjs | 17 ++++++------ styles/less/ux/tooltip/battlepoints.less | 7 ++++- styles/less/ux/tooltip/bordered-tooltip.less | 4 ++- styles/less/ux/tooltip/tooltip.less | 4 +++ templates/ui/tooltip/battlepoints.hbs | 28 +++++++++++--------- 7 files changed, 40 insertions(+), 26 deletions(-) diff --git a/module/applications/ui/combatTracker.mjs b/module/applications/ui/combatTracker.mjs index b1e658a5..23bede60 100644 --- a/module/applications/ui/combatTracker.mjs +++ b/module/applications/ui/combatTracker.mjs @@ -42,13 +42,13 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C const modifierBP = this.combats .find(x => x.active) - ?.system?.extendedBattleToggles?.reduce((acc, toggle) => acc + toggle.category, 0) ?? 0; + ?.system?.extendedBattleToggles?.reduce((acc, toggle) => (acc ?? 0) + toggle.category, null) ?? null; const maxBP = CONFIG.DH.ENCOUNTER.BaseBPPerEncounter(context.characters.length) + modifierBP; const currentBP = AdversaryBPPerEncounter(context.adversaries, context.characters); Object.assign(context, { fear: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear), - battlepoints: { max: maxBP, current: currentBP, hasModifierBP: Boolean(modifierBP) } + battlepoints: { max: maxBP, current: currentBP, hasModifierBP: modifierBP !== null } }); } diff --git a/module/config/encounterConfig.mjs b/module/config/encounterConfig.mjs index 96efd745..0269b5c1 100644 --- a/module/config/encounterConfig.mjs +++ b/module/config/encounterConfig.mjs @@ -21,7 +21,7 @@ export const AdversaryBPPerEncounter = (adversaries, characters) => { if (type.partyAmountPerBP) { acc += characters.length === 0 ? 0 : Math.ceil(entry.nr / characters.length); } else { - acc += bpCost; + acc += bpCost * entry.nr; } return acc; diff --git a/module/documents/tooltipManager.mjs b/module/documents/tooltipManager.mjs index 23e04ac1..1784698a 100644 --- a/module/documents/tooltipManager.mjs +++ b/module/documents/tooltipManager.mjs @@ -10,6 +10,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti let html = options.html; if (element.dataset.tooltip?.startsWith('#battlepoints#')) { this.#wide = true; + this.#bordered = true; html = await this.getBattlepointHTML(element.dataset.combatId); options.direction = this._determineItemTooltipDirection(element); @@ -22,6 +23,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti return; } else { this.#wide = false; + this.#bordered = false; } if (element.dataset.tooltip === '#effect-display#') { @@ -168,14 +170,6 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti super.activate(element, { ...options, html: html }); } - _setStyle(position = {}) { - super._setStyle(position); - - if (this.#bordered) { - this.tooltip.classList.add('bordered-tooltip'); - } - } - _determineItemTooltipDirection(element, prefered = this.constructor.TOOLTIP_DIRECTIONS.LEFT) { const pos = element.getBoundingClientRect(); const dirs = this.constructor.TOOLTIP_DIRECTIONS; @@ -247,12 +241,17 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti if (this.#wide) { this.tooltip.classList.add('wide'); } + + if (this.#bordered) { + this.tooltip.classList.add('bordered-tooltip'); + } } /**@inheritdoc */ lockTooltip() { const clone = super.lockTooltip(); - clone.classList.add('wide'); + if (this.#wide) clone.classList.add('wide'); + if (this.#bordered) clone.classList.add('bordered-tooltip'); return clone; } diff --git a/styles/less/ux/tooltip/battlepoints.less b/styles/less/ux/tooltip/battlepoints.less index 61c7083d..9fe43a75 100644 --- a/styles/less/ux/tooltip/battlepoints.less +++ b/styles/less/ux/tooltip/battlepoints.less @@ -3,7 +3,12 @@ display: flex; flex-direction: column; gap: 8px; - margin-bottom: 16px; + + .battlepoint-categories-inner-container { + display: flex; + flex-direction: column; + gap: 8px; + } .battlepoint-grouping-container { display: flex; diff --git a/styles/less/ux/tooltip/bordered-tooltip.less b/styles/less/ux/tooltip/bordered-tooltip.less index a4779d71..78622377 100644 --- a/styles/less/ux/tooltip/bordered-tooltip.less +++ b/styles/less/ux/tooltip/bordered-tooltip.less @@ -1,4 +1,5 @@ -#tooltip.bordered-tooltip { +#tooltip.bordered-tooltip, +.locked-tooltip.bordered-tooltip { border: 1px solid @golden; background-image: url('../assets/parchments/dh-parchment-dark.png'); @@ -14,6 +15,7 @@ .tooltip-header { display: flex; flex-direction: column; + align-items: center; text-align: start; padding: 5px; gap: 0px; diff --git a/styles/less/ux/tooltip/tooltip.less b/styles/less/ux/tooltip/tooltip.less index 4579a3d8..2aa1c2c7 100644 --- a/styles/less/ux/tooltip/tooltip.less +++ b/styles/less/ux/tooltip/tooltip.less @@ -2,6 +2,10 @@ .locked-tooltip { &.wide { max-width: 480px; + + .daggerheart.dh-style.tooltip { + align-items: start; + } } .daggerheart.dh-style.tooltip { diff --git a/templates/ui/tooltip/battlepoints.hbs b/templates/ui/tooltip/battlepoints.hbs index ec8bbb1c..d793fe8c 100644 --- a/templates/ui/tooltip/battlepoints.hbs +++ b/templates/ui/tooltip/battlepoints.hbs @@ -1,20 +1,24 @@
+ +

{{localize "Adversaries"}} ({{currentBP}}/{{maxBP}})

-

{{localize "Adversaries"}} ({{currentBP}}/{{maxBP}})

- {{#each categories as |category key|}} - {{#each category as |grouping index|}} -
- {{#if grouping.nr}} - - {{else}} - - {{/if}} -
+
+ {{#each categories as |category key|}} + {{#each category as |grouping index|}} +
+ {{#if grouping.nr}} + + {{else}} + + {{/if}} +
+ {{/each}} {{/each}} - {{/each}} +
+ +

{{localize "Modifiers"}}

-

{{localize "Modifiers"}}

{{#each toggles as |toggle|}}
{{#if toggle.disabled}}