diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-12-03 16:15:16 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:38 +0100 |
commit | 31e14b3a7419d50e742e5b6288105cb26419bdcc (patch) | |
tree | 45c4ffde235dabf1700228677b7c4ffaa56671ef /play.js | |
parent | dacb621397c54e257e24bc02ee4f16dca977b037 (diff) | |
download | nevsky-31e14b3a7419d50e742e5b6288105cb26419bdcc.tar.gz |
Sail!
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -253,6 +253,21 @@ function is_card_in_use(c) { return false } +function has_global_capability(cap) { + for (let c of view.capabilities) + if (data.cards[c].capability === cap) + return true + return false +} + +function is_vassal_ready(vassal) { + return view.lords.vassals[vassal] === 0 +} + +function is_vassal_mustered(vassal) { + return view.lords.vassals[vassal] > 0 +} + function for_each_teutonic_card(fn) { for (let i = 0; i < 21; ++i) fn(i) @@ -808,13 +823,17 @@ function update_assets(id, parent, assets) { function update_vassals(ready_parent, mustered_parent, lord_ix) { for (let v of data.lords[lord_ix].vassals) { let e = ui.vassal_service[v] - if (view.lords.vassals[v] === 0) { + if (is_vassal_ready(v)) { e.classList.remove("hide") ready_parent.appendChild(e) - } else { + } + else if (is_vassal_mustered(v)) { e.classList.remove("hide") mustered_parent.appendChild(e) } + else { + e.classList.add("hide") + } e.classList.toggle("action", is_vassal_action(v)) } } |