From 734af1b5803a048e64e47b9eb49d41379e88cffc Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Thu, 2 May 2024 17:19:26 -0700
Subject: Fix preexisting prone counter not removing if unit end movement
without moving
---
src/modules/game/soldier.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
(limited to 'src')
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js
index c5b2323..ffb902b 100644
--- a/src/modules/game/soldier.js
+++ b/src/modules/game/soldier.js
@@ -115,11 +115,13 @@ export function removeClones(svg, counter) {
}
export function endMove(svg, counter) {
- const proneCounter = counter.querySelector('[href="#counter-prone"]');
-
- if (proneCounter) {
- proneCounter.dataset.preexisting = '';
- }
+ Array.from(counter.children).forEach(n => {
+ if (n.classList.contains('removed')) {
+ n.remove();
+ } else {
+ n.dataset.preexisting = '';
+ }
+ });
svg.querySelector(traceSelector(counter))?.remove();
delete counter.dataset.previous;
--
cgit v1.2.3