diff --git a/apps/server/src/rooms/uno.room.test.ts b/apps/server/src/rooms/uno.room.test.ts index 4877a56..0f503ce 100644 --- a/apps/server/src/rooms/uno.room.test.ts +++ b/apps/server/src/rooms/uno.room.test.ts @@ -28,7 +28,7 @@ function practice(options: Record = {}) { room.addBot('A'); room.configure('A', { options: { ...(room.config.options as object), ...options } }); expect(room.start('A')).toBeNull(); - return { room, clock, msgs }; + return { room, clock, msgs, a }; } /** Bots move at once; when the game waits on the person, they play their first legal action (or the clock runs out). */ @@ -72,3 +72,19 @@ test('500 points with house rules: the person only times out, the computers stil const view = JSON.stringify(GAMES.uno!.view(s, 'A')); for (const bot of s.seats.filter(isBotId)) for (const c of s.hands[bot]!) expect(view).not.toContain(`"${c.id}"`); }); + +test('무제한 time: no clock while the person is here; a dropped connection is still auto-played after the grace time', () => { + const { room, clock, a } = practice({ turnSeconds: null }); + // Let the computers move until the game waits on the person. + for (let i = 0; i < 200 && room.bots.dueAt !== null; i++) room.bots.fire(); + const s = () => room.game!.state as UnoState; + expect(GAMES.uno!.activePlayers(s())).toContain('A'); + expect(room.effectiveDeadline()).toBeNull(); + const turn = s().turnNo; + room.disconnect(a); + const d = room.effectiveDeadline(); + expect(d).not.toBeNull(); + clock.advance(d! - clock.advance(0) + 1); + room.onTimer(); + expect(s().turnNo !== turn || s().log.some((e) => e.t === 'timeout' && e.p === 'A')).toBe(true); +}); diff --git a/apps/web/src/games/bang/help.ts b/apps/web/src/games/bang/help.ts index bda8e8f..7b1a436 100644 --- a/apps/web/src/games/bang/help.ts +++ b/apps/web/src/games/bang/help.ts @@ -77,7 +77,7 @@ export function helpNow(v: BangView, me: string | null, players: Record= p.needed) { const label = use.map((c) => NAME[c.kind as 'bang' | 'missed'] ?? '빗나감!').join(' + '); lines.push(`[${label} 내기]를 누르면 막아요. 막지 않으려면 [맞기 (생명 −1)]를 눌러요.`); - if (v.options.autoDefend) lines.push('시간 안에 고르지 않으면 막을 카드를 자동으로 내요.'); + if (v.options.autoDefend) lines.push(v.options.reactionSeconds === null ? '반응 시간 제한은 없어요. 연결이 끊긴 채 오래 돌아오지 않으면 막을 카드를 자동으로 내요.' : '시간 안에 고르지 않으면 막을 카드를 자동으로 내요.'); } else lines.push(`막을 카드가 ${p.options.length > 0 ? '모자라요' : '없어요'}. [맞기 (생명 −1)]를 눌러요.`); if (p.canBarrel) lines.push('[술통 판정하기]를 누르면 카드를 한 장 뒤집어 ♥가 나올 때 피해요.'); lines.push(life); diff --git a/apps/web/src/games/bang/index.tsx b/apps/web/src/games/bang/index.tsx index 95f33e8..755390c 100644 --- a/apps/web/src/games/bang/index.tsx +++ b/apps/web/src/games/bang/index.tsx @@ -1034,7 +1034,7 @@ function BangSide({ view: v, me, players }: BoardProps) { {v.winner ? ' · 게임 끝' : ''} - 카드 더미 {v.deckCount}장 · 버린 카드 {v.discardCount}장 · 반응 {v.options.reactionSeconds}초 · 턴 {v.options.turnSeconds}초 + 카드 더미 {v.deckCount}장 · 버린 카드 {v.discardCount}장 · {secText('반응', v.options.reactionSeconds)} · {secText('턴', v.options.turnSeconds)}
    {v.players.map((p) => ( @@ -1132,7 +1132,7 @@ function statusText(v: BangView, me: string | null, players: Record({ value, options, onChange, label }: { value: T; options: [T, string][]; onChange: (v: T) => void; label: string }) { +function Seg({ value, options, onChange, label }: { value: T; options: [T, string][]; onChange: (v: T) => void; label: string }) { return (
    {options.map(([k, l]) => ( @@ -1168,10 +1168,10 @@ function Options({ value: o, onChange }: OptionsProps) { set({ characterDraft })} /> - set({ turnSeconds })} /> + set({ turnSeconds })} /> - - set({ reactionSeconds })} /> + + set({ reactionSeconds })} />