using Chessistics.Engine.Model; namespace Chessistics.Engine.Rules; public static class MissionChecker { /// /// Check if all demands for the current mission are satisfied. /// In campaign mode, only checks the current mission's demands. /// In legacy level mode, checks all demands. /// public static bool AllCurrentDemandsMet(BoardState state) { var missionIndex = state.Campaign?.CurrentMissionIndex ?? 0; return state.Demands.Values .Where(d => d.MissionIndex == missionIndex) .All(d => d.IsSatisfied); } /// /// Check if all demands on the board are satisfied (all missions). /// public static bool AllDemandsMet(BoardState state) => state.Demands.Values.All(d => d.IsSatisfied); }