섯다 화면을 한게임 섯다 사진대로 다시 배치: 테이블 아래 금색 판에 족보판·내 얼굴·내 패와 족보·베팅 버튼

- 테이블에는 다른 사람 자리만(패 위, 이름·돈 아래). 내 자리는 테이블 아래 금색 판으로 옮김
- 족보판(jokbo.tsx): 3열 목록, 내 족보 칸 강조, 누르면 그림 2장과 설명. 옆 패널의 족보 도우미는 뺌(전체 표는 규칙 화면)
- 내 패 밑에 지금 족보, 3장이면 세 조합의 족보(가장 센 것 금색)
- 베팅 버튼 두 줄: 콜7·삥4·따당1·하프0 / 다이8·체크5(쿼터2·풀9는 빈칸)
- 3장 섯다 공개패·쓸 패 고르기는 내 패를 직접 누르고, 버튼 자리에 확인 버튼. 카드 공개 묻기, 판 결과와 다음 판으로도 그 자리
- HwatuCard disabled: 고르기 단계가 바뀔 때 카드가 다시 마운트되어 나눠 주기 애니메이션이 반복되던 것을 막음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-17 00:52:24 +09:00
parent 8e549a72c3
commit 3125008895
8 changed files with 469 additions and 342 deletions

View File

@@ -90,6 +90,7 @@ export function HwatuCard({
showMonth = true,
monthStyle = 'badge',
onClick,
disabled,
className,
style,
}: {
@@ -105,6 +106,8 @@ export function HwatuCard({
/** 'badge': small dark circle top-right. 'corner': big white outlined number bottom-left (섯다). */
monthStyle?: 'badge' | 'corner';
onClick?: () => void;
/** Keeps the card a (disabled) button while it can't be clicked, so switching on/off doesn't remount it (no replayed deal animation). */
disabled?: boolean;
className?: string;
style?: CSSProperties;
}) {
@@ -122,7 +125,7 @@ export function HwatuCard({
border: 0,
borderRadius: radius,
background: 'none',
cursor: onClick ? 'pointer' : 'default',
cursor: onClick && !disabled ? 'pointer' : 'default',
opacity: dimmed ? 0.45 : 1,
transform: selected ? `translateY(${-Math.round(w * 0.2)}px)` : undefined,
transition: 'transform 0.12s ease',
@@ -145,8 +148,9 @@ export function HwatuCard({
<Tag
style={s}
onClick={onClick}
disabled={onClick ? disabled : undefined}
aria-label={card.name}
aria-pressed={onClick ? !!selected : undefined}
aria-pressed={onClick && !disabled ? !!selected : undefined}
title={card.name}
className={className}
>

View File

@@ -1,6 +1,7 @@
/**
* 섯다 판 화면 (docs/games/seotda.md §9), 한게임 섯다처럼: 초록 테이블 둘레에 자리, 가운데 판돈, 아래쪽 내 자리에 큰 패와
* 족보 이름, 그 밑에 숫자 키가 붙은 베팅 버튼. 돈은 이 방 안에서만 쓰는 놀이용 원(§12).
* 섯다 판 화면 (docs/games/seotda.md §9), 한게임 섯다처럼: 테이블 둘레에 다른 사람 자리(패 위, 이름·돈 아래), 가운데 판돈,
* 테이블 아래 금색 판에 왼쪽부터 족보판 · 내 얼굴과 시계 · 내 패와 지금 족보 · 숫자 키가 붙은 베팅 버튼(콜 다이 / 삥 체크 /
* 따당 / 하프 두 줄). 돈은 이 방 안에서만 쓰는 놀이용 원(§12).
* Sound and motion follow view changes (anyone's bet, deal, reveal, payout), so other players' moves play too.
*/
import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react';
@@ -14,6 +15,7 @@ import { haptic, sfx, sounds } from '../../lib/feedback';
import { usePhone } from '../../lib/media';
import type { BoardProps } from '../types';
import { fxMs } from '../../lib/motion';
import { JokboBoard } from './jokbo';
export const BET_KO: Record<BetType, string> = { check: '체크', ping: '삥', call: '콜', ddadang: '따당', quarter: '쿼터', half: '하프', full: '풀', die: '다이' };
/** Number keys like 한게임 섯다 (콜 7, 다이 8, 삥 4, 체크 5, 따당 1, 하프 0); 쿼터 2 and 풀 9 are ours. */
@@ -84,8 +86,8 @@ function bannerOf(v: SeotdaView): string | null {
const isBig = (name: string) => /광땡|땡$|장땡/.test(name) && name !== '땡잡이';
const CSS = `
.sd-wrap { width: 100%; max-width: 1060px; display: flex; flex-direction: column; gap: 10px; align-self: center; }
.sd-table { position: relative; width: 100%; aspect-ratio: 16 / 9.4; min-height: 470px; border-radius: 44px; border: 12px solid #5b3a1e;
.sd-wrap { width: 100%; max-width: 1060px; display: flex; flex-direction: column; gap: 10px; align-self: center; container: sd / inline-size; }
.sd-table { position: relative; width: 100%; aspect-ratio: 16 / 7.4; min-height: 380px; border-radius: 44px; border: 12px solid #5b3a1e;
background: radial-gradient(ellipse at 50% 45%, #2f8a5c 0%, #1d6a44 55%, #134b30 100%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.08), inset 0 0 60px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.3); }
.sd-table::before { content: ''; position: absolute; inset: 14px; border-radius: 30px; border: 2px dashed rgba(255,255,255,.12); pointer-events: none; }
.sd-seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: 156px; z-index: 2;
@@ -117,23 +119,62 @@ const CSS = `
background: radial-gradient(circle at 35% 35%, #fff7c2, #f5b301 55%, #b45309); border: 2px solid #92400e;
animation: sd-fly .55s cubic-bezier(.3,.7,.4,1) both; animation-delay: var(--d, 0ms); }
@keyframes sd-fly { from { transform: translate(0, 0) scale(.9); opacity: 1; } 85% { opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.7); opacity: 0; } }
.sd-me { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 2; display: flex; align-items: flex-end; gap: 14px;
background: rgba(10, 22, 16, .72); border: 2px solid rgba(255,255,255,.14); border-radius: 16px; padding: 8px 14px; color: #fff; max-width: 96%; }
.sd-me.turn { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.35); }
.sd-me.win { border-color: #fde047; box-shadow: 0 0 0 3px rgba(253,224,71,.5), 0 0 22px rgba(253,224,71,.45); }
.sd-me .mine { display: flex; gap: 6px; align-items: flex-end; }
.sd-me .meta { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.sd-myhand { font-size: 1.45rem; font-weight: 900; color: #fde047; text-shadow: 0 2px 4px rgba(0,0,0,.5); line-height: 1.15; }
.sd-bar { display: flex; gap: 12px; align-items: stretch; justify-content: center; flex-wrap: wrap; }
.sd-bets { display: grid; grid-template-columns: repeat(3, minmax(92px, 1fr)); gap: 8px; flex: 1; max-width: 560px; }
.sd-bet { position: relative; min-height: 58px; border: 0; border-radius: 12px; color: #fff; font-weight: 900; font-size: 1.15rem; cursor: pointer;
display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.2); }
.sd-bet small { font-size: .78rem; font-weight: 700; opacity: .95; font-variant-numeric: tabular-nums; }
.sd-bet kbd { position: absolute; top: 4px; left: 6px; font: 700 .7rem/1 inherit; opacity: .8; background: rgba(0,0,0,.25); border-radius: 4px; padding: 2px 4px; }
.sd-bet:disabled { filter: grayscale(.85) brightness(.85); opacity: .45; cursor: default; box-shadow: none; }
.sd-bet:not(:disabled):hover { filter: brightness(1.1); }
.sd-bet:not(:disabled):active { transform: translateY(1px); }
.sd-dock { position: relative; display: flex; gap: 12px; align-items: stretch; padding: 10px 12px; border-radius: 16px; color: #3b2306;
background: linear-gradient(180deg, #f8e3a3 0%, #ecc768 55%, #d9a744 100%); border: 3px solid #8a5a1c;
box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 6px 16px rgba(0,0,0,.25); transition: box-shadow .2s, border-color .2s; }
.sd-dock.turn { border-color: #f59e0b; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 0 0 4px rgba(245,158,11,.45), 0 6px 16px rgba(0,0,0,.25); }
.sd-dock.win { border-color: #fde047; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 0 0 4px rgba(253,224,71,.6), 0 0 24px rgba(253,224,71,.5); }
.sd-jokbo { flex: 0 0 262px; display: flex; flex-direction: column; gap: 5px; background: rgba(74,44,10,.88); color: #fdf6e3; border-radius: 10px; padding: 6px 8px; }
.sd-jokbo h3 { margin: 0; font-size: .95rem; font-weight: 900; color: #fde68a; letter-spacing: .2em; }
.sd-jokbo ol { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.sd-jokbo li button { width: 100%; text-align: left; border: 1px solid rgba(253,230,138,.25); border-radius: 4px; background: rgba(255,255,255,.08); color: inherit;
font: 700 .74rem/1.55 inherit; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.sd-jokbo li button.sel { border-color: #fde68a; }
.sd-jokbo li button.hit { background: #c4b5fd; color: #2e1065; border-color: #ede9fe; }
.sd-jokbo-desc { display: flex; gap: 6px; align-items: center; font-size: .78rem; line-height: 1.3; margin-top: auto; padding-top: 4px; border-top: 1px solid rgba(253,230,138,.25); }
.sd-jokbo-desc .pics { display: flex; gap: 2px; flex: none; }
.sd-jokbo-desc strong { color: #fde68a; }
.sd-prof { position: relative; flex: 0 0 104px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
background: rgba(255,255,255,.35); border-radius: 10px; padding: 8px 6px; }
.sd-prof .nm { font-size: .85rem; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-prof .sd-money { color: #7c2d12; font-size: .95rem; }
.sd-prof .sd-delta.plus { color: #15803d; } .sd-prof .sd-delta.minus { color: #b91c1c; }
.sd-play { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: stretch; }
.sd-handarea { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
background: rgba(122,74,18,.18); border-radius: 10px; padding: 8px 6px; }
.sd-handarea .mine { display: flex; gap: 8px; align-items: flex-end; justify-content: center; }
.sd-handarea .under { display: flex; justify-content: center; }
.sd-handarea .hint { font-size: .8rem; text-align: center; opacity: .9; }
.sd-myhand { display: inline-block; font-size: 1.3rem; font-weight: 900; line-height: 1.2; padding: 1px 14px; border-radius: 999px; background: #3b2306; color: #fde047; }
.sd-myhand.big { background: linear-gradient(180deg, #fde047, #f59e0b); color: #422006; box-shadow: 0 0 0 2px #7c2d12; }
.sd-myhand.die { background: #7f1d1d; color: #fecaca; }
.sd-combos { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sd-combo { border: 0; border-radius: 999px; padding: 2px 10px; font: 800 .9rem/1.4 inherit; background: #3b2306; color: #fde68a; }
.sd-combo.best { background: linear-gradient(180deg, #fde047, #f59e0b); color: #422006; box-shadow: 0 0 0 2px #7c2d12; }
button.sd-combo { cursor: pointer; }
button.sd-combo[aria-pressed='true'] { outline: 3px solid #2563eb; outline-offset: 1px; }
.sd-actions { flex: 0 0 236px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.sd-actions p { margin: 0; font-size: .86rem; line-height: 1.4; }
.sd-result { display: flex; flex-direction: column; gap: 2px; font-size: .86rem; line-height: 1.4; background: rgba(255,255,255,.55); border-radius: 10px; padding: 8px 10px; }
.sd-bets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(38px, 1fr); gap: 6px; }
.sd-bet { position: relative; border: 1px solid #a07a3c; border-radius: 8px; padding: 0 8px 0 30px; cursor: pointer; display: flex; align-items: center; gap: 4px;
background: linear-gradient(180deg, #fffbeb, #f3dfa8); color: #3b2306; font-weight: 900; font-size: 1.05rem; line-height: 1.1;
box-shadow: inset 0 -2px 0 rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.2); }
.sd-bet .lb { flex: 1; text-align: center; }
.sd-bet small { font-size: .72rem; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-bet kbd { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
font: 800 .78rem/1 inherit; background: #e9d29a; color: #7a5520; border: 1px solid #c9a35a; }
.sd-bet.on { border-color: var(--c); box-shadow: inset 4px 0 0 var(--c), 0 0 0 1px var(--c), 0 2px 4px rgba(0,0,0,.25); }
.sd-bet.on .lb { color: var(--c); }
.sd-bet:disabled { opacity: .5; cursor: default; box-shadow: none; }
.sd-bet.on:hover { filter: brightness(1.06); }
.sd-bet.on:active { transform: translateY(1px); }
.sd-help { margin: 0; text-align: center; min-height: 1.4em; }
@container sd (max-width: 899px) {
.sd-dock { flex-wrap: wrap; }
.sd-jokbo { order: 3; flex: 1 1 100%; }
.sd-jokbo ol { grid-auto-flow: row; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: none !important; }
}
@media (max-width: 719px) {
.sd-table { aspect-ratio: auto; min-height: 0; border-width: 7px; border-radius: 22px; padding: 10px 8px; display: flex; flex-direction: column; gap: 8px; }
.sd-table::before { inset: 6px; border-radius: 16px; }
@@ -146,22 +187,28 @@ const CSS = `
.sd-pile { height: 26px; }
.sd-pile i { width: 20px; height: 20px; }
.sd-banner { position: fixed; top: 38%; font-size: 2.2rem; }
.sd-me { position: relative; left: auto; bottom: auto; transform: none; max-width: none; justify-content: center; gap: 10px; padding: 8px; }
.sd-me .meta { min-width: 0; flex: 1; }
.sd-myhand { font-size: 1.15rem; }
.sd-bets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: none; }
.sd-bet { min-height: 56px; font-size: 1.05rem; }
.sd-dock { padding: 8px; gap: 8px; }
.sd-prof { order: -1; flex: 1 1 100%; flex-direction: row; justify-content: flex-start; padding: 4px 8px; gap: 8px; }
.sd-prof .row { min-height: 0 !important; }
.sd-play { flex: 1 1 100%; flex-direction: column; gap: 8px; }
.sd-actions { flex: none; }
.sd-myhand { font-size: 1.1rem; }
.sd-bets { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 48px; }
.sd-bets .sd-gap { display: none; }
.sd-bet { justify-content: center; padding: 0 4px; flex-direction: column; gap: 0; }
.sd-bet .lb { flex: none; }
.sd-bet kbd { display: none; }
.sd-jokbo ol { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row; }
}
`;
// ---------------------------------------------------------------- table positions
/** Seats other than mine around the table: from my left, over the top, to my right (PC). */
/** Seats other than mine around the table (mine is the bar below it): from my left, over the top, to my right (PC). */
function seatPos(rel: number, others: number): { x: number; y: number } {
const t = rel / (others + 1);
const ang = ((150 + t * 240) * Math.PI) / 180;
return { x: 50 + 41 * Math.cos(ang), y: 49 + 36 * Math.sin(ang) };
const ang = ((160 + t * 220) * Math.PI) / 180;
return { x: 50 + 39 * Math.cos(ang), y: 52 + 33 * Math.sin(ang) };
}
/** Pile of coins in the middle; more coins for a bigger 판돈 (up to 9). */
@@ -239,6 +286,7 @@ function Seat({ seat, view: v, players, me, deadline, pos, cardW, winner, setRef
aria-label={`${u.nickname}, 보유 ${formatWon(seat.stack)}${seat.isDealer ? ', 선' : ''}${seat.folded ? ', 다이' : ''}${tags.length ? `, ${tags.map((t) => t[0]).join(', ')}` : ''}`}
>
<ActBubble seat={seat} />
<SeatCards seat={seat} view={v} width={cardW} />
<div className="row" style={{ gap: 5, flexWrap: 'nowrap' }}>
<Avatar user={u} size={22} />
<span className="nm">
@@ -262,7 +310,6 @@ function Seat({ seat, view: v, players, me, deadline, pos, cardW, winner, setRef
</span>
)}
</div>
<SeatCards seat={seat} view={v} width={cardW} />
{seat.handName && <div className={`sd-hand${isBig(seat.handName) ? ' big' : ''} anim-pop`}>{seat.handName}</div>}
{seat.handDelta !== null && seat.handDelta !== 0 && (
<div className={`sd-delta anim-slide-up ${seat.handDelta > 0 ? 'plus' : 'minus'}`}>{formatWonDelta(seat.handDelta)}</div>
@@ -280,67 +327,6 @@ function Seat({ seat, view: v, players, me, deadline, pos, cardW, winner, setRef
);
}
/** My place at the bottom of the table: big cards, 족보 name, money. */
function MySeat({ seat, view: v, players, deadline, winner, setRef, phone }: { seat: SeotdaSeatView; view: SeotdaView; players: Record<string, PublicUser>; deadline: number | null; winner: boolean; setRef: SeatProps['setRef']; phone: boolean }) {
const u = userOf(players, seat.id);
const cards = seat.cards;
const w = phone ? (cards.length > 2 ? 62 : 74) : cards.length > 2 ? 78 : 92;
const tag = `${v.handNo}-${v.rematchNo}`;
const h = v.myHand;
return (
<div ref={(el) => setRef(seat.id, el)} className={`sd-me${seat.isTurn ? ' turn' : ''}${winner ? ' win' : ''}`} aria-label={`내 자리, 보유 ${formatWon(seat.stack)}`}>
<ActBubble seat={seat} />
<div className="mine" aria-label="내 패">
{cards.length === 0 && <span className="small" style={{ opacity: 0.8, alignSelf: 'center' }}>{seat.inHand ? '패를 기다리는 중' : '이번 판은 쉬어요'}</span>}
{cards.map((c, i) =>
isCard(c) ? (
<HwatuCard
key={c.key}
card={c}
width={w}
monthStyle="corner"
className="anim-deal"
highlight={!!v.myChosen?.includes(c.id) || (!v.myChosen && v.myOpened === c.id)}
dimmed={(!!v.myChosen && !v.myChosen.includes(c.id)) || seat.folded}
style={{ ['--anim-delay' as string]: `${i * 110}ms`, ['--from-y' as string]: '-180px' }}
/>
) : (
<HwatuCard key={`m${tag}-${i}`} card={null} width={w} />
),
)}
</div>
<div className="meta">
<div className="row" style={{ gap: 6, flexWrap: 'nowrap' }}>
<Avatar user={u} size={22} />
<strong style={{ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{u.nickname} (나)</strong>
{seat.isDealer && (
<span className="sd-tag" style={{ background: '#facc15', color: '#422006' }}>
선
</span>
)}
{(seat.isTurn || seat.chosen === false || seat.opening === false || !!v.reveal?.mine) && <TurnTimer deadline={deadline} totalMs={totalMsOf(v)} mine size={30} />}
</div>
<span className="sd-money" style={{ fontSize: '1.05rem' }}>
{formatWon(seat.stack)}
</span>
{h && seat.inHand && !seat.folded && !seat.handName && (
<span className="sd-myhand" aria-live="polite">
{h.name}
</span>
)}
{h && seat.inHand && !seat.folded && !seat.handName && v.options.hints && <span className="small" style={{ opacity: 0.9 }}>{h.hint}</span>}
{seat.folded && <span className="small" style={{ opacity: 0.9 }}>다이했어요. 내 패는 나만 볼 수 있어요.</span>}
{seat.handName && <div className={`sd-myhand anim-pop`}>{seat.handName}</div>}
{seat.handDelta !== null && seat.handDelta !== 0 && (
<div className={`sd-delta anim-slide-up ${seat.handDelta > 0 ? 'plus' : 'minus'}`} style={{ textAlign: 'left', fontSize: '1.1rem' }}>
{formatWonDelta(seat.handDelta)}
</div>
)}
</div>
</div>
);
}
function Center({ view: v, potRef }: { view: SeotdaView; potRef: (el: HTMLElement | null) => void }) {
const limit = v.options.endCondition === 'hands' ? `/${v.options.handLimit}` : '';
// On the result screen the paid pots are no longer in v.pot (only a carried rematch pot is).
@@ -473,16 +459,16 @@ function useTableEffects(v: SeotdaView, me: string | null, tableRef: React.RefOb
return { flies, banner };
}
// ---------------------------------------------------------------- bet bar
// ---------------------------------------------------------------- bottom bar (한게임 섯다처럼: 족보 · 내 얼굴 · 내 패 · 베팅 버튼)
function BetBar({ view: v, me, act, pending, players }: { view: SeotdaView; me: string; act: (a: unknown) => void; pending: boolean; players: Record<string, PublicUser> }) {
/** Bet buttons in 한게임's two columns (콜 다이 / 삥 체크 / 따당 · / 하프 ·); 쿼터 and 풀 take the free right cells. */
const GRID: (BetType | null)[] = ['call', 'die', 'ping', 'check', 'ddadang', 'quarter', 'half', 'full'];
function BetGrid({ view: v, me, act, pending, setHover }: { view: SeotdaView; me: string; act: (a: unknown) => void; pending: boolean; setHover: (t: BetType | null) => void }) {
const seat = v.seats.find((s) => s.id === me)!;
const myTurn = v.toAct === me && v.handPhase === 'betting';
const myTurn = v.toAct === me && v.handPhase === 'betting' && seat.inHand && !seat.folded;
const legal = new Map(v.legal.map((l) => [l.type, l]));
const [hover, setHover] = useState<BetType | null>(null);
const types: BetType[] = ['call', 'die', 'half', 'ping', 'check', 'ddadang'];
if (v.options.quarter) types.push('quarter');
if (v.options.maxRaise === 'full') types.push('full');
const shown = (t: BetType) => (t === 'quarter' ? v.options.quarter : t === 'full' ? v.options.maxRaise === 'full' : true);
const press = (t: BetType) => {
if (!myTurn || pending || !legal.has(t)) return;
sfx.click();
@@ -505,131 +491,225 @@ function BetBar({ view: v, me, act, pending, players }: { view: SeotdaView; me:
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, []);
const hoverBet = hover ? legal.get(hover) : undefined;
return (
<div className="stack" style={{ gap: 6 }}>
<div className="sd-bar">
<div className="sd-bets" role="group" aria-label="베팅">
{types.map((t) => {
const l = legal.get(t);
const enabled = myTurn && !!l && !pending;
return (
<button
key={t}
type="button"
className={`sd-bet${enabled && t !== 'die' ? ' anim-pop' : ''}`}
style={{ background: BET_COLOR[t] }}
disabled={!enabled}
title={`${BET_HELP[t]} (숫자 ${BET_KEY[t]})`}
aria-keyshortcuts={BET_KEY[t]}
onMouseEnter={() => setHover(t)}
onMouseLeave={() => setHover(null)}
onFocus={() => setHover(t)}
onBlur={() => setHover(null)}
onClick={() => press(t)}
>
<kbd aria-hidden>{BET_KEY[t]}</kbd>
<span>{BET_KO[t]}</span>
<small>{l ? (l.amount > 0 ? `${formatWonShort(l.amount)}원${l.allIn ? ' 올인' : ''}` : t === 'die' ? '포기' : '0원') : ' '}</small>
</button>
);
})}
</div>
</div>
<p className="small muted sd-help">
{myTurn
? hoverBet
? `${BET_KO[hover!]}: ${BET_HELP[hover!]}. 걸고 나면 내 돈 ${formatWon(seat.stack - hoverBet.amount)}, 판돈 ${formatWon(v.pot + hoverBet.amount)}`
: v.forcedHalf
? `베팅 규칙 ${v.options.betRule}: 첫 베팅은 하프 또는 다이만 할 수 있어요.`
: '내 차례예요. 버튼이나 숫자 키로 걸어요.'
: v.toAct
? `${nick(players, v.toAct)}님 차례예요.`
: ' '}
</p>
<div className="sd-bets" role="group" aria-label="베팅">
{GRID.map((t, i) => {
if (!t || !shown(t)) return <span key={`gap${i}`} className="sd-gap" aria-hidden />;
const l = legal.get(t);
const enabled = myTurn && !!l && !pending;
return (
<button
key={t}
type="button"
className={`sd-bet${enabled ? ' on' : ''}`}
style={{ '--c': BET_COLOR[t] } as CSSProperties}
disabled={!enabled}
title={`${BET_HELP[t]} (숫자 ${BET_KEY[t]})`}
aria-keyshortcuts={BET_KEY[t]}
onMouseEnter={() => setHover(t)}
onMouseLeave={() => setHover(null)}
onFocus={() => setHover(t)}
onBlur={() => setHover(null)}
onClick={() => press(t)}
>
<kbd aria-hidden>{BET_KEY[t]}</kbd>
<span className="lb">{BET_KO[t]}</span>
<small>{l && myTurn ? (l.amount > 0 ? `${formatWonShort(l.amount)}${l.allIn ? ' 올인' : ''}` : t === 'die' ? '' : '0') : ''}</small>
</button>
);
})}
</div>
);
}
// ---------------------------------------------------------------- 3장 섯다 choice and result
/** 3장 섯다 (한게임): of the first two cards, pick the one everyone gets to see. */
function OpenBox({ view: v, me, act, pending }: { view: SeotdaView; me: string; act: (a: unknown) => void; pending: boolean }) {
const seat = v.seats.find((s) => s.id === me)!;
const [pick, setPick] = useState<number | null>(null);
useEffect(() => setPick(null), [v.handNo, v.rematchNo]);
const cards = seat.cards.filter(isCard);
const picked = cards.find((c) => c.id === pick);
return (
<div className="card stack" style={{ gap: 8, padding: 12 }} role="group" aria-label="공개패 고르기">
<p style={{ margin: 0, textAlign: 'center' }}>
<strong>모두에게 보여 줄 패 1장을 골라 주세요.</strong> 나머지 1장과 다음에 받을 1장은 나만 봐요.
</p>
<div className="row" style={{ justifyContent: 'center', gap: 10 }}>
{cards.map((c) => (
<HwatuCard key={c.key} card={c} size="lg" monthStyle="corner" selected={pick === c.id} onClick={() => setPick(c.id)} />
))}
</div>
<button type="button" className="btn btn-primary" disabled={pick === null || pending} onClick={() => act({ type: 'open', cardId: pick })}>
{picked ? `${picked.month}월 패 공개하기` : '공개할 패를 눌러 고르세요'}
</button>
</div>
);
interface DockProps {
view: SeotdaView;
seat: SeotdaSeatView | null;
players: Record<string, PublicUser>;
act: (a: unknown) => void;
pending: boolean;
deadline: number | null;
winner: boolean;
setRef: SeatProps['setRef'];
phone: boolean;
}
/** Everyone else died: show my cards to everyone, or keep them hidden (the default when time runs out). */
function RevealBox({ view: v, act, pending }: { view: SeotdaView; act: (a: unknown) => void; pending: boolean }) {
return (
<div className="card stack" style={{ gap: 8, padding: 12 }} role="group" aria-label="카드 공개">
<p style={{ margin: 0, textAlign: 'center' }}>
<strong>모두 다이해서 판돈 {formatWon(v.pot)}은 내 거예요.</strong> 내 패를 모두에게 보여 줄까요? 시간이 지나면 공개하지 않아요.
</p>
<div className="row">
<button type="button" className="btn btn-primary" style={{ flex: 1 }} disabled={pending} onClick={() => act({ type: 'reveal', show: true })}>
카드 공개
</button>
<button type="button" className="btn btn-secondary" style={{ flex: 1 }} disabled={pending} onClick={() => act({ type: 'reveal', show: false })}>
공개 안 함
</button>
</div>
</div>
);
}
function ChooseBox({ view: v, me, act, pending }: { view: SeotdaView; me: string; act: (a: unknown) => void; pending: boolean }) {
const seat = v.seats.find((s) => s.id === me)!;
/**
* The bottom bar, laid out like 한게임 섯다: 족보판 on the left, my face and clock, my cards with the current 족보 under
* them, then the number-key bet buttons. In 3장 섯다 the cards themselves are clicked to pick the open card / the two
* cards to use, and the bet buttons make room for that step's button.
*/
function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef, phone }: DockProps) {
const [pick, setPick] = useState<number[]>([]);
useEffect(() => setPick([]), [v.handNo, v.rematchNo]);
const cards = seat.cards.filter(isCard);
const preview = pick.length === 2 ? v.myCombos?.find((c) => c.cardIds.includes(pick[0]!) && c.cardIds.includes(pick[1]!)) : null;
const toggle = (id: number) => setPick((p) => (p.includes(id) ? p.filter((x) => x !== id) : p.length >= 2 ? [p[1]!, id] : [...p, id]));
return (
<div className="card stack" style={{ gap: 8, padding: 12 }}>
<p style={{ margin: 0, textAlign: 'center' }}>
<strong>쓸 패 2장을 골라 주세요.</strong> 남는 1장은 아무에게도 보이지 않아요.
</p>
<div className="row" style={{ justifyContent: 'center', gap: 10 }}>
{cards.map((c) => (
<HwatuCard key={c.key} card={c} size="lg" monthStyle="corner" selected={pick.includes(c.id)} onClick={() => toggle(c.id)} />
))}
</div>
{v.options.hints && v.myCombos && (
<div className="row" style={{ justifyContent: 'center', gap: 6 }}>
{v.myCombos.map((c) => (
<button key={c.cardIds.join()} type="button" className={`btn btn-sm ${c.best ? 'btn-soft' : 'btn-ghost'}`} onClick={() => setPick([...c.cardIds])}>
useEffect(() => setPick([]), [v.handNo, v.rematchNo, v.handPhase]);
const [hover, setHover] = useState<BetType | null>(null);
const u = seat ? userOf(players, seat.id) : null;
const cards = seat?.cards ?? [];
const opening = !!seat && v.handPhase === 'open' && seat.opening === false;
const choosing = !!seat && v.handPhase === 'choose' && seat.chosen === false;
const revealing = !!v.reveal?.mine;
const playing = !!seat && seat.inHand && !seat.folded;
const w = phone ? (cards.length > 2 ? 62 : 74) : cards.length > 2 ? 76 : 88;
const tag = `${v.handNo}-${v.rematchNo}`;
const h = v.myHand;
const hints = v.options.hints;
const onCard = (id: number) =>
opening ? setPick([id]) : choosing ? setPick((p) => (p.includes(id) ? p.filter((x) => x !== id) : p.length >= 2 ? [p[1]!, id] : [...p, id])) : undefined;
const openPicked = opening ? cards.filter(isCard).find((c) => c.id === pick[0]) : undefined;
const preview = choosing && pick.length === 2 ? v.myCombos?.find((c) => c.cardIds.includes(pick[0]!) && c.cardIds.includes(pick[1]!)) : null;
const myTurn = !!seat && v.toAct === seat.id && v.handPhase === 'betting' && playing;
const hoverBet = hover ? v.legal.find((l) => l.type === hover) : undefined;
const timed = !!seat && (seat.isTurn || seat.chosen === false || seat.opening === false || revealing);
const group = opening ? '공개패 고르기' : choosing ? '쓸 패 고르기' : revealing ? '카드 공개' : undefined;
// Under my cards: the 족보 (or, with 3 cards, every pair's 족보 like 한게임; clickable while choosing).
let under: ReactNode = null;
if (seat?.handName) under = <span className={`sd-myhand anim-pop${isBig(seat.handName) ? ' big' : ''}`}>{seat.handName}</span>;
else if (seat?.folded) under = <span className="sd-myhand die">다이</span>;
else if (playing && hints && v.myCombos && !v.myChosen)
under = (
<span className="sd-combos">
{v.myCombos.map((c) =>
choosing ? (
<button key={c.cardIds.join()} type="button" className={`sd-combo${c.best ? ' best' : ''}`} aria-pressed={!!preview && preview.cardIds.join() === c.cardIds.join()} onClick={() => setPick([...c.cardIds])}>
{c.name}
{c.best ? ' (추천)' : ''}
</button>
))}
) : (
<span key={c.cardIds.join()} className={`sd-combo${c.best ? ' best' : ''}`}>
{c.name}
</span>
),
)}
</span>
);
else if (playing && h) under = <span className={`sd-myhand${h.value !== null && isBig(h.name) ? ' big' : ''}`} aria-live="polite">{h.name}</span>;
let actions: ReactNode;
if (opening)
actions = (
<>
<p>
<strong>모두에게 보여 줄 패 1장</strong>을 눌러 고르세요. 나머지 1장과 다음에 받을 1장은 나만 봐요.
</p>
<button type="button" className="btn btn-primary btn-block" disabled={!openPicked || pending} onClick={() => act({ type: 'open', cardId: pick[0] })}>
{openPicked ? `${openPicked.month}월 패 공개하기` : '공개할 패를 눌러 고르세요'}
</button>
</>
);
else if (choosing)
actions = (
<>
<p>
<strong>쓸 패 2장</strong>을 눌러 고르세요. 남는 1장은 아무에게도 보이지 않아요.
</p>
<button type="button" className="btn btn-primary btn-block" disabled={pick.length !== 2 || pending} onClick={() => act({ type: 'choose', cardIds: [pick[0], pick[1]] })}>
{preview ? `${preview.name}(으)로 정하기` : '두 장을 고르세요'}
</button>
</>
);
else if (revealing)
actions = (
<>
<p>
<strong>모두 다이해서 판돈 {formatWon(v.pot)}은 내 거예요.</strong> 내 패를 보여 줄까요? 시간이 지나면 공개하지 않아요.
</p>
<button type="button" className="btn btn-primary btn-block" disabled={pending} onClick={() => act({ type: 'reveal', show: true })}>
카드 공개
</button>
<button type="button" className="btn btn-secondary btn-block" disabled={pending} onClick={() => act({ type: 'reveal', show: false })}>
공개 안 함
</button>
</>
);
else if (v.handPhase === 'open' && seat?.opening === true) actions = <p>공개패를 골랐어요. 다른 사람을 기다리는 중이에요.</p>;
else if (v.handPhase === 'choose' && seat?.chosen === true) actions = <p>골랐어요. 다른 사람이 고르기를 기다리는 중이에요.</p>;
else if (v.reveal) actions = <p>{nick(players, v.reveal.by)}님이 카드 공개 여부를 고르는 중이에요.</p>;
else if (v.handPhase === 'handEnd')
actions = (
<>
<ResultPanel view={v} players={players} />
{seat && seat.status === 'playing' && !seat.left && (
<button type="button" className="btn btn-primary btn-block" disabled={seat.ready || pending} onClick={() => act({ type: 'ready' })}>
{seat.ready ? '다른 사람을 기다리는 중…' : v.next === 'rematch' ? '재경기 시작' : '다음 판으로'}
</button>
)}
</>
);
else if (seat) actions = <BetGrid view={v} me={seat.id} act={act} pending={pending} setHover={setHover} />;
else actions = <p>구경 중이에요.</p>;
const help = myTurn
? hoverBet
? `${BET_KO[hover!]}: ${BET_HELP[hover!]}. 걸고 나면 내 돈 ${formatWon(seat!.stack - hoverBet.amount)}, 판돈 ${formatWon(v.pot + hoverBet.amount)}`
: v.forcedHalf
? `베팅 규칙 ${v.options.betRule}: 첫 베팅은 하프 또는 다이만 할 수 있어요.`
: '내 차례예요. 버튼이나 숫자 키로 걸어요.'
: v.handPhase === 'betting' && v.toAct
? `${nick(players, v.toAct)}님 차례예요.`
: ' ';
return (
<>
<div className={`sd-dock${seat?.isTurn ? ' turn' : ''}${winner ? ' win' : ''}`}>
<JokboBoard options={v.options} mine={playing ? h : null} />
{seat && u && (
<div className="sd-prof" ref={(el) => setRef(seat.id, el)} aria-label={`내 자리, 보유 ${formatWon(seat.stack)}`}>
<ActBubble seat={seat} />
<Avatar user={u} size={phone ? 34 : 52} />
<strong className="nm">{u.nickname} (나)</strong>
<span className="sd-money">{formatWonShort(seat.stack)}원</span>
<span className="row" style={{ gap: 4, justifyContent: 'center', minHeight: 30 }}>
{seat.isDealer && (
<span className="sd-tag" style={{ background: '#facc15', color: '#422006' }} title="선(먼저 받고 먼저 거는 사람)">
선
</span>
)}
{timed && <TurnTimer deadline={deadline} totalMs={totalMsOf(v)} mine size={30} />}
</span>
{seat.handDelta !== null && seat.handDelta !== 0 && <span className={`sd-delta anim-slide-up ${seat.handDelta > 0 ? 'plus' : 'minus'}`}>{formatWonDelta(seat.handDelta)}</span>}
</div>
)}
<div className="sd-play" role={group ? 'group' : undefined} aria-label={group}>
{seat && (
<div className="sd-handarea">
<div className="mine" aria-label="내 패">
{cards.length === 0 && <span className="small">{seat.inHand ? '패를 기다리는 중' : '이번 판은 쉬어요'}</span>}
{cards.map((c, i) =>
isCard(c) ? (
<HwatuCard
key={c.key}
card={c}
width={w}
monthStyle="corner"
className="anim-deal"
onClick={() => onCard(c.id)}
disabled={!opening && !choosing}
selected={(opening || choosing) && pick.includes(c.id)}
highlight={!!v.myChosen?.includes(c.id) || (!v.myChosen && v.myOpened === c.id)}
dimmed={(!!v.myChosen && !v.myChosen.includes(c.id)) || seat.folded}
style={{ ['--anim-delay' as string]: `${i * 110}ms`, ['--from-y' as string]: '-180px' }}
/>
) : (
<HwatuCard key={`m${tag}-${i}`} card={null} width={w} />
),
)}
</div>
{under && <div className="under">{under}</div>}
{playing && h && hints && !seat.handName && <span className="hint">{h.hint}</span>}
{seat.folded && !seat.handName && <span className="hint">다이했어요. 내 패는 나만 볼 수 있어요.</span>}
</div>
)}
<div className="sd-actions">{actions}</div>
</div>
)}
<button type="button" className="btn btn-primary" disabled={pick.length !== 2 || pending} onClick={() => act({ type: 'choose', cardIds: [pick[0], pick[1]] })}>
{preview ? `${preview.name}(으)로 정하기` : '두 장을 고르세요'}
</button>
</div>
</div>
<p className="small muted sd-help">{help}</p>
</>
);
}
// ---------------------------------------------------------------- result
export function resultLine(v: SeotdaView, players: Record<string, PublicUser>): string {
if (v.foldWin) return `${nick(players, v.foldWin.winner)}님이 판돈 ${formatWon(v.foldWin.amount)}을 가져갔어요(모두 다이${v.foldWin.shown ? ' · 패 공개' : ''}).`;
if (!v.showdown) return '';
@@ -647,7 +727,7 @@ export function resultLine(v: SeotdaView, players: Record<string, PublicUser>):
function ResultPanel({ view: v, players }: { view: SeotdaView; players: Record<string, PublicUser> }) {
const foldName = v.foldWin ? v.seats.find((s) => s.id === v.foldWin!.winner)?.handName : null;
return (
<div className="card stack" style={{ gap: 4, padding: 12 }} aria-live="polite">
<div className="sd-result" aria-live="polite">
<strong>{v.next === 'rematch' ? '재경기가 정해졌어요' : '이번 판 결과'}</strong>
{v.foldWin && (
<span>
@@ -747,7 +827,6 @@ export function SeotdaBoard({ view: v, me, players, act, pending, deadline }: Bo
othersEls
)}
<Center view={v} potRef={(el) => (potEl.current = el)} />
{mySeat && <MySeat seat={mySeat} view={v} players={players} deadline={deadline} winner={winners.has(mySeat.id)} setRef={setRef} phone={phone} />}
{flies.map((f) => (
<span key={f.id} className="sd-fly" aria-hidden style={{ '--sx': `${f.sx}px`, '--sy': `${f.sy}px`, '--dx': `${f.dx}px`, '--dy': `${f.dy}px`, '--d': `${f.d}ms` } as CSSProperties} />
))}
@@ -757,19 +836,7 @@ export function SeotdaBoard({ view: v, me, players, act, pending, deadline }: Bo
</div>
)}
</div>
{mySeat && v.handPhase === 'open' && mySeat.opening === false && <OpenBox view={v} me={mySeat.id} act={act} pending={pending} />}
{mySeat && v.handPhase === 'open' && mySeat.opening === true && <p className="small muted sd-help">공개패를 골랐어요. 다른 사람을 기다리는 중이에요.</p>}
{v.reveal?.mine && <RevealBox view={v} act={act} pending={pending} />}
{v.reveal && !v.reveal.mine && <p className="small muted sd-help">{nick(players, v.reveal.by)}님이 카드 공개 여부를 고르는 중이에요.</p>}
{mySeat && v.handPhase === 'choose' && mySeat.chosen === false && <ChooseBox view={v} me={mySeat.id} act={act} pending={pending} />}
{mySeat && v.handPhase === 'choose' && mySeat.chosen === true && <p className="small muted sd-help">골랐어요. 다른 사람이 고르기를 기다리는 중이에요.</p>}
{mySeat && mySeat.inHand && v.handPhase === 'betting' && !mySeat.folded && <BetBar view={v} me={mySeat.id} act={act} pending={pending} players={players} />}
{v.handPhase === 'handEnd' && <ResultPanel view={v} players={players} />}
{mySeat && v.handPhase === 'handEnd' && mySeat.status === 'playing' && !mySeat.left && (
<button type="button" className="btn btn-primary btn-block" disabled={mySeat.ready || pending} onClick={() => act({ type: 'ready' })}>
{mySeat.ready ? '다른 사람을 기다리는 중…' : v.next === 'rematch' ? '재경기 시작' : '다음 판으로'}
</button>
)}
<Dock view={v} seat={mySeat} players={players} act={act} pending={pending} deadline={deadline} winner={!!mySeat && winners.has(mySeat.id)} setRef={setRef} phone={phone} />
<p className="sr-only" aria-live="polite">
{announce}
</p>

View File

@@ -65,7 +65,7 @@ test('섯다: 2장째를 받으면 지금 내 족보와 마지막 베팅, 족보
const off = setupGame('seotda', 2, { hints: false }).state;
const p = view(off, null).toAct as string;
expect(helpNow(view(off, p), p, users)).toContain("'족보 도우미'를 보고");
expect(helpNow(view(off, p), p, users)).toContain("'족보'판을 보고");
});
test('섯다: 3장 섯다 공개패 → 베팅 2번 → 고르기 단계(한게임)', () => {

View File

@@ -34,10 +34,10 @@ 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 {

View File

@@ -3,121 +3,20 @@
* 원은 이 방 안에서만 쓰는 놀이용 숫자다(§12): 진짜 돈과 바꿀 수 없고 방이 끝나면 사라진다.
*/
import { useState } from 'react';
import type { SeotdaOptions, SeotdaView, SpecialKind } from '@bg/games/seotda';
import type { SeotdaOptions, SeotdaView } from '@bg/games/seotda';
import { formatWon, formatWonDelta, formatWonShort } from '@bg/games/seotda/money';
import type { PublicUser } from '@bg/shared/lite';
import { Avatar, ConfirmSheet, Sheet } from '../../components/ui';
import { TurnTimer } from '../../components/TurnTimer';
import { HWATU_CREDIT, HwatuCard, type HwatuInfo } from '../../components/cards/HwatuCard';
import { HWATU_CREDIT } from '../../components/cards/HwatuCard';
import type { BoardProps, GameUI, OptionsProps } from '../types';
import { BET_KO, SeotdaBoard, nick, resultLine, totalMsOf, userOf } from './board';
import { helpNow } from './help';
import { JokboTable } from './jokbo';
import { quickStart } from './quick';
/** Illustration card for the 족보표 (no rule code needed on the client). */
function illus(month: number, special: boolean): HwatuInfo {
const gwang = [1, 3, 8].includes(month);
const kind: HwatuInfo['kind'] = special ? (gwang ? 'gwang' : 'yeol') : month === 8 ? 'pi' : 'tti';
return {
id: (month - 1) * 4 + (special ? 0 : 1),
month,
kind,
...(kind === 'tti' ? { tti: 'plain' as const } : {}),
name: `${month}월 ${special ? (gwang ? '광' : '열끗') : month === 8 ? '기러기' : '띠'}`,
};
}
const PLAY_MONEY_NOTICE = '여기 나오는 원과 판돈은 이 방 안에서만 쓰는 놀이용 숫자예요. 진짜 돈과는 아무 상관이 없고, 바꾸거나 주고받을 수 없으며 방이 끝나면 사라져요.';
// ---------------------------------------------------------------- 족보 도우미
interface JokboRow {
name: string;
cards: [number, boolean][];
note: string;
match: (value: number | null, special: SpecialKind | null) => boolean;
/** 특수 족보 (numbered "특" like the 한게임 족보 list). */
special?: boolean;
}
function jokboRows(o: SeotdaOptions): JokboRow[] {
const v = (lo: number, hi = lo) => (x: number | null, sp: SpecialKind | null) => !sp && x !== null && x >= lo && x <= hi;
const rows: JokboRow[] = [
{ name: '38광땡', cards: [[3, true], [8, true]], note: '가장 센 패', match: v(1000) },
...(o.gwangTtaeng === 'all'
? [
{ name: '18광땡', cards: [[1, true], [8, true]], note: '', match: v(990) } as JokboRow,
{ name: '13광땡', cards: [[1, true], [3, true]], note: '', match: v(980) } as JokboRow,
]
: []),
{ name: '장땡(10땡)', cards: [[10, true], [10, false]], note: '같은 달 두 장 중 최고', match: v(910) },
{ name: '9땡 ~ 삥땡(1땡)', cards: [[9, true], [9, false]], note: '숫자가 클수록 셈', match: v(901, 909) },
{ name: '알리', cards: [[1, true], [2, false]], note: '1 + 2', match: v(806) },
{ name: '독사', cards: [[1, true], [4, false]], note: '1 + 4', match: v(805) },
{ name: '구삥', cards: [[1, true], [9, false]], note: '1 + 9', match: v(804) },
{ name: '장삥', cards: [[1, true], [10, false]], note: '1 + 10', match: v(803) },
{ name: '장사', cards: [[4, false], [10, false]], note: '4 + 10', match: v(802) },
{ name: '세륙', cards: [[4, false], [6, false]], note: '4 + 6', match: v(801) },
{ name: '갑오(9끗)', cards: [[2, false], [7, false]], note: '두 달을 더한 일의 자리 9', match: v(9) },
{ name: '8끗 ~ 1끗', cards: [[3, false], [5, false]], note: '일의 자리가 클수록 셈', match: v(1, 8) },
{ name: '망통(0끗)', cards: [[2, false], [8, false]], note: '가장 약한 패', match: v(0) },
];
const sp = (k: SpecialKind) => (_x: number | null, s: SpecialKind | null) => s === k;
if (o.ttaengjabi !== 'off')
rows.push({
name: '땡잡이',
special: true,
cards: [[3, true], [7, true]],
note: `${o.ttaengjabi === 'strict' ? '3월 광 + 7월 열끗' : '3월 + 7월'}. 상대 최고가 1~9땡이면 이김, 아니면 망통`,
match: sp('ttaengjabi'),
});
if (o.amhaeng) rows.push({ name: '암행어사', special: true, cards: [[4, true], [7, true]], note: '4·7월 열끗. 13·18광땡을 잡음, 아니면 1끗', match: sp('amhaeng') });
if (o.gusa) {
rows.push({ name: '구사', special: true, cards: [[4, false], [9, true]], note: '4 + 9. 상대가 알리 이하면 재경기, 아니면 3끗', match: sp('gusa') });
if (o.mungGusa !== 'off') {
const upTo = o.mungGusa === 'upTo9' ? '9땡' : o.mungGusa === 'upToJang' ? '장땡' : '8땡';
rows.push({ name: '멍텅구리구사', special: true, cards: [[4, true], [9, true]], note: `4·9월 열끗. 상대가 ${upTo} 이하면 재경기`, match: sp('mungGusa') });
}
}
return rows;
}
function JokboTable({ options, mine }: { options: SeotdaOptions; mine?: SeotdaView['myHand'] }) {
const rows = jokboRows(options);
return (
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '0.88rem' }}>
<tbody>
{rows.map((r, i) => {
const hit = !!mine && options.hints && r.match(mine.value, mine.special);
return (
<tr
key={r.name}
style={{ background: hit ? 'color-mix(in srgb, #7c3aed 22%, transparent)' : undefined, borderBottom: '1px solid var(--border)' }}
aria-current={hit ? 'true' : undefined}
>
<td style={{ padding: '3px 4px', fontWeight: 800, color: 'var(--text-sub)', width: 28, textAlign: 'right', whiteSpace: 'nowrap' }}>{r.special ? '특' : i + 1}</td>
<td style={{ padding: '3px 2px', whiteSpace: 'nowrap' }}>
{r.cards.map(([m, sp], j) => (
<HwatuCard key={j} card={illus(m, sp)} width={30} showMonth={false} style={{ marginRight: 2 }} />
))}
</td>
<td style={{ padding: '3px 6px' }}>
<strong>{r.name}</strong>
{hit && (
<span className="sd-tag" style={{ background: '#7c3aed', color: '#fff', marginLeft: 4, borderRadius: 999, padding: '0 7px', fontSize: '.74rem', fontWeight: 800 }}>
내 패
</span>
)}
{r.note && <div className="small muted">{r.note}</div>}
</td>
</tr>
);
})}
</tbody>
</table>
);
}
// ---------------------------------------------------------------- side panel
function SeotdaSide({ view: v, me, players, act, pending, deadline }: BoardProps<SeotdaView>) {
@@ -181,10 +80,6 @@ function SeotdaSide({ view: v, me, players, act, pending, deadline }: BoardProps
</ol>
</details>
)}
<details className="card wide-open" open style={{ padding: 12 }}>
<summary style={{ cursor: 'pointer', fontWeight: 700 }}>족보 도우미</summary>
<JokboTable options={v.options} mine={v.myHand} />
</details>
{v.history.length > 0 && (
<details className="card" style={{ padding: 12 }}>
<summary style={{ cursor: 'pointer', fontWeight: 700 }}>판 기록</summary>

View File

@@ -0,0 +1,160 @@
/**
* 섯다 족보 (docs/games/seotda.md §3): the rows for the current room rules, the full table (규칙 화면) and the compact
* 족보판 at the left of the bottom bar (한게임 섯다처럼 3열 목록 + 고른 족보 설명).
*/
import { useEffect, useState } from 'react';
import type { SeotdaOptions, SeotdaView, SpecialKind } from '@bg/games/seotda';
import { HwatuCard, type HwatuInfo } from '../../components/cards/HwatuCard';
/** Illustration card for the 족보표 (no rule code needed on the client). */
export function illus(month: number, special: boolean): HwatuInfo {
const gwang = [1, 3, 8].includes(month);
const kind: HwatuInfo['kind'] = special ? (gwang ? 'gwang' : 'yeol') : month === 8 ? 'pi' : 'tti';
return {
id: (month - 1) * 4 + (special ? 0 : 1),
month,
kind,
...(kind === 'tti' ? { tti: 'plain' as const } : {}),
name: `${month}월 ${special ? (gwang ? '광' : '열끗') : month === 8 ? '기러기' : '띠'}`,
};
}
export interface JokboRow {
name: string;
/** Short label for the compact 족보 board under the table. */
short: string;
cards: [number, boolean][];
note: string;
match: (value: number | null, special: SpecialKind | null) => boolean;
/** 특수 족보 (numbered "특" like the 한게임 족보 list). */
special?: boolean;
}
export function jokboRows(o: SeotdaOptions): JokboRow[] {
const v = (lo: number, hi = lo) => (x: number | null, sp: SpecialKind | null) => !sp && x !== null && x >= lo && x <= hi;
const rows: JokboRow[] = [
{ name: '38광땡', short: '38광땡', cards: [[3, true], [8, true]], note: '가장 센 패', match: v(1000) },
...(o.gwangTtaeng === 'all'
? [
{ name: '18광땡', short: '18광땡', cards: [[1, true], [8, true]], note: '1월 광 + 8월 광', match: v(990) } as JokboRow,
{ name: '13광땡', short: '13광땡', cards: [[1, true], [3, true]], note: '1월 광 + 3월 광', match: v(980) } as JokboRow,
]
: []),
{ name: '장땡(10땡)', short: '장땡', cards: [[10, true], [10, false]], note: '같은 달 두 장 중 최고', match: v(910) },
{ name: '9땡 ~ 삥땡(1땡)', short: '9~1땡', cards: [[9, true], [9, false]], note: '숫자가 클수록 셈', match: v(901, 909) },
{ name: '알리', short: '알리', cards: [[1, true], [2, false]], note: '1 + 2', match: v(806) },
{ name: '독사', short: '독사', cards: [[1, true], [4, false]], note: '1 + 4', match: v(805) },
{ name: '구삥', short: '구삥', cards: [[1, true], [9, false]], note: '1 + 9', match: v(804) },
{ name: '장삥', short: '장삥', cards: [[1, true], [10, false]], note: '1 + 10', match: v(803) },
{ name: '장사', short: '장사', cards: [[4, false], [10, false]], note: '4 + 10', match: v(802) },
{ name: '세륙', short: '세륙', cards: [[4, false], [6, false]], note: '4 + 6', match: v(801) },
{ name: '갑오(9끗)', short: '갑오', cards: [[2, false], [7, false]], note: '두 달을 더한 일의 자리 9', match: v(9) },
{ name: '8끗 ~ 1끗', short: '8~1끗', cards: [[3, false], [5, false]], note: '일의 자리가 클수록 셈', match: v(1, 8) },
{ name: '망통(0끗)', short: '망통', cards: [[2, false], [8, false]], note: '가장 약한 패', match: v(0) },
];
const sp = (k: SpecialKind) => (_x: number | null, s: SpecialKind | null) => s === k;
if (o.ttaengjabi !== 'off')
rows.push({
name: '땡잡이',
short: '땡잡이',
special: true,
cards: [[3, true], [7, true]],
note: `${o.ttaengjabi === 'strict' ? '3월 광 + 7월 열끗' : '3월 + 7월'}. 상대 최고가 1~9땡이면 이김, 아니면 망통`,
match: sp('ttaengjabi'),
});
if (o.amhaeng) rows.push({ name: '암행어사', short: '암행어사', special: true, cards: [[4, true], [7, true]], note: '4·7월 열끗. 13·18광땡을 잡음, 아니면 1끗', match: sp('amhaeng') });
if (o.gusa) {
rows.push({ name: '구사', short: '구사', special: true, cards: [[4, false], [9, true]], note: '4 + 9. 상대가 알리 이하면 재경기, 아니면 3끗', match: sp('gusa') });
if (o.mungGusa !== 'off') {
const upTo = o.mungGusa === 'upTo9' ? '9땡' : o.mungGusa === 'upToJang' ? '장땡' : '8땡';
rows.push({ name: '멍텅구리구사', short: '멍구사', special: true, cards: [[4, true], [9, true]], note: `4·9월 열끗. 상대가 ${upTo} 이하면 재경기`, match: sp('mungGusa') });
}
}
return rows;
}
export function JokboTable({ options, mine }: { options: SeotdaOptions; mine?: SeotdaView['myHand'] }) {
const rows = jokboRows(options);
return (
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '0.88rem' }}>
<tbody>
{rows.map((r, i) => {
const hit = !!mine && options.hints && r.match(mine.value, mine.special);
return (
<tr
key={r.name}
style={{ background: hit ? 'color-mix(in srgb, #7c3aed 22%, transparent)' : undefined, borderBottom: '1px solid var(--border)' }}
aria-current={hit ? 'true' : undefined}
>
<td style={{ padding: '3px 4px', fontWeight: 800, color: 'var(--text-sub)', width: 28, textAlign: 'right', whiteSpace: 'nowrap' }}>{r.special ? '특' : i + 1}</td>
<td style={{ padding: '3px 2px', whiteSpace: 'nowrap' }}>
{r.cards.map(([m, sp], j) => (
<HwatuCard key={j} card={illus(m, sp)} width={30} showMonth={false} style={{ marginRight: 2 }} />
))}
</td>
<td style={{ padding: '3px 6px' }}>
<strong>{r.name}</strong>
{hit && (
<span className="sd-tag" style={{ background: '#7c3aed', color: '#fff', marginLeft: 4, borderRadius: 999, padding: '0 7px', fontSize: '.74rem', fontWeight: 800 }}>
내 패
</span>
)}
{r.note && <div className="small muted">{r.note}</div>}
</td>
</tr>
);
})}
</tbody>
</table>
);
}
/**
* Compact 족보판 (bottom-left of the table, like 한게임 섯다): every hand in 3 columns, my current hand lit up (when
* hints are on); the line below explains the selected hand (my hand by default, or the one clicked).
*/
export function JokboBoard({ options, mine }: { options: SeotdaOptions; mine: SeotdaView['myHand'] }) {
const rows = jokboRows(options);
const hitIdx = mine && options.hints ? rows.findIndex((r) => r.match(mine.value, mine.special)) : -1;
const [sel, setSel] = useState<number | null>(null);
useEffect(() => setSel(null), [hitIdx]);
const shown = rows[sel ?? (hitIdx >= 0 ? hitIdx : 0)]!;
let n = 0;
return (
<section className="sd-jokbo" aria-label="족보">
<h3>족보</h3>
<ol style={{ gridTemplateRows: `repeat(${Math.ceil(rows.length / 3)}, auto)` }}>
{rows.map((r, i) => {
const label = r.special ? `*${r.short}` : `${++n}.${r.short}`;
return (
<li key={r.name}>
<button
type="button"
className={`${i === hitIdx ? 'hit' : ''}${shown === r ? ' sel' : ''}`}
aria-pressed={shown === r}
aria-current={i === hitIdx ? 'true' : undefined}
title={`${r.name}${r.note ? `: ${r.note}` : ''}`}
onClick={() => setSel(sel === i ? null : i)}
>
{label}
</button>
</li>
);
})}
</ol>
<div className="sd-jokbo-desc" aria-live="polite">
<span className="pics" aria-hidden>
{shown.cards.map(([m, sp], j) => (
<HwatuCard key={j} card={illus(m, sp)} width={22} showMonth={false} />
))}
</span>
<span>
<strong>{shown.name}</strong>
{shown.note ? ` ${shown.note}` : ''}
</span>
</div>
</section>
);
}

View File

@@ -89,6 +89,6 @@ export const quickStart: QuickCard[] = [
),
alt: '장땡, 알리, 8끗 순서로 화투 두 장씩 놓여 있고 사이에 큰 쪽 표시가 있어요',
title: '땡 > 알리 > 끗 순서예요',
text: "광땡 > 땡(같은 달 2장) > 알리·독사 등 > 끗(두 달을 더한 일의 자리) 순으로 세요. 화면의 '족보 도우미'를 보면 쉬워요.",
text: "광땡 > 땡(같은 달 2장) > 알리·독사 등 > 끗(두 달을 더한 일의 자리) 순으로 세요. 화면 아래 '족보'판을 보면 쉬워요.",
},
];

View File

@@ -484,12 +484,13 @@ interface SeotdaResult /* extends GameResult */ {
한게임 섯다 화면을 본떴다(`apps/web/src/games/seotda/board.tsx`).
화면 배치:
- PC: 나무 테두리의 초록 테이블. 다른 사람 자리는 내 왼쪽 아래에서 위를 돌아 오른쪽 아래까지 둥글게, 내 자리는 테이블 아래 가운데에 크게(패 2~3장, 족보 이름 금색 큰 글씨, 보유 금액). 가운데에 동전 더미와 **판돈** 큰 숫자, 그 밑에 판 수·기본금·현재 콜 금액. 재경기면 "재경기 2회차 · 구사" 띠.
- 자리 상자: 아바타, 닉네임, 선 표시, 남은 시간 고리, 보유 금액(만 단위로 줄임), 이번 판에 건 돈, 카드 뒷면, 마지막 행동 말풍선(콜·하프·다이 … 색 구분), 쇼다운 뒤 족보 이름(땡 이상은 금색)과 딴/잃은 금액(+1만 5,000원 / -1만원), 이긴 자리는 금빛 테두리.
- 휴대폰: 테이블이 세로로 바뀐다. 위에 다른 사람 자리 2~3열, 가운데 판돈, 아래 내 자리. 버튼은 3열.
- 아래: 베팅 버튼 3×2(콜·다이·하프 / 삥·체크·따당, 쿼터·풀을 켜면 한 줄 더). 버튼마다 낼 금액과 숫자 키(PC)를 적는다. 못 누르는 버튼은 흐리게 두고 자리를 바꾸지 않는다(오조작 방지). 마우스를 올리면 "걸고 나면 내 돈 … 판돈 …"을 미리 보여 준다.
- 옆 패널: 놀이용 원 안내, 판 정보·시간, 보유 금액 순위, 이번 판 베팅 기록, **족보 도우미**(번호가 작을수록 센 족보, 내 패 줄을 보라색으로 강조, 켜진 특수패만), 판 기록.
화면 배치 (2026-10-17 한게임 섯다 화면 사진대로 다시 짬):
- 테이블(위): 나무 테두리의 초록 테이블. 다른 사람 자리는 왼쪽 아래에서 위를 돌아 오른쪽 아래까지 둥글게, 자리마다 패가 위·이름과 돈이 아래. 가운데에 동전 더미와 **판돈** 큰 숫자, 그 밑에 판 수·기본금·현재 콜 금액. 재경기면 "재경기 2회차 · 구사" 띠. 내 자리는 테이블 안에 두지 않는다.
- 자리 상자: 패(공개패·쇼다운 패는 앞면, 왼쪽 아래 큰 월 숫자), 아바타, 닉네임, 선 표시, 남은 시간 고리, 보유 금액(만 단위로 줄임), 이번 판에 건 돈, 마지막 행동 말풍선(콜·하프·다이 … 색 구분), 쇼다운 뒤 족보 이름(땡 이상은 금색)과 딴/잃은 금액, 이긴 자리는 금빛 테두리.
- 아래 금색 판(PC, 왼쪽부터): **족보판**(3열 목록 `1.38광땡 … 14.망통`, 특수패는 `*땡잡이`처럼 켜진 것만, 내 지금 족보 칸을 보라색으로 강조, 칸을 누르면 아래 줄에 그 족보의 그림 2장과 설명, 기본은 내 족보) · 내 얼굴(아바타·닉네임·보유 금액·선·남은 시간, 쇼다운 뒤 딴/잃은 금액) · **내 패**(2~3장 크게, 그 밑에 지금 족보 이름, 3장일 때는 세 조합의 족보를 나란히 적고 가장 센 것을 금색으로, 그 밑에 한 줄 도움말) · **베팅 버튼** 두 줄(왼쪽 콜7·삥4·따당1·하프0, 오른쪽 다이8·체크5, 쿼터2·풀9를 켜면 오른쪽 빈칸). 버튼마다 숫자 키를 왼쪽에 적고, 내 차례일 때만 낼 금액이 나온다. 못 누르는 버튼은 흐리게 두고 자리를 바꾸지 않는다(오조작 방지). 마우스를 올리면 판 아래 줄에 "걸고 나면 내 돈 … 판돈 …"을 미리 보여 준다.
- 베팅 버튼 자리는 단계에 따라 바뀐다: 3장 섯다 공개패 고르기(내 패를 눌러 1장 → "N월 패 공개하기")·쓸 패 고르기(내 패 2장을 누르거나 족보 조합 버튼 → "…(으)로 정하기"), 모두 다이했을 때 카드 공개/공개 안 함, 판이 끝나면 **이번 판 결과**와 "다음 판으로".
- 화면 폭이 좁으면(판 폭 900px 아래) 족보판이 금색 판 맨 아래 한 줄(6열)로 내려간다. 휴대폰: 테이블이 세로로 바뀌어 위에 다른 사람 자리 2~3열, 가운데 판돈. 금색 판은 내 얼굴 한 줄 → 내 패 → 버튼 3열(콜·다이·삥 / 체크·따당·하프) → 족보판 3열 순서.
- 옆 패널: 놀이용 원 안내, 판 정보·시간, 보유 금액 순위, 이번 판 베팅 기록, 판 기록. 족보 전체 표(그림·설명)는 규칙 화면에 있다.
소리와 움직임(내 행동이든 상대·컴퓨터 행동이든 화면 변화에 반응, 한 변화에 한 번만):
- 새 판·재경기: 섞는 소리, 카드가 위에서 날아와 놓임(`anim-deal`), 장수만큼 카드 소리.