updates
This commit is contained in:
parent
e590baf28d
commit
6382de19c9
15 changed files with 239 additions and 28 deletions
|
|
@ -185,7 +185,7 @@ export function createGame({ pool, decks, seed, rules = DEFAULT_RULES, log = fal
|
|||
discard: [],
|
||||
serverPile: shuffle(rng, deck.servers.map((n) => add(n, p))),
|
||||
avatars: [
|
||||
...avatars.map((card, i) => newAvatar(card, i === 0, null)),
|
||||
...avatars.map((card, i) => newAvatar(card, i < rules.startingAvatars, null)),
|
||||
...avatars.map((card, i) => newAvatar(card, false, i + 1)),
|
||||
],
|
||||
unlockedLevel: 1,
|
||||
|
|
@ -202,9 +202,22 @@ export function createGame({ pool, decks, seed, rules = DEFAULT_RULES, log = fal
|
|||
for (let i = 0; i < rules.openingHand; i++) drawNow(s, p);
|
||||
say(s, `${playerName(p)} starts on ${nameOf(s, server)} with ${me.ram} RAM. Avatar 1: ${nameOf(s, me.avatars[0].card)}.`);
|
||||
}
|
||||
s.stats.cardsDrawn = [0, 0];
|
||||
s.firstPlayer = randInt(rng, 2) as PlayerId;
|
||||
s.active = s.firstPlayer;
|
||||
const p2 = other(s.firstPlayer);
|
||||
const second = s.players[p2];
|
||||
second.ram += rules.secondPlayer.ram;
|
||||
second.avatars.slice(0, rules.startingAvatars + rules.secondPlayer.avatars).forEach((av) => (av.faceUp = true));
|
||||
for (let i = 0; i < rules.secondPlayer.cards; i++) drawNow(s, p2);
|
||||
if (rules.secondPlayer.locations > 0) {
|
||||
// The location next to the starting Server, with a Server from the pile: no RAM, no unlock.
|
||||
const line = LINES_AT.get(START_LOC[p2])![0];
|
||||
const L = s.locations[otherEnd(line, START_LOC[p2])];
|
||||
L.owner = p2;
|
||||
L.server = second.serverPile.shift()!;
|
||||
played(s, s.cards[L.server].name, p2);
|
||||
}
|
||||
s.stats.cardsDrawn = [0, 0];
|
||||
say(s, `${playerName(s.firstPlayer)} goes first.`);
|
||||
beginTurn(s, true);
|
||||
run(s);
|
||||
|
|
@ -326,6 +339,11 @@ function pushClears(s: GameState, p: PlayerId, out: Action[]): void {
|
|||
}
|
||||
|
||||
/** Latency Spike: the attacking player can't play Executions before the roll. */
|
||||
/** Whether a first-turn rule variant stops p playing cards from hand right now. */
|
||||
function cardsBlocked(s: GameState, p: PlayerId): boolean {
|
||||
return s.turn === 1 && p === s.firstPlayer && !s.rules.firstTurn.cards;
|
||||
}
|
||||
|
||||
function latencyBlocked(s: GameState, p: PlayerId): boolean {
|
||||
const c = s.combat;
|
||||
const w = openWindow(s);
|
||||
|
|
@ -375,7 +393,7 @@ export function executionCost(s: GameState, p: PlayerId, card: number, target: L
|
|||
*/
|
||||
export function executionActions(s: GameState, p: PlayerId, budget: 'now' | 'reachable' | 'any', limit = Infinity): Action[] {
|
||||
const out: Action[] = [];
|
||||
if (latencyBlocked(s, p)) return out;
|
||||
if (latencyBlocked(s, p) || cardsBlocked(s, p)) return out;
|
||||
const seen = new Set<string>();
|
||||
let who: (LocId | null)[] | null = null;
|
||||
let all: Source[] | null = null;
|
||||
|
|
@ -484,7 +502,7 @@ export function legalActions(s: GameState): Action[] {
|
|||
|
||||
if (s.step === 'deploy') {
|
||||
const placementOpen = s.declarations.length === 0;
|
||||
const targets = advanceTargets(s, p);
|
||||
const targets = s.turn === 1 && !s.rules.firstTurn.advance ? [] : advanceTargets(s, p);
|
||||
me.avatars.forEach((av, i) => {
|
||||
const ref = { player: p, slot: i + 1 };
|
||||
if (!av.faceUp || av.advanced || av.attacks > 0) return;
|
||||
|
|
@ -503,7 +521,7 @@ export function legalActions(s: GameState): Action[] {
|
|||
} else {
|
||||
const seen = new Set<string>();
|
||||
const all = sources(s);
|
||||
for (const card of me.hand) {
|
||||
for (const card of cardsBlocked(s, p) ? [] : me.hand) {
|
||||
const def = defOf(s, card);
|
||||
if (seen.has(def.name)) continue;
|
||||
seen.add(def.name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue