diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-22 15:14:41 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:38 +0100 |
commit | c7856fc54d20e88f53adb72d93cd89a6045a2f1e (patch) | |
tree | d040bc7139d818af541a781e5cddf94c7d4bec7e | |
parent | 880049b3d4f7aa57e16633684f0a1f1519087339 (diff) | |
download | crusader-rex-c7856fc54d20e88f53adb72d93cd89a6045a2f1e.tar.gz |
crusader: Fix battle screen tooltips.
-rw-r--r-- | ui.js | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -102,20 +102,18 @@ function on_click_map_block(evt) { send_action('block', b); } -function is_battle_reserve(who, list) { - for (let [b, s, m] of list) - if (who == b) - return true; - return false; -} - function on_focus_battle_block(evt) { let b = evt.target.block; - let msg = block_name(b); - if (is_battle_reserve(b, game.battle.FR)) - msg = "Frank Reserve"; - if (is_battle_reserve(b, game.battle.SR)) - msg = "Saracen Reserve"; + let msg; + + if (!evt.target.classList.contains("known")) { + if (block_owner(b) == FRANKS) + msg = "Franks"; + else if (block_owner(b) == SARACENS) + msg = "Saracens"; + } else { + msg = block_name(b); + } if (game.actions && game.actions.battle_fire && game.actions.battle_fire.includes(b)) msg = "Fire with " + msg; @@ -123,6 +121,8 @@ function on_focus_battle_block(evt) { msg = "Storm with " + msg; else if (game.actions && game.actions.battle_sally && game.actions.battle_sally.includes(b)) msg = "Sally with " + msg; + else if (game.actions && game.actions.battle_withdraw && game.actions.battle_withdraw.includes(b)) + msg = "Withdraw with " + msg; else if (game.actions && game.actions.battle_hit && game.actions.battle_hit.includes(b)) msg = "Take hit on " + msg; |