From 40fd74d16cdd2749c512e38989783894b001d7b2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 13 Dec 2023 22:53:36 +0100 Subject: Tactical victory check. --- play.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'play.js') diff --git a/play.js b/play.js index 6d8eca6..5b5566e 100644 --- a/play.js +++ b/play.js @@ -8,6 +8,7 @@ const reactions = [ "Screen", "Counterattack", "Absorb" ] let ui = { main: document.querySelector("main"), role_name: [ document.getElementById("role1"), document.getElementById("role2") ], + role_stat: [ document.getElementById("stat1"), document.getElementById("stat2") ], name: [ document.getElementById("name1"), document.getElementById("name2") ], front: [ document.getElementById("front1"), document.getElementById("front2") ], morale: [ document.getElementById("morale1"), document.getElementById("morale2") ], @@ -315,6 +316,16 @@ function on_update() { ui.role_name[p1].textContent = data.scenarios[view.scenario].players[0].name ui.role_name[p2].textContent = data.scenarios[view.scenario].players[1].name + if (data.scenarios[view.scenario].players[1].tactical) + ui.role_stat[p1].textContent = `${view.morale[0]} (-${view.lost[0]})` + else + ui.role_stat[p1].textContent = view.morale[0] + + if (data.scenarios[view.scenario].players[0].tactical) + ui.role_stat[p2].textContent = `${view.morale[1]} (-${view.lost[1]})` + else + ui.role_stat[p2].textContent = view.morale[1] + for (let e of animation_registry) remember_position(e) -- cgit v1.2.3