규약 세부화(유형D·13석 표결·툴팁) + 밸런스 피드백 5건 반영

같은 날 두 차례 플레이테스트에서 나온 이슈를 이어서 처리했다.

**의회 세부화**
- 유형 D(이득 규약) 5종 신설 — 토큰 지급/게이지 완화/지출 가산 완화/
  주목도 한도 증가/실적 요구치 하향. 내부 명분("강제 상정")이 여태 불리한
  유형 A만 올릴 수 있어 실속 없던 문제를 해결 — 상정 풀에 D가 포함되는 게
  내부 명분이 존재하는 이유
- 13석 표결을 실제 표 수로 구현(tallyVotes, 최대잔여법 + 결정적 해시).
  혼합 명분이 "직접 통과 지정" 자리표시자에서 §7.3 스펙대로 실제 1표
  이동으로 교체 — 동점은 스윙 전 득표가 많던 쪽이 이겨 1표 차에서만 뒤집힘.
  의회 화면에 후보별 예상 득표·표 차·뒤집기 가능 여부를 미리 노출
- 공보 축 오염 선택지 1→7개로 보강(서사 기준 6개 재배정), 축 분포 균형화

**툴팁 신설 (InfoTooltip·ProtocolChip)**
- 규약·징벌·명분을 클릭하면 정확히 무엇이 막혔는지 설명이 뜬다. 문구는
  UI가 추측하지 않고 council.js의 protocolEffectDetail·justificationDetail이
  카탈로그에서 생성. 모바일 대상이라 hover가 아닌 클릭으로 연다

**크리티컬 버그: 주목도 미초기화**
- 라운드 종료 후 한도 판정에 총 주목도(이월 포함)를 쓰고 있어, 2라운드가
  시작하자마자 이미 한도를 넘어 버스트가 무한 반복되고 있었다. 한도 판정은
  "이번 라운드에 받은 카드"만 세도록 분리(roundAttention), 게이지·토큰
  가산은 기존대로 총계(이월 포함) 기준 유지

**밸런스 피드백 5건**
- 결재 카드가 고정으로 보인다는 지적 → 실제 버그였다. cardIndex를 그냥
  +1씩 돌려 CSV 순서 그대로 결정론적으로 반복되고 있었다. Fisher–Yates
  셔플 큐로 교체(큐 소진 시 재셔플)
- 위협 축도 거의 안 나온다 → 위 셔플 버그가 원인의 상당 부분. 명백한
  오배정 1건도 발견해 수정(id11 "군사 개입 지시": 고대 신 소환 저지가
  인사 축으로 잘못 들어가 있었음 → 위협 축)
- 게이지 상승이 너무 낮음 → 등급 합계(주목도) 단독 기준이 실제 카드
  등급 분포(대부분 1~4급)와 맞지 않아 3~4장을 쌓아도 최하 구간을 못
  벗어났다. 카드 장수를 1차 기준으로 되돌리고 등급 배율(평균등급/5)을
  곱하는 방식으로 재설계 — 3~4장 구간에서 6배 점프(0.5%→3.0%)
- 좌우 모두 오염 없는 완전 무행동 카드 1건(id15) 수정 — 좌측에 대외/6급
  부여(기존 tag_corruption과 정합)
- 오염 카드 한쪽만 있어 안전 선택 메리트가 없다는 지적은 카드 데이터가
  아니라 게이지 곡선 문제로 판단, 위 재설계로 해결(카드 재배분 안 함)

**문서**
- 결정 노트 2건: 2026-09-17-주목도-라운드-분리,
  2026-09-17-게이지상승-장수기준-복원(기각한 대안 포함)
- 기획서 §4.2-A/B, §7.3, §9.2, §17 갱신. DEVLOG 2건 기록

