From 26316a6b8d32e4075eb09826f66a9ce07d4af7e3 Mon Sep 17 00:00:00 2001 From: The Happy Anarchist Date: Sat, 12 Sep 2020 23:13:06 -1000 Subject: [PATCH] Added hold turn tracker for Judge --- src/module/combat.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/module/combat.js b/src/module/combat.js index e9538c7..618d0b6 100644 --- a/src/module/combat.js +++ b/src/module/combat.js @@ -101,6 +101,10 @@ export class AcksCombat { controls.eq(1).after( `` ); + const holdActive = cmbtant.flags.acks && cmbtant.flags.acks.holdTurn ? "active" : ""; + controls.eq(1).after( + `` + ); }); AcksCombat.announceListener(html); @@ -162,6 +166,16 @@ export class AcksCombat { } static announceListener(html) { + html.find(".combatant-control.hold-turn").click((ev) => { + ev.preventDefault(); + // Toggle hold announcement + let id = $(ev.currentTarget).closest(".combatant")[0].dataset.combatantId; + let isActive = ev.currentTarget.classList.contains('active'); + game.combat.updateCombatant({ + _id: id, + flags: { acks: { holdTurn: !isActive } }, + }); + }) html.find(".combatant-control.prepare-spell").click((ev) => { ev.preventDefault(); // Toggle spell announcement @@ -174,14 +188,14 @@ export class AcksCombat { }); html.find(".combatant-control.move-combat").click((ev) => { ev.preventDefault(); - // Toggle spell announcement + // Toggle retreat announcement let id = $(ev.currentTarget).closest(".combatant")[0].dataset.combatantId; let isActive = ev.currentTarget.classList.contains('active'); game.combat.updateCombatant({ _id: id, flags: { acks: { moveInCombat: !isActive } }, }); - }) + }); } static addListeners(html) {