summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-13 22:53:36 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit40fd74d16cdd2749c512e38989783894b001d7b2 (patch)
treee044fa6bb8441fd3956283e7209c65116993c199 /play.js
parentd6373f1887af64b092d55fa07d70ad383721405b (diff)
downloadtable-battles-40fd74d16cdd2749c512e38989783894b001d7b2.tar.gz
Tactical victory check.
Diffstat (limited to 'play.js')
-rw-r--r--play.js11
1 files changed, 11 insertions, 0 deletions
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)