섯다 화면 다시 만듦(한게임 섯다처럼): 초록 테이블·가운데 판돈·숫자 키 베팅 버튼·족보 도우미, 동전 날아가기·카드 나눠 주기·뒤집기·큰 글자 연출과 소리, 실제 화투 그림(Wikimedia Commons, CC BY-SA 4.0, 고스톱도 같이), 원·판돈 표기(돈 표현 검사에서 섯다만 예외), 문서·E2E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
/** 섯다 [?] "지금 할 수 있는 것" (docs/07 §5). Pure: only reads the client view (never other players' cards). */
|
||||
import type { BetType, SeotdaSeatView, SeotdaView } from '@bg/games/seotda';
|
||||
import { formatWon } from '@bg/games/seotda/money';
|
||||
import type { PublicUser } from '@bg/shared/lite';
|
||||
|
||||
/** Same order and labels as the bet buttons in index.tsx. */
|
||||
const BET_ORDER: BetType[] = ['die', 'check', 'ping', 'call', 'ddadang', 'quarter', 'half', 'full'];
|
||||
/** Same order, labels and number keys as the bet buttons in board.tsx (한게임 섯다 배치). */
|
||||
const BET_ORDER: BetType[] = ['call', 'die', 'half', 'ping', 'check', 'ddadang', 'quarter', 'full'];
|
||||
const BET_KEY: Record<BetType, string> = { call: '7', die: '8', ping: '4', check: '5', ddadang: '1', half: '0', quarter: '2', full: '9' };
|
||||
const BET_KO: Record<BetType, string> = { check: '체크', ping: '삥', call: '콜', ddadang: '따당', quarter: '쿼터', half: '하프', full: '풀', die: '다이' };
|
||||
const RAISES: BetType[] = ['ping', 'ddadang', 'quarter', 'half', 'full'];
|
||||
const STRENGTH_KO = { high: '센 패', mid: '중간 패', low: '약한 패' } as const;
|
||||
const REMATCH_KO = { gusa: '구사', mungGusa: '멍텅구리구사', tie: '같은 족보(동점)' } as const;
|
||||
const REASON_KO = { gusa: '구사', mungGusa: '멍텅구리구사', tie: '동점' } as const;
|
||||
|
||||
const chips = (n: number) => `${Math.max(0, Math.round(n)).toLocaleString('ko-KR')} 칩`;
|
||||
const won = (n: number) => formatWon(Math.max(0, n));
|
||||
|
||||
function who(players: Record<string, PublicUser>, id: string): string {
|
||||
return `${players[id]?.nickname ?? '다른 사람'}님`;
|
||||
@@ -32,27 +34,27 @@ function roundText(v: SeotdaView): string {
|
||||
/** My current hand as the view gives it (hints option on). */
|
||||
function handLine(v: SeotdaView, seat: SeotdaSeatView): string {
|
||||
const h = v.myHand;
|
||||
if (!h) return seat.cards.length > 0 ? "이 방은 족보 이름을 따로 보여 주지 않아요. '족보표'를 보고 내 패를 맞춰 보세요." : '';
|
||||
if (!h) return seat.cards.length > 0 ? "이 방은 족보 이름을 따로 보여 주지 않아요. '족보 도우미'를 보고 내 패를 맞춰 보세요." : '';
|
||||
if (h.special) return h.hint;
|
||||
if (h.value === null) return `지금은 ${h.name}만 받았어요. ${h.hint}`;
|
||||
return `지금 내 족보: ${h.name}${h.strength ? `(${STRENGTH_KO[h.strength]})` : ''}. 족보표에 '내 패'로 표시돼요.`;
|
||||
return `지금 내 족보: ${h.name}${h.strength ? `(${STRENGTH_KO[h.strength]})` : ''}. 족보 도우미에 '내 패'로 표시돼요.`;
|
||||
}
|
||||
|
||||
function rematchLine(v: SeotdaView): string {
|
||||
if (v.rematchNo === 0 || !v.rematchReason) return '';
|
||||
return `재경기 ${v.rematchNo}회차(${REMATCH_KO[v.rematchReason]})예요. 모인 칩은 그대로 두고, 학교(기본 칩)는 다시 내지 않아요.`;
|
||||
return `재경기 ${v.rematchNo}회차(${REMATCH_KO[v.rematchReason]})예요. 판돈은 그대로 두고, 기본금은 다시 내지 않아요.`;
|
||||
}
|
||||
|
||||
function resultLine(v: SeotdaView, players: Record<string, PublicUser>): string {
|
||||
if (v.foldWin) return `모두 다이해서 ${who(players, v.foldWin.winner)}이 ${chips(v.foldWin.amount)}을 가져갔어요. 이때는 패를 공개하지 않아요.`;
|
||||
if (v.foldWin) return `모두 다이해서 ${who(players, v.foldWin.winner)}이 판돈 ${won(v.foldWin.amount)}을 가져갔어요. 이때는 패를 공개하지 않아요.`;
|
||||
if (!v.showdown) return '이번 판이 끝났어요.';
|
||||
return v.showdown.pots
|
||||
.map((p) => {
|
||||
const names = p.winners.map((id) => players[id]?.nickname ?? '다른 사람').join('·') + '님';
|
||||
const name = v.showdown!.hands.find((h) => h.id === p.winners[0])?.name ?? '';
|
||||
if (p.type === 'rematch') return `${REASON_KO[p.reason as keyof typeof REASON_KO] ?? '동점'} 재경기: ${names}이 다시 겨뤄요. 모인 칩은 그대로 남아요.`;
|
||||
if (p.type === 'split') return `${names}이 ${chips(p.amount)}을 나눠 가졌어요.`;
|
||||
return `${names}이 ${name ? `${name}(으)로 ` : ''}${chips(p.amount)}을 가져갔어요.`;
|
||||
if (p.type === 'rematch') return `${REASON_KO[p.reason as keyof typeof REASON_KO] ?? '동점'} 재경기: ${names}이 다시 겨뤄요. 판돈은 그대로 남아요.`;
|
||||
if (p.type === 'split') return `${names}이 ${won(p.amount)}을 나눠 가졌어요.`;
|
||||
return `${names}이 ${name ? `${name}(으)로 ` : ''}${won(p.amount)}을 가져갔어요.`;
|
||||
})
|
||||
.join('\n');
|
||||
}
|
||||
@@ -73,10 +75,10 @@ function waitingLine(v: SeotdaView, players: Record<string, PublicUser>): string
|
||||
function watching(v: SeotdaView, players: Record<string, PublicUser>, prefix = ''): string {
|
||||
if (v.phase === 'rebuy') {
|
||||
const ids = v.rebuy?.pending ?? [];
|
||||
const names = ids.length ? ids.map((id) => players[id]?.nickname ?? '다른 사람').join('·') + '님이' : '칩을 모두 잃은 사람이';
|
||||
return `${prefix}${names} 칩을 다시 받을지 고르는 중이에요.`;
|
||||
const names = ids.length ? ids.map((id) => players[id]?.nickname ?? '다른 사람').join('·') + '님이' : '원을 모두 잃은 사람이';
|
||||
return `${prefix}${names} 시작 금액을 다시 받을지 고르는 중이에요.`;
|
||||
}
|
||||
return [prefix + waitingLine(v, players), v.handPhase === 'betting' ? `모인 칩은 ${chips(v.pot)}이에요.` : '', rematchLine(v)].filter(Boolean).join('\n');
|
||||
return [prefix + waitingLine(v, players), v.handPhase === 'betting' ? `판돈은 ${won(v.pot)}이에요.` : '', rematchLine(v)].filter(Boolean).join('\n');
|
||||
}
|
||||
|
||||
function myBetting(v: SeotdaView, seat: SeotdaSeatView): string {
|
||||
@@ -85,13 +87,14 @@ function myBetting(v: SeotdaView, seat: SeotdaSeatView): string {
|
||||
const lines = [`내 차례예요. ${roundText(v)}`];
|
||||
const hand = handLine(v, seat);
|
||||
if (hand) lines.push(hand);
|
||||
lines.push(`누를 수 있는 버튼: ${buttons.map((t) => `[${BET_KO[t]}]`).join(' ')}. 버튼 아래 적힌 만큼 칩이 바로 나가요.`);
|
||||
lines.push(`누를 수 있는 버튼: ${buttons.map((t) => `[${BET_KO[t]}]`).join(' ')}. 버튼 아래 적힌 금액이 바로 판돈에 들어가요. PC에서는 버튼 왼쪽 위 숫자 키(${buttons.map((t) => `${BET_KO[t]} ${BET_KEY[t]}`).join(', ')})로도 걸 수 있어요.`);
|
||||
const tips: string[] = [];
|
||||
if (v.forcedHalf) tips.push(`이 방은 베팅 규칙 ${v.options.betRule}이라 첫 베팅에서 앞쪽 사람은 [하프]나 [다이]만 할 수 있어요.`);
|
||||
const call = legal.get('call');
|
||||
if (call) tips.push(`앞사람이 칩을 걸었어요. [콜]은 그만큼(${chips(call.amount)}) 맞추는 거예요.`);
|
||||
else if (legal.has('ping')) tips.push(`[체크]는 칩을 걸지 않고 넘기고, [삥]은 학교(기본 칩)만큼 ${chips(v.baseUnit)}을 걸어요.`);
|
||||
if (call) tips.push(`앞사람이 걸었어요. [콜]은 그만큼(${won(call.amount)}) 맞추는 거예요.`);
|
||||
else if (legal.has('ping')) tips.push(`[체크]는 걸지 않고 넘기고, [삥]은 기본금만큼 ${won(v.baseUnit)}을 걸어요.`);
|
||||
if (!buttons.some((t) => RAISES.includes(t)) && seat.lastAction) tips.push('이번 라운드에 이미 한 번 해서 더 올릴 수는 없어요(올리기는 한 라운드에 한 번).');
|
||||
if (v.legal.some((l) => l.allIn)) tips.push('칩이 모자라면 가진 칩을 다 내는 올인이 돼요.');
|
||||
if (v.legal.some((l) => l.allIn)) tips.push('가진 금액이 모자라면 가진 만큼 다 내는 올인이 돼요.');
|
||||
tips.push('패가 약하면 [다이]로 이번 판을 포기할 수 있어요.');
|
||||
lines.push(tips.join(' '));
|
||||
return lines.join('\n');
|
||||
@@ -108,7 +111,7 @@ export function helpNow(v: SeotdaView, me: string | null, players: Record<string
|
||||
if (!v.rebuy?.mine) return watching(v, players) + ' 잠시 기다려 주세요.';
|
||||
const left = v.rebuy.left !== null ? `(남은 횟수 ${v.rebuy.left}번)` : '';
|
||||
return [
|
||||
`칩을 모두 잃었어요. [칩 다시 받기]를 누르면 놀이용 칩 ${chips(v.options.startingChips)}을 다시 받고 계속해요${left}.`,
|
||||
`가진 원을 모두 잃었어요. [다시 받기]를 누르면 놀이용 시작 금액 ${won(v.options.startingChips)}을 다시 받고 계속해요${left}.`,
|
||||
'[그만하기]를 누르면 탈락하고 구경만 해요. 다시 받은 만큼 최종 점수에서 빠져요.',
|
||||
'시간 안에 고르지 않으면 그만하는 것으로 처리돼요.',
|
||||
].join('\n');
|
||||
@@ -122,27 +125,27 @@ export function helpNow(v: SeotdaView, me: string | null, players: Record<string
|
||||
if (seat.folded) return `이번 판은 다이했어요. 다음 판을 기다려 주세요. 내 패는 나만 볼 수 있어요.\n${waitingLine(v, players)}`;
|
||||
if (v.toAct === me) return [re, myBetting(v, seat)].filter(Boolean).join('\n');
|
||||
const hand = handLine(v, seat);
|
||||
if (seat.allIn) return ['올인했어요(가진 칩을 다 걸었어요). 더 걸지 않고 결과를 기다리면 돼요.', hand, re].filter(Boolean).join('\n');
|
||||
if (seat.allIn) return ['올인했어요(가진 금액을 다 걸었어요). 더 걸지 않고 결과를 기다리면 돼요.', hand, re].filter(Boolean).join('\n');
|
||||
return [`${waitingLine(v, players)} 내 차례가 올 때까지 기다려 주세요.`, hand, re].filter(Boolean).join('\n');
|
||||
}
|
||||
case 'choose': {
|
||||
if (seat.chosen === null) return seat.folded ? '이번 판은 다이했어요. 다음 판을 기다려 주세요.' : [notIn, watching(v, players)].join('\n');
|
||||
if (seat.chosen) {
|
||||
const name = v.myHand ? `(${v.myHand.name})` : '';
|
||||
return `쓸 카드 2장을 골랐어요${name}. 다른 사람이 다 고를 때까지 기다려 주세요. 다 고르면 마지막 베팅을 해요.`;
|
||||
return `쓸 패 2장을 골랐어요${name}. 다른 사람이 다 고를 때까지 기다려 주세요. 다 고르면 마지막 베팅을 해요.`;
|
||||
}
|
||||
const lines = ["3장 중 쓸 카드 2장을 눌러 고르면 아래 버튼이 '○○(으)로 정하기'로 바뀌어요. 그 버튼을 눌러 정해 주세요. 남는 1장은 아무에게도 보이지 않아요."];
|
||||
const lines = ["3장 중 쓸 패 2장을 눌러 고르면 아래 버튼이 '○○(으)로 정하기'로 바뀌어요. 그 버튼을 눌러 정해 주세요. 남는 1장은 아무에게도 보이지 않아요."];
|
||||
const best = v.options.hints ? v.myCombos?.find((c) => c.best) : undefined;
|
||||
if (best) lines.push(`[추천 조합]을 누르면 가장 센 조합(${best.name})이 골라져요.`);
|
||||
if (best) lines.push(`조합 버튼을 누르면 그 2장이 골라져요. [${best.name} (추천)]이 가장 센 조합이에요.`);
|
||||
lines.push('모두 동시에 몰래 고르고, 시간이 지나면 가장 센 조합으로 저절로 골라져요.');
|
||||
return lines.join('\n');
|
||||
}
|
||||
case 'rejoin': {
|
||||
if (!v.rejoin?.mine) return `${waitingLine(v, players)} 잠시 기다려 주세요.`;
|
||||
const cost = chips(v.rejoin.cost);
|
||||
const cost = won(v.rejoin.cost);
|
||||
return [
|
||||
`구사 재경기가 열려요. 다이했던 나도 모인 칩에 ${cost}을 더 내면 다시 들어갈 수 있어요.`,
|
||||
v.rejoin.canAfford ? `[${cost} 내고 참가] 또는 [참가 안 함]을 눌러 주세요.` : '칩이 모자라서 참가할 수 없어요. [참가 안 함]을 눌러 주세요.',
|
||||
`구사 재경기가 열려요. 다이했던 나도 판돈에 ${cost}을 더 내면 다시 들어갈 수 있어요.`,
|
||||
v.rejoin.canAfford ? `[${cost} 내고 참가] 또는 [참가 안 함]을 눌러 주세요.` : '보유 금액이 모자라서 참가할 수 없어요. [참가 안 함]을 눌러 주세요.',
|
||||
'시간이 지나면 참가하지 않는 것으로 처리돼요.',
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user