Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions battle-tanks/scripts/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion battle-tanks/scripts/game.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions server/battle-tanks-rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ class BattleTanksRooms {
// Health remains public, but no positional or aiming property crosses the trust boundary.
state.tanks[opponent] = { health: room.game.tanks[opponent].health, concealed: true };
if (state.activePlayer === opponent) state.announcement = 'Opponent concealed.';
// Rays resolve synchronously, so their complete path must be removed just
// like a projectile that has not crossed the disclosure boundary. Impact
// history contains the same path and must not provide a second side channel.
if (state.laserPath?.owner === opponent) state.laserPath = null;
state.impacts = state.impacts.map(impact => impact.type === 'laser' && impact.owner === opponent ? { ...impact, path: null } : impact);
if (state.lastImpact?.type === 'laser' && state.lastImpact.owner === opponent) state.lastImpact = { ...state.lastImpact, path: null };
const projectile = room.game.projectile;
if (projectile?.owner === opponent) {
const barrier = room.game.arena.barrier;
Expand Down
7 changes: 7 additions & 0 deletions tests/battle-tanks-page.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ test('Battle Tanks collects pickups along local pointer-drag movement', () => {
assert.match(app, /pointermove[\s\S]*?tank\.y=tankYAt\(state,tank\);collectPickup\(state,state\.activePlayer\);sync\(\)/);
});

test('Battle Tanks disables online-only power-ups in local matches and guards activation', () => {
const app = read('battle-tanks/scripts/app.js'), core = require('../battle-tanks/scripts/game');
assert.equal(core.POWER_UP_CATALOG.invisibility.onlineOnly, true);
assert.match(app, /button\.disabled=locked\|\|unavailable/);
assert.match(app, /if\(!item\|\|item\.onlineOnly&&mode!==['"]online['"]\)return/);
});

test('Battle Tanks exposes an accessible, queued, local-only acquisition card', () => {
const page = read('battle-tanks/index.html'), app = read('battle-tanks/scripts/app.js'), styles = read('battle-tanks/styles.css');
assert.match(page, /id="power-card"[^>]*role="dialog"/); assert.match(page, /id="dismiss-power-card"[^>]*aria-label="Dismiss power-up card"/); assert.match(page, /id="power-card-live"[^>]*aria-live="polite"/);
Expand Down
14 changes: 14 additions & 0 deletions tests/battle-tanks-rooms.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading