From d939e4e0146919eb323e62bd59d0b92611fe968a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 1 Nov 2024 00:36:33 +0100 Subject: show troop total in power banner --- rules.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 06c6446..e027f01 100644 --- a/rules.js +++ b/rules.js @@ -6189,6 +6189,17 @@ function is_trump_card(c) { return (game.trump >= 0) && (is_reserve(c) || to_suit(c) === game.trump) } +function total_troops_list() { + let list = [] + for (let pow of all_powers) { + let n = 0 + for (let p of all_power_generals[pow]) + n += game.troops[p] + list[pow] = n + } + return list +} + exports.view = function (state, player) { game = state view = { @@ -6211,6 +6222,7 @@ exports.view = function (state, player) { troops: mask_troops(player), hand1: mask_hand1(player), hand2: mask_hand2(player), + pt: total_troops_list(), discard: total_discard_list(), contracts: game.contracts, -- cgit v1.2.3