More progress

* Make it so that the initiative isn't actually saved to the database
* Add .25 for unknown disposition entities
* Add .5 for entities that lose the coinflip
This commit is contained in:
Oliver-Akins 2025-02-14 23:23:53 -07:00
parent e302b56a4e
commit c549a59c13
6 changed files with 146 additions and 23 deletions

View file

@ -1,5 +1,3 @@
import { Logger } from "../../utils/Logger.mjs";
const { CombatTracker } = foundry.applications.sidebar.tabs;
export class RipCryptCombatTracker extends CombatTracker {
@ -7,15 +5,13 @@ export class RipCryptCombatTracker extends CombatTracker {
* @override
*/
async _prepareTurnContext(combat, combatant, index) {
Logger.debug(`_prepareTurnContext`);
const turn = await super._prepareTurnContext(combat, combatant, index);
// if ( !this.viewed ) return;
turn.hasDecimals = true;
turn.initiative = combatant.dynamicInitiative;
// ! TODO: This is causing an error while the combat is not active, but is fine when it's active, this needs to be fixed
Logger.debug(turn, combatant);
const groupKey = combatant.groupKey;
if (groupKey) {
if (groupKey && combat.started) {
turn.active ||= combat.combatant.groupKey === groupKey;
if (turn.active && !turn.css.includes(`active`)) {
turn.css += `active`;
@ -23,5 +19,15 @@ export class RipCryptCombatTracker extends CombatTracker {
};
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();
};
};