summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-10-31 14:34:34 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commit3b359b06d5e5460feb3eb969761094559f90c6e1 (patch)
treee0e7693f4b0545f3b65eca8af2eafc3599d6c3be
parent57a65847177425776c348da5fa82eec4afeee608 (diff)
downloadpax-pamir-3b359b06d5e5460feb3eb969761094559f90c6e1.tar.gz
Don't mark cards as used if you pay "0" coins to them.
-rw-r--r--rules.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/rules.js b/rules.js
index 98d19e3..9e9087d 100644
--- a/rules.js
+++ b/rules.js
@@ -1072,13 +1072,15 @@ states.actions = {
let cost = market_cost(col, c)
let cost_per_card = cost / col
- for (let i = 0; i < col; ++i) {
- if (game.market_cards[row][i] > 0) {
- game.market_coins[row][i] += cost_per_card
- mark_card_used(game.market_cards[row][i])
- } else {
- game.market_coins[1-row][i] += cost_per_card
- mark_card_used(game.market_cards[1-row][i])
+ if (cost_per_card > 0) {
+ for (let i = 0; i < col; ++i) {
+ if (game.market_cards[row][i] > 0) {
+ game.market_coins[row][i] += cost_per_card
+ mark_card_used(game.market_cards[row][i])
+ } else {
+ game.market_coins[1-row][i] += cost_per_card
+ mark_card_used(game.market_cards[1-row][i])
+ }
}
}
check_public_withdrawal()