Beispiel #1
0
        public void UpdateStrategy(GameState game)
        {
            int turnsUntilDark = 0;
            int turnsUntilLight = 0;
            if ((int)game.TimeOfDay > 3)
            {
                turnsUntilLight = 7 - (int)game.TimeOfDay;
            }
            if ((int)game.TimeOfDay < 4)
            {
                turnsUntilDark = 4 - (int)game.TimeOfDay;
            }

            // if there are any hunters in range
            var potentialVictims = game.HuntersWithinDistanceOf(game.Dracula.CurrentLocation, turnsUntilLight);
            var victimsToEliminate = new List<HunterPlayer>();
            foreach (HunterPlayer h in potentialVictims)
            {
                // eliminate any that have a stake
                if (h.LikelihoodOfHavingItemOfType(game, Item.Stake) > 0.5)
                {
                    // unless they only have 1 and I have a rage card that can discard it
                    if (h.LikelihoodOfHavingItemOfType(game, Item.Stake) < 2 && game.Dracula.EventHand.Any(card => card.Event == Event.Rage))
                    {
                        // but if someone can cancel my rage card and I can't cancel their good luck
                        if (game.Dracula.EventHand.Count(card => card.Event == Event.DevilishPower) - game.LikelihoodOfAnyHunterHavingEventOfType(Event.GoodLuck) < 0.5)
                        {
                            victimsToEliminate.Add(h);
                            continue;
                        }
                    }
                    else
                    {
                        victimsToEliminate.Add(h);
                        continue;
                    }
                }
                // elminate any that have Heavenly Host
                if (h.LikelihoodOfHavingItemOfType(game, Item.HeavenlyHost) > 0.75)
                {
                    // unless they only have 1 and I have a rage card that can discard it
                    if (h.LikelihoodOfHavingItemOfType(game, Item.HeavenlyHost) < 2 && game.Dracula.EventHand.Any(card => card.Event == Event.Rage))
                    {
                        // but if someone can cancel my rage card and I can't cancel their good luck
                        if (game.Dracula.EventHand.Count(card => card.Event == Event.DevilishPower) - game.LikelihoodOfAnyHunterHavingEventOfType(Event.GoodLuck) < 0.5)
                        {
                            victimsToEliminate.Add(h);
                            continue;
                        }
                    }
                    else
                    {
                        victimsToEliminate.Add(h);
                        continue;
                    }
                }
            }
            foreach (HunterPlayer h in victimsToEliminate)
            {
                potentialVictims.Remove(h);
            }
            potentialVictims.Clear();
            // if there are any that are in the same location as someone who is not a potential victim, I don't want to attack them both
            foreach (HunterPlayer h in potentialVictims)
            {
                for (int i = 1; i < 5; i++)
                {
                    if (!potentialVictims.Contains(game.Hunters[i]) && h.CurrentLocation == game.Hunters[i].CurrentLocation)
                    {
                        victimsToEliminate.Add(h);
                    }
                }
            }
            foreach (HunterPlayer h in victimsToEliminate)
            {
                potentialVictims.Remove(h);
            }

            if (potentialVictims.Any())
            {
                // if it's worth breaking cover to attack
                if ((NumberOfPossibleCurrentLocations < 6 && potentialVictims.Any(hunter => LikelihoodOfHunterDeath(game, hunter) > LikelihoodOfDraculaDeath(game.Dracula.Blood))) || (game.Vampires > 3 && potentialVictims.Any(hunter => LikelihoodOfHunterDeath(game, hunter) > 25)))
                {
                    float highestLikelihoodOfDeath = 0;
                    foreach (HunterPlayer hunter in potentialVictims)
                    {
                        if (LikelihoodOfHunterDeath(game, hunter) > highestLikelihoodOfDeath)
                        {
                            victim = hunter;
                            highestLikelihoodOfDeath = LikelihoodOfHunterDeath(game, hunter);
                        }
                    }
                    if (victim != null)
                    {
                        Strategy = Strategy.Aggressive;
                        return;
                    }
                }
            }

            if (game.Dracula.Blood < 6)
            {
                Strategy = Strategy.FleeToCastleDracula;
                victim = null;
                return;
            }
            Strategy = Strategy.Sneaky;
            victim = null;
        }