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')
-rw-r--r-- | src/modules/game/soldier.js | 1 | ||||
-rw-r--r-- | src/modules/gameboard.js | 11 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js index ae1d708..2a89426 100644 --- a/src/modules/game/soldier.js +++ b/src/modules/game/soldier.js @@ -67,6 +67,7 @@ export function createCounter(selected) { const use = document.createElementNS(svgns, 'use'); const g = document.createElementNS(svgns, 'g'); use.setAttributeNS(null, 'href', `#t-${selected.dataset.number}`); + // use.setAttributeNS(null, 'href', `counters.svg#rifle`); g.classList.add('counter'); g.dataset.allegiance = selected.dataset.allegiance; g.dataset.number = selected.dataset.number; diff --git a/src/modules/gameboard.js b/src/modules/gameboard.js index 8b64617..a354795 100644 --- a/src/modules/gameboard.js +++ b/src/modules/gameboard.js @@ -175,14 +175,12 @@ function selectOffBoard() { } function select(data) { - if (!data) return; - - const counter = soldier.getCounter(svg, data) || soldier.createCounter(data); - const isSelected = counter.classList.contains(soldier.getSelectedClass()); + const counter = data && (soldier.getCounter(svg, data) || soldier.createCounter(data)); + const isSelected = counter?.classList.contains(soldier.getSelectedClass()); deselect(); - if (isSelected) return; + if (isSelected || !data) return; counter.classList.add(soldier.getSelectedClass()); firingArc.get(svg, counter).forEach(el => el.removeAttribute('clip-path')); @@ -223,7 +221,8 @@ export function start(el) { placing.push(toPlace); getLockedSightLine(svg) ? updateSightLine(toPlace.parentElement) : drawSightLine(toPlace.parentElement, cell); } else { - deselect(); + // deselect(); + Observable.notify('select'); } } else if (!occupant.classList.contains('clone')) { Observable.notify('select', occupant); |