updates
This commit is contained in:
parent
5368464042
commit
937f44defe
100 changed files with 10185 additions and 2042 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { avatarCores, execBlocked, executionActions, executionCost, openWindow } from '../src/engine.ts';
|
||||
import { anomalyCores, execBlocked, executionActions, executionCost, openWindow } from '../src/engine.ts';
|
||||
import { card } from './card.ts';
|
||||
import { Table, type Side } from './table.ts';
|
||||
|
||||
/** South's Avatar 1 on B1, North's Avatar 1 on C1 (both Broken Bits, 4 Cores). */
|
||||
/** South's Anomaly 1 on B1, North's Anomaly 1 on C1 (both Broken Bits, 4 Cores). */
|
||||
function scene(o: { south?: Side; north?: Side; first?: 0 | 1 } = {}) {
|
||||
const t = new Table(o);
|
||||
t.own(0, 'B1');
|
||||
|
|
@ -20,11 +20,11 @@ const defenderDice = (t: Table) => t.logText().match(/Roll: .* vs Broken Bits \[
|
|||
card('Recursive Infection', () => {
|
||||
const t = scene({ north: { main: ['Recursive Infection'] } });
|
||||
t.program(1, 'C1', 'Recursive Infection');
|
||||
t.avatar(0, 1).infection = 2;
|
||||
t.anomaly(0, 1).infection = 2;
|
||||
attackC1(t);
|
||||
assert.equal(t.avatar(0, 1).infection, 3, 'a counter for attacking');
|
||||
assert.equal(avatarCores(t.s, 0, 1, 'attack'), 2, '3+ counters: -2 Cores');
|
||||
assert.equal(avatarCores(t.s, 0, 1, 'attack', 'S1'), 2, 'anywhere, while the Program is in play');
|
||||
assert.equal(t.anomaly(0, 1).infection, 3, 'a counter for attacking');
|
||||
assert.equal(anomalyCores(t.s, 0, 1, 'attack'), 2, '3+ counters: -2 Cores');
|
||||
assert.equal(anomalyCores(t.s, 0, 1, 'attack', 'S1'), 2, 'anywhere, while the Program is in play');
|
||||
});
|
||||
|
||||
card('Recursive Infection', () => {
|
||||
|
|
@ -34,7 +34,7 @@ card('Recursive Infection', () => {
|
|||
t.program(1, 'C1', 'Recursive Infection');
|
||||
t.place(0, 1, 'B1');
|
||||
t.go({ type: 'advance', slot: 1, to: 'C1' }).to('attack').end();
|
||||
assert.equal(t.avatar(0, 1).infection, 1, 'a counter for breaching');
|
||||
assert.equal(t.anomaly(0, 1).infection, 1, 'a counter for breaching');
|
||||
});
|
||||
|
||||
card('Memory Parasite', () => {
|
||||
|
|
@ -45,7 +45,7 @@ card('Memory Parasite', () => {
|
|||
attackC1(t);
|
||||
t.rig(6, 6, 6, 6, 6, 6, 1, 1, 1, 1).end();
|
||||
assert.equal(t.s.choice?.kind, 'Memory Parasite:disable');
|
||||
assert.equal(t.s.choice?.player, 0, "the attacking Avatar's owner chooses");
|
||||
assert.equal(t.s.choice?.player, 0, "the attacking Anomaly's owner chooses");
|
||||
t.choose('Additional Core').settle();
|
||||
assert.equal(attackerDice(t), 6, '4 + Overclocked CPU only');
|
||||
});
|
||||
|
|
@ -54,11 +54,11 @@ card('Replication Routine', () => {
|
|||
const t = new Table({ south: { main: ['Replication Routine', 'Resource Leech'] } });
|
||||
t.own(0, 'B1');
|
||||
const [rr, leech] = t.hand(0, 'Replication Routine', 'Resource Leech');
|
||||
t.ram(0, 6).to('play').act({ type: 'installProgram', card: rr, at: 'B1' });
|
||||
t.bandwidth(0, 6).to('play').act({ type: 'installProgram', card: rr, at: 'B1' });
|
||||
assert.equal(t.s.choice?.kind, 'Replication Routine:install');
|
||||
t.choose('Resource Leech').settle();
|
||||
assert.deepEqual(t.s.locations.B1.programs, [rr, leech]);
|
||||
assert.equal(t.s.players[0].ram, 0, 'the second Virus is free');
|
||||
assert.equal(t.s.players[0].bandwidth, 0, 'the second Virus is free');
|
||||
});
|
||||
|
||||
card('Resource Leech', () => {
|
||||
|
|
@ -66,27 +66,27 @@ card('Resource Leech', () => {
|
|||
t.program(1, 'C1', 'Resource Leech');
|
||||
attackC1(t);
|
||||
t.rig(1, 1, 1, 1, 6, 6, 6, 6).end();
|
||||
assert.equal(t.avatar(0, 1).at, null);
|
||||
assert.equal(t.s.players[1].ram, 3);
|
||||
assert.equal(t.anomaly(0, 1).at, null);
|
||||
assert.equal(t.s.players[1].bandwidth, 3);
|
||||
});
|
||||
|
||||
card('Worm Protocol', () => {
|
||||
const t = new Table({ first: 1, north: { main: ['Worm Protocol', 'Memory Leak'] }, south: { main: ['Additional Core'] } });
|
||||
const t = new Table({ first: 1, north: { main: ['Worm Protocol', 'Bloatware'] }, south: { main: ['Additional Core'] } });
|
||||
t.own(1, 'C1');
|
||||
t.own(1, 'D1');
|
||||
t.own(0, 'C2');
|
||||
t.program(1, 'C1', 'Memory Leak');
|
||||
t.program(1, 'C1', 'Bloatware');
|
||||
t.place(1, 1, 'D1');
|
||||
const [worm] = t.hand(1, 'Worm Protocol');
|
||||
t.ram(1, 4).to('play').act({ type: 'installProgram', card: worm, at: 'C1' });
|
||||
t.bandwidth(1, 4).to('play').act({ type: 'installProgram', card: worm, at: 'C1' });
|
||||
assert.equal(t.s.choice?.kind, 'Worm Protocol:spread');
|
||||
t.choose('D1').to('playAgain').end();
|
||||
// South attacks D1, where Memory Leak now also applies.
|
||||
// South attacks D1, where Bloatware now also applies.
|
||||
t.place(0, 1, 'C2');
|
||||
t.hardware(0, 1, 'Additional Core');
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'D1' });
|
||||
t.rig(6, 6, 6, 6, 1, 1, 1, 1).end();
|
||||
assert.match(t.logText(), /Memory Leak: Avatar 1 \(Broken Bits\) loses 1 Core/);
|
||||
assert.match(t.logText(), /Bloatware: Anomaly 1 \(Broken Bits\) loses 1 Core/);
|
||||
assert.equal(attackerDice(t), 4, '4 + 1 - 1');
|
||||
});
|
||||
|
||||
|
|
@ -97,8 +97,8 @@ card('Payload Injector', () => {
|
|||
const [ra] = t.hand(0, 'Execute: Root Access', 'Execute: Root Access');
|
||||
assert.equal(executionCost(t.s, 0, ra, 'B1', {}), 2);
|
||||
assert.equal(executionCost(t.s, 0, ra, 'A2', {}), 4, 'only when targeting its Server');
|
||||
t.ram(0, 2).play(0, 'Execute: Root Access', 'B1').settle();
|
||||
assert.equal(t.s.players[0].ram, 0);
|
||||
t.bandwidth(0, 2).play(0, 'Execute: Root Access', 'B1').settle();
|
||||
assert.equal(t.s.players[0].bandwidth, 0);
|
||||
assert.equal(executionCost(t.s, 0, t.s.players[0].hand[0], 'B1', {}), 4, 'first each turn only');
|
||||
});
|
||||
|
||||
|
|
@ -107,8 +107,8 @@ card('Persistent Infection', () => {
|
|||
t.program(1, 'C1', 'Persistent Infection');
|
||||
attackC1(t);
|
||||
t.rig(1, 1, 1, 1, 6, 6, 6, 6).end();
|
||||
assert.equal(t.avatar(0, 1).at, null);
|
||||
assert.equal(t.avatar(0, 1).permanentInfection, 1, 'stays after defeat');
|
||||
assert.equal(t.anomaly(0, 1).at, null);
|
||||
assert.equal(t.anomaly(0, 1).permanentInfection, 1, 'stays after defeat');
|
||||
});
|
||||
|
||||
card('Infinite Loop', () => {
|
||||
|
|
@ -132,8 +132,8 @@ card('Stack Overflow', () => {
|
|||
const t = scene({ north: { main: ['Stack Overflow', 'Resource Leech'] } });
|
||||
t.program(1, 'C1', 'Stack Overflow');
|
||||
t.program(1, 'C1', 'Resource Leech');
|
||||
assert.equal(avatarCores(t.s, 1, 1, 'defend'), 6, '+1 per Program here');
|
||||
assert.equal(avatarCores(t.s, 0, 1, 'defend'), 4);
|
||||
assert.equal(anomalyCores(t.s, 1, 1, 'defend'), 6, '+1 per Program here');
|
||||
assert.equal(anomalyCores(t.s, 0, 1, 'defend'), 4);
|
||||
});
|
||||
|
||||
card('Race Condition', () => {
|
||||
|
|
@ -150,9 +150,9 @@ card('Race Condition', () => {
|
|||
}
|
||||
});
|
||||
|
||||
card('Memory Leak', () => {
|
||||
const t = scene({ south: { main: ['Additional Core', 'Overclocked CPU'] }, north: { main: ['Memory Leak'] } });
|
||||
t.program(1, 'C1', 'Memory Leak');
|
||||
card('Bloatware', () => {
|
||||
const t = scene({ south: { main: ['Additional Core', 'Overclocked CPU'] }, north: { main: ['Bloatware'] } });
|
||||
t.program(1, 'C1', 'Bloatware');
|
||||
t.hardware(0, 1, 'Additional Core');
|
||||
t.hardware(0, 1, 'Overclocked CPU');
|
||||
attackC1(t);
|
||||
|
|
@ -165,7 +165,7 @@ card('Null Pointer', () => {
|
|||
t.program(1, 'C1', 'Null Pointer');
|
||||
const so = t.program(1, 'C1', 'Stack Overflow');
|
||||
t.hand(0, 'Execute: Kill Process', 'Execute: Kill Process');
|
||||
t.ram(0, 10).play(0, 'Execute: Kill Process', 'C1', { card: so }).settle();
|
||||
t.bandwidth(0, 10).play(0, 'Execute: Kill Process', 'C1', { card: so }).settle();
|
||||
assert.equal(t.s.cards[so].disabledUntil, 0, 'the first enemy Execution has no effect');
|
||||
t.play(0, 'Execute: Kill Process', 'C1', { card: so }).settle();
|
||||
assert.ok(t.s.cards[so].disabledUntil > t.s.clock, 'once per turn');
|
||||
|
|
@ -202,11 +202,11 @@ card('Undefined Behavior', () => {
|
|||
const ub = t.program(1, 'C1', 'Undefined Behavior');
|
||||
const so = t.program(0, 'B1', 'Stack Overflow');
|
||||
t.use(ub, { card: so }).settle();
|
||||
assert.equal(avatarCores(t.s, 1, 1, 'defend'), 5, 'copied Stack Overflow: +1 for the one Program here');
|
||||
assert.equal(anomalyCores(t.s, 1, 1, 'defend'), 5, 'copied Stack Overflow: +1 for the one Program here');
|
||||
assert.ok(t.s.cards[ub].disabledUntil > t.s.clock, 'Undefined Behavior shuts itself off');
|
||||
t.to('playAgain').end();
|
||||
assert.equal(t.s.active, 0);
|
||||
assert.equal(avatarCores(t.s, 1, 1, 'defend'), 5, "the copy lasts through the opponent's turn");
|
||||
assert.equal(anomalyCores(t.s, 1, 1, 'defend'), 5, "the copy lasts through the opponent's turn");
|
||||
});
|
||||
|
||||
card('Packet Loss', () => {
|
||||
|
|
@ -228,7 +228,7 @@ card('Desynchronization', () => {
|
|||
t.hardware(0, 1, 'Hot-Swap Bay');
|
||||
t.hardware(0, 1, 'Additional Core');
|
||||
t.hand(0, 'RAM Expansion');
|
||||
t.ram(0, 10);
|
||||
t.bandwidth(0, 10);
|
||||
attackC1(t);
|
||||
t.act({ type: 'end' });
|
||||
// Broken Bits' own Ability still works after the roll; only the Hardware ability is blocked.
|
||||
|
|
@ -251,7 +251,7 @@ card('Ghost Process', () => {
|
|||
const t = scene({ south: { main: ['Ghost Process', 'Execute: Kill Process'] }, north: { main: ['Stack Overflow'] } });
|
||||
const so = t.program(1, 'C1', 'Stack Overflow');
|
||||
t.hand(0, 'Execute: Kill Process');
|
||||
t.ram(0, 5);
|
||||
t.bandwidth(0, 5);
|
||||
const reach = () => executionActions(t.s, 0, 'now').some((a) => a.type === 'play' && a.target === 'B1' && a.args.card === so);
|
||||
assert.ok(!reach(), 'without Ghost Process, B1 only reaches B1');
|
||||
t.program(0, 'B1', 'Ghost Process');
|
||||
|
|
@ -268,14 +268,14 @@ card('False Positive', () => {
|
|||
t.place(0, 1, 'B1');
|
||||
t.place(0, 2, 'A2');
|
||||
t.hand(0, 'Execute: Force Reboot');
|
||||
t.ram(0, 5);
|
||||
t.bandwidth(0, 5);
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'B1' }).act({ type: 'end' });
|
||||
assert.equal(t.decider, 0, 'South may respond before the roll');
|
||||
t.play(0, 'Execute: Force Reboot', 'B1', { ref: { player: 1, slot: 1 } });
|
||||
assert.equal(t.s.choice?.kind, 'False Positive:redirect');
|
||||
t.choose('Pixelated Picture').settle();
|
||||
assert.ok(!execBlocked(t.s, 'C1'), "North's attacker is untouched");
|
||||
assert.ok(execBlocked(t.s, 'A2'), "South's own Avatar took it");
|
||||
assert.ok(execBlocked(t.s, 'A2'), "South's own Anomaly took it");
|
||||
});
|
||||
|
||||
card('Fragmentation', () => {
|
||||
|
|
@ -291,7 +291,7 @@ card('Latency Spike', () => {
|
|||
const t = scene({ south: { main: ['Execute: Ping Sweep'] }, north: { main: ['Latency Spike'] } });
|
||||
if (spike) t.program(1, 'C1', 'Latency Spike');
|
||||
t.hand(0, 'Execute: Ping Sweep');
|
||||
t.ram(0, 4);
|
||||
t.bandwidth(0, 4);
|
||||
attackC1(t);
|
||||
t.act({ type: 'end' });
|
||||
assert.equal(openWindow(t.s)?.kind, spike ? 'postRoll' : 'preRoll');
|
||||
|
|
@ -315,10 +315,10 @@ card('Error Correction', () => {
|
|||
t.own(0, 'B1');
|
||||
t.program(0, 'B1', 'Error Correction');
|
||||
t.place(0, 1, 'B1');
|
||||
t.avatar(0, 1).infection = 2;
|
||||
t.anomaly(0, 1).infection = 2;
|
||||
t.to('playAgain').end();
|
||||
assert.equal(t.s.active, 0);
|
||||
assert.equal(t.avatar(0, 1).infection, 1, 'one removed at the start of the turn');
|
||||
assert.equal(t.anomaly(0, 1).infection, 1, 'one removed at the start of the turn');
|
||||
});
|
||||
|
||||
card('Garbage Collection', () => {
|
||||
|
|
@ -327,7 +327,7 @@ card('Garbage Collection', () => {
|
|||
const gc = t.program(0, 'B1', 'Garbage Collection');
|
||||
const so = t.program(0, 'B1', 'Stack Overflow');
|
||||
t.use(gc, { card: so }).settle();
|
||||
assert.equal(t.s.players[0].ram, 7);
|
||||
assert.equal(t.s.players[0].bandwidth, 7);
|
||||
assert.deepEqual(t.s.locations.B1.programs, [gc]);
|
||||
});
|
||||
|
||||
|
|
@ -346,8 +346,8 @@ card('Version Control', () => {
|
|||
});
|
||||
|
||||
card('Rollback Routine', () => {
|
||||
const t = scene({ south: { main: ['Rollback Routine', 'Additional Core'] }, north: { main: ['Memory Leak'] } });
|
||||
t.program(1, 'C1', 'Memory Leak');
|
||||
const t = scene({ south: { main: ['Rollback Routine', 'Additional Core'] }, north: { main: ['Bloatware'] } });
|
||||
t.program(1, 'C1', 'Bloatware');
|
||||
const rr = t.program(0, 'B1', 'Rollback Routine');
|
||||
t.hardware(0, 1, 'Additional Core');
|
||||
attackC1(t);
|
||||
|
|
@ -356,17 +356,17 @@ card('Rollback Routine', () => {
|
|||
assert.equal(t.decider, 0);
|
||||
t.rig(6, 6, 6, 6, 6, 1, 1, 1, 1);
|
||||
t.use(rr, { ref: { player: 0, slot: 1 } }).settle();
|
||||
assert.equal(attackerDice(t), 5, "Memory Leak's -1 is undone");
|
||||
assert.equal(attackerDice(t), 5, "Bloatware's -1 is undone");
|
||||
});
|
||||
|
||||
card('Compatibility Layer', () => {
|
||||
const t = new Table({ south: { main: ['Compatibility Layer', 'Stack Overflow', 'Hotfix'] } });
|
||||
t.own(0, 'B1');
|
||||
const [cl, so, hf] = t.hand(0, 'Compatibility Layer', 'Stack Overflow', 'Hotfix');
|
||||
t.ram(0, 6 + 7 + 5).to('play');
|
||||
t.bandwidth(0, 6 + 7 + 5).to('play');
|
||||
t.go({ type: 'installProgram', card: cl, at: 'B1' });
|
||||
t.go({ type: 'installProgram', card: so, at: 'B1' });
|
||||
t.go({ type: 'installProgram', card: hf, at: 'B1' });
|
||||
assert.equal(t.s.locations.B1.programs.length, 3);
|
||||
assert.equal(t.s.players[0].ram, 0, 'Hotfix, a Patch, cost 2 less');
|
||||
assert.equal(t.s.players[0].bandwidth, 0, 'Hotfix, a Patch, cost 2 less');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue