증강 윷놀이: 이의있음! 재선택에서는 혼돈 모드 두 번째 후보에도 이의있음!이 안 나오게, 증강 팝업이 위아래 공간이 모자라도 화면 안에 들어오게

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-08 02:32:05 +09:00
parent 7084a20e59
commit c2ce1979b2
4 changed files with 50 additions and 4 deletions

View File

@@ -156,6 +156,27 @@ describe('증강 윷놀이: options and selection', () => {
expect(t.aug!.delivery['1']).toEqual([]);
});
test('이의있음! happens once per selection: the redo never offers it, 혼돈 mode\'s second offers included', () => {
const on: AugId[] = ['cat', 'shield', 'objection'];
const augOff = AUG_IDS.filter((id) => !on.includes(id));
const s = yut.setup({ players: ['A', 'B'], options: yut.optionsSchema.parse({ augmented: true, augChaos: true, augOff }), rng: SeededRng.fromSeed(seedN(2)), now: 0 });
s.aug!.select!.offers = { '0': ['objection', 'cat', 'shield'], '1': ['cat', 'shield'] };
let t = act(s, 'A', { type: 'AUG_PICK', aug: 'objection' });
t = act(t, 'B', { type: 'AUG_PICK', aug: 'cat' });
t = act(t, 'B', { type: 'AUG_PICK', aug: t.aug!.select!.offers['1']![0]! });
expect(t.aug!.select!.redo).toBe(true);
for (const who of ['A', 'B']) {
const key = who === 'A' ? '0' : '1';
expect(t.aug!.select!.offers[key]).not.toContain('objection');
t = act(t, who, { type: 'AUG_PICK', aug: t.aug!.select!.offers[key]![0]! });
expect(t.aug!.select!.offers[key]).not.toContain('objection');
t = act(t, who, { type: 'AUG_PICK', aug: t.aug!.select!.offers[key]![0]! });
}
expect(t.aug!.select).toBeNull();
expect(t.log.filter((e) => e.type === 'augEffect' && (e as { aug?: string }).aug === 'objection')).toHaveLength(1);
expect(t.aug!.sides.map((x) => x.augs.map((o) => o.id).sort())).toEqual([['cat', 'shield'], ['cat', 'shield']]);
});
test('간택: a 고양이 among the offers must be taken', () => {
const s = make(2);
give(s, 1, 'chosen');

View File

@@ -134,6 +134,8 @@ export interface AugSelect {
picks: { side: SideId; id: AugId; target?: AugId }[];
/** 배달 orders this selection was made with, so an 이의있음! redo offers them again. */
ordered?: Record<string, AugId[]>;
/** This is the 이의있음! redo: 이의있음! is never offered again (혼돈 mode's second offers included). */
redo?: boolean;
}
/** Something the screen should show once (popup / animation); `no` increases. */
@@ -1348,7 +1350,8 @@ function applyPick(s: YutState, ctx: Ctx, side: SideId, act: AugPick): void {
} else {
sel.picks.push({ side, id: act.aug, ...(act.target ? { target: act.target } : {}) });
sel.left[key]! -= 1;
sel.offers[key] = sel.left[key]! > 0 ? genOffers(s, side, sel.tier, ctx.rng, sel.picks.filter((p) => p.side === side).map((p) => p.id)) : [];
const mine = sel.picks.filter((p) => p.side === side).map((p) => p.id);
sel.offers[key] = sel.left[key]! > 0 ? genOffers(s, side, sel.tier, ctx.rng, sel.redo ? ['objection', ...mine] : mine) : [];
if (!sel.offers[key]!.length) sel.left[key] = 0;
}
if (Object.values(sel.left).every((n) => n <= 0)) resolveSelection(s, ctx);
@@ -1391,7 +1394,7 @@ function redoSelection(s: YutState, ctx: Ctx, sel: AugSelect, objectors: SideId[
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 } : {}) };
const next: AugSelect = { no: sel.no, tier: sel.tier, offers: {}, left: {}, picks: [], redo: true, ...(sel.ordered ? { ordered: sel.ordered } : {}) };
for (const x of liveSides(s)) {
const key = String(x.id);
a.delivery[key] = [...(sel.ordered?.[key] ?? [])];