섯다·포커: 다른 사람이 모두 죽고 혼자 남으면 카드를 공개할지 고르기(카드 공개/공개 안 함, 시간 초과·나감·기본은 공개 안 함, 공개하면 모두에게 패와 족보를 뒤집어 보여 주고 기록에 남김, 컴퓨터도 센 패면 가끔 공개)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -82,10 +82,16 @@ test('텍사스 홀덤: 노리밋 버튼과 공용 카드, 모두 포기하면
|
||||
const flop = drive(state, (x) => x.handPhase === 'betting' && x.board.length === 3);
|
||||
expect(help(flop, null)).toContain('가운데 공용 카드 3장이 펼쳐져 있어요');
|
||||
|
||||
const s = applyAction('poker', state, turn, { type: 'nl.fold' });
|
||||
const r = applyAction('poker', state, turn, { type: 'nl.fold' });
|
||||
expect(view(r, null).handPhase).toBe('reveal');
|
||||
expect(help(r, other)).toContain('[카드 공개]');
|
||||
expect(help(r, turn)).toContain(`혼자 남은 ${nickOf(other)}이 카드 공개 여부를 고르는 중이에요`);
|
||||
const shown = applyAction('poker', r, other, { type: 'reveal', show: true });
|
||||
expect(help(shown, turn)).toContain('패를 공개했어요(');
|
||||
const s = applyAction('poker', r, other, { type: 'reveal', show: false });
|
||||
expect(view(s, null).handPhase).toBe('handEnd');
|
||||
const w = help(s, other);
|
||||
expect(w).toContain('다른 사람이 모두 포기해서 내가 모인 칩을 가져갔어요');
|
||||
expect(w).toContain('다른 사람이 모두 포기해서 내가 모인 칩을 가져갔어요. 패는 공개하지 않았어요.');
|
||||
expect(w).toContain('[다음 판으로]');
|
||||
expect(help(s, null)).toContain(`${nickOf(other)}이 모인 칩을 가져갔어요`);
|
||||
});
|
||||
|
||||
@@ -149,6 +149,8 @@ function watchText(v: PokerView, players: Record<string, PublicUser>, me: string
|
||||
return `모두 동시에 바꿀 카드를 고르는 중이에요(${drawName(v)}). 버린 카드는 공개되지 않고, 바꾼 장수만 각 자리에 보여요.${waiting}`;
|
||||
case 'declare':
|
||||
return `남은 사람들이 하이·로우·스윙 중 하나를 몰래 고르는 중이에요. 모두 고르면 한꺼번에 공개돼요.${waiting}`;
|
||||
case 'reveal':
|
||||
return `다른 사람이 모두 포기해서 혼자 남은 ${nickOf(players, v.waiting[0])}이 카드 공개 여부를 고르는 중이에요.`;
|
||||
default:
|
||||
return '카드를 나눠 주는 중이에요. 잠시만 기다려 주세요.';
|
||||
}
|
||||
@@ -161,7 +163,8 @@ function handEndText(v: PokerView, players: Record<string, PublicUser>, me: stri
|
||||
const sdName = (id: string) => (v.mode === 'sevenHiLo' ? undefined : v.showdown?.find((e) => e.id === id)?.handName);
|
||||
const who = (id: string) => (id === me ? '내가' : `${nickOf(players, id)}이`);
|
||||
if (v.foldWin && v.winners.length === 1) {
|
||||
lines.push(`다른 사람이 모두 포기해서 ${who(v.winners[0]!)} 모인 칩을 가져갔어요. 이럴 때는 패를 공개하지 않아요.`);
|
||||
const shown = v.foldShown ? `패를 공개했어요(${v.foldShown.handName}).` : '패는 공개하지 않았어요.';
|
||||
lines.push(`다른 사람이 모두 포기해서 ${who(v.winners[0]!)} 모인 칩을 가져갔어요. ${shown}`);
|
||||
} else if (v.winners.length === 1) {
|
||||
const name = sdName(v.winners[0]!);
|
||||
lines.push(`이번 판은 ${who(v.winners[0]!)} ${name ? `${name}(으)로 ` : ''}이겼어요.`);
|
||||
@@ -245,6 +248,14 @@ export function helpNow(v: PokerView, me: string | null, players: Record<string,
|
||||
]);
|
||||
}
|
||||
return withHand([`${m.declare ? `${SIDE_KO[m.declare]}(으)로 선언했어요. ` : ''}다른 사람이 선언할 때까지 기다려 주세요.`]);
|
||||
case 'reveal':
|
||||
if (m.canReveal) {
|
||||
return [
|
||||
`다른 사람이 모두 포기해서 모인 칩 ${chips(v.pot)}은 내 거예요.`,
|
||||
'[카드 공개]를 누르면 모두에게 내 카드를 보여 주고, [공개 안 함]을 누르면 아무도 내 카드를 못 봐요. 시간이 지나면 공개하지 않아요.',
|
||||
].join('\n');
|
||||
}
|
||||
return `${watchText(v, players, me)}${away}`;
|
||||
default:
|
||||
return `${watchText(v, players, me)}${away}`;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ function seatBadges(seat: SeatView, v: PokerView): [string, string][] {
|
||||
if (contesting && v.handPhase === 'draw') b.push(seat.drawDone ? ['냄', 'var(--success)'] : ['바꿀 카드 고르는 중', 'var(--text-sub)']);
|
||||
if (contesting && v.handPhase === 'declare') b.push(seat.declared ? ['선언함', 'var(--success)'] : ['선언 고르는 중', 'var(--text-sub)']);
|
||||
if (seat.declare) b.push([`선언: ${SIDE_KO[seat.declare]}`, '#7c3aed']);
|
||||
if (v.handPhase === 'reveal' && v.waiting.includes(seat.id)) b.push(['카드 공개 고르는 중', 'var(--text-sub)']);
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -187,6 +188,7 @@ function SeatBox({ seat, v, players, me, deadline, x, y }: { seat: SeatView; v:
|
||||
</div>
|
||||
)}
|
||||
<SeatCards seat={seat} v={v} me={me} />
|
||||
{!sd && v.foldShown?.id === seat.id && <strong style={{ color: 'var(--primary)', textAlign: 'center' }}>{v.foldShown.handName}</strong>}
|
||||
{sd && (
|
||||
<strong style={{ color: 'var(--primary)', textAlign: 'center' }}>
|
||||
{sd.handName}
|
||||
@@ -458,6 +460,16 @@ function usePokerFx(v: PokerView, me: string | null, players: Record<string, Pub
|
||||
}
|
||||
t += n * 220 + 200;
|
||||
}
|
||||
// Everyone else folded and the last player showed the cards: turn them over.
|
||||
const fs = v.foldShown;
|
||||
if (fs && !p.foldShown && fs.id !== me) {
|
||||
const s = v.seats.find((x) => x.id === fs.id);
|
||||
const els = seatCardEls(fs.id);
|
||||
const off = s?.forehead !== undefined ? 1 : 0;
|
||||
for (let i = 0; i < (s?.hole.length ?? 0); i++) turnOver(els[off + i], t + i * 60);
|
||||
later(t + 120, sfx.cardFlip);
|
||||
t += 400;
|
||||
}
|
||||
// 인디언: my own forehead card is shown at the end of the hand.
|
||||
const myNow = v.seats.find((s) => s.id === me);
|
||||
const myBefore = p.seats.find((s) => s.id === me);
|
||||
@@ -566,7 +578,7 @@ function resultLine(v: PokerView, players: Record<string, PublicUser>): string {
|
||||
for (const a of v.awards) if (a.side !== 'refund') won.set(a.to, (won.get(a.to) ?? 0) + a.amount);
|
||||
if (!won.size) return v.carryOver > 0 ? `동점이라 ${formatChips(v.carryOver)}이 다음 판으로 넘어가요` : '이번 판은 칩을 모두 돌려받았어요';
|
||||
const parts = [...won].map(([id, amt]) => {
|
||||
const name = v.showdown?.find((e) => e.id === id)?.handName;
|
||||
const name = v.showdown?.find((e) => e.id === id)?.handName ?? (v.foldShown?.id === id ? v.foldShown.handName : undefined);
|
||||
return `${nick(players, id)}님이 ${name ? `${name}(으)로 ` : ''}${formatChips(amt)}을 가져갔어요`;
|
||||
});
|
||||
return parts.join(' / ') + (v.foldWin ? ' (모두 포기)' : '');
|
||||
@@ -577,7 +589,11 @@ function ResultPanel({ v, players }: { v: PokerView; players: Record<string, Pub
|
||||
return (
|
||||
<div className="card stack" style={{ gap: 6, padding: 12 }} aria-live="polite">
|
||||
<strong>이번 판 결과</strong>
|
||||
{v.foldWin && <span className="small muted">한 명만 남아서 패는 공개하지 않아요.</span>}
|
||||
{v.foldWin && (
|
||||
<span className="small muted">
|
||||
{v.foldShown ? `한 명만 남았고, ${nick(players, v.foldShown.id)}님이 패를 공개했어요(${v.foldShown.handName}).` : '한 명만 남았고, 패는 공개하지 않았어요.'}
|
||||
</span>
|
||||
)}
|
||||
{v.awards.map((a, i) => {
|
||||
const sd = v.showdown?.find((e) => e.id === a.to);
|
||||
const hand = !sd ? '' : a.side === 'low' ? (sd.lowName ? `로우 ${sd.lowName}` : '') : !a.side || a.side === 'high' || a.side === 'scoop' ? sd.handName : '';
|
||||
@@ -639,6 +655,12 @@ function MyArea({ v, me, players, act, pending }: AreaProps) {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{m.canReveal && <RevealBox v={v} act={act} pending={pending} />}
|
||||
{v.handPhase === 'reveal' && !m.canReveal && v.waiting[0] && (
|
||||
<p className="small muted" style={{ margin: 0, textAlign: 'center' }}>
|
||||
{nick(players, v.waiting[0])}님이 카드 공개 여부를 고르는 중이에요.
|
||||
</p>
|
||||
)}
|
||||
{seat.inHand && v.handPhase === 'betting' && !seat.folded && !seat.allIn && <BetBar v={v} me={me} players={players} act={act} pending={pending} />}
|
||||
{v.handPhase === 'handEnd' && <ResultPanel v={v} players={players} />}
|
||||
{m.canReady && (
|
||||
@@ -651,6 +673,25 @@ function MyArea({ v, me, players, act, pending }: AreaProps) {
|
||||
);
|
||||
}
|
||||
|
||||
/** Everyone else folded: show my cards to everyone, or keep them hidden (the default when time runs out). */
|
||||
function RevealBox({ v, act, pending }: { v: PokerView; 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>모두 포기해서 모인 칩 {formatChips(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 MyCards({ v, seat }: { v: PokerView; seat: SeatView }) {
|
||||
const sd = v.showdown?.find((e) => e.id === seat.id);
|
||||
const best = new Set(sd?.best ?? []);
|
||||
@@ -1094,6 +1135,8 @@ function statusText(v: PokerView, me: string | null, players: Record<string, Pub
|
||||
return mine ? '내 차례예요. 바꿀 카드를 골라 주세요' : '다른 사람이 바꿀 카드를 고르는 중이에요';
|
||||
case 'declare':
|
||||
return mine ? '내 차례예요. 하이·로우·스윙을 선언해 주세요' : '다른 사람이 선언하는 중이에요';
|
||||
case 'reveal':
|
||||
return mine ? '모두 포기했어요. 내 카드를 공개할지 골라 주세요' : `${nick(players, v.waiting[0] ?? '')}님이 카드 공개 여부를 고르는 중이에요`;
|
||||
case 'handEnd':
|
||||
return resultLine(v, players) || '판이 끝났어요';
|
||||
default:
|
||||
@@ -1260,6 +1303,12 @@ function Rules({ options }: { options?: PokerOptions }) {
|
||||
: `폴드(포기), 체크, 콜, 레이즈, 올인. 레이즈는 직전 레이즈만큼 이상 올려야 해요.${style === 'potLimit' ? ' 팟리밋은 모인 칩만큼까지만 올릴 수 있어요.' : ''}`}{' '}
|
||||
칩이 모자라면 가진 만큼 내고 올인하며, 그 이상 걸린 칩은 따로(사이드 팟) 겨뤄요.
|
||||
</p>
|
||||
<p>
|
||||
<strong>혼자 남으면</strong>: 다른 사람이 모두 포기하면 남은 한 명이 모인 칩을 가져가요.{' '}
|
||||
{mode === 'indian'
|
||||
? '인디언 포커는 판이 끝나면 모든 카드가 공개돼요.'
|
||||
: '이때 남은 사람이 카드를 모두에게 보여 줄지([카드 공개]) 숨길지([공개 안 함]) 골라요. 시간이 지나면 공개하지 않아요.'}
|
||||
</p>
|
||||
<p>
|
||||
<strong>족보</strong>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user