Normalize late campaign supply rewards
This commit is contained in:
@@ -1,7 +1,30 @@
|
|||||||
import { spawn } from 'node:child_process';
|
import { spawn } from 'node:child_process';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
import { chromium } from 'playwright';
|
import { chromium } from 'playwright';
|
||||||
|
|
||||||
const targetUrl = process.env.VERIFY_URL ?? 'http://localhost:5173/';
|
const targetUrl = process.env.VERIFY_URL ?? 'http://localhost:5173/';
|
||||||
|
const rewardDataFiles = ['src/game/data/battles.ts', 'src/game/scenes/CampScene.ts'];
|
||||||
|
|
||||||
|
function assertNoLegacyNumericRewardLabels() {
|
||||||
|
const legacyNumericRewardPattern = /itemRewards:\s*\[[^\]\r\n]*(["'])(쌀|금|군주)\s+\d+\1/u;
|
||||||
|
const failures = [];
|
||||||
|
|
||||||
|
for (const file of rewardDataFiles) {
|
||||||
|
const source = readFileSync(file, 'utf8');
|
||||||
|
const lines = source.split(/\r?\n/);
|
||||||
|
|
||||||
|
lines.forEach((line, index) => {
|
||||||
|
const match = legacyNumericRewardPattern.exec(line);
|
||||||
|
if (match) {
|
||||||
|
failures.push(`${file}:${index + 1} ${match[2]}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failures.length > 0) {
|
||||||
|
throw new Error(`Legacy numeric reward labels should use inventory names 콩/상처약/탁주: ${failures.join(', ')}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function unitUsesTexture(state, unitId, textureBase) {
|
function unitUsesTexture(state, unitId, textureBase) {
|
||||||
return state?.units?.some((unit) => unit.id === unitId && unit.textureBase === textureBase && unit.actionTexture === `${textureBase}-actions`);
|
return state?.units?.some((unit) => unit.id === unitId && unit.textureBase === textureBase && unit.actionTexture === `${textureBase}-actions`);
|
||||||
@@ -11,6 +34,8 @@ let serverProcess;
|
|||||||
let browser;
|
let browser;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
assertNoLegacyNumericRewardLabels();
|
||||||
|
|
||||||
serverProcess = await ensureLocalServer(targetUrl);
|
serverProcess = await ensureLocalServer(targetUrl);
|
||||||
|
|
||||||
browser = await chromium.launch({ headless: true });
|
browser = await chromium.launch({ headless: true });
|
||||||
|
|||||||
@@ -9837,7 +9837,7 @@ const campVisits: CampVisitDefinition[] = [
|
|||||||
response: '이엄은 무도와 음평에 예비 수레를 나누었고, 황권은 그 수레가 늦어질 때 대체할 고개 이름을 장부 옆에 적었습니다.',
|
response: '이엄은 무도와 음평에 예비 수레를 나누었고, 황권은 그 수레가 늦어질 때 대체할 고개 이름을 장부 옆에 적었습니다.',
|
||||||
bondExp: 72,
|
bondExp: 72,
|
||||||
gold: 2760,
|
gold: 2760,
|
||||||
itemRewards: ['쌀 34', '상처약 24']
|
itemRewards: ['콩 34', '상처약 24']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -9867,7 +9867,7 @@ const campVisits: CampVisitDefinition[] = [
|
|||||||
response: '마량은 마을 이름을 하나씩 불렀고, 황권은 그 이름 옆에 실제로 남길 군량 숫자를 적었습니다.',
|
response: '마량은 마을 이름을 하나씩 불렀고, 황권은 그 이름 옆에 실제로 남길 군량 숫자를 적었습니다.',
|
||||||
bondExp: 76,
|
bondExp: 76,
|
||||||
gold: 2860,
|
gold: 2860,
|
||||||
itemRewards: ['쌀 36', '상처약 26']
|
itemRewards: ['콩 36', '상처약 26']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -9897,7 +9897,7 @@ const campVisits: CampVisitDefinition[] = [
|
|||||||
response: '이엄은 회수 표식마다 예비 군량을 남겼고, 황권은 그 군량이 마을 몫을 줄이지 않도록 다시 계산했습니다.',
|
response: '이엄은 회수 표식마다 예비 군량을 남겼고, 황권은 그 군량이 마을 몫을 줄이지 않도록 다시 계산했습니다.',
|
||||||
bondExp: 80,
|
bondExp: 80,
|
||||||
gold: 2940,
|
gold: 2940,
|
||||||
itemRewards: ['쌀 38', '상처약 28']
|
itemRewards: ['콩 38', '상처약 28']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -9924,10 +9924,10 @@ const campVisits: CampVisitDefinition[] = [
|
|||||||
{
|
{
|
||||||
id: 'store-riverbank-supplies',
|
id: 'store-riverbank-supplies',
|
||||||
label: '강안 예비 군량을 남긴다',
|
label: '강안 예비 군량을 남긴다',
|
||||||
response: '위수 남안의 예비 창고에 쌀과 상처약이 남았고, 병사들은 강가 안개 속에서도 돌아올 표식을 확인했습니다.',
|
response: '위수 남안의 예비 창고에 콩과 상처약이 남았고, 병사들은 강가 안개 속에서도 돌아올 표식을 확인했습니다.',
|
||||||
bondExp: 84,
|
bondExp: 84,
|
||||||
gold: 3020,
|
gold: 3020,
|
||||||
itemRewards: ['쌀 40', '상처약 30']
|
itemRewards: ['콩 40', '상처약 30']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -9954,10 +9954,10 @@ const campVisits: CampVisitDefinition[] = [
|
|||||||
{
|
{
|
||||||
id: 'store-northbank-village-supplies',
|
id: 'store-northbank-village-supplies',
|
||||||
label: '강북 마을 예비 군량을 남긴다',
|
label: '강북 마을 예비 군량을 남긴다',
|
||||||
response: '강북 마을마다 쌀과 상처약이 남았고, 병사들은 돌아올 길이 지도뿐 아니라 실제 마을에도 남았다는 것을 확인했습니다.',
|
response: '강북 마을마다 콩과 상처약이 남았고, 병사들은 돌아올 길이 지도뿐 아니라 실제 마을에도 남았다는 것을 확인했습니다.',
|
||||||
bondExp: 88,
|
bondExp: 88,
|
||||||
gold: 3100,
|
gold: 3100,
|
||||||
itemRewards: ['쌀 42', '상처약 32']
|
itemRewards: ['콩 42', '상처약 32']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user