diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-27 18:55:06 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:38 +0100 |
commit | daeef6c6473cc6285f75f45f56e074c6acd0525e (patch) | |
tree | 3d0a98bbfd465d3886f74818792f770baa9068e9 /ui.js | |
parent | abffcc1c2282123265784c899ce5c569b34da8e3 (diff) | |
download | crusader-rex-daeef6c6473cc6285f75f45f56e074c6acd0525e.tar.gz |
crusader: Flash 'click next' when out of options in battles.
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -808,6 +808,24 @@ function update_battle() { } } +let flash_timer = 0; +function start_flash() { + let element = document.querySelector(".battle_message"); + let tick = true; + if (flash_timer) + return; + flash_timer = setInterval(function () { + if (!game.flash_next) { + element.textContent = game.battle.flash; + clearInterval(flash_timer); + flash_timer = 0; + } else { + element.textContent = tick ? game.battle.flash : game.flash_next; + tick = !tick; + } + }, 1000); +} + function on_update() { show_action_button("#next_button", "next"); show_action_button("#pass_button", "pass"); @@ -833,6 +851,8 @@ function on_update() { if (game.battle) { document.querySelector(".battle_header").textContent = game.battle.title; document.querySelector(".battle_message").textContent = game.battle.flash; + if (game.flash_next) + start_flash(); document.querySelector(".battle").classList.add("show"); update_battle(); } else { |