체스·장기·쿼리도 소리·움직임, 장기 상차림 시간 무제한
- 체스: 기물이 출발 칸에서 미끄러져 와 내려앉음(내가 끌어다 놓은 수는 제외), 캐슬링은 룩도 같이, 잡힌 기물(앙파상 폰 포함) 사라짐, 체크 칸 빛·말풍선 튀어나옴, 마지막 수 칸 살짝 나타남 - 체스 소리: 나무 기물 톡, 잡기, 캐슬링, 승진, 체크, 체크메이트 순간, 무르기, 기물 집기, 안 되는 칸 (fx.ts 순수 함수 + 테스트) - 장기: 묵직한 기물 미끄러짐·내려앉기, 잡힌 기물 사라짐, 장군 궁 자리 고동, 상차림 마·상 하나씩 튀어나옴 - 장기 소리: 두꺼운 나무 "딱", 잡기, 장군·멍군·빅장, 외통 순간, 한수쉼, 무르기, 상차림 놓기 (fx.ts + 테스트) - 장기 상차림 고르는 시간에 무제한(0) 추가, 방 설정 "자세한 설정"에서 30초·1분·3분·무제한 (기본 1분 그대로), 무제한이면 상차림 시계 숨김, 끊긴 사람만 접속 유예 뒤 자동 선택 - 쿼리도: 말 한 칸은 살짝 튀며, 점프는 높이 뛰어 넘음, 도착 칸 고리, 벽 내려앉기+먼지, 무르기로 빠진 벽 사라짐, 안 되는 벽 흔들림, 목표 도착 띠 깜빡임·금빛 고리 - 쿼리도 소리: 말 톡, 점프, 벽 끼우기, 안 되는 곳, 목표 도착, 무르기 - 상대·컴퓨터 수도 화면 변화로 같은 소리·움직임, 새로 열면 다시 재생 안 함, 숨은 탭 내 차례 소리는 방 화면에 맡김 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,7 +62,7 @@ export const janggiOptionsSchema = z.object({
|
||||
})
|
||||
.default({ kind: 'byoyomi', mainSec: 600, periodSec: 30, periods: 3 })
|
||||
.meta({ title: '시간 제한' }),
|
||||
setupTimeSec: z.number().int().min(10).max(600).default(60).meta({ title: '상차림 고르는 시간(초)' }),
|
||||
setupTimeSec: z.number().int().min(0).max(600).default(60).meta({ title: '상차림 고르는 시간(초, 0이면 무제한)' }),
|
||||
undo: z
|
||||
.enum(['off', '1', '3', 'unlimited'])
|
||||
.default('3')
|
||||
@@ -722,7 +722,8 @@ export const janggi: GameDefinition<JanggiState, JanggiAction, JanggiView, Jangg
|
||||
},
|
||||
|
||||
deadline(s) {
|
||||
if (s.phase === 'setup') return s.setup.startedAt + s.options.setupTimeSec * 1000;
|
||||
// 상차림 시간 0 = 무제한 (연결이 끊긴 사람만 방의 접속 유예 뒤에 자동으로 골라 줌)
|
||||
if (s.phase === 'setup') return s.options.setupTimeSec > 0 ? s.setup.startedAt + s.options.setupTimeSec * 1000 : null;
|
||||
if (s.phase !== 'playing') return null;
|
||||
const tc = s.options.timeControl;
|
||||
const start = s.clock.turnStartedAt;
|
||||
|
||||
@@ -138,6 +138,30 @@ describe('setup (§4)', () => {
|
||||
expect(janggi.validate(fresh(), 'A', { type: 'timeout' }).ok).toBe(false);
|
||||
});
|
||||
|
||||
test('setupTimeSec 0 = no setup deadline; a disconnected chooser can still be auto-picked', () => {
|
||||
expect(opts().setupTimeSec).toBe(60);
|
||||
expect(janggi.deadline!(fresh())).toBe(60_000);
|
||||
expect(janggi.optionsSchema.safeParse({ setupTimeSec: 0 }).success).toBe(true);
|
||||
expect(janggi.optionsSchema.safeParse({ setupTimeSec: -1 }).success).toBe(false);
|
||||
const none = { setupTimeSec: 0, timeControl: { kind: 'none' as const, mainSec: 600, periodSec: 30, periods: 3 } };
|
||||
let s = fresh(none);
|
||||
expect(janggi.deadline!(s)).toBeNull();
|
||||
// The room only fires the timeout after the disconnect grace (deadline null), so the players stay listed.
|
||||
expect(janggi.timeoutPlayers!(s)).toEqual(['B']);
|
||||
s = act(s, 'B', janggi.onTimeout(s, 'B'), 5_000_000);
|
||||
expect(s.setup.choice.han).not.toBeNull();
|
||||
expect(janggi.deadline!(s)).toBeNull();
|
||||
s = act(s, 'A', { type: 'chooseSetup', arrangement: 'SMMS' }, 9_000_000);
|
||||
expect(s.phase).toBe('playing');
|
||||
expect(janggi.deadline!(s)).toBeNull();
|
||||
// The main clock is independent: unlimited setup with byoyomi play still times the moves.
|
||||
let t = fresh({ setupTimeSec: 0 });
|
||||
t = act(t, 'B', { type: 'chooseSetup', arrangement: 'MSSM' });
|
||||
t = act(t, 'A', { type: 'chooseSetup', arrangement: 'MSSM' }, 2000);
|
||||
expect(janggi.deadline!(t)).toBe(2000 + 600_000 + 3 * 30_000);
|
||||
expect(janggi.view(t, 'A').rules.setupTimeSec).toBe(0);
|
||||
});
|
||||
|
||||
test('resign during setup aborts without a result ranking', () => {
|
||||
const s = act(fresh(), 'A', { type: 'resign' });
|
||||
expect(janggi.result(s)).toMatchObject({ ranking: [], reason: 'abandoned' });
|
||||
|
||||
Reference in New Issue
Block a user