카드 게임 시간 무제한(우노·뱅!·달무티·고스톱·도둑잡기·포커·바퀴벌레 포커·99), 공통 카드 움직임(card-fx), 우노·달무티·도둑잡기·포커 소리·애니메이션

- 무제한(null): 차례 시계·타임아웃 없음, 자리 비움만 짧은 시계, 연결 끊김은 방 유예 뒤 자동 행동 그대로
- 포커는 리바이 고르는 시간도 무제한 가능, 고스톱은 고·스톱 선택 시간도 무제한 가능, 뱅!은 반응 시간·캐릭터 고르기도
- card-fx: 날아가는 카드·칩(ghost), 제자리 날아오기, 배너, view 변화 감지 훅(처음 렌더·다시 보기는 건너뜀)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-13 13:04:11 +09:00
parent f12cf12b84
commit ac37a6a6d8
44 changed files with 1438 additions and 198 deletions

View File

@@ -256,9 +256,11 @@ function validatePlay(s: NinetyNineState, actor: PlayerId, a: PlayAction): Valid
return r.ok ? ok : fail(r.reason);
}
/** Turn clock in ms; null = 무제한 (away players still get the short clock). */
function deadlineMs(s: NinetyNineState): number | null {
if (s.phase !== 'playing') return null;
return s.away[s.current] ? AWAY_MS : s.options.turnSeconds * 1000;
if (s.away[s.current]) return AWAY_MS;
return s.options.turnSeconds === null ? null : s.options.turnSeconds * 1000;
}
function handView(s: NinetyNineState, p: PlayerId, myTurn: boolean): HandCardView[] {

View File

@@ -463,6 +463,20 @@ describe('시간 초과, 연결 끊김, 나가기 (§8.5)', () => {
expect([t.away.A, t.timeoutsInRow.A]).toEqual([false, 0]);
});
test('무제한 (turnSeconds null): no turn clock, but timeouts (dropped connection) still play and lead to away (3 s clock)', () => {
expect(ninetyNine.optionsSchema.safeParse({ turnSeconds: null }).success).toBe(true);
let s = rig(make({ turnSeconds: null }), { hands: { A: ['1', '2', '3', '4'], B: ['1', '2', '3', '4'], C: ['1', '2', '3', '4'] }, total: 10 });
expect(ninetyNine.deadline!(s)).toBeNull();
expect(ninetyNine.view(s, 'A').deadlineTotalMs).toBe(0);
s.timeoutsInRow.A = 2;
s = act(s, 'A', { type: 'timeout' });
expect(s.away.A).toBe(true);
expect(s.total).toBeGreaterThan(10);
expect(ninetyNine.deadline!(s)).toBeNull();
s.current = 'A';
expect(ninetyNine.deadline!(s)).toBe(s.turnStartedAt + 3000);
});
test('leaving: the current player leaving passes the turn with the same total; 2 players → the other wins', () => {
let s = rig(make({ lives: 3 }), { hands: { A: ['1'], B: ['2'], C: ['3'] }, total: 40 });
expect(ninetyNine.onLeave!(s, 'A')).toEqual({ type: 'leave' });

View File

@@ -2,7 +2,7 @@
import { z } from 'zod';
import type { PlayerId } from '@bg/engine';
const lit = <T extends string | number>(...vals: T[]) =>
const lit = <T extends string | number | null>(...vals: T[]) =>
z.union(vals.map((v) => z.literal(v)) as unknown as [z.ZodLiteral<T>, z.ZodLiteral<T>, ...z.ZodLiteral<T>[]]);
export const ninetyNineOptionsSchema = z.object({
@@ -47,9 +47,10 @@ export const ninetyNineOptionsSchema = z.object({
deckCount: lit<'auto' | 1 | 2>('auto', 1, 2)
.default('auto')
.meta({ title: '(트럼프) 덱 수', labels: { auto: '자동(7명부터 2벌)', 1: '1벌', 2: '2벌' } }),
turnSeconds: lit(10, 15, 20, 30)
/** null = 무제한 (no turn clock; a dropped connection still gets auto moves after the room's grace time). */
turnSeconds: lit(10, 15, 20, 30, null)
.default(15)
.meta({ title: '한 턴 제한 시간', labels: { 10: '10초', 15: '15초', 20: '20초', 30: '30초' } }),
.meta({ title: '한 턴 제한 시간', labels: { 10: '10초', 15: '15초', 20: '20초', 30: '30초', null: '무제한' } }),
});
export type NNOptions = z.infer<typeof ninetyNineOptionsSchema>;
export type NNMode = NNOptions['mode'];