Playwright로 전 구간 검증: 셔플(3회 재접속 시 다른 카드, 15연속 무반복),
게이지 상승률 표시, 13석 표결 예상치, 규약/명분 툴팁, 2라운드 진입 시
주목도 0으로 리셋 확인. 콘솔 에러 0건, 빌드 클린.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
kyoung5seo
2026-09-17 23:00:42 +09:00
co-authored by Claude Sonnet 5
parent 0a065068c1
commit 6398599199
18 changed files with 1113 additions and 214 deletions
+67 -23
View File
@@ -5,17 +5,19 @@ import DeskBar from './DeskBar';
import CoreSwipeCard from './CoreSwipeCard';
import CombinePanel from './CombinePanel';
import HandGuidePopup from './HandGuidePopup';
import ProtocolChip from './ProtocolChip';
import ShopScreen from './ShopScreen';
import CouncilScreen from './CouncilScreen';
import { pickPollutionEntry } from '../engine/pollutionPool';
import {
makeDeskCard, applyPassiveGaugeRise, addToDesk, removeFromDesk, tokenSurcharge,
totalAttention, roundAttentionCap,
roundAttention, roundAttentionCap,
} from '../engine/desk';
import { rollShopDisplay, purgePrice, REROLL_COST } from '../engine/shop';
import {
requiredScore, settleScore, rollProtocolCandidates, resolveProtocolVote, rollPenalty,
applyInterventions, penaltyGaugeSurcharge, penaltyTokenSurcharge,
applyInterventions, gaugeSurchargeOf, tokenSurchargeOf, attentionCapBonusOf,
requiredScoreDeltaOf, grantTokenOf, tallyVotes, applyVoteSwing, COUNCIL_SEATS,
} from '../engine/council';
import './CoreGameScreen.css';
@@ -57,13 +59,27 @@ const buildCard = (row) => ({
const INITIAL_GAUGES = { entropy: 0, resistance: 0, panic: 0, risk: 0 };
// 2026-09-17 피드백: 결재 카드가 "고정으로 등장하는 것 같다"는 지적 — 실제로 버그였다.
// 예전엔 cardIndex를 그냥 +1씩 돌려서 CSV 파일 순서 그대로, 매 실행마다 똑같은 순서로
// 반복됐다(진짜 무작위가 아니라 결정론적 순환). Fisher–Yates로 섞은 뒤 앞에서부터 뽑고,
// 큐가 비면 다시 섞어 채운다 — 한 바퀴 안에서는 같은 카드가 두 번 나오지 않으면서도
// 실행할 때마다, 그리고 한 바퀴가 끝날 때마다 순서가 달라진다.
const shuffle = (arr) => {
const a = [...arr];
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
};
export default function CoreGameScreen() {
const deck = useMemo(() => {
const parsed = Papa.parse(cardsCsvRaw, { header: true, skipEmptyLines: true });
return parsed.data.map(buildCard);
}, []);
const [cardIndex, setCardIndex] = useState(0);
const [drawQueue, setDrawQueue] = useState(() => shuffle(deck));
const [deskCards, setDeskCards] = useState([]);
const [gauges, setGauges] = useState(INITIAL_GAUGES);
const [tokens, setTokens] = useState(INITIAL_TOKENS);
@@ -88,13 +104,22 @@ export default function CoreGameScreen() {
const pushLog = (msg) => setLog((prev) => [msg, ...prev].slice(0, 6));
const activeProtocols = activeProtocol ? [activeProtocol] : [];
const gaugeExtraFlat = penaltyGaugeSurcharge(penalties);
const tokenExtraFlat = penaltyTokenSurcharge(penalties);
// 징벌(유형 C)과 활성 규약(유형 A/D)이 같은 수치를 건드리므로 합쳐서 합산한다.
// 이득 규약이면 음수라 페널티가 상쇄된다.
const effectiveProtocols = [...penalties, ...activeProtocols];
const gaugeExtraFlat = gaugeSurchargeOf(effectiveProtocols);
const tokenExtraFlat = tokenSurchargeOf(effectiveProtocols);
const surcharge = tokenSurcharge(deskCards, tokenExtraFlat);
const justificationTotal = Object.values(justifications).reduce((a, b) => a + b, 0);
const attentionCap = roundAttentionCap(round);
const attentionCap = roundAttentionCap(round, attentionCapBonusOf(activeProtocols));
const currentCard = deck.length > 0 ? deck[cardIndex % deck.length] : null;
const currentCard = drawQueue[0] || null;
const advanceCard = () => {
setDrawQueue((prev) => {
const rest = prev.slice(1);
return rest.length > 0 ? rest : shuffle(deck);
});
};
const checkGameOver = (nextGauges) => {
const hit = Object.entries(nextGauges).find(([, v]) => v >= 100);
@@ -131,7 +156,7 @@ export default function CoreGameScreen() {
if (side.axis) {
const grade = side.grade || 1;
const entry = pickPollutionEntry(side.axis, grade);
const newCard = makeDeskCard(side.axis, grade, entry || {});
const newCard = makeDeskCard(side.axis, grade, entry || {}, round);
nextDesk = addToDesk(deskCards, [newCard]);
setDeskCards(nextDesk);
pushLog(`『${side.text}』 결재됨 → 오염 서류 『${entry?.name || '미상'}』(등급 ${grade}) 접수`);
@@ -139,12 +164,14 @@ export default function CoreGameScreen() {
pushLog(`『${side.text}』 결재됨 — 오염 없음`);
}
setCardIndex((i) => (i + 1) % deck.length);
advanceCard();
if (checkGameOver(nextGauges)) return;
// §4.2-B: 이번 라운드 한도를 넘기면 합본 기회 없이 그 즉시 강제 종료된다. 카드는 이월(§4.1).
if (totalAttention(nextDesk) > attentionCap) {
// 이월 카드는 한도 판정에서 빠진다(roundAttention) — 안 그러면 다음 라운드가 시작하자마자
// 버스트가 반복된다.
if (roundAttention(nextDesk, round) > attentionCap) {
pushLog(`주목도 초과(한도 ${attentionCap}) — 라운드 강제 종료, 합본 기회 없이 정산으로 이동`);
goToShop();
return;
@@ -154,7 +181,7 @@ export default function CoreGameScreen() {
/** 플레이어가 한도 밑에서 스스로 라운드를 끝내는 "정산하기" — 블랙잭의 스탠드. */
const handleEndRound = () => {
if (phase !== 'approval') return;
pushLog(`제${round}라운드 자율 종료(정산하기) — 주목도 ${totalAttention(deskCards)}/${attentionCap}`);
pushLog(`제${round}라운드 자율 종료(정산하기) — 주목도 ${roundAttention(deskCards, round)}/${attentionCap}`);
goToShop();
};
@@ -201,10 +228,11 @@ export default function CoreGameScreen() {
/* ── 의회 (§9) ── */
const handleCouncilResolve = ({ tokensPaid, justificationsPaidCount, interventions }) => {
const { candidates: remainingCandidates, forcedWinnerId, deferred, penaltyIdToClear } =
const { candidates: remainingCandidates, voteSwingTargetId, deferred, penaltyIdToClear } =
applyInterventions(councilCandidates, interventions);
const finalRequired = requiredScore(round);
// 이번 라운드 내내 적용 중이던 규약이 실적 요구치를 낮췄을 수 있다 (유형 D).
const finalRequired = Math.max(0, requiredScore(round) + requiredScoreDeltaOf(activeProtocols));
// §9.3: 실적 점수 = Σ(이번 라운드 족보 점수) + 토큰 납입×5 + 명분 납입×20.
const finalScore = settleScore({
combineScore: roundScore, tokensPaid, justificationsPaid: justificationsPaidCount,
@@ -241,12 +269,20 @@ export default function CoreGameScreen() {
pushLog(`절차 명분으로 『${deferred.map((d) => d.name).join(', ')}』 다음 라운드 이월`);
}
const winner = forcedWinnerId
? remainingCandidates.find((c) => c.id === forcedWinnerId) || null
: resolveProtocolVote(remainingCandidates);
// §9.2 13석 표결. 혼합 명분은 1표만 움직이므로 1표 차 승부에서만 결과가 뒤집힌다 (§7.3).
const tallied = applyVoteSwing(tallyVotes(remainingCandidates), voteSwingTargetId);
const winner = resolveProtocolVote(tallied);
setActiveProtocol(winner);
if (winner) pushLog(`규약 통과: 『${winner.name}』 — 다음 라운드 적용`);
else pushLog('통과된 규약 없음 — 다음 라운드는 제약 없이 진행됩니다.');
if (winner) {
pushLog(`규약 통과: 『${winner.name}』 ${winner.votes}/${COUNCIL_SEATS}표 — 다음 라운드 적용`);
const grant = grantTokenOf(winner);
if (grant > 0) {
setTokens((prev) => prev + grant);
pushLog(`이득 규약 『${winner.name}』 — 토큰 +${grant} 즉시 지급`);
}
} else {
pushLog('통과된 규약 없음 — 다음 라운드는 제약 없이 진행됩니다.');
}
setRound((r) => r + 1);
setRoundScore(0);
@@ -277,11 +313,10 @@ export default function CoreGameScreen() {
deskCards={deskCards}
gauges={gauges}
tokens={tokens}
round={round}
attentionCap={attentionCap}
onOpenCombine={() => setShowCombine(true)}
onOpenGuide={() => setShowGuide(true)}
onEndRound={handleEndRound}
canEndRound={phase === 'approval'}
gaugeExtraFlat={gaugeExtraFlat}
tokenExtraFlat={tokenExtraFlat}
/>
@@ -290,11 +325,19 @@ export default function CoreGameScreen() {
<span>제{round}라운드</span>
<span>실적 {score} (이번 라운드 {roundScore})</span>
<span>명분 {justificationTotal}개</span>
{penalties.length > 0 && <span className="core-status-penalty">⚠ 징벌 {penalties.length}</span>}
{activeProtocol && <span className="core-status-protocol">⚖ {activeProtocol.name}</span>}
{activeProtocol && <ProtocolChip protocol={activeProtocol} prefix="⚖ " />}
{penalties.map((p) => <ProtocolChip key={p.id} protocol={p} prefix="⚠ " />)}
</div>
{phase === 'approval' && <CoreSwipeCard card={currentCard} onSwipe={handleSwipe} />}
{phase === 'approval' && (
<CoreSwipeCard
card={currentCard}
onSwipe={handleSwipe}
onEndRound={handleEndRound}
roundAttention={roundAttention(deskCards, round)}
attentionCap={attentionCap}
/>
)}
{phase === 'shop' && (
<ShopScreen
@@ -316,6 +359,7 @@ export default function CoreGameScreen() {
justifications={justifications}
penalties={penalties}
candidates={councilCandidates}
requiredDelta={requiredScoreDeltaOf(activeProtocols)}
onResolve={handleCouncilResolve}
/>
)}