summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-08 14:29:21 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:47 +0100
commit2bc24d10329f5ff9f4bc20a5e790c328abcbe21e (patch)
tree586e1d9c84e6b62aafacc4bb499a03bca557035f /play.js
parentbc9231a030f94f98eb2a0afcbeaea0bb89756b0d (diff)
downloadtable-battles-2bc24d10329f5ff9f4bc20a5e790c328abcbe21e.tar.gz
eslint
Diffstat (limited to 'play.js')
-rw-r--r--play.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/play.js b/play.js
index 7a95fdb..6bd7e4d 100644
--- a/play.js
+++ b/play.js
@@ -1,5 +1,7 @@
"use strict"
+/* global data, view, send_action, action_button, player */
+
const wing_name = [ "red", "pink", "blue", "dkblue" ]
const reactions = [ "Screen", "Counterattack", "Absorb" ]
@@ -133,8 +135,6 @@ function create_formation_slot(id, top) {
function create_formation_card(id) {
let card = data.cards[id]
let e = create_div("card formation " + wing_name[card.wing])
- let e_a1 = null
- let e_a2 = null
register_action(e, "card", id)
@@ -182,9 +182,9 @@ function create_formation_card(id) {
}
if (card.actions.length >= 1)
- e_a1 = create_action(card.actions[0], 1)
+ create_action(card.actions[0], 1)
if (card.actions.length >= 2)
- e_a2 = create_action(card.actions[1], 2)
+ create_action(card.actions[1], 2)
if (card.rule_text)
append_div(e, "rule_text", card.rule_text)
@@ -211,7 +211,7 @@ function create_formation_card(id) {
function fill_card_row(top, parent, list) {
parent.replaceChildren()
for (let id of list) {
- let i, n, x
+ let n, x
if (!ui.cards[id])
ui.cards[id] = create_formation_card(id)
@@ -357,6 +357,22 @@ for (let i = 0; i < 12; ++i) {
register_animation(ui.dice[i], 250)
}
+function set_has(set, item) {
+ let a = 0
+ let b = set.length - 1
+ while (a <= b) {
+ let m = (a + b) >> 1
+ let x = set[m]
+ if (item < x)
+ b = m - 1
+ else if (item > x)
+ a = m + 1
+ else
+ return true
+ }
+ return false
+}
+
function map_get(map, key, missing) {
let a = 0
let b = (map.length >> 1) - 1