feat: add sortie operation orders
This commit is contained in:
@@ -2,6 +2,7 @@ import type { BattleBond, UnitData } from '../data/scenario';
|
||||
import { isCampaignStep, type CampaignStep } from './campaignState';
|
||||
import type { UnitDirection } from '../data/unitAssets';
|
||||
import { equipmentExpToNext, equipmentSlots, type EquipmentSlot } from '../data/battleItems';
|
||||
import type { SortieOrderId } from '../data/sortieOrders';
|
||||
|
||||
export type BattleSaveFaction = 'ally' | 'enemy';
|
||||
export type BattleSaveRosterTab = 'ally' | 'enemy';
|
||||
@@ -70,6 +71,7 @@ export type BattleSaveState = {
|
||||
version: 1;
|
||||
battleId: string;
|
||||
campaignStep?: CampaignStep;
|
||||
sortieOrderId?: SortieOrderId;
|
||||
savedAt: string;
|
||||
turnNumber: number;
|
||||
activeFaction: BattleSaveFaction;
|
||||
@@ -172,6 +174,10 @@ export function isValidBattleSaveState(state: unknown, options: BattleSaveValida
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state.sortieOrderId !== undefined && !isSortieOrderId(state.sortieOrderId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const attackIntents = state.attackIntents;
|
||||
const units = state.units;
|
||||
|
||||
@@ -254,6 +260,10 @@ function isTacticalCommandRole(value: unknown): value is BattleSaveTacticalComma
|
||||
return value === 'front' || value === 'flank' || value === 'support';
|
||||
}
|
||||
|
||||
function isSortieOrderId(value: unknown): value is SortieOrderId {
|
||||
return value === 'elite' || value === 'mobile' || value === 'siege';
|
||||
}
|
||||
|
||||
function isUnitIdArray(value: unknown, options: BattleSaveValidationOptions) {
|
||||
return (
|
||||
Array.isArray(value) &&
|
||||
|
||||
Reference in New Issue
Block a user