feat: směrové ovládání tanků, větší mapy, zvýraznění vlastního tanku a legenda bonusů
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Successful in 2m0s
CI / Build and push Docker image (push) Successful in 49s
CI / Notify (push) Successful in 2s
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Successful in 2m0s
CI / Build and push Docker image (push) Successful in 49s
CI / Notify (push) Successful in 2s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c8132c283c
commit
16cf680183
6 files changed
+330
-146
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
TankGame, TankState, MAPS, COLS, ROWS, TICK_MS, COUNTDOWN_SECONDS, RESPAWN_MS, DEATHMATCH_MS,
|
||||
LAST_MAN_LIVES, MAX_PLAYERS, TANK_RADIUS, ROCKET_AMMO, MINE_AMMO, MINE_ARM_MS,
|
||||
LAST_MAN_LIVES, MAX_PLAYERS, TANK_RADIUS, ROCKET_AMMO, MINE_AMMO, MINE_ARM_MS, FIELD_WIDTH,
|
||||
} from '../tankGame';
|
||||
import { GameError } from '../minigames';
|
||||
import { fakeClock } from './helpers/fakeClock';
|
||||
@@ -94,6 +94,32 @@ describe('tanky', () => {
|
||||
expect(ctx.player('alice').angle).toBe(0);
|
||||
});
|
||||
|
||||
test('směrové ovládání jede rovnou zvoleným směrem', () => {
|
||||
const ctx = setup();
|
||||
ctx.startGame();
|
||||
ctx.game.placeForTest('alice', 300, 300, 0);
|
||||
ctx.game.input('alice', { dx: 0, dy: -1 });
|
||||
ctx.ticks(10);
|
||||
const p = ctx.player('alice');
|
||||
expect(p.angle).toBeCloseTo(-Math.PI / 2, 2);
|
||||
expect(p.x).toBeCloseTo(300, 0);
|
||||
expect(p.y).toBeLessThan(300);
|
||||
});
|
||||
|
||||
test('směrové ovládání bez stisknutého směru tank zastaví a nechá natočený', () => {
|
||||
const ctx = setup();
|
||||
ctx.startGame();
|
||||
ctx.game.placeForTest('alice', 300, 300, 0);
|
||||
ctx.game.input('alice', { dx: -1, dy: 0 });
|
||||
ctx.ticks(1);
|
||||
ctx.game.input('alice', { dx: 0, dy: 0 });
|
||||
const { x, angle } = ctx.player('alice');
|
||||
expect(x).toBeLessThan(300);
|
||||
ctx.ticks(5);
|
||||
expect(ctx.player('alice').angle).toBe(angle);
|
||||
expect(ctx.player('alice').x).toBe(x);
|
||||
});
|
||||
|
||||
test('zásah zničí soupeře, přidá bod a soupeř se po chvíli znovu objeví', () => {
|
||||
const ctx = setup();
|
||||
ctx.startGame();
|
||||
@@ -397,7 +423,7 @@ describe('tanky — týmy', () => {
|
||||
const ctx = setup();
|
||||
ctx.startGame('deathmatch', LOGINS, 'arena', true);
|
||||
for (const p of ctx.last().players) {
|
||||
expect(p.x < 480).toBe(p.team === 0);
|
||||
expect(p.x < FIELD_WIDTH / 2).toBe(p.team === 0);
|
||||
}
|
||||
// alice a carol jsou tým 0, bob tým 1
|
||||
ctx.game.placeForTest('alice', 100, 60, 0);
|
||||
|
||||
Reference in new issue
Block a user