Expose sortie checklist summary
This commit is contained in:
@@ -9578,6 +9578,14 @@ function assertSortieTacticalRoster(state, requiredUnitIds) {
|
|||||||
if (!state?.sortieVisible || !Array.isArray(state.sortieRoster)) {
|
if (!state?.sortieVisible || !Array.isArray(state.sortieRoster)) {
|
||||||
throw new Error(`Expected sortie tactical roster to be exposed: ${JSON.stringify(state)}`);
|
throw new Error(`Expected sortie tactical roster to be exposed: ${JSON.stringify(state)}`);
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
typeof state.sortieChecklistSummary?.total !== 'number' ||
|
||||||
|
typeof state.sortieChecklistSummary?.completeCount !== 'number' ||
|
||||||
|
typeof state.sortieChecklistSummary?.requiredRemainingCount !== 'number' ||
|
||||||
|
typeof state.sortieChecklistSummary?.recommendedRemainingCount !== 'number'
|
||||||
|
) {
|
||||||
|
throw new Error(`Expected sortie checklist summary counts: ${JSON.stringify(state.sortieChecklistSummary)}`);
|
||||||
|
}
|
||||||
|
|
||||||
const missingIds = requiredUnitIds.filter((unitId) => !state.sortieRoster.some((unit) => unit.id === unitId));
|
const missingIds = requiredUnitIds.filter((unitId) => !state.sortieRoster.some((unit) => unit.id === unitId));
|
||||||
if (missingIds.length > 0) {
|
if (missingIds.length > 0) {
|
||||||
|
|||||||
@@ -13797,6 +13797,15 @@ export class CampScene extends Phaser.Scene {
|
|||||||
return `${prefix}: ${next.label} - ${next.detail}`;
|
return `${prefix}: ${next.label} - ${next.detail}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sortieChecklistSummary(checklist: SortieChecklistItem[]) {
|
||||||
|
return {
|
||||||
|
total: checklist.length,
|
||||||
|
completeCount: checklist.filter((item) => item.complete).length,
|
||||||
|
requiredRemainingCount: checklist.filter((item) => !item.complete && item.priority === 'required').length,
|
||||||
|
recommendedRemainingCount: checklist.filter((item) => !item.complete && item.priority !== 'required').length
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private currentSortieFlow() {
|
private currentSortieFlow() {
|
||||||
return getSortieFlow(this.campaign?.latestBattleId, this.campaign?.step);
|
return getSortieFlow(this.campaign?.latestBattleId, this.campaign?.step);
|
||||||
}
|
}
|
||||||
@@ -15808,6 +15817,7 @@ export class CampScene extends Phaser.Scene {
|
|||||||
sortieFocusedUnit: this.sortieFocusedUnitSummary(),
|
sortieFocusedUnit: this.sortieFocusedUnitSummary(),
|
||||||
sortiePlanFeedback: this.sortiePlanFeedback,
|
sortiePlanFeedback: this.sortiePlanFeedback,
|
||||||
sortieChecklist,
|
sortieChecklist,
|
||||||
|
sortieChecklistSummary: this.sortieChecklistSummary(sortieChecklist),
|
||||||
sortieNextAction: this.sortiePrepSubtitle(sortieChecklist),
|
sortieNextAction: this.sortiePrepSubtitle(sortieChecklist),
|
||||||
reserveTrainingFocus,
|
reserveTrainingFocus,
|
||||||
reserveTrainingFocusOptions: campaignReserveTrainingFocusDefinitions.map((focus) => ({
|
reserveTrainingFocusOptions: campaignReserveTrainingFocusDefinitions.map((focus) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user