This commit is contained in:
Forrest 2026-09-28 02:54:54 -04:00
parent e590baf28d
commit 6382de19c9
15 changed files with 239 additions and 28 deletions

View file

@ -1,4 +1,5 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { addBugs } from '../src/cards/util.ts';
import { avatarCores, canWear, executionActions, executionCost, programCost } from '../src/engine.ts';
import { portsFree } from '../src/query.ts';
@ -197,6 +198,31 @@ card('Hot-Swap Bay', () => {
assert.equal(t.s.players[0].ram, 0, 'pays the 1 RAM difference');
});
test('Hardware must still fit its ports when Network Interface Upgrade leaves', () => {
const t = new Table({
south: {
avatars: ['Beta Version 1.0', 'Broken Bits', 'Code Zero', 'Pixelated Picture'],
main: ['Network Interface Upgrade', 'Hot-Swap Bay', 'Additional Core', 'Packet Accelerator', 'RAM Expansion', 'Execute: Rollback'],
},
});
t.place(0, 1, 'S1');
const niu = t.hardware(0, 1, 'Network Interface Upgrade');
const hsb = t.hardware(0, 1, 'Hot-Swap Bay');
const ac = t.hardware(0, 1, 'Additional Core');
const pa = t.hardware(0, 1, 'Packet Accelerator');
t.hand(0, 'RAM Expansion', 'Execute: Rollback');
t.ram(0, 20);
// Beta Version 1.0 has 2 ports, +1 from the NIU, and all 3 are in use.
const swaps = t.legal().filter((a) => a.type === 'activate' && a.card === hsb);
assert.ok(!swaps.some((a) => a.type === 'activate' && a.args.card === niu), "Hot-Swap Bay can't swap the NIU for a card that needs a port");
assert.ok(swaps.some((a) => a.type === 'activate' && a.args.card === ac));
// Rollback returns the NIU: the newest Hardware no longer fits and is discarded.
t.s.cards[niu].installedTurn = t.s.turn;
t.play(0, 'Execute: Rollback', 'S1', { card: niu }).settle();
assert.deepEqual(t.avatar(0, 1).hardware, [hsb, ac]);
assert.ok(t.s.players[0].discard.includes(pa));
});
card('Quantum Coprocessor', () => {
const t = new Table({ south: { main: ['Quantum Coprocessor', 'Execute: Kill Process'] }, north: { main: ['Stack Overflow', 'Hotfix'] } });
t.own(1, 'C1');