증강 윷놀이: 이의있음!은 모두 고른 뒤 화면 전체에 크게 띄우고, 그 선택에서 모두가 고른 증강을 없앤 채 모두 새 후보로 다시 고름

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-08 02:05:51 +09:00
parent f4fb796dfe
commit 2403b6747f
5 changed files with 122 additions and 19 deletions

View File

@@ -73,7 +73,15 @@ export const AUG_CSS = `
.aug-pop .aug-pop-state { font-weight: 800; color: var(--danger); }
.aug-chip[tabindex] { cursor: help; }
@keyframes aug-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .aug-toast, .aug-pop { animation: none; } }
.aug-objection { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; background: rgba(17, 24, 39, .72); cursor: pointer;
animation: aug-obj-bg .25s ease both; }
.aug-objection-box { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; text-align: center; color: #fff; max-width: min(92vw, 640px); }
.aug-objection-box strong { font-size: clamp(3.2rem, 15vw, 7rem); line-height: 1; font-weight: 900; color: #fde047; letter-spacing: -.02em;
text-shadow: 0 4px 0 #b91c1c, 0 8px 24px rgba(0, 0, 0, .5); transform: rotate(-4deg); animation: aug-obj-hit .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.aug-objection-box p { margin: 0; font-size: 1.05rem; font-weight: 700; }
@keyframes aug-obj-hit { 0% { opacity: 0; transform: rotate(-4deg) scale(2.4); } 60% { opacity: 1; transform: rotate(-4deg) scale(.92); } 100% { transform: rotate(-4deg) scale(1); } }
@keyframes aug-obj-bg { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .aug-toast, .aug-pop, .aug-objection, .aug-objection-box strong { animation: none; } }
`;
// ---------------------------------------------------------------- round bar
@@ -435,10 +443,18 @@ export function AugFxLayer({ v, players, me }: { v: YutView; players: Record<str
const seen = useRef(fx.reduce((m, f) => Math.max(m, f.no), 0));
const [popup, setPopup] = useState<AugFx | null>(null);
const [toast, setToast] = useState<{ key: number; text: string } | null>(null);
const [objection, setObjection] = useState<AugFx | null>(null);
useEffect(() => {
const fresh = fx.filter((f) => f.no > seen.current);
if (!fresh.length) return;
seen.current = Math.max(...fresh.map((f) => f.no));
// 이의있음!: a big full-screen call, then the (already open) new selection shows underneath
const obj = fresh.find((f) => f.kind === 'objection');
if (obj) {
setObjection(obj);
sounds.buzz();
haptic(80);
}
// When the game just ended the result window says it all.
const big = v.phase === 'finished' ? undefined : fresh.find((f) => f.kind === 'win' || f.kind === 'out' || f.kind === 'bronze');
if (big) {
@@ -447,7 +463,7 @@ export function AugFxLayer({ v, players, me }: { v: YutView; players: Record<str
if (big.kind === 'out') (mine ? sounds.lose : sounds.buzz)();
else (mine ? sounds.win : sounds.ding)();
}
const small = fresh.filter((f) => f !== big && f.kind !== 'flick');
const small = fresh.filter((f) => f !== big && f !== obj && f.kind !== 'flick');
if (small.length) setToast({ key: small[small.length - 1]!.no, text: small.map((f) => f.text).join(' · ') });
}, [fx.map((f) => f.no).join(',')]); // eslint-disable-line react-hooks/exhaustive-deps
useEffect(() => {
@@ -455,8 +471,24 @@ export function AugFxLayer({ v, players, me }: { v: YutView; players: Record<str
const t = setTimeout(() => setToast(null), fxMs(3200));
return () => clearTimeout(t);
}, [toast]);
useEffect(() => {
if (!objection) return;
const t = setTimeout(() => setObjection(null), fxMs(2800));
return () => clearTimeout(t);
}, [objection]);
return (
<>
{objection &&
createPortal(
<div className="aug-objection" role="alert" onClick={() => setObjection(null)}>
<div className="aug-objection-box">
<AugIcon id="objection" size={72} />
<strong>이의있음!</strong>
<p>{objection.text}</p>
</div>
</div>,
document.body,
)}
{toast && (
<div key={toast.key} className="aug-toast" role="status" aria-live="polite">
{toast.text}

View File

@@ -12,7 +12,7 @@
- 첫 선택은 범용 + 시작 전용, 마지막은 범용 + 마무리 전용, 그 사이는 범용 + 중간 전용. `augOff`에 든 증강은 나오지 않는다.
- 혼돈 모드(`augChaos`): 한 번에 두 번 고른다(두 번째는 새 후보).
- 모두 고르면 공개되고, 차례 순서대로 효과가 난다. 명탐정이 먼저 적용된다.
- 이의있음!: 고르면 새 후보(이의있음 제외)로 바로 다시 고른다. 가진 증강으로 남지 않는다.
- 이의있음!: 고른 것은 다른 것처럼 비밀이고, 혼돈 모드라도 그 사람의 선택은 거기서 끝난다. 모두 고르면 공개 대신 화면 전체에 "이의있음!"이 크게 뜨고(누가 냈는지 함께), 이번에 모두가 고른 증강은 하나도 받지 않은 채 살아 있는 모두가 새 후보로 같은 선택을 처음부터 다시 한다. 다시 고를 때는 이의있음!이 후보에 없어서 한 선택에 한 번만 일어난다. 배달로 주문해 둔 증강은 다시 고를 때도 후보에 나온다. 가진 증강으로 남지 않는다.
- 고를 것이 없으면(후보 0개) 그 사람은 건너뛴다. 시간 제한은 max(30초, 행동 시간×2), 넘기면 첫 후보(이의있음 제외, 대상은 첫 항목).
- **질문(prompt)**: 효과에 선택이 필요한 증강(거머리·접기·돌림판·착각·계획·승부·손버릇은 주인, 나 누구게?는 다른 모두, 내려는 모두)은 공개 직후 차례로 묻는다. 시간 초과는 첫 선택지.
- **순위**: 말을 모두 내거나 특수 승리 조건을 이루면 그 즉시 비어 있는 가장 높은 순위(공동 순위는 같은 숫자, 다음은 +1)를 받고 빠진다. 탈락하면 판 위 말이 빠지고 꼴찌 쪽(늦게 탈락할수록 위). `ranking=first`면 첫 승자가 나오면 끝(동메달은 '승자'가 아님), `all`이면 한 명 남을 때까지. 끝날 때 남은 사람은 난 말 수·남은 거리로 순위를 매긴다.
@@ -82,7 +82,7 @@
| `illusion` | 언제부터 착각한 거지? | 즉시 | 다른 사람의 증강 하나를 3라운드 동안 고양이로 바꿔요. | 이미 다 쓴 증강은 고를 수 없어요. |
| `throwyut` | 윷을 잘 던져봐 | 사용·1회 | 윷을 던져 한 사람을 맞혀요. 맞은 사람은 차례를 두 번 건너뛰어요. | |
| `dual` | 이도류 | 규칙 | 윷가락을 2개씩 두 번 던져서 결과를 두 개 받아요. 모(둘 다 등)는 도로 바뀌어요. | 도·개·빽도만 나와서 한 번 더 던지는 일은 없어요. |
| `objection` | 이의있음! | 즉시 | 이번 증강 선택을 없던 걸로 하고 새 후보 중에서 다시 골라요. | |
| `objection` | 이의있음! | 즉시 | 이번 증강 선택을 없던 걸로 해요. 모두 고르고 나면 모두가 고른 증강이 사라지고, 모두 새 후보 중에서 다시 골라요. | 다시 고를 때는 이의있음!이 나오지 않아요. |
| `jajinmori` | 자진모리 장단 | 규칙 | 걸이 두 번 나올 때마다 개를 하나 더 받아요. | |
| `moonwalk` | 천마군림보 - 달걸음 | 규칙 | 내 말은 모두 반대 방향(시계 방향)으로 돌아요. | 참먹이에서 날윷 쪽으로 출발하고, 찌모·뒷모·방에 멈추면 지름길로 꺾어요. |
| `shield` | 천상의 보호막 | 사용·1회 | 내 말뭉치 하나에 보호막을 씌워요. 보호막은 잡힐 때 한 번 막아 줘요. | 막아 낸 말은 그 자리에 그대로 남아요. |

View File

@@ -107,15 +107,53 @@ describe('증강 윷놀이: options and selection', () => {
expect(yut.view(t, 'A').aug!.sides[1]!.augs[0]!.voided).toBe(true);
});
test('이의있음! rerolls the offers and is not kept', () => {
const s = yut.setup({ players: ['A', 'B'], options: yut.optionsSchema.parse({ augmented: true }), rng: SeededRng.fromSeed(seedN(2)), now: 0 });
s.aug!.select!.offers['0'] = ['objection', 'cat', 'fog'];
const t = act(s, 'A', { type: 'AUG_PICK', aug: 'objection' });
const offers = t.aug!.select!.offers['0']!;
expect(offers).toHaveLength(3);
expect(offers).not.toContain('objection');
expect(offers).not.toContain('cat');
expect(t.aug!.select!.left['0']).toBe(1);
test('이의있음!: kept secret until everyone has picked, then every pick is called off and everyone picks again', () => {
const s = yut.setup({ players: ['A', 'B', 'C'], options: yut.optionsSchema.parse({ augmented: true }), rng: SeededRng.fromSeed(seedN(2)), now: 0 });
s.aug!.select!.offers = { '0': ['objection', 'cat', 'fog'], '1': ['shield', 'cat', 'fog'], '2': ['tiger', 'cat', 'fog'] };
let t = act(s, 'A', { type: 'AUG_PICK', aug: 'objection' });
t = act(t, 'B', { type: 'AUG_PICK', aug: 'shield' });
// not revealed yet: no log line / popup, A just waits like anyone who picked
expect(JSON.stringify(t.log)).not.toContain('이의');
expect(t.aug!.fx.some((f) => f.kind === 'objection')).toBe(false);
expect(yut.view(t, 'C').aug!.select!.waiting).toEqual([2]);
expect(yut.view(t, 'A').aug!.select!.offers).toEqual([]);
t = act(t, 'C', { type: 'AUG_PICK', aug: 'tiger' });
// everyone picked → 이의있음!: nobody gets anything, the same selection starts over for all
expect(t.phase).toBe('aug');
expect(t.aug!.sides.every((x) => x.augs.length === 0)).toBe(true);
const sel = t.aug!.select!;
expect(sel.no).toBe(s.aug!.select!.no);
expect(sel.picks).toEqual([]);
expect(sel.left).toEqual({ '0': 1, '1': 1, '2': 1 });
for (const k of ['0', '1', '2']) {
expect(sel.offers[k]).toHaveLength(3);
expect(sel.offers[k]).not.toContain('objection');
}
const fx = t.aug!.fx.filter((f) => f.kind === 'objection');
expect(fx).toHaveLength(1);
expect(fx[0]).toMatchObject({ side: 0, aug: 'objection' });
expect(fx[0]!.text).toContain('빨강');
expect(yut.view(t, 'B').aug!.fx.some((f) => f.kind === 'objection')).toBe(true);
// the second round of picks counts normally
const pick = (st: YutState, who: string, k: string) => act(st, who, { type: 'AUG_PICK', aug: st.aug!.select!.offers[k]!.find((x) => x !== 'detective' && x !== 'delivery' && x !== 'cat')! });
t = pick(pick(pick(t, 'A', '0'), 'B', '1'), 'C', '2');
expect(t.aug!.select).toBeNull();
expect(t.aug!.sides.map((x) => x.augs.length)).toEqual([1, 1, 1]);
expect(t.aug!.sides.some((x) => x.augs.some((o) => o.id === 'objection'))).toBe(false);
});
test('이의있음! in 혼돈 mode ends that person\'s picking; a 배달 order is offered again in the redo', () => {
const s = yut.setup({ players: ['A', 'B'], options: yut.optionsSchema.parse({ augmented: true, augChaos: true }), rng: SeededRng.fromSeed(seedN(2)), now: 0 });
const sel = s.aug!.select!;
sel.offers = { '0': ['objection', 'cat', 'fog'], '1': ['shield', 'cat', 'fog'] };
sel.ordered = { '1': ['shield'] };
let t = act(s, 'A', { type: 'AUG_PICK', aug: 'objection' });
expect(t.aug!.select!.left['0']).toBe(0);
t = act(t, 'B', { type: 'AUG_PICK', aug: 'shield' });
t = act(t, 'B', { type: 'AUG_PICK', aug: t.aug!.select!.offers['1']![0]! });
expect(t.aug!.select!.left).toEqual({ '0': 2, '1': 2 });
expect(t.aug!.select!.offers['1']).toContain('shield');
expect(t.aug!.delivery['1']).toEqual([]);
});
test('간택: a 고양이 among the offers must be taken', () => {

View File

@@ -131,12 +131,14 @@ export interface AugSelect {
offers: Record<string, AugId[]>;
left: Record<string, number>;
picks: { side: SideId; id: AugId; target?: AugId }[];
/** 배달 orders this selection was made with, so an 이의있음! redo offers them again. */
ordered?: Record<string, AugId[]>;
}
/** Something the screen should show once (popup / animation); `no` increases. */
export interface AugFx {
no: number;
kind: 'win' | 'out' | 'effect' | 'flick' | 'pick' | 'bronze';
kind: 'win' | 'out' | 'effect' | 'flick' | 'pick' | 'bronze' | 'objection';
side: SideId;
aug?: AugId;
text: string;
@@ -1287,6 +1289,8 @@ function openSelection(s: YutState, ctx: Ctx): void {
const a = A(s);
const tier = selectionTier(a.selNo, a.rounds.length);
const sel: AugSelect = { no: a.selNo + 1, tier, offers: {}, left: {}, picks: [] };
const ordered = Object.entries(a.delivery).filter(([, ids]) => ids.length);
if (ordered.length) sel.ordered = Object.fromEntries(ordered.map(([k, ids]) => [k, [...ids]]));
for (const x of liveSides(s)) {
const offers = genOffers(s, x.id, tier, ctx.rng, []);
if (!offers.length) continue;
@@ -1336,9 +1340,10 @@ function applyPick(s: YutState, ctx: Ctx, side: SideId, act: AugPick): void {
const sel = a.select!;
const key = String(side);
if (act.aug === 'objection') {
log(s, ctx, { type: 'augEffect', side, aug: 'objection', text: `${nm(side)}: 이의있음! 다시 골라요` });
sel.offers[key] = genOffers(s, side, sel.tier, ctx.rng, ['objection', ...sel.offers[key]!, ...sel.picks.filter((p) => p.side === side).map((p) => p.id)]);
if (!sel.offers[key]!.length) sel.left[key] = 0;
// kept secret like any pick; when everyone is done the whole selection is called off (resolveSelection)
sel.picks.push({ side, id: 'objection' });
sel.left[key] = 0;
sel.offers[key] = [];
} else {
sel.picks.push({ side, id: act.aug, ...(act.target ? { target: act.target } : {}) });
sel.left[key]! -= 1;
@@ -1352,10 +1357,12 @@ function resolveSelection(s: YutState, ctx: Ctx): void {
const a = A(s);
const sel = a.select!;
a.select = null;
const objectors = [...new Set(sel.picks.filter((p) => p.id === 'objection').map((p) => p.side))].filter((k) => sideActive(s.sides[k]!));
if (objectors.length && redoSelection(s, ctx, sel, objectors)) return;
const voidIds = new Map<AugId, SideId>();
for (const p of sel.picks) if (p.id === 'detective' && p.target) voidIds.set(p.target, p.side);
const n = s.sides.length;
const order = [...sel.picks].sort((p, q) => ((p.side - s.turnSide + n) % n) - ((q.side - s.turnSide + n) % n));
const order = sel.picks.filter((p) => p.id !== 'objection').sort((p, q) => ((p.side - s.turnSide + n) % n) - ((q.side - s.turnSide + n) % n));
for (const p of order) {
const by = voidIds.get(p.id);
if (by !== undefined && by !== p.side) {
@@ -1373,6 +1380,32 @@ function resolveSelection(s: YutState, ctx: Ctx): void {
afterInterlude(s, ctx);
}
/**
* 이의있음!: nobody gets what they picked in this selection; every live side picks again from new offers
* (이의있음! is not offered again, so it happens at most once per selection). False when nobody has anything to pick.
*/
function redoSelection(s: YutState, ctx: Ctx, sel: AugSelect, objectors: SideId[]): boolean {
const a = A(s);
const who = objectors.map((k) => nm(k)).join(', ');
const text = `${josa(who, '이/가')} 이의를 제기했어요. 이번에 고른 증강을 모두 없애고 다시 골라요`;
log(s, ctx, { type: 'augEffect', side: objectors[0]!, aug: 'objection', text: `이의있음! ${text}` });
addFx(s, { kind: 'objection', side: objectors[0]!, aug: 'objection', text });
const next: AugSelect = { no: sel.no, tier: sel.tier, offers: {}, left: {}, picks: [], ...(sel.ordered ? { ordered: sel.ordered } : {}) };
for (const x of liveSides(s)) {
const key = String(x.id);
a.delivery[key] = [...(sel.ordered?.[key] ?? [])];
const offers = genOffers(s, x.id, sel.tier, ctx.rng, ['objection']);
a.delivery[key] = [];
if (!offers.length) continue;
next.offers[key] = offers;
next.left[key] = s.options.augChaos ? 2 : 1;
}
if (!Object.keys(next.offers).length) return false;
a.select = next;
s.phase = 'aug';
return true;
}
/** Random empty node (no pieces, no objects), never 참먹이. */
function randomEmptyNode(s: YutState, rng: Rng, avoid: NodeId[] = []): NodeId | null {
const a = A(s);

View File

@@ -83,7 +83,7 @@ const L: Omit<AugInfo, 'id'>[] = [
{ name: '언제부터 착각한 거지?', tier: 'any', kind: 'instant', text: '다른 사람의 증강 하나를 3라운드 동안 고양이로 바꿔요.', note: '이미 다 쓴 증강은 고를 수 없어요.' },
{ name: '윷을 잘 던져봐', tier: 'any', kind: 'active', once: true, text: '윷을 던져 한 사람을 맞혀요. 맞은 사람은 차례를 두 번 건너뛰어요.' },
{ name: '이도류', tier: 'any', kind: 'passive', text: '윷가락을 2개씩 두 번 던져서 결과를 두 개 받아요. 모(둘 다 등)는 도로 바뀌어요.', note: '도·개·빽도만 나와서 한 번 더 던지는 일은 없어요.' },
{ name: '이의있음!', tier: 'any', kind: 'instant', text: '이번 증강 선택을 없던 걸로 하고 새 후보 중에서 다시 골라요.' },
{ name: '이의있음!', tier: 'any', kind: 'instant', text: '이번 증강 선택을 없던 걸로 해요. 모두 고르고 나면 모두가 고른 증강이 사라지고, 모두 새 후보 중에서 다시 골라요.', note: '다시 고를 때는 이의있음!이 나오지 않아요.' },
{ name: '자진모리 장단', tier: 'any', kind: 'passive', text: '걸이 두 번 나올 때마다 개를 하나 더 받아요.' },
{ name: '천마군림보 - 달걸음', tier: 'any', kind: 'passive', text: '내 말은 모두 반대 방향(시계 방향)으로 돌아요.', note: '참먹이에서 날윷 쪽으로 출발하고, 찌모·뒷모·방에 멈추면 지름길로 꺾어요.' },
{ name: '천상의 보호막', tier: 'any', kind: 'active', once: true, text: '내 말뭉치 하나에 보호막을 씌워요. 보호막은 잡힐 때 한 번 막아 줘요.', note: '막아 낸 말은 그 자리에 그대로 남아요.' },