diff --git a/app/game-engine/src/turn/incomeHandler.ts b/app/game-engine/src/turn/incomeHandler.ts index e014884e..fe3252fd 100644 --- a/app/game-engine/src/turn/incomeHandler.ts +++ b/app/game-engine/src/turn/incomeHandler.ts @@ -174,7 +174,10 @@ const processIncomeForNation = ( world.updateNation(nation.id, { rice: next, meta: nextMeta }); } - const incomeText = incomeValue.toLocaleString(); + // Ref keeps the fractional pre-flush value for the payout ratio and + // prev_income_* metadata, but number_format() rounds the user-facing log + // to the same integer precision as the persisted resource column. + const incomeText = Math.round(incomeValue).toLocaleString('en-US'); const incomeLog = type === 'gold' ? `이번 수입은 금 ${incomeText}입니다.` : `이번 수입은 쌀 ${incomeText}입니다.`; for (const general of nationGenerals) { diff --git a/app/game-engine/test/monthlyCoreEventAction.test.ts b/app/game-engine/test/monthlyCoreEventAction.test.ts index 2e65f899..0b1532db 100644 --- a/app/game-engine/test/monthlyCoreEventAction.test.ts +++ b/app/game-engine/test/monthlyCoreEventAction.test.ts @@ -373,6 +373,13 @@ describe('core monthly event actions at the real month boundary', () => { await world.advanceMonth(new Date('0191-01-01T00:00:00.000Z')); expect(world.getNationById(1)?.meta.prev_income_gold).toBe(157.5); + expect(world.peekDirtyState().logs).toContainEqual( + expect.objectContaining({ + generalId: 1, + text: '이번 수입은 금 158입니다.', + }) + ); + expect(world.peekDirtyState().logs.map((entry) => entry.text).join('\n')).not.toContain('157.5'); }); it('uses the Ref default nation resource floors when scenario const omits them', async () => { diff --git a/app/game-frontend/e2e/legacyLogHtml.spec.ts b/app/game-frontend/e2e/legacyLogHtml.spec.ts index 66f73ea5..e1e1efee 100644 --- a/app/game-frontend/e2e/legacyLogHtml.spec.ts +++ b/app/game-frontend/e2e/legacyLogHtml.spec.ts @@ -23,6 +23,10 @@ const history = [ '강조' + '오염 이름', }, + { + id: 3, + text: '이번 수입은 금 158입니다.', + }, ]; const publicResponse = (operation: string): unknown => { @@ -59,10 +63,12 @@ for (const viewport of [ await page.goto('public'); const lines = page.locator('.recent-log-line'); - await expect(lines).toHaveCount(2); + await expect(lines).toHaveCount(3); await expect(lines.nth(0).locator('b')).toHaveText('안전 강조'); await expect(lines.nth(1).locator('.small_war_log .war_type_attack')).toHaveText('→'); await expect(lines.nth(1).locator('.ev_highlight')).toHaveText('강조'); + await expect(lines.nth(2)).toHaveText('이번 수입은 금 158입니다.'); + await expect(lines.nth(2)).not.toContainText('157.5'); await expect(lines.locator('script, img, svg, a, [onerror], [onclick], [style*="url"]')).toHaveCount(0); await expect(lines.nth(0)).toContainText('