ripcrypt/module/Apps/sidebar/CombatTracker.mjs
2025-02-15 01:43:25 -07:00

33 lines
980 B
JavaScript

const { CombatTracker } = foundry.applications.sidebar.tabs;
export class RipCryptCombatTracker extends CombatTracker {
/**
* @override
*/
async _prepareTurnContext(combat, combatant, index) {
const turn = await super._prepareTurnContext(combat, combatant, index);
turn.hasDecimals = true;
turn.initiative = combatant.dynamicInitiative;
const groupKey = combatant?.groupKey;
if (groupKey && combat.started) {
turn.active ||= combat.combatant?.groupKey === groupKey;
if (turn.active && !turn.css.includes(`active`)) {
turn.css += `active`;
};
};
return turn;
};
async _onRender(...args) {
await super._onRender(...args);
// Purge the combat controls that I don't want to exist because they don't
// make sense in the system.
this.element.querySelector(`[data-action="resetAll"]`)?.remove();
this.element.querySelector(`[data-action="rollNPC"]`)?.remove();
this.element.querySelector(`[data-action="rollAll"]`)?.remove();
};
};