증강 윷놀이: 거머리·네크로맨서 연결도 그 증강이 고양이인 동안 멈춤(승리·탈락·기권 전파), 풀리면 다시 작동

- activeLink: 연결을 만든 증강이 살아 있을 때만 전파(win, eliminate, 기권)
- 사람 카드에 멈춘 연결은 "(멈춤)" 표시
- 회귀 테스트 4개(멈춤, 만료 후 복원, 사슬 중간에서 끊김, 네크로맨서)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-19 23:00:17 +09:00
parent 049d910dc6
commit 9ba93e9576
4 changed files with 90 additions and 10 deletions

View File

@@ -88,7 +88,7 @@ export function AugSlots({ v, side }: { v: YutView; side: number }) {
if (s.skip) info.push(`건너뛰기 ${s.skip}번`);
if (s.hp !== null) info.push(`체력 ${'❤'.repeat(Math.max(0, s.hp))}${s.hp <= 0 ? '0' : ''}`);
if (s.queenLives !== null) info.push(`👑 목숨 ${s.queenLives}`);
for (const l of s.links) info.push(`${l.by === 'leech' ? '🩸 거머리' : '💀 네크로'} → ${augSideName(l.to)}`);
for (const l of s.links) info.push(`${l.by === 'leech' ? '🩸 거머리' : '💀 네크로'} → ${augSideName(l.to)}${l.on ? '' : ' (멈춤)'}`);
return (
<>
{info.length > 0 && <div className="small muted" style={{ marginTop: 6 }}>{info.join(' · ')}</div>}

View File

@@ -25,7 +25,7 @@
- 잡으면 한 번 더 던지기는 보통 이동·특수 말 이동만. 증강 효과로 잡은 것(트럭·합체·바둑 등)은 한 번 더 던지지 않는다(바둑은 잡은 수만큼 던진다).
- **차례 소모**(8톤 트럭·3단 합체·알까기): 그 차례 첫 던지기 전에만 쓰고, 쓰면 차례가 끝난다.
- 1회 증강은 쓰면 칸에 "사용함" 도장(✔). 명탐정에 걸린 증강은 줄이 그어진다. 언제부터 착각한 거지?에 걸리면 🐱(효과·버튼·승리 조건 모두 꺼짐). 과유불급의 윷가락 +2, 변환으로 만든 특수 말의 능력(선봉장 +1칸, 도깨비·포 이동, 폰 전진)도 그동안 멈췄다가 풀리면 돌아온다.
- 거머리·네크로맨서 연결은 이어진다: A→B→C에서 C가 이기면 B와 A도 같은 순위.
- 거머리·네크로맨서 연결은 이어진다: A→B→C에서 C가 이기면 B와 A도 같은 순위. 연결을 만든 증강이 고양이인 동안에는 그 연결이 멈춘다(승리·탈락·기권 모두 넘어가지 않음, 사람 카드에 "멈춤"). 연결은 지워지지 않고 고양이가 풀리면 다시 작동한다. 중간 사람의 연결이 멈춰 있으면 사슬도 거기서 끊긴다.
- 안개 속에서는 숨은 말 때문에 생기는 선택지(자리 바꾸기·바둑 대상, 포가 넘는 칸)도 화면에 나오지 않는다.
- 취~소 뒤에는 모든 승리 조건 증강이 꺼진다(중전마마·김첨지 등의 말은 남고 승리만 없음).

View File

@@ -566,9 +566,9 @@ describe('증강 윷놀이: review regressions', () => {
test('거머리 chains: A → B → C, C wins → B and A share the rank', () => {
const s = make(4, { ranking: 'all' });
s.aug!.sides[0]!.links.push({ to: 1, loss: true, by: 'leech' });
s.aug!.sides[1]!.links.push({ to: 2, loss: true, by: 'leech' });
s.aug!.sides[2]!.links.push({ to: 0, loss: true, by: 'leech' }); // a loop must not hang
leech(s, 0, 1);
leech(s, 1, 2);
leech(s, 2, 0); // a loop must not hang
for (const p of s.sides[2]!.pieces) Object.assign(p, { status: 'done', node: null, trail: [] });
put(s, 2, 0, 19);
Object.assign(s, { turnSide: 2, current: 'C' });
@@ -594,6 +594,77 @@ describe('증강 윷놀이: review regressions', () => {
expect(u.sides[0]!.out).toBe(true);
});
/** A (side 0) holds 거머리 tied to `to`; `cat`: the 거머리 is a 고양이 for 3 rounds. */
const leech = (s: YutState, from: number, to: number, cat = false) => {
s.aug!.sides[from]!.augs.push({ uid: 900 + from, id: 'leech', ...(cat ? { catUntil: s.aug!.round + 3 } : {}) });
s.aug!.sides[from]!.links.push({ to, loss: true, by: 'leech' });
};
/** Side `side` finishes its last piece now (ranking = all keeps the game going). */
const finish = (s: YutState, side: number) => {
for (const p of s.sides[side]!.pieces) Object.assign(p, { status: 'done', node: null, trail: [] });
put(s, side, 0, 19);
Object.assign(s, { turnSide: side, current: PLAYERS[side]! });
moving(s, ['gae']);
return act(s, PLAYERS[side]!, { type: 'MOVE', throwIndex: 0, from: 19 });
};
/** Side `side` goes out by 과유불급 (six 배). */
const bust = (s: YutState, side: number) => {
give(s, side, 'excess');
Object.assign(s, { turnSide: side, current: PLAYERS[side]!, phase: 'throw', throwsOwed: 1, pending: [] });
return act(s, PLAYERS[side]!, { type: 'THROW' }, new Script([F, F, F, F, F, F]));
};
test('고양이가 된 거머리: the link pauses (no shared win, no shared loss, not on conceding either)', () => {
let s = make(4, { ranking: 'all' });
leech(s, 0, 1, true);
expect(yut.view(s, 'A').aug!.sides[0]!.links).toEqual([{ to: 1, by: 'leech', on: false }]);
let t = finish(s, 1);
expect(t.sides[1]!.finishedRank).toBe(1);
expect(t.sides[0]!.finishedRank).toBe(null);
s = make(4, { ranking: 'all' });
leech(s, 0, 1, true);
t = bust(s, 1);
expect(t.sides[1]!.out).toBe(true);
expect(t.sides[0]!.out).toBe(false);
s = make(4, { ranking: 'all' });
leech(s, 0, 1, true);
t = act(s, 'B', { type: 'CONCEDE' });
expect(t.sides[1]!.out).toBe(true);
expect(t.sides[0]!.out).toBe(false);
expect(t.aug!.sides[0]!.links).toHaveLength(1); // kept for later
});
test('when the 고양이 wears off the 거머리 link works again', () => {
let s = make(4, { ranking: 'all' });
leech(s, 0, 1, true);
s.aug!.round += 3;
expect(yut.view(s, 'A').aug!.sides[0]!.links[0]!.on).toBe(true);
let t = finish(s, 1);
expect(t.sides[0]!.finishedRank).toBe(1);
s = make(4, { ranking: 'all' });
leech(s, 0, 1, true);
s.aug!.round += 3;
t = bust(s, 1);
expect(t.sides[0]!.out).toBe(true);
});
test('A → B → C with B’s 거머리 as a 고양이: the chain stops at B (neither B nor A ranks with C)', () => {
const s = make(4, { ranking: 'all' });
leech(s, 0, 1);
leech(s, 1, 2, true);
const t = finish(s, 2);
expect(t.sides.map((x) => x.finishedRank)).toEqual([null, null, 1, null]);
});
test('네크로맨서 links follow the same rule', () => {
const s = make(4, { ranking: 'all' });
s.aug!.sides[0]!.augs.push({ uid: 950, id: 'necro', used: true, catUntil: s.aug!.round + 3 });
s.aug!.sides[0]!.links.push({ to: 1, loss: false, by: 'necro' });
expect(finish(structuredClone(s), 1).sides[0]!.finishedRank).toBe(null);
s.aug!.round += 3;
expect(finish(s, 1).sides[0]!.finishedRank).toBe(1);
});
test('a 고양이 also stops the special piece of a 변환 augment', () => {
const s = make(2);
give(s, 0, 'vanguard');

View File

@@ -209,7 +209,8 @@ export interface AugSideView {
ritual: number;
garlic: number;
queenLives: number | null;
links: { to: SideId; by: AugId }[];
/** `on`: false while the augment that made the link is a 고양이 (the link waits). */
links: { to: SideId; by: AugId; on: boolean }[];
reason: string | null;
bronze: boolean;
/** Waiting special pieces (they enter on their own, see the MOVE `piece` field). */
@@ -801,6 +802,14 @@ function killNodes(s: YutState, ctx: Ctx, killer: SideId | null, nodes: NodeId[]
return n;
}
/**
* A 거머리 / 네크로맨서 link only works while the augment that made it works (a 고양이 from 언제부터 착각한 거지?
* pauses it; the link stays and works again when the cat wears off).
*/
function activeLink(s: YutState, side: SideId, link: AugSide['links'][number]): boolean {
return !!hasAug(s, side, link.by);
}
function usedRanks(s: YutState): Set<number> {
return new Set(s.sides.map((x) => x.finishedRank).filter((r): r is number => r !== null));
}
@@ -827,7 +836,7 @@ function win(s: YutState, ctx: Ctx, side: SideId, reason: string, aug: AugId | n
while (queue.length) {
const winner = queue.shift()!;
for (const y of s.sides) {
const l = a.sides[y.id]!.links.find((k) => k.to === winner);
const l = a.sides[y.id]!.links.find((k) => k.to === winner && activeLink(s, y.id, k));
if (!l || !sideActive(y) || (a.winsOff && l.by !== 'leech')) continue;
y.finishedRank = rank;
a.sides[y.id]!.reason = AUGS[l.by].name;
@@ -853,7 +862,7 @@ function eliminate(s: YutState, ctx: Ctx, side: SideId, reason: string, aug: Aug
a.objs = a.objs.filter((o) => !(o.owner === side && (o.kind === 'mark' || o.kind === 'mine')));
log(s, ctx, { type: 'augOut', side, reason, ...(aug ? { aug } : {}) });
addFx(s, { kind: 'out', side, ...(aug ? { aug } : {}), text: `${nm(side)} 탈락 · ${reason}` });
for (const y of s.sides) if (a.sides[y.id]!.links.some((k) => k.to === side && k.loss)) eliminate(s, ctx, y.id, '거머리(같이 탈락)', 'leech');
for (const y of s.sides) if (a.sides[y.id]!.links.some((k) => k.to === side && k.loss && activeLink(s, y.id, k))) eliminate(s, ctx, y.id, '거머리(같이 탈락)', 'leech');
}
function gameOver(s: YutState): boolean {
@@ -2813,7 +2822,7 @@ function concedeAug(s: YutState, ctx: Ctx, actor: PlayerId): void {
x.outSeq = ++s.outCount;
a.sides[side]!.reason = '기권';
for (const p of x.pieces) if (p.status === 'board') clearPiece(p, 'home');
for (const y of s.sides) if (a.sides[y.id]!.links.some((k) => k.to === side && k.loss)) eliminate(s, ctx, y.id, '거머리(같이 탈락)', 'leech');
for (const y of s.sides) if (a.sides[y.id]!.links.some((k) => k.to === side && k.loss && activeLink(s, y.id, k))) eliminate(s, ctx, y.id, '거머리(같이 탈락)', 'leech');
if (checkEnd(s, ctx)) return;
// drop the side from a selection / prompt in progress
if (a.select) {
@@ -2973,7 +2982,7 @@ export function augView(s: YutState, viewer: PlayerId | null, base: YutView): Yu
ritual: as.ritual,
garlic: as.garlic,
queenLives: x.pieces.some((p) => p.kind === 'queen') ? as.queenLives : null,
links: as.links.map((l) => ({ to: l.to, by: l.by })),
links: as.links.map((l) => ({ to: l.to, by: l.by, on: activeLink(s, x.id, l) })),
reason: as.reason,
bronze: !!as.bronze,
homeSpecial: x.pieces.filter((p) => p.status === 'home' && p.kind).map((p) => ({ piece: p.id, kind: p.kind! })),