updates
This commit is contained in:
parent
5d771eed1b
commit
5368464042
28 changed files with 887 additions and 187 deletions
|
|
@ -15,8 +15,8 @@ function turnOf(t: Table, p: 0 | 1): Table {
|
|||
}
|
||||
|
||||
/** South's Avatar 1 (Broken Bits, 4 Cores, 9 Health) on B1 facing North's Avatar 1 on C1. */
|
||||
function standoff(o: { northMain?: string[] } = {}): Table {
|
||||
const t = new Table({ health: true, north: { main: o.northMain } });
|
||||
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');
|
||||
t.own(1, 'C1');
|
||||
t.place(0, 1, 'B1');
|
||||
|
|
@ -180,3 +180,68 @@ test('health: with two defenders the damage destroys the weakest first, and the
|
|||
assert.equal(u.s.locations.C1.owner, 0);
|
||||
assert.equal(u.avatar(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;
|
||||
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');
|
||||
});
|
||||
|
||||
test('health: Overflow Error only disables, until the next command, while the attacker lives', () => {
|
||||
const t = standoff({ northMain: ['Overflow Error'], southMain: ['Stack Overflow'] });
|
||||
t.program(1, 'C1', 'Overflow Error');
|
||||
const so = t.program(0, 'B1', 'Stack Overflow');
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(3, 3, 3, 3, 4, 4, 4, 4);
|
||||
t.end();
|
||||
assert.equal(t.s.choice?.kind, 'Overflow Error:hit');
|
||||
assert.ok(t.s.choice!.options.every((o) => o.label.startsWith('Disable')), 'no destroy option while the attacker lives');
|
||||
t.choose('Disable Stack Overflow').settle();
|
||||
assert.ok(t.s.cards[so].disabledUntil > t.s.clock && t.s.cards[so].disabledUntil < FOREVER, 'disabled until the next command');
|
||||
assert.ok(t.s.locations.B1.programs.includes(so), 'still installed');
|
||||
});
|
||||
|
||||
test('health: Overflow Error may destroy a Program when the attacker is destroyed', () => {
|
||||
const t = standoff({ northMain: ['Overflow Error'], southMain: ['Stack Overflow'] });
|
||||
t.program(1, 'C1', 'Overflow Error');
|
||||
const so = t.program(0, 'B1', 'Stack Overflow');
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
t.rig(1, 1, 1, 1, 6, 6, 6, 6); // 4 to 24: 20 damage on 9 Health
|
||||
t.end();
|
||||
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);
|
||||
});
|
||||
|
||||
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'] } });
|
||||
t.own(0, 'B1');
|
||||
t.place(0, 1, 'B1');
|
||||
const bm = t.avatar(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);
|
||||
assert.equal(healthLeft(t.s, { player: 0, slot: 1 }), 8);
|
||||
});
|
||||
|
||||
test('health: RAM Expansion adds 2 Health, so a hit that would destroy the wearer leaves it standing', () => {
|
||||
const t = standoff({ northMain: ['RAM Expansion'] });
|
||||
t.hardware(1, 1, 'RAM Expansion');
|
||||
assert.equal(healthOf(t.s, { player: 1, slot: 1 }), 11);
|
||||
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(healthLeft(t.s, { player: 1, slot: 1 }), 2);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue