mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
.
This commit is contained in:
parent
09141053c9
commit
2b1535333a
7 changed files with 40 additions and 26 deletions
|
|
@ -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 }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
.locked-tooltip {
|
||||
&.wide {
|
||||
max-width: 480px;
|
||||
|
||||
.daggerheart.dh-style.tooltip {
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
|
||||
.daggerheart.dh-style.tooltip {
|
||||
|
|
|
|||
|
|
@ -1,20 +1,24 @@
|
|||
<div class="daggerheart dh-style tooltip">
|
||||
|
||||
<div class="tooltip-header"><h2>{{localize "Adversaries"}} ({{currentBP}}/{{maxBP}})</h2></div>
|
||||
<div class="battlepoint-categories-container">
|
||||
<h3>{{localize "Adversaries"}} ({{currentBP}}/{{maxBP}})</h3>
|
||||
{{#each categories as |category key|}}
|
||||
{{#each category as |grouping index|}}
|
||||
<div class="battlepoint-grouping-container">
|
||||
{{#if grouping.nr}}
|
||||
<label>{{key}} BP: {{concat (localize grouping.description) ' ' '('grouping.nr 'x)'}}</label>
|
||||
{{else}}
|
||||
<label class="unselected-grouping">{{key}} BP - {{localize grouping.description}}</label>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="battlepoint-categories-inner-container">
|
||||
{{#each categories as |category key|}}
|
||||
{{#each category as |grouping index|}}
|
||||
<div class="battlepoint-grouping-container">
|
||||
{{#if grouping.nr}}
|
||||
<label>{{key}} BP: {{concat (localize grouping.description) ' ' '('grouping.nr 'x)'}}</label>
|
||||
{{else}}
|
||||
<label class="unselected-grouping">{{key}} BP - {{localize grouping.description}}</label>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tooltip-header"><h2>{{localize "Modifiers"}}</h2></div>
|
||||
<div class="battlepoint-toggles-container">
|
||||
<h3>{{localize "Modifiers"}}</h3>
|
||||
{{#each toggles as |toggle|}}
|
||||
<div class="battlepoint-toggle-container {{#if (and toggle.disabled (not toggle.checked))}}inactive{{/if}}">
|
||||
{{#if toggle.disabled}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue