Validate battle opening objective briefs
This commit is contained in:
@@ -43,6 +43,7 @@ try {
|
||||
assertNonEmptyString(errors, scenario.title, `${context}: title`);
|
||||
assertNonEmptyString(errors, scenario.victoryConditionLabel, `${context}: victory condition label`);
|
||||
assertNonEmptyString(errors, scenario.defeatConditionLabel, `${context}: defeat condition label`);
|
||||
validateOpeningObjectiveLines(errors, scenario, context);
|
||||
|
||||
validateMap(errors, scenario, terrainKeys, context);
|
||||
validateUnits(errors, scenario, classKeys, itemKeys, equipmentSlots, context);
|
||||
@@ -67,7 +68,7 @@ try {
|
||||
);
|
||||
const tacticalGuideCount = scenarioEntries.reduce((total, [, scenario]) => total + (scenario.tacticalGuide ? 1 : 0), 0);
|
||||
console.log(
|
||||
`Verified ${scenarioEntries.length} battle scenarios, ${unitCount} unit placements, maps, objectives, sortie data, ${tacticalGuideCount} tactical guides, equipment, and ${rewardCount} reward labels.`
|
||||
`Verified ${scenarioEntries.length} battle scenarios, ${unitCount} unit placements, maps, opening briefs, objectives, sortie data, ${tacticalGuideCount} tactical guides, equipment, and ${rewardCount} reward labels.`
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
@@ -201,6 +202,17 @@ function validateObjectives(errors, scenario, context) {
|
||||
});
|
||||
}
|
||||
|
||||
function validateOpeningObjectiveLines(errors, scenario, context) {
|
||||
if (!Array.isArray(scenario.openingObjectiveLines) || scenario.openingObjectiveLines.length === 0) {
|
||||
errors.push(`${context}: openingObjectiveLines must include at least one line`);
|
||||
return;
|
||||
}
|
||||
|
||||
scenario.openingObjectiveLines.forEach((line, index) => {
|
||||
assertNonEmptyString(errors, line, `${context}: openingObjectiveLines[${index}]`);
|
||||
});
|
||||
}
|
||||
|
||||
function validateTacticalGuide(errors, scenario, eventKeys, context) {
|
||||
const guide = scenario.tacticalGuide;
|
||||
if (!guide) {
|
||||
|
||||
Reference in New Issue
Block a user