카드 게임 시간 무제한(우노·뱅!·달무티·고스톱·도둑잡기·포커·바퀴벌레 포커·99), 공통 카드 움직임(card-fx), 우노·달무티·도둑잡기·포커 소리·애니메이션
- 무제한(null): 차례 시계·타임아웃 없음, 자리 비움만 짧은 시계, 연결 끊김은 방 유예 뒤 자동 행동 그대로 - 포커는 리바이 고르는 시간도 무제한 가능, 고스톱은 고·스톱 선택 시간도 무제한 가능, 뱅!은 반응 시간·캐릭터 고르기도 - card-fx: 날아가는 카드·칩(ghost), 제자리 날아오기, 배너, view 변화 감지 훅(처음 렌더·다시 보기는 건너뜀) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -475,6 +475,30 @@ describe('시간 초과와 나가기 (§8.5)', () => {
|
||||
expect(s.away.B).toBe(false);
|
||||
});
|
||||
|
||||
test('무제한 (turnSeconds null): no clock for turns, hand check or tax return; timeouts still work and away keeps the 5 s clock', () => {
|
||||
expect(dalmuti.optionsSchema.safeParse({ turnSeconds: null }).success).toBe(true);
|
||||
// Hand check and tax return have no clock either.
|
||||
let c = make({ turnSeconds: null });
|
||||
expect(c.phase.kind).toBe('revolutionCheck');
|
||||
expect(dalmuti.deadline!(c)).toBeNull();
|
||||
expect(dalmuti.view(c, 'A').deadlineTotalMs).toBe(0);
|
||||
for (const p of c.players) c = act(c, p, { type: 'timeout' });
|
||||
expect(c.phase.kind).toBe('taxReturn');
|
||||
expect(dalmuti.deadline!(c)).toBeNull();
|
||||
// Playing: no turn clock; a dropped connection's timeouts still play and lead to away.
|
||||
let s = rig(make({ turnSeconds: null }), { order: P5, hands: { A: [C(1, 1), C(9, 1), C(9, 2), C(9, 3)], B: [C(12, 1), C(12, 2)], C: [C(12, 3)], D: [C(12, 4)], E: [C(12, 5)] } });
|
||||
s.timeoutsInRow.B = 2;
|
||||
s = play(s, 'A', [C(9, 1)]);
|
||||
expect(dalmuti.deadline!(s)).toBeNull();
|
||||
s = act(s, 'B', { type: 'timeout' });
|
||||
expect(s.away.B).toBe(true);
|
||||
for (const p of ['C', 'D', 'E']) s = pass(s, p);
|
||||
s = play(s, 'A', [C(9, 2)]);
|
||||
expect(s.current).toBe('B');
|
||||
expect(dalmuti.deadline!(s)).toBe(s.turnStartedAt + 5000);
|
||||
expect(dalmuti.view(s, 'A').deadlineTotalMs).toBe(5000);
|
||||
});
|
||||
|
||||
test('leaving does not eliminate: the seat stays, marked away, and keeps being auto-played', () => {
|
||||
let s = rig(make(), { order: P5, hands: { A: [C(9, 1)], B: [C(12, 1), C(5, 1)], C: [C(12, 3)], D: [C(12, 4)], E: [C(12, 5)] } });
|
||||
expect(dalmuti.onLeave!(s, 'B')).toEqual({ type: 'leave' });
|
||||
|
||||
@@ -437,18 +437,20 @@ function waiting(s: DalmutiState): PlayerId[] {
|
||||
}
|
||||
}
|
||||
|
||||
/** Clock in ms; null = 무제한 (`turnSeconds` null: no clock for any decision, but away players keep the short one). */
|
||||
function deadlineMs(s: DalmutiState): number | null {
|
||||
const w = waiting(s);
|
||||
const allAway = w.length > 0 && w.every((p) => s.away[p]);
|
||||
if (s.phase.kind === 'finished') return null;
|
||||
if (allAway) return AWAY_MS;
|
||||
if (s.options.turnSeconds === null) return null;
|
||||
switch (s.phase.kind) {
|
||||
case 'revolutionCheck':
|
||||
return allAway ? AWAY_MS : REVOLUTION_MS;
|
||||
return REVOLUTION_MS;
|
||||
case 'taxReturn':
|
||||
return allAway ? AWAY_MS : TAX_MS;
|
||||
return TAX_MS;
|
||||
case 'playing':
|
||||
return allAway ? AWAY_MS : s.options.turnSeconds * 1000;
|
||||
case 'finished':
|
||||
return null;
|
||||
return s.options.turnSeconds * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export function deckFor(removeHighCards: boolean): DCard[] {
|
||||
|
||||
// ---------------------------------------------------------------- options / actions
|
||||
|
||||
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 dalmutiOptionsSchema = z.object({
|
||||
@@ -66,9 +66,13 @@ export const dalmutiOptionsSchema = z.object({
|
||||
jesterTaxable: z.boolean().default(false).meta({ title: '세금 낼 때 광대도 좋은 카드로 내기' }),
|
||||
passLocksOut: z.boolean().default(false).meta({ title: '한 번 패스하면 그 트릭에서 다시 못 내기' }),
|
||||
removeHighCards: z.boolean().default(false).meta({ title: '9~12 카드를 빼고 하기(38장)' }),
|
||||
turnSeconds: lit<15 | 20 | 30 | 45>(15, 20, 30, 45)
|
||||
/**
|
||||
* null = 무제한: no clock for turns, the hand check and the tax return either (a dropped connection still gets
|
||||
* automatic moves after the room's grace time, and away players keep the short clock).
|
||||
*/
|
||||
turnSeconds: lit<15 | 20 | 30 | 45 | null>(15, 20, 30, 45, null)
|
||||
.default(20)
|
||||
.meta({ title: '한 턴 제한 시간', labels: { 15: '15초', 20: '20초', 30: '30초', 45: '45초' } }),
|
||||
.meta({ title: '한 턴 제한 시간', labels: { 15: '15초', 20: '20초', 30: '30초', 45: '45초', null: '무제한' } }),
|
||||
});
|
||||
export type DalmutiOptions = z.infer<typeof dalmutiOptionsSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user