diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-08 14:45:52 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:47 +0100 |
commit | 127f51411515dec1eab118113002ed7c2cde0352 (patch) | |
tree | 7ac805037bae8f81eec10bd4d91eb85f1809bc31 | |
parent | 2bc24d10329f5ff9f4bc20a5e790c328abcbe21e (diff) | |
download | table-battles-127f51411515dec1eab118113002ed7c2cde0352.tar.gz |
"While this card is in play, you may place dice on TWO wing cards per turn."
-rw-r--r-- | rules.js | 52 |
1 files changed, 40 insertions, 12 deletions
@@ -16,6 +16,11 @@ var view = null const POOL = -1 +const RED = 0 +const PINK = 1 +const BLUE = 2 +const DKBLUE = 3 + exports.scenarios = { "": [ "Random" ], } @@ -537,16 +542,19 @@ function can_place_dice(c) { throw Error("bad pattern definition: " + pattern) let wing = data.cards[c].wing + let n_wing = 0 for (let i = 0; i < game.placed.length; i += 2) { let x = game.placed[i] if (x !== c) { - // TODO: place_2_on_WING ability let i_wing = data.cards[x].wing if (i_wing === wing) - return false + n_wing ++ } } + if (n_wing >= game.place_max[wing]) + return false + if (place_dice_once[pattern]) { if (map_has(game.placed, c)) return false @@ -746,6 +754,23 @@ function goto_roll_phase() { game.target = -1 game.action = 0 game.state = "roll" + + game.place_max = [ 1, 1, 1, 1 ] + + let p = player_index() + for (let c of game.front[p]) { + let rules = data.cards[c].rules + if (rules) { + if (rules.place_2_blue) + game.place_max[BLUE] = 2 + if (rules.place_2_red) + game.place_max[RED] = 2 + if (rules.place_2_pink) + game.place_max[PINK] = 2 + if (rules.place_2_dkblue) + game.place_max[DKBLUE] = 2 + } + } } states.roll = { @@ -829,6 +854,7 @@ states.place_on_card = { function end_roll_phase() { clear_undo() map_clear(game.placed) + game.place_max = null // Remove placed dice to add cube on special cards. for (let c of game.front[player_index()]) { @@ -1504,16 +1530,18 @@ function resume_routing() { } function end_routing() { - // Morale loss - if ((game.routed[0] > 0 && !game.routed[1]) || (game.routed[1] > 0 && !game.routed[0])) { - if (game.routed[0]) { - game.routed[0] = Math.min(game.routed[0], game.morale[0]) - game.morale[0] -= game.routed[0] - game.morale[1] += game.routed[0] - } else { - game.routed[1] = Math.min(game.routed[1], game.morale[1]) - game.morale[1] -= game.routed[1] - game.morale[0] += game.routed[1] + // Morale loss and gain (except for S3 - Plains of Abraham) + if (game.morale[0] >= 0 && game.morale[1] >= 0) { + if ((game.routed[0] > 0 && !game.routed[1]) || (game.routed[1] > 0 && !game.routed[0])) { + if (game.routed[0]) { + game.routed[0] = Math.min(game.routed[0], game.morale[0]) + game.morale[0] -= game.routed[0] + game.morale[1] += game.routed[0] + } else { + game.routed[1] = Math.min(game.routed[1], game.morale[1]) + game.morale[1] -= game.routed[1] + game.morale[0] += game.routed[1] + } } } |