Release alpha 13 balance and mission tests
This commit is contained in:
1 parent
fc4fcd40a4
commit
026d0bad58
9 files changed
+219
-13
No files matched your search
@@ -22,6 +22,10 @@ assert.ok(context.TOWERS[3].bothScale < 1, "Universal towers should trade damage
|
||||
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.");
|
||||
assert.strictEqual(context.TOWERS[6].targetClass, "air", "The Flak tower must only target air units.");
|
||||
assert.strictEqual(context.TOWERS[6].damage, 22, "The air-only Flak tower should receive its focused damage tuning.");
|
||||
assert.strictEqual(context.ENEMIES[5].hp, 620, "The first aerial boss base hull should use the reduced balance value.");
|
||||
assert.strictEqual(context.initialState({ difficulty: 0 }).difficulty, 0, "Easy must not be coerced to the default difficulty.");
|
||||
assert.strictEqual(context.initialState({ difficulty: 0 }).credits[0], context.DIFFICULTIES[0].startCredits);
|
||||
const balanceStorage = new Map();
|
||||
let balanceVersion = 0;
|
||||
const balanceNk = {
|
||||
@@ -44,6 +48,25 @@ assert.strictEqual(JSON.parse(context.rpcSetGameBalance({}, {}, balanceNk, JSON.
|
||||
assert.strictEqual(JSON.parse(context.rpcGetGameBalance({ userId: "pilot-b" }, {}, balanceNk, "{}")).config.towers[0].damage, 31);
|
||||
assert.strictEqual(context.matchInit({}, {}, balanceNk, { difficulty: 1 }).state.balance.enemies[0].hp, 90);
|
||||
assert.throws(() => context.rpcSetGameBalance({}, {}, balanceNk, JSON.stringify({ config: { towers: [], enemies: [] } })), /invalid balance schema/);
|
||||
const legacyStorage = new Map();
|
||||
const legacyKey = `game_balance:${context.SYSTEM_USER_ID}:global`;
|
||||
const legacyConfig = JSON.parse(JSON.stringify(context.defaultBalanceConfig()));
|
||||
legacyConfig.schema = 1;
|
||||
legacyConfig.towers[0].damage = 31;
|
||||
legacyConfig.towers[6].damage = 20;
|
||||
legacyConfig.enemies[5].hp = 740;
|
||||
legacyStorage.set(legacyKey, { collection: "game_balance", key: "global", userId: context.SYSTEM_USER_ID,
|
||||
value: { config: legacyConfig, updated_at: 1 }, permissionRead: 0, permissionWrite: 0, version: "7" });
|
||||
const migrationNk = {
|
||||
storageRead(ops) { return ops.map(op => legacyStorage.get(`${op.collection}:${op.userId}:${op.key}`)).filter(Boolean); },
|
||||
storageWrite(ops) { for (const op of ops) legacyStorage.set(`${op.collection}:${op.userId}:${op.key}`, { ...op, version: "8" }); }
|
||||
};
|
||||
const migratedBalance = context.readBalanceConfig(migrationNk);
|
||||
assert.strictEqual(migratedBalance.config.schema, 2);
|
||||
assert.strictEqual(migratedBalance.config.towers[0].damage, 31, "Balance migrations must preserve unrelated admin tuning.");
|
||||
assert.strictEqual(migratedBalance.config.towers[6].damage, 22, "Unchanged legacy Flak defaults should migrate to the new value.");
|
||||
assert.strictEqual(migratedBalance.config.enemies[5].hp, 620, "Unchanged legacy boss HP should migrate to the new value.");
|
||||
assert.strictEqual(legacyStorage.get(legacyKey).value.config.schema, 2, "Migrated balance should persist for future matches.");
|
||||
const hostId = "11111111-1111-1111-1111-111111111111";
|
||||
const friendId = "22222222-2222-2222-2222-222222222222";
|
||||
const sentInvites = [];
|
||||
|
||||
Reference in new issue
Block a user