Skip to content
Merged

5.6.6 #310

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/module/combat/combat-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,28 +244,28 @@ 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) {
// The combatant has a double initiative, so we display "Fast" and "Slow"
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 = `<span class="combatant-control dlturnorder">${init}</span>`
el.getElementsByClassName('token-initiative')[0].innerHTML = `<span class="combatant-control dlturnorder">${init}</span>`
} 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 =
`<a class="combatant-control dlturnorder" title="${i18n('DL.TurnChangeTurn')}">${init}</a>`
el.getElementsByClassName('token-initiative')[0].innerHTML = `<a class="combatant-control dlturnorder" title="${i18n('DL.TurnChangeTurn')}">${init}</a>`
}
}

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) {
Expand Down
15 changes: 15 additions & 0 deletions src/module/demonlord.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Loading