Exemplo n.º 1
0
 // done
 internal LocationDetail DecideWhichLocationToRemoveHeavenlyHostFrom(GameState g)
 {
     Logger.WriteToDebugLog("Deciding from which location to remove Heavenly Host");
     List<LocationDetail> map = g.GetMap();
     List<LocationDetail> locationsWithHost = new List<LocationDetail>();
     foreach (LocationDetail loc in map)
     {
         if (loc.HasHost)
         {
             locationsWithHost.Add(loc);
         }
     }
     LocationDetail target = locationsWithHost[new Random().Next(0, locationsWithHost.Count())];
     Logger.WriteToDebugLog("Returning " + target.Name);
     return target;
 }
Exemplo n.º 2
0
 // done
 internal LocationDetail DecideWhereToEvadeTo(GameState g)
 {
     Logger.WriteToDebugLog("Deciding where to move with Evade");
     List<LocationDetail> map = g.GetMap();
     LocationDetail locationToReturn;
     do {
     locationToReturn = map[new Random().Next(0, map.Count())];
     } while (g.LocationIsInTrail(locationToReturn) || g.LocationIsInCatacombs(locationToReturn));
     Logger.WriteToDebugLog("Returning " + locationToReturn.Name);
     return locationToReturn;
 }
Exemplo n.º 3
0
 // done
 internal void DecideWhereToPutRoadblock(GameState g, Roadblock roadblockCounter)
 {
     Logger.WriteToDebugLog("Deciding where to put Roadblock");
     List<LocationDetail> map = g.GetMap();
     LocationDetail firstLocationToBlock;
     do
     {
         firstLocationToBlock = map[new Random().Next(0, map.Count())];
     } while (firstLocationToBlock.Type != LocationType.City && firstLocationToBlock.Type != LocationType.Town);
     List<LocationDetail> secondLocationToBlockCandidates = new List<LocationDetail>();
     foreach (LocationDetail loc in firstLocationToBlock.ByRoad)
     {
         secondLocationToBlockCandidates.Add(loc);
     }
     foreach (LocationDetail loc in firstLocationToBlock.ByTrain)
     {
         secondLocationToBlockCandidates.Add(loc);
     }
     LocationDetail secondLocationToBlock = secondLocationToBlockCandidates[new Random().Next(0, secondLocationToBlockCandidates.Count())];
     if (firstLocationToBlock.ByRoad.Contains(secondLocationToBlock))
     {
         if (firstLocationToBlock.ByTrain.Contains(secondLocationToBlock))
         {
             if (new Random().Next(0, 2) > 0)
             {
                 roadblockCounter.connectionType = "road";
             }
             else
             {
                 roadblockCounter.connectionType = "rail";
             }
         }
         else
         {
             roadblockCounter.connectionType = "road";
         }
     }
     else
     {
         roadblockCounter.connectionType = "rail";
     }
     roadblockCounter.firstLocation = firstLocationToBlock;
     roadblockCounter.secondLocation = secondLocationToBlock;
     Logger.WriteToDebugLog("Nothing is returned, but the Roadblock counter has been put on the " + roadblockCounter.connectionType + " between " + roadblockCounter.firstLocation + " and " + roadblockCounter.secondLocation);
 }
Exemplo n.º 4
0
        internal void PlayDevilishPowerToRemoveHeavenlyHostOrHunterAlly(GameState g, UserInterface ui)
        {
            List<LocationDetail> map = g.GetMap();
            if (map.FindIndex(l => l.HasHost == true) > -1)
            {
                if (g.HuntersHaveAlly())
                {
                }
                else
                {
                    LocationDetail locationToRemoveHost = logic.DecideWhichLocationToRemoveHeavenlyHostFrom(g);
                    Logger.WriteToDebugLog("Dracula played Devilish Power to discard a Heavenly Host from " + locationToRemoveHost.Name);
                    ui.TellUser("Dracula played Devilish Power to discard a Heavenly Host from " + locationToRemoveHost.Name);
                    int hunterIndex = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent();
                    if (hunterIndex > 0)
                    {
                        g.DiscardEventFromHunterAtIndex("Good Luck", hunterIndex, ui);
                    }
                    else
                    {
                        locationToRemoveHost.HasHost = false;
                    }
                }

            }
            else
            {
                ui.TellUser("Dracula played Devilish Power to discard the Hunters' Ally from play");
                Logger.WriteToDebugLog("Dracula played Devilish Power to discard the Hunters' Ally from play");
                int hunterIndex = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent();
                if (hunterIndex > 0)
                {
                    g.DiscardEventFromHunterAtIndex("Good Luck", hunterIndex, ui);
                }
                else
                {
                    g.RemoveHunterAlly();
                }
            }
        }