Example #1
0
        internal void PlayConsecratedGround(int hunterIndex, UserInterface ui)
        {
            EventDetail draculaEventCard = Dracula.WillPlayDevilishPower(this, ui);
            bool eventIsCancelled = false;
            if (draculaEventCard != null)
            {
                switch (draculaEventCard.name)
                {
                    case "DevilishPower":
                        ui.TellUser("Dracula played Devilish power to cancel this event");
                        DiscardEventFromDracula("Devilish Power");
                        int hunterPlayingGoodluck = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent();
                        if (hunterPlayingGoodluck > -1)
                        {
                            DiscardEventFromHunterAtIndex("Good Luck", hunterPlayingGoodluck, ui);
                        }
                        else
                        {
                            eventIsCancelled = true;
                        }

                        break;
                }
            }
            if (!eventIsCancelled)
            {
                LocationDetail locationToConsecrate;
                do
                {
                    locationToConsecrate = GetLocationFromName(ui.GetNameOfLocationToConsecrate());
                    ui.TellUser(locationToConsecrate.Name);
                } while (locationToConsecrate.Name == "Unknown location" || locationToConsecrate.Name == "Multiple locations" || (locationToConsecrate.Type != LocationType.City && locationToConsecrate.Type != LocationType.Town) || locationToConsecrate.Name == "Galatz" || locationToConsecrate.Name == "Klausenburg");
                Logger.WriteToDebugLog("Consecrate Ground was played in " + locationToConsecrate.Name);
                Logger.WriteToGameLog("Consecrate Ground was played in " + locationToConsecrate.Name);

                foreach (LocationDetail loc in Map)
                {
                    loc.IsConsecrated = false;
                }
                locationToConsecrate.IsConsecrated = true;
                ui.TellUser(locationToConsecrate.Name + " is now consecrated ground");

                if (locationToConsecrate == Dracula.CurrentLocation)
                {
                    locationToConsecrate.IsRevealed = true;
                    List<EncounterDetail> encountersToDiscard = new List<EncounterDetail>();
                    foreach (EncounterDetail e in locationToConsecrate.Encounters)
                    {
                        ui.TellUser(e.name + " was discarded");
                        encountersToDiscard.Add(e);
                        e.isRevealed = false;
                        EncounterPool.Add(e);
                    }
                    foreach (EncounterDetail e in encountersToDiscard)
                    {
                        locationToConsecrate.Encounters.Remove(e);
                    }
                }
            }
        }