diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-07-25 12:06:15 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-25 12:06:15 +0200 |
commit | a883830f6370f0e7c27132641d69d6b8d5904a0f (patch) | |
tree | ef5e9f05684243d5324bca3afc2bf4350f085127 | |
parent | 51b710372e37c331c62c1c14e9661c11a062aac3 (diff) | |
download | time-of-crisis-a883830f6370f0e7c27132641d69d6b8d5904a0f.tar.gz |
Fix tied emperor turns legacy calculation.
-rw-r--r-- | rules.js | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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 |