Exemplo n.º 1
0
 // done
 internal EventDetail DecideEventCardToPlayAtStartOfDraculaTurn(GameState g, Dracula dracula)
 {
     Logger.WriteToDebugLog("Deciding what card to play at the start of Dracula's turn");
     List<EventDetail> eventCardsThatCanBePlayed = new List<EventDetail>();
     if (dracula.EventCardsInHand.FindIndex(ev => ev.name == "Time Runs Short") > -1) {
         eventCardsThatCanBePlayed.Add(dracula.EventCardsInHand.Find(ev => ev.name == "Time Runs Short"));
     }
     if (dracula.EventCardsInHand.FindIndex(ev => ev.name == "Unearthly Swiftness") > -1) {
         eventCardsThatCanBePlayed.Add(dracula.EventCardsInHand.Find(ev => ev.name == "Unearthly Swiftness"));
     }
     if (dracula.EventCardsInHand.FindIndex(ev => ev.name == "Roadblock") > -1) {
         eventCardsThatCanBePlayed.Add(dracula.EventCardsInHand.Find(ev => ev.name == "Roadblock"));
     }
     if (dracula.EventCardsInHand.FindIndex(ev => ev.name == "Devilish Power") > -1 && (g.HuntersHaveAlly() || g.HeavenlyHostIsInPlay())) {
         eventCardsThatCanBePlayed.Add(dracula.EventCardsInHand.Find(ev => ev.name == "Devilish Power"));
     }
     if (eventCardsThatCanBePlayed.Count() > 0 && new Random().Next(0, 3) > 1)
     {
         EventDetail cardToPlay = eventCardsThatCanBePlayed[new Random().Next(0, eventCardsThatCanBePlayed.Count())];
         Logger.WriteToDebugLog("Returning " + cardToPlay.name);
     }
     Logger.WriteToDebugLog("Returning null");
     return null;
 }
Exemplo n.º 2
0
        internal void drawGameState(GameState g)
        {
            // top line, trail headers, time header, Dracula blood and Vampire track header, Catacombs header, Dracula cards header
            Console.WriteLine("6th 5th 4th 3rd 2nd 1st   Time        Blood    Vampires  Catacombs    Events");
            // second line, trail cards, time, Dracula blood, Vampires, Catacombs cards, Events
            // trail cards
            for (int i = 5; i >= 0; i--)
            {
                if (i + 1 > g.TrailLength())
                {
                    Console.Write("    ");
                }
                else
                {
                    g.DrawLocationAtTrailIndex(i);
                }
            }

            string timeOfDay = g.TimeOfDay();
            switch (timeOfDay)
            {
                case "Dawn": Console.ForegroundColor = ConsoleColor.DarkYellow; break;
                case "Noon": Console.ForegroundColor = ConsoleColor.Yellow; break;
                case "Dusk": Console.ForegroundColor = ConsoleColor.DarkYellow; break;
                case "Twilight": Console.ForegroundColor = ConsoleColor.Cyan; break;
                case "Midnight": Console.ForegroundColor = ConsoleColor.Blue; break;
                case "Small Hours": Console.ForegroundColor = ConsoleColor.Cyan; break;
            }
            // time of day
            Console.Write("  " + timeOfDay);
            Console.ForegroundColor = ConsoleColor.Red;
            for (int i = 0; i < (12 - timeOfDay.Length); i++)
            {
                Console.Write(" ");
            }
            // Dracula blood
            Console.Write(g.DraculaBloodLevel());
            Console.ResetColor();
            for (int i = 0; i < (9 - g.DraculaBloodLevel().ToString().Length); i++)
            {
                Console.Write(" ");
            }
            // Vampire tracker
            Console.Write(Math.Max(0, g.VampireTracker()));
            for (int i = 0; i < (10 - g.VampireTracker().ToString().Length); i++)
            {
                Console.Write(" ");
            }
            Console.ForegroundColor = ConsoleColor.Red;
            // Catacombs cards
            for (int i = 0; i < 3; i++)
            {
                if (!g.LocationIsEmptyAtCatacombIndex(i))
                {
                    if (g.LocationIsRevealedAtCatacombIndex(i))
                    {
                        Console.Write(g.LocationAbbreviationAtCatacombIndex(i) + " ");
                    }
                    else
                    {
                        Console.Write("### ");
                    }
                }
                else
                {
                    Console.Write("    ");
                }
            }
            Console.ResetColor();
            // Events
            Console.WriteLine(" " + g.NumberOfEventCardsInDraculaHand());
            // third line power cards,
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            string tempString;
            // power cards
            for (int counter = 5; counter > -1; counter--)
            {
                tempString = "    ";
                for (int i = 0; i < g.NumberOfDraculaPowers(); i++)
                {
                    if (g.DraculaPowerAtPowerIndexIsAtLocationIndex(i, counter) && g.DraculaPowerNameAtPowerIndex(i) != "Hide" && g.DraculaPowerNameAtPowerIndex(i) != "Dark Call" && g.DraculaPowerNameAtPowerIndex(i) != "Feed")
                    {
                        tempString = g.DraculaPowerNameAtPowerIndex(i).Substring(0, 3).ToUpper() + " ";
                    }
                }
                Console.Write(tempString);
            }
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("                                 ");
            // first Catacombs encounters
            for (int i = 0; i < 3; i++)
            {
                if (!g.LocationIsEmptyAtCatacombIndex(i))
                {
                    if (g.NumberOfEncountersAtLocationAtCatacombIndex(i) > 0)
                    {
                        g.DrawEncounterAtCatacombIndex(i);
                    }
                }
                else
                {
                    Console.Write("    ");
                }
            }

            Console.WriteLine("");
            // fourth line trail encounters, ally headers, second Catacomb encounters
            // trail encounters
            for (int i = 5; i > -1; i--)
            {
                if (i + 1 > g.TrailLength())
                {
                    Console.Write("    ");
                }
                else
                {
                    g.DrawEncounterAtTrailIndex(i);
                }
            }
            Console.ResetColor();
            // ally headers
            Console.Write("  Dracula's Ally    Hunters' Ally");

            // second Catacomb encounters
            for (int i = 0; i < 3; i++)
            {
                if (!g.LocationIsEmptyAtCatacombIndex(i))
                {
                    if (g.NumberOfEncountersAtLocationAtCatacombIndex(i) > 0)
                    {
                        g.DrawEncounterAtCatacombIndex(i, true);
                    }
                }
                else
                {
                    Console.Write("    ");
                }
            }
            Console.WriteLine("");
            // fifth line, ally names
            Console.Write("                          ");
            Console.ResetColor();
            if (g.DraculaHasAlly())
            {
                Console.Write(g.NameOfDraculaAlly().Substring(0, 3).ToUpper());
            }
            else
            {
                Console.Write("   ");
            }
            Console.Write("               ");
            if (g.HuntersHaveAlly())
            {
                Console.Write(g.NameOfHunterAlly().Substring(0, 3).ToUpper());
            }
            else
            {
                Console.Write("   ");
            }
            Console.ResetColor();
            Console.WriteLine("");
            // sixth line, nothing
            Console.WriteLine("");
            // seventh line, resolve header
            Console.WriteLine("                          Resolve");
            // eighth line, resolve value
            Console.WriteLine("                          " + Math.Max(0, g.ResolveTracker()));
        }
Exemplo n.º 3
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();
                }
            }
        }