Prepare Void Bastion alpha 7 release
This commit is contained in:
1 parent
56077e88a5
commit
e63e08ddde
18 files changed
+799
-95
No files matched your search
@@ -8,6 +8,62 @@ const context = { console, Math, Date, JSON, isFinite };
|
||||
vm.createContext(context);
|
||||
vm.runInContext(source, context);
|
||||
|
||||
assert.strictEqual(context.ENEMIES.length, 9);
|
||||
assert.strictEqual(context.ENEMIES[0].category, "air");
|
||||
assert.strictEqual(context.ENEMIES[6].category, "ground");
|
||||
assert.strictEqual(context.TOWERS[0].targetClass, "ground");
|
||||
assert.strictEqual(context.TOWERS[1].targetClass, "both");
|
||||
assert.ok(context.TOWERS[1].bothScale < 1, "The all-purpose laser should trade damage for shield-breaking ground coverage.");
|
||||
assert.strictEqual(context.TOWERS[3].targetClass, "both");
|
||||
assert.ok(context.TOWERS[3].bothScale < 1, "Universal towers should trade damage for flexibility.");
|
||||
assert.strictEqual(context.TOWERS[4].damage, 20, "EMP damage should be tuned down to about 20.");
|
||||
assert.strictEqual(context.TOWERS[4].targetClass, "both", "EMP should cover both air and ground units.");
|
||||
const shieldTest = { hp: 100, shield: true, shield_hp: 30, max_shield_hp: 30, shield_resistance: 0.28 };
|
||||
context.applyDamageToEnemy(shieldTest, 20, 1);
|
||||
assert.strictEqual(shieldTest.hp, 100, "Laser damage should drain shield before hull.");
|
||||
assert.strictEqual(shieldTest.shield_hp, 10);
|
||||
context.applyDamageToEnemy(shieldTest, 20, 1);
|
||||
assert.strictEqual(shieldTest.shield, false);
|
||||
assert.strictEqual(shieldTest.hp, 90, "Laser damage beyond shield capacity should spill into hull.");
|
||||
const priorityState = {
|
||||
towers: [{ id: 1, type: 1, x: 800, y: 120, owner: 0, level: 1, cooldown: 0 }],
|
||||
enemies: [
|
||||
{ id: 201, type: 6, x: 850, y: 120, path_index: 1, hp: 100, shield: true, shield_hp: 50, max_shield_hp: 50, shield_resistance: 0.28 },
|
||||
{ id: 202, type: 0, x: 950, y: 120, path_index: 1, hp: 100, shield: false }
|
||||
],
|
||||
credits: [0, 0], wave: 1
|
||||
};
|
||||
context.updateTowers(priorityState, 1);
|
||||
assert.ok(priorityState.enemies[0].shield_hp < 50, "Online lasers should drain a shield before firing at unshielded units.");
|
||||
assert.strictEqual(priorityState.enemies[1].hp, 100);
|
||||
|
||||
const railgunState = {
|
||||
towers: [{ id: 10, type: 5, x: 300, y: 120, owner: 0, level: 1, cooldown: 0 }],
|
||||
enemies: [
|
||||
{ id: 301, type: 0, x: 400, y: 120, path_index: 1, hp: 1000, shield: false },
|
||||
{ id: 302, type: 6, x: 500, y: 120, path_index: 1, hp: 1000, shield: false },
|
||||
{ id: 303, type: 0, x: 450, y: 150, path_index: 1, hp: 1000, shield: false }
|
||||
],
|
||||
credits: [0, 0], wave: 1
|
||||
};
|
||||
context.updateTowers(railgunState, 0.01);
|
||||
assert.ok(railgunState.enemies[0].hp < 1000 && railgunState.enemies[1].hp < 1000, "Online railgun should pierce enemies behind its first hit on the same line.");
|
||||
assert.strictEqual(railgunState.enemies[2].hp, 1000, "Online railgun should not hit units away from its beam line.");
|
||||
|
||||
const empState = {
|
||||
towers: [{ id: 11, type: 4, x: 300, y: 120, owner: 0, level: 1, cooldown: 0 }],
|
||||
enemies: [
|
||||
{ id: 401, type: 0, x: 400, y: 120, path_index: 1, hp: 1000, shield: false },
|
||||
{ id: 402, type: 6, x: 450, y: 120, path_index: 1, hp: 1000, shield: false },
|
||||
{ id: 403, type: 6, x: 570, y: 120, path_index: 1, hp: 1000, shield: false }
|
||||
],
|
||||
credits: [0, 0], wave: 1
|
||||
};
|
||||
context.updateTowers(empState, 0.01);
|
||||
assert.strictEqual(empState.enemies[0].hp, 980, "EMP should deal 20 damage to its primary target.");
|
||||
assert.strictEqual(empState.enemies[1].hp, 980, "EMP should deal its reduced 20 damage to nearby ground units too.");
|
||||
assert.strictEqual(empState.enemies[2].hp, 1000, "EMP should not damage units outside its area radius.");
|
||||
|
||||
const sent = [];
|
||||
const dispatcher = {
|
||||
broadcastMessage(opCode, data) {
|
||||
@@ -132,6 +188,9 @@ assert.strictEqual(state.credits[1], 250);
|
||||
state = context.matchLoop({}, logger, nk, dispatcher, 6, state, [message(presenceA, 13, {})]).state;
|
||||
assert.strictEqual(state.wave, 1);
|
||||
assert.strictEqual(state.waveActive, true);
|
||||
assert.strictEqual(context.snapshot(state, 6).wave_types_remaining.length, state.spawnRemaining);
|
||||
const groundSchedule = context.buildWaveSchedule(state, 3, context.wavePopulation(state, 3));
|
||||
assert.ok(groundSchedule.some(entry => context.ENEMIES[entry.type].category === "ground"), "Ground units should enter the wave schedule from wave 3.");
|
||||
for (let tick = 7; tick < 30; tick++) state = context.matchLoop({}, logger, nk, dispatcher, tick, state, []).state;
|
||||
assert.ok(state.enemies.length > 0 || state.spawnRemaining > 0);
|
||||
assert.ok(sent.some(entry => entry.opCode === 1 && entry.data.started === true));
|
||||
|
||||
Reference in new issue
Block a user