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/game')
-rw-r--r-- | src/modules/game/soldier.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js index fc3d113..7a3ffaa 100644 --- a/src/modules/game/soldier.js +++ b/src/modules/game/soldier.js @@ -1,4 +1,5 @@ import counters from './assets/images/counters.svg'; +import { extractWeaponFromRecord, isRecord } from '../record_sheet.js'; const selectedClass = 'selected'; @@ -58,8 +59,11 @@ function createTrace(previous, current, selected) { export function createCounter(selected, weapon = 'rifle') { const use = document.createElementNS(svgns, 'use'); const g = document.createElementNS(svgns, 'g'); - use.setAttributeNS(null, 'href', `../../${counters}#${weapon}`); + const assignedWeapon = isRecord(selected) ? extractWeaponFromRecord(selected) : weapon; + + use.setAttributeNS(null, 'href', `../../${counters}#${assignedWeapon}`); use.classList.add('primary-weapon'); + g.classList.add('counter'); g.dataset.allegiance = selected.dataset.allegiance; g.dataset.number = selected.dataset.number; |