diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 140 |
1 files changed, 90 insertions, 50 deletions
@@ -316,11 +316,13 @@ const CARD_S3X = [ 122, 129 ] const CARD_P3X = [ 130, 137 ] const CARD_M4 = [ 138, 143 ] const CARD_S4 = [ 144, 149 ] -const CARD_S4B = [ 150, 155 ] +const CARD_S4_V2 = [ 150, 155 ] // updated damnatio const CARD_P4 = [ 156, 161 ] const CARD_M4X = [ 162, 167 ] const CARD_S4X = [ 168, 173 ] const CARD_P4X = [ 174, 179 ] +const CARD_S3_V2 = [ 180, 188 ] // updated foederati +const CARD_P4X_V2 = [ 189, 194 ] // updated demagogue const CARD_INDEX = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, @@ -329,6 +331,8 @@ const CARD_INDEX = [ 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, + 22, 22, 22, 22, 22, 22, 22, 22, + 23, 23, 23, 23, 23, 23, ] const CARD_INFO = [ @@ -354,6 +358,8 @@ const CARD_INFO = [ { name: "M4(Spiculum)", type: 0, value: 4, event: "Spiculum" }, { name: "S4(Triumph)", type: 1, value: 4, event: "Triumph" }, { name: "P4(Demagogue)", type: 2, value: 4, event: "Demagogue" }, + { name: "S3(Foederati)", type: 1, value: 3, event: "Foederati" }, + { name: "P4(Demagogue)", type: 2, value: 4, event: "Demagogue" }, ] function card_name(c) { @@ -483,6 +489,10 @@ const BIT_MILITIA = 1 << 11 const BIT_BREAKAWAY = 1 << 12 const BIT_SEAT_OF_POWER = 1 << 13 const BIT_MILITIA_CASTRA = 1 << 14 +const BIT_MARKET = 1 << 15 +const BIT_MONUMENT = 1 << 16 +const BIT_PORT = 1 << 17 +const BIT_TEMPLE = 1 << 18 function is_no_place_governor(where) { return where >= game.provinces.length @@ -517,9 +527,20 @@ function remove_militia(where) { game.provinces[where] &= ~BIT_MILITIA } function has_amphitheater(where) { return game.provinces[where] & BIT_AMPHITHEATER } function has_basilica(where) { return game.provinces[where] & BIT_BASILICA } function has_limes(where) { return game.provinces[where] & BIT_LIMES } +function has_market(where) { return game.provinces[where] & BIT_MARKET } +function has_monument(where) { return game.provinces[where] & BIT_MONUMENT } +function has_port(where) { return game.provinces[where] & BIT_PORT } +function has_temple(where) { return game.provinces[where] & BIT_TEMPLE } + function add_amphitheater(where) { game.provinces[where] |= BIT_AMPHITHEATER } function add_basilica(where) { game.provinces[where] |= BIT_BASILICA } function add_limes(where) { game.provinces[where] |= BIT_LIMES } +function add_market(where) { game.provinces[where] |= BIT_MARKET } +function add_monument(where) { game.provinces[where] |= BIT_MONUMENT } +function add_port(where) { game.provinces[where] |= BIT_PORT } +function add_temple(where) { game.provinces[where] |= BIT_TEMPLE } + +function remove_monument(where) { game.provinces[where] &= ~BIT_MONUMENT } function is_breakaway(where) { return game.provinces[where] & BIT_BREAKAWAY } function add_breakaway(where) { game.provinces[where] |= BIT_BREAKAWAY } @@ -2641,7 +2662,7 @@ function goto_place_governor_success() { place_governor(game.where, game.selected_governor) - if (old_emperor >= 0 && !was_senate_emperor && (has_card_event(CARD_S4) || has_card_event(CARD_S4B))) { + if (old_emperor >= 0 && !was_senate_emperor && (has_card_event(CARD_S4) || has_card_event(CARD_S4_V2))) { game.count = (old_emperor << 3) | old_support game.state = "damnatio_memoriae" } else { @@ -2712,7 +2733,7 @@ states.damnatio_memoriae = { prompt() { prompt("Place Governor: You may play Damnatio Memoriae.") gen_card_event(CARD_S4) - gen_card_event(CARD_S4B) + gen_card_event(CARD_S4_V2) view.actions.pass = 1 }, card(c) { @@ -3759,7 +3780,7 @@ function play_triumph() { // TODO: skip players who have no turn left (auto-select worst card?) function can_play_demagogue() { - return !used_card_event(CARD_P4X) + return !used_card_event(CARD_P4X) && !used_card_event(CARD_P4X_V2) } function play_demagogue() { @@ -5462,7 +5483,11 @@ function setup_market_pile(cards) { let pile = [] for (let c = cards[0]; c <= cards[1]; ++c) pile.push(c) - return pile + game.market.push(pile) +} + +function setup_market_pile_random(cards1, cards2) { + setup_market_pile(random(2) ? cards1 : cards2) } function setup_barbarians(tribe, home) { @@ -5546,59 +5571,74 @@ exports.setup = function (seed, scenario, options) { game.emperor = NEUTRAL_EMPEROR } + game.market = [] + switch (scenario) { default: case "Standard": - game.market = [ - setup_market_pile(CARD_M2), - setup_market_pile(CARD_S2), - setup_market_pile(CARD_P2), - setup_market_pile(CARD_M3), - setup_market_pile(CARD_S3), - setup_market_pile(CARD_P3), - setup_market_pile(CARD_M4), - setup_market_pile(CARD_S4), - setup_market_pile(CARD_P4), - ] + setup_market_pile(CARD_M2) + setup_market_pile(CARD_S2) + setup_market_pile(CARD_P2) + setup_market_pile(CARD_M3) + if (is_classic()) + setup_market_pile(CARD_S3) + else + setup_market_pile(CARD_S3_V2) + setup_market_pile(CARD_P3) + setup_market_pile(CARD_M4) + setup_market_pile(CARD_S4) + setup_market_pile(CARD_P4) break + case "Expansion - Fixed": - game.market = [ - setup_market_pile(CARD_M2), - setup_market_pile(CARD_S2), - setup_market_pile(CARD_P2), - setup_market_pile(CARD_M2X), - setup_market_pile(CARD_S2X), - setup_market_pile(CARD_P2X), - setup_market_pile(CARD_M3), - setup_market_pile(CARD_S3), - setup_market_pile(CARD_P3), - setup_market_pile(CARD_M3X), - setup_market_pile(CARD_S3X), - setup_market_pile(CARD_P3X), - setup_market_pile(CARD_M4), - setup_market_pile(CARD_S4B), - setup_market_pile(CARD_P4), - setup_market_pile(CARD_M4X), - setup_market_pile(CARD_S4X), - ] - if (!options.no_demagogue) - game.market.push(setup_market_pile(CARD_P4X)) + setup_market_pile(CARD_M2) + setup_market_pile(CARD_S2) + setup_market_pile(CARD_P2) + setup_market_pile(CARD_M2X) + setup_market_pile(CARD_S2X) + setup_market_pile(CARD_P2X) + setup_market_pile(CARD_M3) + if (is_classic()) + setup_market_pile(CARD_S3) + else + setup_market_pile(CARD_S3_V2) + setup_market_pile(CARD_P3) + setup_market_pile(CARD_M3X) + setup_market_pile(CARD_S3X) + setup_market_pile(CARD_P3X) + setup_market_pile(CARD_M4) + setup_market_pile(CARD_S4_V2) + setup_market_pile(CARD_P4) + setup_market_pile(CARD_M4X) + setup_market_pile(CARD_S4X) + if (!options.no_demagogue) { + if (is_classic()) + setup_market_pile(CARD_P4X) + else + setup_market_pile(CARD_P4X_V2) + } break + case "Expansion - Random": - game.market = [ - setup_market_pile(random(2) ? CARD_M2 : CARD_M2X), - setup_market_pile(random(2) ? CARD_S2 : CARD_S2X), - setup_market_pile(random(2) ? CARD_P2 : CARD_P2X), - setup_market_pile(random(2) ? CARD_M3 : CARD_M3X), - setup_market_pile(random(2) ? CARD_S3 : CARD_S3X), - setup_market_pile(random(2) ? CARD_P3 : CARD_P3X), - setup_market_pile(random(2) ? CARD_M4 : CARD_M4X), - setup_market_pile(random(2) ? CARD_S4B : CARD_S4X), - ] - if (!options.no_demagogue) - game.market.push(setup_market_pile(random(2) ? CARD_P4 : CARD_P4X)) + setup_market_pile_random(CARD_M2, CARD_M2X) + setup_market_pile_random(CARD_S2, CARD_S2X) + setup_market_pile_random(CARD_P2, CARD_P2X) + setup_market_pile_random(CARD_M3, CARD_M3X) + if (is_classic()) + setup_market_pile_random(CARD_S3, CARD_S3X) else - game.market.push(setup_market_pile(CARD_P4)) + setup_market_pile_random(CARD_S3_V2, CARD_S3X) + setup_market_pile_random(CARD_P3, CARD_P3X) + setup_market_pile_random(CARD_M4, CARD_M4X) + setup_market_pile_random(CARD_S4_V2, CARD_S4X) + if (!options.no_demagogue) { + if (is_classic()) + setup_market_pile_random(CARD_P4, CARD_P4X) + else + setup_market_pile_random(CARD_P4, CARD_P4X_V2) + } else { + setup_market_pile(CARD_P4) + } break } |