index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/modules/gameboard.js')
-rw-r--r-- | src/modules/gameboard.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/modules/gameboard.js b/src/modules/gameboard.js index 3482ce7..2df5b36 100644 --- a/src/modules/gameboard.js +++ b/src/modules/gameboard.js @@ -234,6 +234,7 @@ export function start(el) { selector = `[data-allegiance="${allegiance}"][data-number="${number}"]`; svg.querySelectorAll(selector).forEach(el => el.remove()); + selectCallback(); } }); @@ -272,15 +273,18 @@ export function start(el) { } export function select(selected) { - const counter = soldier.getCounter(svg, selected); + unSelect(); + let counter = soldier.getCounter(svg, selected); if (counter) { - unSelect(); - placing.push(counter); - counter.classList.add(soldier.getSelectedClass()); firingArc.get(svg, counter).forEach(el => el.removeAttribute('clip-path')); - selectCallback && selectCallback({ prone: soldier.hasProne(counter), ...counter.dataset }); + } else { + counter = soldier.createCounter(selected); } + + placing.push(counter); + counter.classList.add(soldier.getSelectedClass()); + selectCallback && selectCallback({ prone: soldier.hasProne(counter), ...counter.dataset }); } export function unSelect() { |