mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge branch 'main' into feature/death-moves
This commit is contained in:
commit
7d0011792f
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue