Пример #1
0
        public IEnumerable <BoardMove> GetBoardMovesFallSpring(Board board, AllianceScenario allianceScenario)
        {
            HashSet <BoardMove> completedBoardMoves = new HashSet <BoardMove>();

            if (board.Season is Winter)
            {
                throw new Exception($"Bad season {board.Season}");
            }
            foreach (var kvp in board.OccupiedMapNodes)
            {
                BoardMove      workingBoardMove = new BoardMove();
                List <MapNode> path;
                UnitMove       currentMove;
                if (_targeter.TryGetMoveTargetValidateWithBoardMove(board, kvp.Key, allianceScenario, workingBoardMove, out path, out currentMove))
                {
                    workingBoardMove.Add(currentMove);
                }
                else
                {
                    throw new Exception("Failed to add the very first move? Really!?");
                }
                GetFallSpringMovesRemaining(board, allianceScenario, _targeter, workingBoardMove, completedBoardMoves);
            }
            return(completedBoardMoves);
        }
Пример #2
0
 private void GetFallSpringMovesRemaining(Board board, AllianceScenario allianceScenario, ITargeter unitTargetCalculator, BoardMove workingBoardMove, HashSet <BoardMove> completedBoardMoves)
 {
     foreach (var kvp in board.OccupiedMapNodes.Where(kvp2 => !workingBoardMove.Sources.Contains(kvp2.Key)))
     {
         List <MapNode> path;
         UnitMove       currentMove;
         if (unitTargetCalculator.TryGetMoveTargetValidateWithBoardMove(board, kvp.Key, allianceScenario, workingBoardMove, out path, out currentMove))
         {
             workingBoardMove.Add(currentMove);
         }
         else
         {
             // uh oh, contradiction
             return;
         }
     }
     completedBoardMoves.Add(workingBoardMove.Clone());
     return;
 }