Beispiel #1
0
 /// <summary>
 /// Handles the entirety of a Hunter's move, including search, Encounters, combat etc.
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">The index of the Hunter (and group) to move</param>
 /// <param name="destination">The destination of the move</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void HandleMoveOperation(GameState game, string destination, string hunterIndex,
     DecisionMaker logic)
 {
     var hunterMoved = Hunter.Nobody;
     Location originatingLocation;
     var trailIndex = MoveHunter(game, hunterIndex, destination, out hunterMoved, out originatingLocation, logic);
     if (DraculaIsPlayingCustomsSearch(game, hunterMoved, originatingLocation, logic))
     {
         foreach (var h in game.Hunters[(int)hunterMoved].HuntersInGroup)
         {
             Console.WriteLine("{0} must discard all Items", h.Name());
             while (game.Hunters[(int)h].ItemCount > 0)
             {
                 DiscardUnknownItemFromHunter(game, game.Hunters[(int)h]);
             }
         }
     }
     if (trailIndex > -1 && game.Map.TypeOfLocation(game.Dracula.Trail[trailIndex].DraculaCards.First().Location) != LocationType.Sea)
     {
         game.Dracula.RevealCardAtPosition(trailIndex);
         logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[trailIndex].DraculaCards.First().Location, trailIndex);
         game.Dracula.RevealEncountersAtPositionInTrail(trailIndex);
         DraculaCardSlot slotBeingRevealed;
         if (trailIndex < 6)
         {
             slotBeingRevealed = game.Dracula.Trail[trailIndex];
         }
         else
         {
             slotBeingRevealed = game.Dracula.Catacombs[trailIndex - 6];
         }
         if (slotBeingRevealed.DraculaCards.First().Location == game.Dracula.LocationWhereHideWasUsed)
         {
             var positionRevealed = game.Dracula.RevealHideCard();
             logic.EliminateTrailsThatDoNotContainHideAtPosition(game, positionRevealed);
             game.Dracula.RevealEncountersAtPositionInTrail(positionRevealed);
         }
         if (slotBeingRevealed.DraculaCards.First().Location == game.Dracula.CurrentLocation)
         {
             Console.WriteLine("Dracula is here!");
         }
         else
         {
             Console.WriteLine("Dracula has been here");
         }
         DrawGameState(game);
         var encounterTilesToResolve = new List<EncounterTile>();
         foreach (var enc in slotBeingRevealed.EncounterTiles)
         {
             encounterTilesToResolve.Add(enc);
         }
         var hunterCanContinueToResolveEncounters = true;
         while (encounterTilesToResolve.Count() > 0 && hunterCanContinueToResolveEncounters)
         {
             var encounterTileBeingResolved = logic.ChooseEncounterToResolveOnSearchingHunter(game,
                 encounterTilesToResolve, hunterMoved);
             hunterCanContinueToResolveEncounters = ResolveEncounterTile(game, encounterTileBeingResolved,
                 game.Hunters[(int)hunterMoved].HuntersInGroup, logic, trailIndex);
             encounterTilesToResolve.Remove(encounterTileBeingResolved);
         }
         if (game.Hunters[(int)hunterMoved].CurrentLocation == game.Dracula.LocationWhereHideWasUsed)
         {
             foreach (var enc in game.Dracula.slotWhereHideCardIs().EncounterTiles)
             {
                 encounterTilesToResolve.Add(enc);
             }
         }
         while (encounterTilesToResolve.Count() > 0 && hunterCanContinueToResolveEncounters)
         {
             var encounterTileBeingResolved = logic.ChooseEncounterToResolveOnSearchingHunter(game,
                 encounterTilesToResolve, hunterMoved);
             hunterCanContinueToResolveEncounters = ResolveEncounterTile(game, encounterTileBeingResolved,
                 game.Hunters[(int)hunterMoved].HuntersInGroup, logic, game.Dracula.PositionWhereHideCardIs());
             encounterTilesToResolve.Remove(encounterTileBeingResolved);
         }
         if (slotBeingRevealed.DraculaCards.First().Location == game.Dracula.CurrentLocation &&
             hunterCanContinueToResolveEncounters)
         {
             Console.WriteLine("Entering combat with Dracula");
             if (DraculaIsPlayingWildHorses(game, logic))
             {
                 Console.WriteLine("The Wild Horses carry you away");
                 HandleMoveOperation(game, ((int)hunterMoved).ToString(),
                     logic.ChooseDestinationForWildHorses(game).Name(), logic);
             }
             else
             {
                 var huntersAttacking = new List<HunterPlayer>();
                 foreach (var h in game.Hunters[(int)hunterMoved].HuntersInGroup)
                 {
                     huntersAttacking.Add(game.Hunters[(int)h]);
                 }
                 ResolveCombat(game, huntersAttacking, Opponent.Dracula, logic);
                 CheckForHunterDeath(game);
             }
         }
     }
     else
     {
         logic.EliminateTrailsThatContainLocation(game, game.Hunters[(int)hunterMoved].CurrentLocation);
     }
 }