diff --git a/src/module/combat/combat-tracker.js b/src/module/combat/combat-tracker.js index c556e763..9277600f 100644 --- a/src/module/combat/combat-tracker.js +++ b/src/module/combat/combat-tracker.js @@ -244,7 +244,7 @@ calculateEncounterDifficulty(combatants) { const combatant = combatants.get(combId) if (!combatant) return - if (!game.modules.get('lancer-initiative')) { + if (this.initiativeMethod === 's' && !game.modules.get('lancer-initiative').active) { const multipleCombatants = game.combat.getCombatantsByToken(combatant.token) if (combatant.actor?.system.fastAndSlowTurn && multipleCombatants.length == 2) { @@ -252,20 +252,20 @@ calculateEncounterDifficulty(combatants) { init = combatant._id === multipleCombatants[0]._id ? game.i18n.localize('DL.TurnSlow') : game.i18n.localize('DL.TurnFast') + // Display only - if (this.initiativeMethod === 's') el.getElementsByClassName('token-initiative')[0].innerHTML = `${init}` + el.getElementsByClassName('token-initiative')[0].innerHTML = `${init}` } else { init = combatant.actor?.system.fastturn ? game.i18n.localize('DL.TurnFast') : game.i18n.localize('DL.TurnSlow') // Change initiative by clicking on the name - if (this.initiativeMethod === 's') el.getElementsByClassName('token-initiative')[0].innerHTML = - `${init}` + el.getElementsByClassName('token-initiative')[0].innerHTML = `${init}` } } - if (this.initiativeMethod === 'h' && game.user.isGM) + if (this.initiativeMethod === 'h' && game.user.isGM && !game.modules.get('lancer-initiative').active) { let groupID = combatant.flags?.demonlord?.group switch (groupID) { diff --git a/src/module/demonlord.js b/src/module/demonlord.js index bda935de..8b2398f5 100644 --- a/src/module/demonlord.js +++ b/src/module/demonlord.js @@ -548,6 +548,21 @@ Hooks.on('renderCompendiumDirectory', async (app, html, _data) => { footer.append(button) }) +// Combat hooks +Hooks.on('combatTurnChange', async (combat, prior, _current) => { + if (game.user.isGM && prior.combatantId) { + const combatant = combat.combatants.get(prior.combatantId) + combatant.setFlag('demonlord', 'hasActed', true) + } +}) + +Hooks.on('combatRound', async (combat) => { + // Reset hasActed flag for all combatants at the start of each round + for (let combatant of combat.combatants) { + await combatant.setFlag('demonlord', 'hasActed', false) + } +}) + Hooks.once('diceSoNiceReady', dice3d => { dice3d.addSystem({id: 'demonlord', name: 'Demonlord'}, true) dice3d.addDicePreset({