updates
This commit is contained in:
parent
5368464042
commit
937f44defe
100 changed files with 10185 additions and 2042 deletions
|
|
@ -14,7 +14,7 @@ function turnOf(t: Table, p: 0 | 1): Table {
|
|||
return t;
|
||||
}
|
||||
|
||||
/** South's Avatar 1 (Broken Bits, 4 Cores, 9 Health) on B1 facing North's Avatar 1 on C1. */
|
||||
/** South's Anomaly 1 (Broken Bits, 4 Cores, 9 Health) on B1 facing North's Anomaly 1 on C1. */
|
||||
function standoff(o: { northMain?: string[]; southMain?: string[] } = {}): Table {
|
||||
const t = new Table({ health: true, north: { main: o.northMain }, south: { main: o.southMain } });
|
||||
t.own(0, 'B1');
|
||||
|
|
@ -38,9 +38,9 @@ test('health: the loser takes the margin as damage, and nobody moves', () => {
|
|||
t.rig(6, 6, 6, 6, 5, 5, 5, 4); // 24 to 19
|
||||
t.end();
|
||||
assert.equal(t.s.locations.C1.owner, 1, 'C1 holds');
|
||||
assert.equal(t.avatar(0, 1).at, 'B1', 'the attacker stays where it attacked from');
|
||||
assert.equal(t.avatar(1, 1).at, 'C1');
|
||||
assert.equal(t.avatar(1, 1).damage, 5);
|
||||
assert.equal(t.anomaly(0, 1).at, 'B1', 'the attacker stays where it attacked from');
|
||||
assert.equal(t.anomaly(1, 1).at, 'C1');
|
||||
assert.equal(t.anomaly(1, 1).damage, 5);
|
||||
assert.equal(healthLeft(t.s, { player: 1, slot: 1 }), 4);
|
||||
assert.equal(t.s.stats.attacksWon[0], 1);
|
||||
assert.equal(t.s.stats.damageDealt[0], 5);
|
||||
|
|
@ -48,21 +48,21 @@ test('health: the loser takes the margin as damage, and nobody moves', () => {
|
|||
assert.equal(t.s.combat, null);
|
||||
});
|
||||
|
||||
test('health: damage adds up; the Avatar is destroyed at 0 Health, loses its Hardware, and the location falls', () => {
|
||||
test('health: damage adds up; the Anomaly is destroyed at 0 Health, loses its Hardware, and the location falls', () => {
|
||||
const t = standoff({ northMain: ['Additional Core'] });
|
||||
const hw = t.hardware(1, 1, 'Additional Core');
|
||||
t.avatar(1, 1).damage = 6;
|
||||
t.anomaly(1, 1).damage = 6;
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(6, 6, 6, 6, 3, 3, 3, 3, 3); // 24 to 15: 9 damage, 3 was enough
|
||||
t.end();
|
||||
assert.equal(t.avatar(1, 1).at, null, 'destroyed: back in its slot');
|
||||
assert.equal(t.avatar(1, 1).damage, 0, 'a destroyed Avatar comes back at full Health');
|
||||
assert.deepEqual(t.avatar(1, 1).hardware, []);
|
||||
assert.equal(t.anomaly(1, 1).at, null, 'destroyed: back in its slot');
|
||||
assert.equal(t.anomaly(1, 1).damage, 0, 'a destroyed Anomaly comes back at full Health');
|
||||
assert.deepEqual(t.anomaly(1, 1).hardware, []);
|
||||
assert.ok(t.s.players[1].discard.includes(hw));
|
||||
assert.equal(t.s.locations.C1.owner, 0);
|
||||
assert.equal(t.avatar(0, 1).at, 'C1');
|
||||
assert.equal(t.anomaly(0, 1).at, 'C1');
|
||||
assert.equal(t.s.stats.capturesInCombat[0], 1);
|
||||
assert.equal(t.s.stats.avatarsDestroyed[1], 1);
|
||||
assert.equal(t.s.stats.anomaliesDestroyed[1], 1);
|
||||
assert.equal(t.s.stats.damageDealt[0], 9, 'the whole margin counts as dealt');
|
||||
});
|
||||
|
||||
|
|
@ -71,18 +71,18 @@ test('health: a losing attacker takes damage and stays put, or is destroyed by a
|
|||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(3, 3, 3, 3, 4, 4, 4, 4); // 12 to 16
|
||||
t.end();
|
||||
assert.equal(t.avatar(0, 1).at, 'B1');
|
||||
assert.equal(t.avatar(0, 1).damage, 4);
|
||||
assert.equal(t.avatar(1, 1).damage, 0, 'the winner takes no damage');
|
||||
assert.equal(t.anomaly(0, 1).at, 'B1');
|
||||
assert.equal(t.anomaly(0, 1).damage, 4);
|
||||
assert.equal(t.anomaly(1, 1).damage, 0, 'the winner takes no damage');
|
||||
assert.equal(t.s.stats.damageDealt[1], 4);
|
||||
|
||||
const u = standoff();
|
||||
u.avatar(0, 1).damage = 5;
|
||||
u.anomaly(0, 1).damage = 5;
|
||||
u.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
u.rig(1, 1, 1, 1, 2, 2, 2, 2); // 4 to 8: 4 damage, 4 left
|
||||
u.end();
|
||||
assert.equal(u.avatar(0, 1).at, null, 'destroyed');
|
||||
assert.equal(u.avatar(0, 1).damage, 0);
|
||||
assert.equal(u.anomaly(0, 1).at, null, 'destroyed');
|
||||
assert.equal(u.anomaly(0, 1).damage, 0);
|
||||
assert.equal(u.s.locations.B1.owner, 0, 'losing an attack never loses the origin');
|
||||
});
|
||||
|
||||
|
|
@ -91,10 +91,10 @@ test('health: a tie is a stalemate, with no reroll and no damage', () => {
|
|||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(3, 3, 3, 3, 4, 4, 2, 2);
|
||||
t.end();
|
||||
assert.equal(t.avatar(0, 1).damage, 0);
|
||||
assert.equal(t.avatar(1, 1).damage, 0);
|
||||
assert.equal(t.avatar(0, 1).at, 'B1');
|
||||
assert.equal(t.avatar(1, 1).at, 'C1');
|
||||
assert.equal(t.anomaly(0, 1).damage, 0);
|
||||
assert.equal(t.anomaly(1, 1).damage, 0);
|
||||
assert.equal(t.anomaly(0, 1).at, 'B1');
|
||||
assert.equal(t.anomaly(1, 1).at, 'C1');
|
||||
assert.deepEqual(t.s.rigged, [], 'no dice were rerolled');
|
||||
assert.match(t.logText(), /stalemate/);
|
||||
assert.equal(t.s.stats.combatsTied[0], 1);
|
||||
|
|
@ -104,13 +104,13 @@ test('health: a tie is a stalemate, with no reroll and no damage', () => {
|
|||
test('health: recall heals fully, keeps Hardware, counts as the placement, and leaves the location undefended', () => {
|
||||
const t = standoff({ northMain: ['Additional Core'] });
|
||||
const hw = t.hardware(1, 1, 'Additional Core');
|
||||
t.avatar(1, 1).damage = 7;
|
||||
t.avatar(1, 1).infection = 2;
|
||||
t.anomaly(1, 1).damage = 7;
|
||||
t.anomaly(1, 1).infection = 2;
|
||||
turnOf(t, 1); // South's turn passes without acting
|
||||
assert.ok(t.can({ type: 'recall', slot: 1 }));
|
||||
assert.ok(!t.can({ type: 'recall', slot: 2 }), 'only Avatars in play can be recalled');
|
||||
assert.ok(!t.can({ type: 'recall', slot: 2 }), 'only Anomalies in play can be recalled');
|
||||
t.go({ type: 'recall', slot: 1 });
|
||||
const av = t.avatar(1, 1);
|
||||
const av = t.anomaly(1, 1);
|
||||
assert.equal(av.at, null);
|
||||
assert.equal(av.damage, 0);
|
||||
assert.equal(av.infection, 0, 'leaving play removes counters');
|
||||
|
|
@ -124,26 +124,26 @@ test('health: recall heals fully, keeps Hardware, counts as the placement, and l
|
|||
assert.ok(t.can({ type: 'advance', slot: 1, to: 'C1' }));
|
||||
});
|
||||
|
||||
test('health: a rooted Avatar can\'t be recalled, and the rule can be switched off', () => {
|
||||
test('health: a rooted Anomaly can\'t be recalled, and the rule can be switched off', () => {
|
||||
const t = standoff();
|
||||
t.avatar(0, 1).rootedUntil = FOREVER;
|
||||
t.anomaly(0, 1).rootedUntil = FOREVER;
|
||||
assert.ok(!t.can({ type: 'recall', slot: 1 }), 'Packet Flood: no retreat');
|
||||
t.avatar(0, 1).rootedUntil = 0;
|
||||
t.anomaly(0, 1).rootedUntil = 0;
|
||||
assert.ok(t.can({ type: 'recall', slot: 1 }));
|
||||
t.s.rules = withRule(t.s.rules, 'health.recall=false');
|
||||
assert.ok(!t.can({ type: 'recall', slot: 1 }));
|
||||
});
|
||||
|
||||
test('health: Redundant Power Supply still saves the Hardware of a destroyed Avatar', () => {
|
||||
test('health: Redundant Power Supply still saves the Hardware of a destroyed Anomaly', () => {
|
||||
const t = standoff({ northMain: ['Redundant Power Supply', 'Additional Core'] });
|
||||
const rps = t.hardware(1, 1, 'Redundant Power Supply');
|
||||
const core = t.hardware(1, 1, 'Additional Core');
|
||||
t.avatar(1, 1).damage = 8;
|
||||
t.anomaly(1, 1).damage = 8;
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(6, 6, 6, 6, 1, 1, 1, 1, 1); // 24 to 5
|
||||
t.end();
|
||||
assert.equal(t.avatar(1, 1).at, null);
|
||||
assert.deepEqual([...t.avatar(1, 1).hardware].sort(), [rps, core].sort());
|
||||
assert.equal(t.anomaly(1, 1).at, null);
|
||||
assert.deepEqual([...t.anomaly(1, 1).hardware].sort(), [rps, core].sort());
|
||||
assert.equal(t.s.locations.C1.owner, 0);
|
||||
});
|
||||
|
||||
|
|
@ -154,14 +154,14 @@ test('health: with two defenders the damage destroys the weakest first, and the
|
|||
t.place(0, 1, 'B1');
|
||||
t.place(1, 1, 'C1'); // Broken Bits, 4 Cores, 9 Health
|
||||
t.place(1, 2, 'C1'); // Pixelated Picture, 3 Cores, 10 Health
|
||||
t.avatar(1, 2).damage = 7; // 3 left
|
||||
t.anomaly(1, 2).damage = 7; // 3 left
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(6, 6, 6, 6, 1, 1, 1, 1, 5, 5, 5); // 24 to 4 + 15 = 19: 5 damage
|
||||
t.end();
|
||||
assert.equal(t.avatar(1, 2).at, null, 'the weak one is destroyed with 3 of the damage');
|
||||
assert.equal(t.avatar(1, 1).damage, 2, 'the other 2 land on the survivor');
|
||||
assert.equal(t.anomaly(1, 2).at, null, 'the weak one is destroyed with 3 of the damage');
|
||||
assert.equal(t.anomaly(1, 1).damage, 2, 'the other 2 land on the survivor');
|
||||
assert.equal(t.s.locations.C1.owner, 1, 'C1 holds with a defender left');
|
||||
assert.equal(t.avatar(0, 1).at, 'B1');
|
||||
assert.equal(t.anomaly(0, 1).at, 'B1');
|
||||
|
||||
// Enough damage for both takes the location.
|
||||
const u = new Table({ health: true, north: { servers: ['Cluster Server'] } });
|
||||
|
|
@ -170,29 +170,29 @@ test('health: with two defenders the damage destroys the weakest first, and the
|
|||
u.place(0, 1, 'B1');
|
||||
u.place(1, 1, 'C1');
|
||||
u.place(1, 2, 'C1');
|
||||
u.avatar(1, 1).damage = 8;
|
||||
u.avatar(1, 2).damage = 8;
|
||||
u.anomaly(1, 1).damage = 8;
|
||||
u.anomaly(1, 2).damage = 8;
|
||||
u.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
u.rig(6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1); // 24 to 7: 17 damage for 1 + 2 left
|
||||
u.end();
|
||||
assert.equal(u.avatar(1, 1).at, null);
|
||||
assert.equal(u.avatar(1, 2).at, null);
|
||||
assert.equal(u.anomaly(1, 1).at, null);
|
||||
assert.equal(u.anomaly(1, 2).at, null);
|
||||
assert.equal(u.s.locations.C1.owner, 0);
|
||||
assert.equal(u.avatar(0, 1).at, 'C1');
|
||||
assert.equal(u.anomaly(0, 1).at, 'C1');
|
||||
});
|
||||
|
||||
test('health: Resource Leech and Persistent Infection fire on a lost roll, not only a destruction', () => {
|
||||
const t = standoff({ northMain: ['Resource Leech', 'Persistent Infection'] });
|
||||
t.program(1, 'C1', 'Resource Leech');
|
||||
t.program(1, 'C1', 'Persistent Infection');
|
||||
const ram = t.s.players[1].ram;
|
||||
const bandwidth = t.s.players[1].bandwidth;
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(3, 3, 3, 3, 4, 4, 4, 4); // 12 to 16: the attacker takes 4 and lives
|
||||
t.end();
|
||||
assert.equal(t.avatar(0, 1).at, 'B1');
|
||||
assert.equal(t.avatar(0, 1).damage, 4);
|
||||
assert.equal(t.s.players[1].ram, ram + 3, 'Resource Leech pays 3');
|
||||
assert.equal(t.avatar(0, 1).permanentInfection, 1, 'a permanent Infection counter');
|
||||
assert.equal(t.anomaly(0, 1).at, 'B1');
|
||||
assert.equal(t.anomaly(0, 1).damage, 4);
|
||||
assert.equal(t.s.players[1].bandwidth, bandwidth + 3, 'Resource Leech pays 3');
|
||||
assert.equal(t.anomaly(0, 1).permanentInfection, 1, 'a permanent Infection counter');
|
||||
});
|
||||
|
||||
test('health: Overflow Error only disables, until the next command, while the attacker lives', () => {
|
||||
|
|
@ -219,19 +219,19 @@ test('health: Overflow Error may destroy a Program when the attacker is destroye
|
|||
assert.equal(t.s.choice?.kind, 'Overflow Error:hit');
|
||||
t.choose('Destroy Stack Overflow').settle();
|
||||
assert.ok(t.s.players[0].discard.includes(so));
|
||||
assert.equal(t.avatar(0, 1).at, null);
|
||||
assert.equal(t.anomaly(0, 1).at, null);
|
||||
});
|
||||
|
||||
test("health: Backup Machine's Restore Point heals 3 damage", () => {
|
||||
const t = new Table({ health: true, south: { avatars: ['Backup Machine', 'Broken Bits', 'Pixelated Picture', 'Corrupt Driver'] } });
|
||||
const t = new Table({ health: true, south: { anomalies: ['Backup Machine', 'Broken Bits', 'Pixelated Picture', 'Corrupt Driver'] } });
|
||||
t.own(0, 'B1');
|
||||
t.place(0, 1, 'B1');
|
||||
const bm = t.avatar(0, 1).card;
|
||||
const bm = t.anomaly(0, 1).card;
|
||||
assert.ok(!t.legal().some((a) => a.type === 'activate' && a.card === bm && a.args.heal), 'nothing to heal yet');
|
||||
t.avatar(0, 1).damage = 5;
|
||||
t.ram(0, 5).use(bm, { heal: true }).settle();
|
||||
assert.equal(t.avatar(0, 1).damage, 2);
|
||||
assert.equal(t.s.players[0].ram, 0);
|
||||
t.anomaly(0, 1).damage = 5;
|
||||
t.bandwidth(0, 5).use(bm, { heal: true }).settle();
|
||||
assert.equal(t.anomaly(0, 1).damage, 2);
|
||||
assert.equal(t.s.players[0].bandwidth, 0);
|
||||
assert.equal(healthLeft(t.s, { player: 0, slot: 1 }), 8);
|
||||
});
|
||||
|
||||
|
|
@ -242,6 +242,6 @@ test('health: RAM Expansion adds 2 Health, so a hit that would destroy the weare
|
|||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(6, 6, 6, 6, 4, 4, 4, 3); // 24 to 15: 9 damage against 11 Health
|
||||
t.end();
|
||||
assert.equal(t.avatar(1, 1).at, 'C1', 'C1 holds');
|
||||
assert.equal(t.anomaly(1, 1).at, 'C1', 'C1 holds');
|
||||
assert.equal(healthLeft(t.s, { player: 1, slot: 1 }), 2);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue