diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-02-16 22:56:44 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:12:42 +0100 |
commit | 61dd59b33138db47c6f8a45b7439c43d8daf4b21 (patch) | |
tree | ac70e0129c5683a3e35fd962695c705da70d66d6 /rules.js | |
parent | 16fa2b730bc38b4de0d0efac4635aa4541bb7a9d (diff) | |
download | shores-of-tripoli-61dd59b33138db47c6f8a45b7439c43d8daf4b21.tar.gz |
Update US score to be 24 - TR score.
Also record final score on game over.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -2771,11 +2771,16 @@ function check_frigate_victory() { return false; } +function calculate_tr_score() { + return Math.min(count_american_frigates(TRIPOLITAN_SUPPLY), 4) * 3 + game.tr.gold; +} + function goto_game_over(result, message) { game.where = null; game.state = 'game_over'; game.active = "None"; game.result = result; + game.score = calculate_tr_score(); if (result === TR) game.victory = "Tripolitan victory:\n" + message; else if (result === US) @@ -2925,7 +2930,8 @@ exports.is_checkpoint = (a, b) => a.season !== b.season; exports.view = function(state, current) { game = state; - let tr_score = Math.min(count_american_frigates(TRIPOLITAN_SUPPLY), 4) * 3 + game.tr.gold; + let tr_score = calculate_tr_score(); + let us_score = 24 - tr_score; let view = { log: game.log, @@ -2949,7 +2955,7 @@ exports.view = function(state, current) { draw: game.us.draw.length, discard: game.us.discard.length + (game.us.queue ? game.us.queue.length : 0), hand: game.us.hand.length, - score: 25 - tr_score, + score: us_score, }, card: game.active_card, where: game.where, |