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 =
|
const modifierBP =
|
||||||
this.combats
|
this.combats
|
||||||
.find(x => x.active)
|
.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 maxBP = CONFIG.DH.ENCOUNTER.BaseBPPerEncounter(context.characters.length) + modifierBP;
|
||||||
const currentBP = AdversaryBPPerEncounter(context.adversaries, context.characters);
|
const currentBP = AdversaryBPPerEncounter(context.adversaries, context.characters);
|
||||||
|
|
||||||
Object.assign(context, {
|
Object.assign(context, {
|
||||||
fear: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear),
|
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) {
|
if (type.partyAmountPerBP) {
|
||||||
acc += characters.length === 0 ? 0 : Math.ceil(entry.nr / characters.length);
|
acc += characters.length === 0 ? 0 : Math.ceil(entry.nr / characters.length);
|
||||||
} else {
|
} else {
|
||||||
acc += bpCost;
|
acc += bpCost * entry.nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
let html = options.html;
|
let html = options.html;
|
||||||
if (element.dataset.tooltip?.startsWith('#battlepoints#')) {
|
if (element.dataset.tooltip?.startsWith('#battlepoints#')) {
|
||||||
this.#wide = true;
|
this.#wide = true;
|
||||||
|
this.#bordered = true;
|
||||||
|
|
||||||
html = await this.getBattlepointHTML(element.dataset.combatId);
|
html = await this.getBattlepointHTML(element.dataset.combatId);
|
||||||
options.direction = this._determineItemTooltipDirection(element);
|
options.direction = this._determineItemTooltipDirection(element);
|
||||||
|
|
@ -22,6 +23,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
this.#wide = false;
|
this.#wide = false;
|
||||||
|
this.#bordered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.dataset.tooltip === '#effect-display#') {
|
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 });
|
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) {
|
_determineItemTooltipDirection(element, prefered = this.constructor.TOOLTIP_DIRECTIONS.LEFT) {
|
||||||
const pos = element.getBoundingClientRect();
|
const pos = element.getBoundingClientRect();
|
||||||
const dirs = this.constructor.TOOLTIP_DIRECTIONS;
|
const dirs = this.constructor.TOOLTIP_DIRECTIONS;
|
||||||
|
|
@ -247,12 +241,17 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
if (this.#wide) {
|
if (this.#wide) {
|
||||||
this.tooltip.classList.add('wide');
|
this.tooltip.classList.add('wide');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.#bordered) {
|
||||||
|
this.tooltip.classList.add('bordered-tooltip');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
lockTooltip() {
|
lockTooltip() {
|
||||||
const clone = super.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;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,12 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-bottom: 16px;
|
|
||||||
|
.battlepoint-categories-inner-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.battlepoint-grouping-container {
|
.battlepoint-grouping-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#tooltip.bordered-tooltip {
|
#tooltip.bordered-tooltip,
|
||||||
|
.locked-tooltip.bordered-tooltip {
|
||||||
border: 1px solid @golden;
|
border: 1px solid @golden;
|
||||||
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
||||||
|
|
||||||
|
|
@ -14,6 +15,7 @@
|
||||||
.tooltip-header {
|
.tooltip-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
text-align: start;
|
text-align: start;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
gap: 0px;
|
gap: 0px;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
.locked-tooltip {
|
.locked-tooltip {
|
||||||
&.wide {
|
&.wide {
|
||||||
max-width: 480px;
|
max-width: 480px;
|
||||||
|
|
||||||
|
.daggerheart.dh-style.tooltip {
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.daggerheart.dh-style.tooltip {
|
.daggerheart.dh-style.tooltip {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,24 @@
|
||||||
<div class="daggerheart dh-style tooltip">
|
<div class="daggerheart dh-style tooltip">
|
||||||
|
|
||||||
|
<div class="tooltip-header"><h2>{{localize "Adversaries"}} ({{currentBP}}/{{maxBP}})</h2></div>
|
||||||
<div class="battlepoint-categories-container">
|
<div class="battlepoint-categories-container">
|
||||||
<h3>{{localize "Adversaries"}} ({{currentBP}}/{{maxBP}})</h3>
|
<div class="battlepoint-categories-inner-container">
|
||||||
{{#each categories as |category key|}}
|
{{#each categories as |category key|}}
|
||||||
{{#each category as |grouping index|}}
|
{{#each category as |grouping index|}}
|
||||||
<div class="battlepoint-grouping-container">
|
<div class="battlepoint-grouping-container">
|
||||||
{{#if grouping.nr}}
|
{{#if grouping.nr}}
|
||||||
<label>{{key}} BP: {{concat (localize grouping.description) ' ' '('grouping.nr 'x)'}}</label>
|
<label>{{key}} BP: {{concat (localize grouping.description) ' ' '('grouping.nr 'x)'}}</label>
|
||||||
{{else}}
|
{{else}}
|
||||||
<label class="unselected-grouping">{{key}} BP - {{localize grouping.description}}</label>
|
<label class="unselected-grouping">{{key}} BP - {{localize grouping.description}}</label>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
{{/each}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/each}}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="tooltip-header"><h2>{{localize "Modifiers"}}</h2></div>
|
||||||
<div class="battlepoint-toggles-container">
|
<div class="battlepoint-toggles-container">
|
||||||
<h3>{{localize "Modifiers"}}</h3>
|
|
||||||
{{#each toggles as |toggle|}}
|
{{#each toggles as |toggle|}}
|
||||||
<div class="battlepoint-toggle-container {{#if (and toggle.disabled (not toggle.checked))}}inactive{{/if}}">
|
<div class="battlepoint-toggle-container {{#if (and toggle.disabled (not toggle.checked))}}inactive{{/if}}">
|
||||||
{{#if toggle.disabled}}
|
{{#if toggle.disabled}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue