summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-07-25 12:06:15 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-25 12:06:15 +0200
commita883830f6370f0e7c27132641d69d6b8d5904a0f (patch)
treeef5e9f05684243d5324bca3afc2bf4350f085127
parent51b710372e37c331c62c1c14e9661c11a062aac3 (diff)
downloadtime-of-crisis-a883830f6370f0e7c27132641d69d6b8d5904a0f.tar.gz
Fix tied emperor turns legacy calculation.
-rw-r--r--rules.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/rules.js b/rules.js
index d7d6968..76acbaa 100644
--- a/rules.js
+++ b/rules.js
@@ -5249,17 +5249,18 @@ function max_emperor_turns(cutoff) {
return n
}
-function award_emperor_turns(amount, cutoff) {
+function award_emperor_turns(amount, n, cutoff) {
let x = max_emperor_turns(cutoff)
if (x > 0) {
for (let p = 0; p < get_player_count(); ++p) {
if (game.emperor_turns[p] === x) {
logi(PLAYER_NAME[p] + " +" + amount + " Legacy")
game.legacy[p] += amount
+ n += 1
}
}
}
- return x
+ return [n, x]
}
function vp_tie(p) {
@@ -5288,10 +5289,10 @@ function goto_game_end() {
log_h3("Emperor Turns:")
- let cutoff = award_emperor_turns(10, 1000)
- cutoff = award_emperor_turns(6, cutoff)
- cutoff = award_emperor_turns(3, cutoff)
- award_emperor_turns(0, cutoff)
+ let [n, cutoff] = award_emperor_turns(10, 0, 1000)
+ if (n < 2) [n, cutoff] = award_emperor_turns(6, n, cutoff)
+ if (n < 3) [n, cutoff] = award_emperor_turns(3, n, cutoff)
+ award_emperor_turns(0, n, cutoff)
log_h3("Final Score:")
game.current = game.first