// done internal Location DecideDraculaStartLocation(Map map, Hunter[] hunters) { Logger.WriteToDebugLog("Starting to decide where Dracula will start"); Location startLocation; Array locationValues = Enum.GetValues(typeof(Location)); do { startLocation = (Location)locationValues.GetValue(new Random().Next(1, 72)); } while (map.TypeOfLocation(startLocation) == LocationType.Hospital || map.TypeOfLocation(startLocation) == LocationType.Sea || map.TypeOfLocation(startLocation) == LocationType.Castle || hunters[0].CurrentLocation == startLocation || hunters[1].CurrentLocation == startLocation || hunters[2].CurrentLocation == startLocation || hunters[3].CurrentLocation == startLocation); Logger.WriteToDebugLog("Returning" + startLocation); return startLocation; }
private bool ResolveEncountersAtLocation(Hunter hunter, Map map, Location location, UserInterface ui) { Dracula.OrderEncounters(hunter, location); foreach (EncounterDetail enc in map.LocationDetails(location).Encounters) { enc.isRevealed = true; ui.TellUser(enc.name + " is revealed"); } ui.drawGameState(this); bool resolveNextEncounter = true; bool discardEncounter = true; List<EncounterDetail> encountersBeingDiscarded = new List<EncounterDetail>(); EncounterDetail firstEncounter = null; EncounterDetail secondEncounter = null; if (map.LocationDetails(location).Encounters.Count() > 0) { firstEncounter = map.LocationDetails(location).Encounters.First(); } if (map.LocationDetails(location).Encounters.Count() > 1) { secondEncounter = map.LocationDetails(location).Encounters[1]; } if (firstEncounter != null) { bool encounterCancelled = false; foreach (Hunter h in Hunters) { int hunterIndex = IndexOfHunter(h); if (h.CurrentLocation == location) { if (ui.AskIfHunterIsPlayingSecretWeapon(h.Name)) { DiscardEventFromHunterAtIndex("Secret Weapon", hunterIndex, ui); Logger.WriteToDebugLog(h.Name + " played Secret Weapon"); Logger.WriteToGameLog(h.Name + " played Secret Weapon"); EventDetail draculaEventCardA = Dracula.WillPlayDevilishPower(this, ui); bool eventIsCancelled = false; if (draculaEventCardA != null) { switch (draculaEventCardA.name) { case "DevilishPower": ui.TellUser("Dracula played Devilish power to cancel this event"); Logger.WriteToDebugLog("Dracula played Devilish Power"); DiscardEventFromDracula("Devilish Power"); int hunterPlayingGoodluck = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent(); if (hunterPlayingGoodluck > -1) { DiscardEventFromHunterAtIndex("Good Luck", hunterPlayingGoodluck, ui); } else { eventIsCancelled = true; } break; } } if (!eventIsCancelled) { PlaySecretWeaponBeforeEncounter(hunterIndex, ui); } } EventDetail draculaEventCard; if (ui.AskIfHunterIsPlayingForeWarned(h.Name)) { 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) { PlayForewarnedBeforeEncounter(hunterIndex, ui); encounterCancelled = true; } } } } if (encounterCancelled) { resolveNextEncounter = true; discardEncounter = true; } else { resolveNextEncounter = ResolveEncounter(firstEncounter, hunter, out discardEncounter, ui); } if (discardEncounter) { map.LocationDetails(location).Encounters.Remove(firstEncounter); EncounterPool.Add(firstEncounter); firstEncounter.isRevealed = false; } else if (firstEncounter.name == "Bats" || firstEncounter.name == "Fog") { EncounterLimbo.Add(firstEncounter); map.LocationDetails(location).Encounters.Remove(firstEncounter); } } if (secondEncounter != null) { bool encounterCancelled = false; foreach (Hunter h in Hunters) { int hunterIndex = IndexOfHunter(h); if (h.CurrentLocation == location) { if (ui.AskIfHunterIsPlayingSecretWeapon(h.Name)) { DiscardEventFromHunterAtIndex("Secret Weapon", hunterIndex, ui); Logger.WriteToDebugLog(h.Name + " played Secret Weapon"); Logger.WriteToGameLog(h.Name + " played Secret Weapon"); EventDetail draculaEventCardA = Dracula.WillPlayDevilishPower(this, ui); bool eventIsCancelled = false; if (draculaEventCardA != null) { switch (draculaEventCardA.name) { case "DevilishPower": ui.TellUser("Dracula played Devilish power to cancel this event"); Logger.WriteToDebugLog("Dracula played Devilish Power"); DiscardEventFromDracula("Devilish Power"); int hunterPlayingGoodluck = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent(); if (hunterPlayingGoodluck > -1) { DiscardEventFromHunterAtIndex("Good Luck", hunterPlayingGoodluck, ui); } else { eventIsCancelled = true; } break; } } if (!eventIsCancelled) { PlaySecretWeaponBeforeEncounter(hunterIndex, ui); } } EventDetail draculaEventCard; if (ui.AskIfHunterIsPlayingForeWarned(h.Name)) { 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) { PlayForewarnedBeforeEncounter(hunterIndex, ui); encounterCancelled = true; } } } } if (encounterCancelled) { resolveNextEncounter = true; discardEncounter = true; } else { resolveNextEncounter = ResolveEncounter(secondEncounter, hunter, out discardEncounter, ui); } if (discardEncounter) { map.LocationDetails(location).Encounters.Remove(secondEncounter); EncounterPool.Add(secondEncounter); } else if (secondEncounter.name == "Bats" || secondEncounter.name == "Fog") { EncounterLimbo.Add(secondEncounter); map.LocationDetails(location).Encounters.Remove(secondEncounter); } } return resolveNextEncounter; }
internal void SetHunterStartLocations(Map map, UserInterface ui) { foreach (Hunter h in Hunters) { string line; do { line = ui.GetHunterStartLocation(h.Name); ui.TellUser(map.LocationName(map.GetLocationFromString(line))); } while (map.GetLocationFromString(line) == Location.Nowhere); } }
//private void SetUpItems() //{ // ItemDeck.Add(new ItemDetail("Crucifix")); // ItemDeck.Add(new ItemDetail("Crucifix")); // ItemDeck.Add(new ItemDetail("Crucifix")); // ItemDeck.Add(new ItemDetail("Dogs")); // ItemDeck.Add(new ItemDetail("Dogs")); // ItemDeck.Add(new ItemDetail("Fast Horse")); // ItemDeck.Add(new ItemDetail("Fast Horse")); // ItemDeck.Add(new ItemDetail("Fast Horse")); // ItemDeck.Add(new ItemDetail("Garlic")); // ItemDeck.Add(new ItemDetail("Garlic")); // ItemDeck.Add(new ItemDetail("Garlic")); // ItemDeck.Add(new ItemDetail("Garlic")); // ItemDeck.Add(new ItemDetail("Heavenly Host")); // ItemDeck.Add(new ItemDetail("Heavenly Host")); // ItemDeck.Add(new ItemDetail("Holy Water")); // ItemDeck.Add(new ItemDetail("Holy Water")); // ItemDeck.Add(new ItemDetail("Holy Water")); // ItemDeck.Add(new ItemDetail("Knife")); // ItemDeck.Add(new ItemDetail("Knife")); // ItemDeck.Add(new ItemDetail("Knife")); // ItemDeck.Add(new ItemDetail("Knife")); // ItemDeck.Add(new ItemDetail("Knife")); // ItemDeck.Add(new ItemDetail("Local Rumours")); // ItemDeck.Add(new ItemDetail("Local Rumours")); // ItemDeck.Add(new ItemDetail("Pistol")); // ItemDeck.Add(new ItemDetail("Pistol")); // ItemDeck.Add(new ItemDetail("Pistol")); // ItemDeck.Add(new ItemDetail("Pistol")); // ItemDeck.Add(new ItemDetail("Pistol")); // ItemDeck.Add(new ItemDetail("Sacred Bullets")); // ItemDeck.Add(new ItemDetail("Sacred Bullets")); // ItemDeck.Add(new ItemDetail("Sacred Bullets")); // ItemDeck.Add(new ItemDetail("Stake")); // ItemDeck.Add(new ItemDetail("Stake")); // ItemDeck.Add(new ItemDetail("Stake")); // ItemDeck.Add(new ItemDetail("Stake")); // ItemDeck.Add(new ItemDetail("Rifle")); // ItemDeck.Add(new ItemDetail("Rifle")); // ItemDeck.Add(new ItemDetail("Rifle")); // ItemDeck.Add(new ItemDetail("Rifle")); //} //private void SetUpEvents() //{ // EventDeck.Add(new EventDetail("Rufus Smith", false, EventType.Ally)); // EventDeck.Add(new EventDetail("Jonathan Harker", false, EventType.Ally)); // EventDeck.Add(new EventDetail("Sister Agatha", false, EventType.Ally)); // EventDeck.Add(new EventDetail("Heroic Leap", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Great Strength", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Money Trail", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Sense of Emergency", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Sense of Emergency", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Vampire Lair", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Long Day", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Long Day", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Mystic Research", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Mystic Research", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Advance Planning", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Advance Planning", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Advance Planning", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Newspaper Reports", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Newspaper Reports", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Newspaper Reports", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Newspaper Reports", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Newspaper Reports", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Re-Equip", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Re-Equip", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Re-Equip", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Consecrated Ground", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Telegraph Ahead", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Telegraph Ahead", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Hypnosis", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Hypnosis", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Stormy Seas", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Surprising Return", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Surprising Return", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Good Luck", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Good Luck", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Blood Transfusion", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Secret Weapon", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Secret Weapon", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Forewarned", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Forewarned", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Forewarned", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Chartered Carriage", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Chartered Carriage", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Chartered Carriage", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Excellent Weather", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Excellent Weather", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Escape Route", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Escape Route", false, EventType.Keep)); // EventDeck.Add(new EventDetail("Hired Scouts", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Hired Scouts", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Hired Scouts", false, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Dracula's Brides", true, EventType.Ally)); // EventDeck.Add(new EventDetail("Immanuel Hildesheim", true, EventType.Ally)); // EventDeck.Add(new EventDetail("Quincey P. Morris", true, EventType.Ally)); // EventDeck.Add(new EventDetail("Roadblock", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Unearthly Swiftness", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Time Runs Short", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Customs Search", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Devilish Power", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Devilish Power", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Vampiric Influence", true, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Vampiric Influence", true, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Night Visit", true, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Evasion", true, EventType.PlayImmediately)); // EventDeck.Add(new EventDetail("Wild Horses", true, EventType.Keep)); // EventDeck.Add(new EventDetail("False Tip-off", true, EventType.Keep)); // EventDeck.Add(new EventDetail("False Tip-off", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Sensationalist Press", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Rage", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Seduction", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Control Storms", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Relentless Minion", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Relentless Minion", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Trap", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Trap", true, EventType.Keep)); // EventDeck.Add(new EventDetail("Trap", true, EventType.Keep)); //} // remove //internal void MoveEventFromEventDeckToKnownEvents(Hunter hunterToInfluence, Event e) //{ // EventDeck.Remove(e); // hunterToInfluence.EventsKnownToDracula.Add(e); //} // remove //internal void MoveItemFromItemDeckToKnownItems(Hunter hunterToInfluence, Item item) //{ // ItemDeck.Remove(item); // hunterToInfluence.ItemsKnownToDracula.Add(item); //} // remove //internal void MoveEventFromKnownEventsToEventDeck(Hunter hunterToInfluence, Event e) //{ // EventDeck.Add(e); // hunterToInfluence.EventsKnownToDracula.Remove(e); //} // remove //internal void MoveItemFromKnownItemsToItemDeck(Hunter hunterToInfluence, Item item) //{ // ItemDeck.Add(item); // hunterToInfluence.ItemsKnownToDracula.Remove(item); //} // remove //internal void GetHunterGroupMemberNamesAtHunterIndex(int hunterIndex, string[] names) //{ // for (int i = 0; i < Hunters[hunterIndex].HuntersInGroup.Count(); i++) // { // names[i] = Hunters[hunterIndex].HuntersInGroup[i].Name; // } //} internal void SearchWithHunter(Hunter hunter, Map map, Location location, UserInterface ui) { if ((Dracula.LocationIsInTrail(location) || Dracula.LocationIsInCatacombs(location)) && map.TypeOfLocation(location) != LocationType.Sea) { Logger.WriteToDebugLog("Hunter moved to a location that Dracula has visited"); if (location == Dracula.CurrentLocation) { ui.TellUser("Dracula is here!"); } else { ui.TellUser("Search reveals evidence of Dracula's visit"); } RevealedLocations.Add(location); bool canFightDracula = ResolveEncountersAtLocation(hunter, map, location, ui); if (location == Dracula.CurrentLocation && canFightDracula) { ResolveCombat(hunter, 1, true, ui); } } else if (location.Type != LocationType.Hospital && location.Type != LocationType.Sea && location.Type != LocationType.Castle) { ui.TellUser("Search reveals nothing in " + location.Name); } }
// remove internal bool LocationIsInTrail(Map map, Location locationToReveal) { return Dracula.LocationTrail.Contains(locationToReveal); }
internal void ChooseStartLocation(Map map, Hunter[] hunters) { CurrentLocation = logic.DecideDraculaStartLocation(map, hunters); }