Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/game.js')
-rw-r--r--src/modules/game.js12
1 files changed, 5 insertions, 7 deletions
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)) {