새 게임 사건 파일: 직접 지은 협력 추리 게임(1~5명). 정해진 날짜·시간 안에 단서를 골라 읽고(이동 시간·야근·돋보기·조언), 마지막에 객관식 수사 보고서로 점수와 등급(S/A/B/미해결)
- 엔진 packages/games/src/case-file/(types·index·cases): 의뢰→수사→보고서→결과, 함께 풀기(반장 돌아가며/투표/아무나)·따로 겨루기, 시간·야근·피로, 열림 규칙(OR)·깊이 보기로 열림, 아침 소식, 조언 감점, 남은 시간 보너스, 한 사람만 읽기, 팀 답 다수결·동점 처리, 시간 초과·자리 비움·나가기 - 사건 3개(c1·c2·c3)를 docs/games/case-file-cases.md 글 그대로 cases/<id>.ts로 옮김(서버 전용). 웹은 types 모듈(라벨·스키마)만 가져오고, view에는 읽은 단서 본문만 나감 - 옵션: 문서 §2 전부(사건·모드·결정 방식·하루 시간·야근·돋보기·조언·남은 시간 보너스·아침 소식·읽기 모드·고르기/보고서/전체 제한 시간). kidSafeChat은 방 채팅을 그대로 쓰므로 방 설정의 채팅 필터로 대신(문서 구현 메모) - 컴퓨터 상대 없음(문서 §8.7, BOT_GAMES에 넣지 않음) - 웹 apps/web/src/games/case-file/: 수사 막대(날짜·시각·돋보기·조언·피로·반장·타이머), 탭 [단서·보고서·결과] [기록] [자료] [메모], 종이 서류 본문 카드(16px 이상), 지도, 장소별 단서 카드(이동+시간·🔍·야근·추천), 두 번 눌러 확정, 투표, 보고서, 등급 도장·문제별 답·풀이·놓친 단서, 30초 요약·도움말 - 등록: GAMES·CATALOG·GAME_UI·GAME_ICON·여럿이 파티 탭, @bg/games/case-file/types 내보내기, docs/games/README.md, e2e/games.e2e.ts - 테스트: 사건 데이터 검사(id·여는 조건·도달·이동표·문제·점수표·고운 말·빠듯한 길을 실제 엔진으로 따라가 해결), 규칙 30여 개(문서 §10), 무작위 판(1~5명·옵션 7조합) 비밀 유출·JSON 왕복·결정성, onTimeout 합법, 방 통합(의뢰·반장·보고서·따로 겨루기 시계), 웹 빌드 결과물에 사건 본문·정답·풀이가 없는지 검사(no-case-text.test.ts), E2E(PC+휴대폰, 한 사람만 읽기 비밀·깊이 보기·하루 마치기·보고서·결과, 320px 가로 넘침 없음) - 문서: case-file.md 구현 메모, case-file-cases.md c2 빠듯한 길 수정(원래 길은 열림 조건상 갈 수 없었음) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1192,6 +1192,94 @@ async function magicalStep(p: Page, phone: boolean, st: { picks: number; selects
|
||||
}
|
||||
|
||||
const PLANS: Record<string, Plan> = {
|
||||
'case-file': {
|
||||
// PC host + phone guest, "고른 사람만 읽기": 의뢰 → 반장 돌기(두 번 눌러 고르기) → 단서 읽기(다른 사람은 제목만)
|
||||
// → 깊이 보기 → 하루 마치기 → 보고서 → 결과(정답·놓친 단서). Phone screenshots at 390 and 320 px.
|
||||
players: 2,
|
||||
lobby: async (host) => {
|
||||
await host.getByRole('group', { name: '단서 글 읽기' }).getByRole('button', { name: '고른 사람만 읽기' }).click();
|
||||
await host.getByText('한 사람만 읽기').first().waitFor();
|
||||
},
|
||||
drive: async (pages) => {
|
||||
const [host, guest] = pages as [Page, Page];
|
||||
const status = (p: Page) => p.locator('.turn-status').innerText();
|
||||
const twice = async (p: Page, name: string | RegExp) => {
|
||||
await p.getByRole('button', { name }).first().click();
|
||||
await p.getByRole('button', { name: '정말 이걸로 해요' }).first().click();
|
||||
};
|
||||
for (const p of pages) await p.getByRole('button', { name: /수사 시작/ }).click();
|
||||
await host.getByRole('tab', { name: '단서' }).waitFor();
|
||||
const captain = async () => {
|
||||
for (let t = 0; t < 100; t++) {
|
||||
for (const p of pages) if ((await status(p)).includes('내가 반장이에요')) return p;
|
||||
await host.waitForTimeout(100);
|
||||
}
|
||||
throw new Error('nobody is captain');
|
||||
};
|
||||
let reads = 0;
|
||||
let deep = false;
|
||||
let readerChecked = false;
|
||||
for (let round = 0; round < 4; round++) {
|
||||
const cap = await captain();
|
||||
const other = cap === host ? guest : host;
|
||||
if (!deep && (await cap.getByRole('button', { name: /깊이 보기\(돋보기/ }).count())) {
|
||||
await cap.getByRole('button', { name: /깊이 보기\(돋보기/ }).click();
|
||||
await cap.getByRole('button', { name: '정말 이걸로 해요' }).click();
|
||||
await cap.locator('.cf-deep').first().waitFor();
|
||||
deep = true;
|
||||
}
|
||||
if (round === 0) await other.getByRole('button', { name: '👍 추천' }).first().click();
|
||||
await twice(cap, '고르기');
|
||||
reads++;
|
||||
await host.getByRole('tab', { name: `기록 ${reads}` }).waitFor();
|
||||
if (!readerChecked) {
|
||||
await other.getByText(/님이 읽고 있어요/).first().waitFor();
|
||||
await cap.locator('.cf-paper .cf-doc').first().waitFor();
|
||||
readerChecked = true;
|
||||
}
|
||||
}
|
||||
await host.screenshot({ path: join(SHOTS, 'case-file-leads-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-leads-phone.png'), fullPage: true });
|
||||
await guest.setViewportSize({ width: 320, height: 700 });
|
||||
await guest.waitForTimeout(200);
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-leads-phone320.png'), fullPage: true });
|
||||
const overflow = await guest.evaluate(() => document.documentElement.scrollWidth > window.innerWidth + 1);
|
||||
if (overflow) throw new Error('page overflows horizontally at 320px');
|
||||
await guest.getByRole('tab', { name: /기록/ }).click();
|
||||
await guest.locator('.cf-log button.cf-row').first().click();
|
||||
await guest.getByRole('dialog').locator('.cf-paper').waitFor();
|
||||
await guest.waitForTimeout(600);
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-reading-phone320.png') });
|
||||
await guest.getByRole('button', { name: '닫기' }).last().click();
|
||||
await guest.getByRole('tab', { name: '단서' }).click();
|
||||
let cap = await captain();
|
||||
await twice(cap, /하루 마치기/);
|
||||
await host.getByText(/2일째 09:00/).first().waitFor();
|
||||
cap = await captain();
|
||||
await twice(cap, '📝 보고서 쓰기');
|
||||
for (const p of pages) {
|
||||
await p.getByRole('button', { name: '📝 보고서 내기' }).waitFor();
|
||||
const groups = p.locator('.cf-choices');
|
||||
const n = await groups.count();
|
||||
for (let i = 0; i < n; i++) await groups.nth(i).getByRole('button').first().click();
|
||||
}
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-report-phone320.png'), fullPage: true });
|
||||
for (const p of pages) {
|
||||
await p.getByRole('button', { name: '📝 보고서 내기' }).click();
|
||||
await p.getByRole('button', { name: /정말 낼까요/ }).click();
|
||||
}
|
||||
await host.getByRole('dialog', { name: '게임 결과' }).waitFor();
|
||||
await host.screenshot({ path: join(SHOTS, 'case-file-result-dialog-pc.png') });
|
||||
await host.keyboard.press('Escape');
|
||||
await guest.getByRole('dialog', { name: '게임 결과' }).waitFor();
|
||||
await guest.keyboard.press('Escape');
|
||||
await host.getByText('정답과 풀이').waitFor();
|
||||
await host.getByRole('button', { name: /놓친 단서 보기/ }).click();
|
||||
await host.screenshot({ path: join(SHOTS, 'case-file-result-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-result-phone320.png'), fullPage: true });
|
||||
console.log(` case-file: ${reads} leads read, deep look ${deep ? 'used' : 'not offered'}, reader mode secret checked`);
|
||||
},
|
||||
},
|
||||
blackjack: {
|
||||
// PC host + phone guest. Each hand: bet the minimum, stand (decline insurance), then press 다음 판, until the
|
||||
// session ends (10 hands). Smoke test only — the rules are covered by the engine tests.
|
||||
|
||||
Reference in New Issue
Block a user