internal static void ClearLogs(UserInterface ui) { try { System.IO.File.Delete(@"debuglog.txt"); } catch (System.IO.IOException) { ui.TellUser("Couldn't delete the old debug log file"); } try { System.IO.File.Delete(@"gamelog.txt"); } catch (System.IO.IOException) { ui.TellUser("Couldn't delete the old game log file"); } WriteToDebugLog("Start of game"); WriteToGameLog("Start of game"); }
private void MatureAmbush(UserInterface ui) { Logger.WriteToDebugLog("Dracula matured Ambush"); Logger.WriteToGameLog("Dracula matured Ambush"); ui.TellUser("Dracula matured Ambush"); bool discard; ResolveEncounter(Dracula.ChooseEncounterToAmbushHunter(), Dracula.ChooseHunterToAmbush(Hunters), out discard, ui); }
internal bool DraculaWillPlayControlStorms(int hunterIndex, UserInterface ui) { EventDetail draculaEventCard = Dracula.PlayControlStorms(this); if (draculaEventCard != null) { switch (draculaEventCard.name) { case "Control Storms": Logger.WriteToDebugLog("Dracula played Control Storms"); Logger.WriteToGameLog("Dracula played Control Storms"); ui.TellUser("Dracula played Control Storms"); DiscardEventFromDracula("Control Storms"); int hunterPlayingGoodluck = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent(); if (hunterPlayingGoodluck > -1) { DiscardEventFromHunterAtIndex("Good Luck", hunterPlayingGoodluck, ui); Logger.WriteToDebugLog(Hunters[hunterPlayingGoodluck].Name + " played Good Luck"); Logger.WriteToGameLog(Hunters[hunterPlayingGoodluck].Name + " played Good Luck"); } else { PlayControlStorms(hunterIndex, ui); return true; } break; } } return false; }
internal void ApplyBiteToOneOfMultipleHunters(int hunterIndex, UserInterface ui) { int hunterIndexBitten; do { hunterIndexBitten = ui.GetIndexOfHunterBitten(); if (Hunters[hunterIndexBitten].CurrentLocation != Hunters[hunterIndex].CurrentLocation) { ui.TellUser(Hunters[hunterIndexBitten].Name + " is not at the same location as " + Hunters[hunterIndex].Name); } } while (Hunters[hunterIndexBitten].CurrentLocation != Hunters[hunterIndex].CurrentLocation); ApplyBiteToHunter(hunterIndexBitten, ui); }
public bool ResolveWolves(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Wolves"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Wolves"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Wolves"); bool hasPistol = false; bool hasRifle = false; for (int i = 1; i < huntersEncountered.Count(); i++) { int answer = ui.GetHunterEquipmentForWolves(huntersEncountered[i].Name); switch (answer) { case 1: hasPistol = true; break; case 2: hasRifle = true; break; case 3: hasPistol = true; hasRifle = true; break; } } int numberOfWeaponTypes = (hasPistol ? 1 : 0) + (hasRifle ? 1 : 0); if (numberOfWeaponTypes == 2) { Logger.WriteToDebugLog("Wolves are negated by Pistol and Rifle"); Logger.WriteToGameLog("Wolves are negated by Pistol and Rifle"); ui.TellUser("Wolves are negated by Pistol and Rifle"); } else { for (int i = 1; i < huntersEncountered.Count(); i++) { Logger.WriteToDebugLog(huntersEncountered[i].Name + " loses " + (numberOfWeaponTypes == 1 ? "1" : "2") + " health"); Logger.WriteToGameLog(huntersEncountered[i].Name + " loses " + (numberOfWeaponTypes == 1 ? "1" : "2") + " health"); ui.TellUser(huntersEncountered[i].Name + " loses " + (numberOfWeaponTypes == 1 ? "1" : "2") + " health"); huntersEncountered[i].Health -= (2 - numberOfWeaponTypes); } } return !HandlePossibleHunterDeath(ui); }
public bool ResolveSpy(List<Hunter> huntersEncountered, UserInterface ui) { ui.TellUser(huntersEncountered.First().Name + " encountered a spy" + (huntersEncountered.Count() > 1 ? " with his group" : "")); foreach (Hunter h in huntersEncountered) { List<String> itemsAlreadyKnownToDracula = new List<String>(); for (int i = 0; i < h.NumberOfItems; i++) { string line = ""; do { line = ui.GetNameOfItemInHandFromHunter(h.Name); if (GetItemByNameFromItemDeck(line).Name == "Unknown item" && h.ItemsKnownToDracula.FindIndex(item => item.Name == line) == -1) { ui.TellUser("I didn't recognise that card name"); } } while (GetItemByNameFromItemDeck(line).Name == "Unknown item" && h.ItemsKnownToDracula.FindIndex(item => item.Name == line) == -1); itemsAlreadyKnownToDracula.Add(line); } List<ItemDetail> itemsToAddToKnownItems = new List<ItemDetail>(); itemsToAddToKnownItems.AddRange(h.ItemsKnownToDracula); foreach (string name in itemsAlreadyKnownToDracula) { if (itemsToAddToKnownItems.FindIndex(it => it.Name == name) > -1) { itemsToAddToKnownItems.Remove(itemsToAddToKnownItems.Find(it => it.Name == name)); } else { h.ItemsKnownToDracula.Add(GetItemByNameFromItemDeck(name)); } } List<String> eventsAlreadyKnownToDracula = new List<String>(); for (int i = 0; i < h.NumberOfItems; i++) { string line = ""; do { line = ui.GetNameOfEventInHandFromHunter(h.Name); if (GetEventByNameFromEventDeck(line).name == "Unknown event" && h.EventsKnownToDracula.FindIndex(ev => ev.name == line) == -1) { ui.TellUser("I didn't recognise that card name"); } } while (GetEventByNameFromEventDeck(line).name == "Unknown event" && h.EventsKnownToDracula.FindIndex(ev => ev.name == line) == -1); eventsAlreadyKnownToDracula.Add(line); } List<EventDetail> eventsToAddToKnownEvents = new List<EventDetail>(); eventsToAddToKnownEvents.AddRange(h.EventsKnownToDracula); foreach (string name in eventsAlreadyKnownToDracula) { if (eventsToAddToKnownEvents.FindIndex(eve => eve.name == name) > -1) { eventsToAddToKnownEvents.Remove(eventsToAddToKnownEvents.Find(eve => eve.name == name)); } else { h.EventsKnownToDracula.Add(GetEventByNameFromEventDeck(name)); } } h.TravelType = ui.AskHunterWhatTravelTypeForSpy(h.Name); string lineB; do { lineB = ui.AskHunterWhichLocationTheyAreMovingToNextTurn(h.Name); } while (GetLocationFromName(lineB).Name == "Unknown location" || GetLocationFromName(lineB).Name == "Multiple locations"); h.Destination = GetLocationFromName(lineB); } return true; }
public bool ResolveRats(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Rats"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Rats"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Rats"); for (int i = 1; i < huntersEncountered.Count(); i++) { if (huntersEncountered[i].HasDogsFaceUp) { ui.TellUser(huntersEncountered[i].Name + " has Dogs face up, Rats have no effect"); Logger.WriteToDebugLog(huntersEncountered[i].Name + " has Dogs face up, Rats have no effect"); Logger.WriteToGameLog(huntersEncountered[i].Name + " has Dogs face up, Rats have no effect"); return true; } } for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("Roll dice for " + huntersEncountered[i].Name); int loss = ui.GetHunterHealthLost(huntersEncountered[i].Name); huntersEncountered[i].Health -= loss; Logger.WriteToDebugLog(huntersEncountered[i] + " lost " + loss + " health"); Logger.WriteToGameLog(huntersEncountered[i] + " lost " + loss + " health"); } return !HandlePossibleHunterDeath(ui); }
private bool ResolvePlague(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Plague"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Plague"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Plague"); for (int i = 1; i < huntersEncountered.Count(); i++) { Logger.WriteToDebugLog(huntersEncountered[i].Name + " loses 2 health"); Logger.WriteToGameLog(huntersEncountered[i].Name + " loses 2 health"); ui.TellUser(huntersEncountered[i].Name + " loses 2 health"); huntersEncountered[i].Health -= 2; } return !HandlePossibleHunterDeath(ui); }
private void PlayForewarnedBeforeEncounter(int hunterIndex, UserInterface ui) { DiscardEventFromHunterAtIndex("Forewarned", hunterIndex, ui); ui.TellUser("Encounter cancelled"); }
private void PlayFalseTipOff(UserInterface ui) { ui.TellUser("I am playing my False Tip-Off card to cancel your train"); Dracula.DiscardEventFromHand(this, "False Tip-Off"); int hunterPlayingGoodluck = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent(); if (hunterPlayingGoodluck > -1) { DiscardEventFromHunterAtIndex("Good Luck", hunterPlayingGoodluck, ui); } }
// remove private void PlayEscapeRouteInCombat(int hunterIndex, UserInterface ui) { ui.TellUser("Combat is cancelled"); }
private void PlayCustomsSearch(int hunterIndex, UserInterface ui) { ui.TellUser("Dracula played Customs Search"); ui.TellUser(Hunters[hunterIndex].Name + " must discard all items, don't forget to tell me what they are"); DiscardEventFromDracula("Customs Search"); }
// remove private void PlayAdvancePlanningInCombat(UserInterface ui) { ui.TellUser("Add 1 to all dice rolls for that hunter"); }
private void MatureNewVampire(UserInterface ui) { Logger.WriteToDebugLog("Dracula matured New Vampire"); Logger.WriteToGameLog("Dracula matured New Vampire"); ui.TellUser("Dracula matured a New Vampire"); VampirePointTracker += 2; Dracula.TrimTrail(this, 1); }
private void MatureDesecratedSoil(UserInterface ui) { Logger.WriteToDebugLog("Dracula matured Desecrated Soil"); Logger.WriteToGameLog("Dracula matured Desecrated Soil"); ui.TellUser("Dracula matured Desecrated Soil"); for (int i = 0; i < 2; i++) { EventDetail cardDrawn; string line; do { line = ui.GetEventCardDrawnByDesecratedSoil(); cardDrawn = GetEventByNameFromEventDeck(line); } while (cardDrawn.name == "Unknown event" && !"dracula".StartsWith(line.ToLower())); if (!"dracula".StartsWith(line.ToLower())) { ui.TellUser(cardDrawn.name + " is discarded"); EventDeck.Remove(cardDrawn); EventDiscard.Add(cardDrawn); } else { switch (cardDrawn.type) { case EventType.Ally: Dracula.PlayAlly(this, cardDrawn, ui); break; case EventType.Keep: Dracula.EventCardsInHand.Add(cardDrawn); EventDeck.Remove(cardDrawn); break; case EventType.PlayImmediately: Dracula.PlayImmediately(this, cardDrawn, ui); EventDeck.Remove(cardDrawn); break; } } } Dracula.DiscardEventsDownTo(this, Dracula.EventHandSize, ui); Dracula.TrimTrail(this, 3); }
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; }
public bool ResolvePeasants(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Peasants"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Peasants"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Peasants"); ui.TellUser("Discard " + (huntersEncountered.First().CurrentLocation.IsEastern ? "one" : "all") + " of your item cards and redraw randomly (don't forget to tell me what is discarded"); return true; }
private void PlayHeroicLeapInCombat(int hunterIndex, UserInterface ui) { ui.TellUser("First roll a die for you and then roll a die for Dracula and tell me the results"); int hunterHealthLost = ui.GetDieRoll(); int draculaBloodLost = ui.GetDieRoll(); Hunters[hunterIndex].Health -= hunterHealthLost; Dracula.Blood -= draculaBloodLost; HandlePossibleHunterDeath(ui); }
private CombatRoundResult ResolveRoundOfCombat(List<Hunter> huntersFighting, List<ItemDetail> combatCards, List<ItemDetail> hunterBasicCards, CombatRoundResult result, bool hunterMoved, int enemyType, UserInterface ui) { string targetHunterName; string newEnemyCardUsed = Dracula.ChooseCombatCardAndTarget(huntersFighting, combatCards, result, NameOfHunterAlly(), out targetHunterName).Name; string newHunterCardUsed = "nothing"; foreach (Hunter h in huntersFighting) { do { newHunterCardUsed = ui.GetCombatCardFromHunter(h.Name); if (GetItemByNameFromItemDeck(newHunterCardUsed).Name == "Unknown item") { if (GetItemByNameFromList(newHunterCardUsed, hunterBasicCards).Name == "Unknown item") { ui.TellUser("I didn't recognise that item name"); } } } while (GetItemByNameFromItemDeck(newHunterCardUsed).Name == "Unknown item" && GetItemByNameFromList(newHunterCardUsed, hunterBasicCards).Name == "Unknown item"); if (newHunterCardUsed != "Punch" && newHunterCardUsed != "Dodge" && newHunterCardUsed != "Escape") { if (h.ItemsKnownToDracula.FindIndex(it => it.Name == newHunterCardUsed) == -1) { h.ItemsKnownToDracula.Add(GetItemByNameFromItemDeck(newHunterCardUsed)); } else if (newHunterCardUsed == h.LastItemUsedInCombat) { List<ItemDetail> copyOfHunterItemsKnown = new List<ItemDetail>(); copyOfHunterItemsKnown.AddRange(h.ItemsKnownToDracula); copyOfHunterItemsKnown.Remove(copyOfHunterItemsKnown.Find(it => it.Name == newHunterCardUsed)); if (copyOfHunterItemsKnown.FindIndex(it => it.Name == newHunterCardUsed) == -1) { h.ItemsKnownToDracula.Add(GetItemByNameFromItemDeck(newHunterCardUsed)); } } h.LastItemUsedInCombat = newHunterCardUsed; } } ui.TellUser("Enemy chose " + newEnemyCardUsed + " against " + targetHunterName); if (NameOfHunterAlly() == "Sister Agatha" && enemyType == 6) { if (newEnemyCardUsed == "Fangs" || newEnemyCardUsed == "Escape (Man)" || newEnemyCardUsed == "Escape (Bat)" || newEnemyCardUsed == "Escape (Mist)") { ui.TellUser("Dracula spent two blood to play his card"); Dracula.Blood -= 2; } } string newOutcome = ui.GetCombatRoundOutcome(); CombatRoundResult newResult = new CombatRoundResult(); newResult.enemyCardUsed = newEnemyCardUsed; newResult.outcome = newOutcome; newResult.hunterTargeted = targetHunterName; return newResult; }
private void PlayRage(List<Hunter> huntersInCombat, UserInterface ui) { Hunter ragedHunter = Dracula.ChooseHunterToRage(huntersInCombat); ui.TellUser(ragedHunter.Name + " must show me all items and I will discard one"); List<ItemDetail> itemsInHunterHand = new List<ItemDetail>(); string cardInRagedHunterHand; do { cardInRagedHunterHand = ui.GetNameOfCardInRagedHunterHand(); if (GetItemByNameFromItemDeck(cardInRagedHunterHand).Name != "Unknown item") { itemsInHunterHand.Add(GetItemByNameFromItemDeck(cardInRagedHunterHand)); } } while (GetItemByNameFromItemDeck(cardInRagedHunterHand).Name == "Unknown item" && cardInRagedHunterHand.ToLower() != "none"); ItemDetail itemToDiscard = Dracula.ChooseItemCardToDiscard(itemsInHunterHand); ui.TellUser("Discarding " + itemToDiscard.Name); DiscardItemFromHunterAtIndex(itemToDiscard.Name, Array.FindIndex(Hunters, h => h.Name == huntersInCombat.First().Name), ui); }
public bool ResolveSaboteur(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Saboteur"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Saboteur"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Saboteur"); for (int i = 1; i < huntersEncountered.Count(); i++) { if (huntersEncountered[i].HasDogsFaceUp) { ui.TellUser(huntersEncountered[i].Name + " has Dogs face up, Saboteur has no effect"); Logger.WriteToDebugLog(huntersEncountered[i].Name + " has Dogs face up, Saboteur has no effect"); Logger.WriteToGameLog(huntersEncountered[i].Name + " has Dogs face up, Saboteur has no effect"); return true; } } for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser(huntersEncountered[i].Name + " must discard 1 item or event (don't forget to tell me what was discarded"); } return false; }
// remove private void PlayTrap(UserInterface ui) { ui.TellUser("Dracula played Trap"); }
public bool ResolveThief(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Thief"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Thief"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Thief"); for (int i = 1; i < huntersEncountered.Count(); i++) { if (huntersEncountered[i].HasDogsFaceUp) { ui.TellUser(huntersEncountered[i].Name + " has Dogs face up, Thief has no effect"); Logger.WriteToDebugLog(huntersEncountered[i].Name + " has Dogs face up, Thief has no effect"); Logger.WriteToGameLog(huntersEncountered[i].Name + " has Dogs face up, Thief has no effect"); return true; } } for (int i = 1; i < huntersEncountered.Count(); i++) { Dracula.DiscardHunterCard(this, huntersEncountered[i], ui); } return true; }
private void PlayWildHorses(List<Hunter> huntersBeingMoved, UserInterface ui) { ui.TellUser("Dracula played Wild Horses"); int hunterIndex = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent(); if (hunterIndex > -1) { DiscardEventFromHunterAtIndex("Good Luck", hunterIndex, ui); } else { LocationDetail locationToMoveHuntersToWithWildHorses = Dracula.ChooseLocationToSendHuntersToWithWildHorses(this, huntersBeingMoved); ui.TellUser("Dracula moved you to " + locationToMoveHuntersToWithWildHorses.Name); foreach (Hunter h in huntersBeingMoved) { h.CurrentLocation = locationToMoveHuntersToWithWildHorses; } } }
internal void ApplyBiteToHunter(int hunterIndex, UserInterface ui) { if (ui.AskIfHunterIsUsingGreatStrengthToCancelBite(Hunters[hunterIndex].Name)) { DiscardEventFromHunterAtIndex("Great Strength", hunterIndex, 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) { CheckBittenHunterCards(ui); return; } } Hunters[hunterIndex].NumberOfBites++; ui.TellUser(Hunters[hunterIndex].Name + " was bitten"); }
private bool ResolveAmbush(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Ambush"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Ambush"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered an Ambush"); Dracula.DrawEncounters(this, Dracula.EncounterHand.Count() + 1); Dracula.DiscardEncountersDownTo(this, Dracula.EncounterHandSize); return true; }
internal void CheckBittenHunterCards(UserInterface ui) { foreach (Hunter h in Hunters) { if (h.NumberOfBites > 0) { if (h.NumberOfItems > 0 && h.ItemShownToDraculaForBeingBitten == null) { string line; do { line = ui.AskHunterToRevealItemForBeingBitten(h.Name); ui.TellUser(GetItemByNameFromItemDeck(line).Name); } while (GetItemByNameFromItemDeck(line).Name == "Unknown item" && h.ItemsKnownToDracula.FindIndex(itm => itm.Name == line) == -1); if (h.ItemsKnownToDracula.FindIndex(itm => itm.Name == line) == -1) { h.ItemsKnownToDracula.Add(GetItemByNameFromItemDeck(line)); } h.ItemShownToDraculaForBeingBitten = GetItemByNameFromItemDeck(line); } if (h.NumberOfEvents > 0 && h.EventShownToDraculaForBeingBitten == null) { string line; do { line = ui.AskHunterToRevealEvent(h.Name); ui.TellUser(GetEventByNameFromEventDeck(line).name); } while (GetEventByNameFromEventDeck(line).name == "Unknown event" && h.EventsKnownToDracula.FindIndex(ev => ev.name == line) == -1); if (h.EventsKnownToDracula.FindIndex(ev => ev.name == line) == -1) { h.EventsKnownToDracula.Add(GetEventByNameFromEventDeck(line)); } h.EventShownToDraculaForBeingBitten = GetEventByNameFromEventDeck(line); } } } }
private bool ResolveBats(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Bats"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Bats"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Bats"); ui.TellUser("Tell me at the start of your next turn and I will move you"); return false; }
private bool ResolveDesecratedSoil(List<Hunter> huntersEncountered, UserInterface ui) { Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Desecrated Soil"); Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Desecrated Soil"); ui.TellUser(huntersEncountered.First().Name + " "); for (int i = 1; i < huntersEncountered.Count(); i++) { ui.TellUser("and " + huntersEncountered[i].Name + " "); } ui.TellUser("encountered Desecrated Soil"); EventDetail cardDrawn; string line; do { line = ui.GetEventCardDrawnByDesecratedSoil(); cardDrawn = GetEventByNameFromEventDeck(line); } while (cardDrawn.name == "Unknown event" && !"dracula".StartsWith(line.ToLower())); if (!"dracula".StartsWith(line.ToLower())) { ui.TellUser(cardDrawn.name + " is discarded"); EventDeck.Remove(cardDrawn); EventDiscard.Add(cardDrawn); } else { switch (cardDrawn.type) { case EventType.Ally: Dracula.PlayAlly(this, cardDrawn, ui); break; case EventType.Keep: Dracula.EventCardsInHand.Add(cardDrawn); break; case EventType.PlayImmediately: Dracula.PlayImmediately(this, cardDrawn, ui); break; } } Dracula.DiscardEventsDownTo(this, Dracula.EventHandSize, ui); return true; }
internal void UseItemByHunterAtHunterIndex(string itemName, int hunterIndex, UserInterface ui) { ui.TellUser(Hunters[hunterIndex].Name + " used " + itemName); switch (itemName) { case "Local Rumors": PlayLocalRumors(hunterIndex, ui); break; case "Dogs": PlayDogs(hunterIndex, ui); break; case "Fast Horse": ui.TellUser("You may now move two road spaces"); DiscardItemFromHunterAtIndex("Fast Horse", hunterIndex, ui); break; case "Heavenly Host": PlayHeavenlyHost(hunterIndex, ui); break; case "Holy Water": PlayHolyWater(hunterIndex, ui); break; default: break; } }