diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-12-02 00:27:19 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:38 +0100 |
commit | dacb621397c54e257e24bc02ee4f16dca977b037 (patch) | |
tree | 13cc1406e204ec4ae894204cf86eb88ff4f3cb0c | |
parent | 38020cb5de2abcee0963937901e97b764e3270ea (diff) | |
download | nevsky-dacb621397c54e257e24bc02ee4f16dca977b037.tar.gz |
Remove "No Event" cards from short scenarios.
-rw-r--r-- | rules.js | 52 |
1 files changed, 35 insertions, 17 deletions
@@ -3,6 +3,8 @@ // TODO: game.who = array for feeding // TODO: highlight shield on mat instead of mat +const data = require("./data.js") + const TODO = false const BOTH = "Both" @@ -22,16 +24,6 @@ let states = {} exports.roles = [ P1, P2 ] exports.scenarios = [ - "Pleskau - 1240", - "Watland - 1241", - "Peipus - 1242", - "Return of the Prince - 1241 to 1242", - "Return of the Prince - Nicolle Variant", - "Crusade on Novgorod - 1240 to 1242", - "Pleskau - 1240 (Quickstart)", -] - -exports.scenarios = [ "Pleskau", "Watland", "Peipus", @@ -41,6 +33,23 @@ exports.scenarios = [ "Pleskau (Quickstart)", ] +const scenario_remove_no_event_cards = [ + "Pleskau", + "Watland", + "Peipus", + "Pleskau (Quickstart)" +] + +const scenario_last_turn = { + "Pleskau": 2, + "Watland": 8, + "Peipus": 16, + "Return of the Prince": 16, + "Return of the Prince (Nicolle)": 16, + "Crusade on Novgorod": 16, + "Pleskau (Quickstart)": 2, +} + // unit types const KNIGHTS = 0 const SERGEANTS = 1 @@ -59,8 +68,6 @@ const SLED = 4 const BOAT = 5 const SHIP = 6 -const data = require("./data.js") - function find_card(name) { return data.cards.findIndex((x) => x.name === name) } @@ -85,9 +92,11 @@ const first_p2_locale = 24 const last_p2_locale = 52 const first_p1_card = 0 -const last_p1_card = 20 +const last_p1_card = 17 +const last_p1_card_no_event = 20 const first_p2_card = 21 -const last_p2_card = 41 +const last_p2_card = 38 +const last_p2_card_no_event = 41 const LORD_ANDREAS = find_lord("Andreas") const LORD_HEINRICH = find_lord("Heinrich") @@ -730,6 +739,7 @@ exports.setup = function (seed, scenario, options) { seed, scenario, options, + log: [], undo: [], @@ -882,8 +892,6 @@ function setup_peipus() { setup_lord_on_calendar(LORD_RUDOLF, 13) setup_lord_on_calendar(LORD_GAVRILO, 13) setup_lord_on_calendar(LORD_VLADISLAV, 15) - - // XXX goto_campaign_plan() } function setup_return_of_the_prince() { @@ -1060,17 +1068,27 @@ function end_setup_lords() { // === LEVY: ARTS OF WAR (FIRST TURN) === function draw_two_cards() { - // TODO: no PASS cards in some scenarios in 2nd ed + let remove_no_event_cards = scenario_remove_no_event_cards.includes(game.scenario) + let deck = [] if (game.active === P1) { for (let c = first_p1_card; c <= last_p1_card; ++c) if (!is_card_in_use(c)) deck.push(c) + if (!remove_no_event) + for (let c = last_p1_card; c <= last_p1_card_no_event; ++c) + if (!is_card_in_use(c)) + deck.push(c) } else { for (let c = first_p2_card; c <= last_p2_card; ++c) if (!is_card_in_use(c)) deck.push(c) + if (!remove_no_event_cards) + for (let c = last_p2_card; c <= last_p2_card_no_event; ++c) + if (!is_card_in_use(c)) + deck.push(c) } + let result = [] let i = random(deck.length) result.push(deck[i]) |