diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-02-25 15:23:57 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-05-03 18:48:15 +0200 |
commit | 3bea3cbdf46d84a2476404bb07ff16ea14a4e637 (patch) | |
tree | 51961450894b77babd554a27cf90582611afc7f5 | |
parent | 3d51314af3e348300736d36660e04c336b86fe99 (diff) | |
download | andean-abyss-3bea3cbdf46d84a2476404bb07ff16ea14a4e637.tar.gz |
Seeded card setup.
-rw-r--r-- | play.html | 3 | ||||
-rw-r--r-- | rules.js | 85 |
2 files changed, 35 insertions, 53 deletions
@@ -28,9 +28,10 @@ <a class="menu_item" href="info/cards.html" target="_blank")">Cards</a> <div class="menu_separator"></div> <div class="menu_item" onclick="send_restart('Standard')">⚠ Restart Standard</div> - <div class="menu_item" onclick="send_restart('Open')">⚠ <s>Restart Open</s></div> <div class="menu_item" onclick="send_restart('Short')">⚠ Restart Short</div> <div class="menu_item" onclick="send_restart('Quick')">⚠ Restart Quick</div> + <div class="menu_item" onclick="send_restart('3P Quick')">⚠ Restart 3P Quick</div> + <div class="menu_item" onclick="send_restart('2P Quick')">⚠ Restart 2P Quick</div> </div> </div> <div class="icon_button" onclick="toggle_pieces()"><img src="/images/earth-america.svg"></div> @@ -203,16 +203,24 @@ exports.setup = function (seed, scenario, options) { setup_standard() - if (scenario === "Quick") { + if (scenario.includes("Quick")) { log_h1("Scenario: Quick") setup_quick() - setup_quick_deck() - } else if (scenario === "Short") { - setup_short_deck() + setup_deck(2, 6, 6) + } else if (scenario.includes("Short")) { + if (options.seeded) + setup_deck(3, 10, 5) + else + setup_deck(3, 0, 15) } else { - setup_standard_deck() + if (options.seeded) + setup_deck(4, 10, 5) + else + setup_deck(4, 0, 15) } + log("DECK " + game.deck.join(", ")) + update_control() goto_card() @@ -327,54 +335,27 @@ function shuffle_all_cards() { return deck } -function setup_standard_deck() { - let cards = shuffle_all_cards() - let piles = [ - cards.slice(0, 15), - cards.slice(15, 15+15), - cards.slice(30, 30+15), - cards.slice(45, 45+15), - ] - piles[0].push(73) - piles[1].push(74) - piles[2].push(75) - piles[3].push(76) - shuffle(piles[0]) - shuffle(piles[1]) - shuffle(piles[2]) - shuffle(piles[3]) - game.deck = piles[0].concat(piles[1], piles[2], piles[3]) -} - -function setup_short_deck() { - let cards = shuffle_all_cards() - let piles = [ - cards.slice(0, 15), - cards.slice(15, 15+15), - cards.slice(30, 30+15), - ] - piles[0].push(73) - piles[1].push(74) - piles[2].push(75) - shuffle(piles[0]) - shuffle(piles[1]) - shuffle(piles[2]) - game.deck = piles[0].concat(piles[1], piles[2], piles[3]) -} - -function setup_quick_deck() { +function setup_deck(count, a, b) { let cards = shuffle_all_cards() - let piles = [ - cards.slice(0, 6), - cards.slice(6, 6+6), - cards.slice(12, 12+6), - cards.slice(24, 24+6), - ] - piles[1].push(73) - piles[3].push(74) - shuffle(piles[1]) - shuffle(piles[3]) - game.deck = piles[0].concat(piles[1], piles[2], piles[3]) + let deck = [] + let pile + let i = 0 + for (let p = 0; p < count; ++p) { + if (a > 0) { + pile = cards.slice(i, i + a) + i += a + shuffle(pile) + deck = deck.concat(pile) + } + if (b > 0) { + pile = cards.slice(i, i + b) + i += b + pile.push(73 + p) + shuffle(pile) + deck = deck.concat(pile) + } + } + game.deck = deck } function set_support(place, amount) { |