Web Dev Solutions

Catalin Mititiuc

From 62a745d59f27c55f2c3689d2bebdc11684621e7b Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Wed, 24 Apr 2024 15:50:59 -0700 Subject: Change troop-number and troop-allegiance references to just number and allegiance --- src/modules/game.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/modules/game.js') diff --git a/src/modules/game.js b/src/modules/game.js index d6059ae..2810fba 100644 --- a/src/modules/game.js +++ b/src/modules/game.js @@ -50,8 +50,8 @@ export default class Game { return this.svg.querySelector('line.sight-line'); } - getExistingArcs(al, n) { - return this.svg.querySelectorAll(`#firing-arcs polygon[data-number="${n}"][data-allegiance="${al}"]`); + getExistingArcs({ dataset: { allegiance, number }}) { + return this.svg.querySelectorAll(`#firing-arcs polygon[data-number="${number}"][data-allegiance="${allegiance}"]`); } getUnclippedFiringArcs() { @@ -99,14 +99,14 @@ export default class Game { } } - select({ dataset: { allegiance, number } }) { - const counter = this.counter.getCounter(allegiance, number); + select(selected) { + const counter = this.counter.getCounter(selected); if (counter) { this.unSelect(); this.placing.push(counter); counter.classList.add(this.counter.selectedClass); - this.getExistingArcs(allegiance, number).forEach(el => el.removeAttribute('clip-path')); + this.getExistingArcs(counter).forEach(el => el.removeAttribute('clip-path')); this.selectCallback({ prone: this.counter.hasProne(counter), ...counter.dataset }); } } @@ -185,8 +185,6 @@ export default class Game { contents: this.getCellContents(cell) }; - console.log(state); - let toPlace = this.placing.pop(); if (isGrenade(toPlace)) { -- cgit v1.2.3