Validate sortie flow next battle titles
This commit is contained in:
@@ -15,6 +15,7 @@ const sortieFlowBodies = extractSortieFlowBodies(campaignFlowSource, battleScena
|
||||
const sortieFlowAfterBattleIds = extractSortieFlowAfterBattleIds(campaignFlowSource, battleScenarioIds);
|
||||
const sortieFlowCampaignSteps = extractSortieFlowCampaignSteps(campaignFlowSource);
|
||||
const sortieFlowNextBattleIds = extractSortieFlowNextBattleIds(campaignFlowSource, battleScenarioIds);
|
||||
const sortieFlowTitleBattleIds = extractSortieFlowTitleBattleIds(campaignFlowSource, battleScenarioIds);
|
||||
const campaignRewardUnlockBattleIds = extractCampaignRewardUnlockBattleIds(battlesSource, battleScenarioIds);
|
||||
const sortieFlowDisplayFields = ['eyebrow', 'title', 'description', 'rewardHint'];
|
||||
|
||||
@@ -42,6 +43,14 @@ for (const [flowKey, campaignStep] of sortieFlowCampaignSteps.entries()) {
|
||||
|
||||
for (const [flowKey, nextBattleId] of sortieFlowNextBattleIds.entries()) {
|
||||
assert(battleIds.has(nextBattleId), `Sortie flow ${flowKey} references unknown next battle id: ${nextBattleId}`);
|
||||
const titleBattleId = sortieFlowTitleBattleIds.get(flowKey);
|
||||
assert(titleBattleId, `Sortie flow ${flowKey} has next battle ${nextBattleId} but title is not a battle title reference`);
|
||||
if (titleBattleId) {
|
||||
assert(
|
||||
titleBattleId === nextBattleId,
|
||||
`Sortie flow ${flowKey} title points to ${titleBattleId} instead of next battle ${nextBattleId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (const flowKey of sortieFlowKeys) {
|
||||
@@ -219,6 +228,15 @@ function extractSortieFlowNextBattleIds(source, scenarioIds) {
|
||||
return entries;
|
||||
}
|
||||
|
||||
function extractSortieFlowTitleBattleIds(source, scenarioIds) {
|
||||
const entries = new Map();
|
||||
const propertyEntries = extractSortieFlowProperty(source, /title:\s*(\w+BattleScenario)\.title/);
|
||||
for (const [flowKey, variableName] of propertyEntries.entries()) {
|
||||
entries.set(flowKey, scenarioIds.get(variableName) ?? variableName);
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
function extractSortieFlowAfterBattleIds(source, scenarioIds) {
|
||||
const entries = new Map();
|
||||
const scenarioEntries = extractSortieFlowProperty(source, /afterBattleId:\s*(\w+BattleScenario)\.id/);
|
||||
|
||||
Reference in New Issue
Block a user