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 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); }
internal bool DraculaWillPlayCustomsSearch(int hunterIndex, UserInterface ui) { Logger.WriteToDebugLog("Dracula is deciding whether to play Customs Search"); EventDetail draculaEventCard = Dracula.WillPlayCustomsSearch(this, Hunters[hunterIndex]); if (draculaEventCard != null) { switch (draculaEventCard.name) { case "Customs Search": int hunterPlayingGoodluck = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent(); if (hunterPlayingGoodluck > -1) { DiscardEventFromHunterAtIndex("Good Luck", hunterPlayingGoodluck, ui); DiscardEventFromDracula("Customs Search"); } else { PlayCustomsSearch(hunterIndex, ui); return true; } break; } } return false; }
internal bool DraculaCancelTrain(int hunterIndex, UserInterface ui) { Logger.WriteToDebugLog("Dracula is deciding whether to cancel the train"); if (Dracula.WillCancelTrain(this, Hunters[hunterIndex])) { PlayFalseTipOff(ui); return true; } return false; }
internal void DiscardEventFromHunterAtIndex(string eventName, int hunterIndex, UserInterface ui) { EventDetail eventToDiscard = GetEventByNameFromEventDeck(eventName); EventDeck.Remove(eventToDiscard); if (Hunters[hunterIndex].EventShownToDraculaForBeingBitten == eventToDiscard) { Hunters[hunterIndex].EventShownToDraculaForBeingBitten = null; CheckBittenHunterCards(ui); } EventDiscard.Add(eventToDiscard); Hunters[hunterIndex].NumberOfEvents--; Logger.WriteToDebugLog(Hunters[hunterIndex].Name + " discarded " + eventName + " down to " + Hunters[hunterIndex].NumberOfEvents); Logger.WriteToGameLog(Hunters[hunterIndex].Name + " discarded " + eventName + " down to " + Hunters[hunterIndex].NumberOfEvents); }
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); } } } }
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); }
internal void AddItemCardToHunterAtIndex(int hunterIndex, UserInterface ui) { Hunters[hunterIndex].NumberOfItems++; Logger.WriteToDebugLog(Hunters[hunterIndex].Name + " drew an item card, up to " + Hunters[hunterIndex].NumberOfItems); Logger.WriteToGameLog(Hunters[hunterIndex].Name + " drew an item card, up to " + Hunters[hunterIndex].NumberOfItems); CheckBittenHunterCards(ui); }
private bool ResolveEncounter(EncounterDetail enc, Hunter hunter, out bool discard, UserInterface ui) { bool resolveNextEncounter = true; discard = true; List<Hunter> huntersInvolved = new List<Hunter>(); foreach (int ind in hunter.HuntersInGroup) { huntersInvolved.Add(Hunters[ind]); } switch (enc.name) { case "Ambush": resolveNextEncounter = ResolveAmbush(huntersInvolved, ui); break; case "Assasin": resolveNextEncounter = ResolveAssassin(huntersInvolved, ui); break; case "Bats": resolveNextEncounter = ResolveBats(huntersInvolved, ui); discard = false; break; case "Desecrated Soil": resolveNextEncounter = ResolveDesecratedSoil(huntersInvolved, ui); break; case "Fog": resolveNextEncounter = ResolveFog(huntersInvolved, ui); discard = false; break; case "Minion with Knife": resolveNextEncounter = ResolveMinionWithKnife(huntersInvolved, ui); break; case "Minion with Knife and Pistol": resolveNextEncounter = ResolveMinionWithKnifeAndPistol(huntersInvolved, ui); break; case "Minion with Knife and Rifle": resolveNextEncounter = ResolveMinionWithKnifeAndRifle(huntersInvolved, ui); break; case "Hoax": resolveNextEncounter = ResolveHoax(huntersInvolved, ui); break; case "Lightning": resolveNextEncounter = ResolveLightning(huntersInvolved, ui); break; case "Peasants": resolveNextEncounter = ResolvePeasants(huntersInvolved, ui); break; case "Plague": resolveNextEncounter = ResolvePlague(huntersInvolved, ui); break; case "Rats": resolveNextEncounter = ResolveRats(huntersInvolved, ui); break; case "Saboteur": resolveNextEncounter = ResolveSaboteur(huntersInvolved, ui); break; case "Spy": resolveNextEncounter = ResolveSpy(huntersInvolved, ui); break; case "Thief": resolveNextEncounter = ResolveThief(huntersInvolved, ui); break; case "New Vampire": bool discardVampire = true; resolveNextEncounter = ResolveNewVampire(huntersInvolved, out discardVampire, ui); discard = discardVampire; break; case "Wolves": resolveNextEncounter = ResolveWolves(huntersInvolved, ui); break; } return resolveNextEncounter; }
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; }
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 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; }
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; } } }
// remove private void PlayTrap(UserInterface ui) { ui.TellUser("Dracula played Trap"); }
private void PlaySecretWeaponBeforeEncounter(int hunterIndex, UserInterface ui) { string line = ""; do { line = ui.GetNameOfItemDiscardedByHunter(Hunters[hunterIndex].Name); } while (GetItemByNameFromItemDeck(line).Name == "Unknown item"); DiscardItemFromHunterAtIndex(line, hunterIndex, ui); do { line = ui.GetNameOfItemRetrievedFromDiscardByHunter(Hunters[hunterIndex].Name); } while (GetItemByNameFromItemDiscard(line).Name == "Unknown item"); Hunters[hunterIndex].ItemsKnownToDracula.Add(GetItemByNameFromItemDiscard(line)); ItemDiscard.Remove(GetItemByNameFromItemDiscard(line)); Hunters[hunterIndex].NumberOfItems++; }
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; }
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); }
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 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"); }
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; }
internal void BlessHunterAtHunterIndex(int hunterIndex, UserInterface ui) { switch (ui.GetHolyWaterResult()) { case 1: Hunters[hunterIndex].Health -= 2; HandlePossibleHunterDeath(ui); break; case 2: break; case 3: Hunters[hunterIndex].NumberOfBites--; if (Hunters[hunterIndex].NumberOfBites < 1) { Hunters[hunterIndex].ItemShownToDraculaForBeingBitten = null; Hunters[hunterIndex].EventShownToDraculaForBeingBitten = null; } break; } }
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); }
// remove internal void DiscardDraculaCardsDownToHandSize(UserInterface ui) { Dracula.DiscardEventsDownTo(this, Dracula.EventHandSize, 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; }
internal void DiscardItemFromHunterAtIndex(string itemName, int hunterIndex, UserInterface ui) { ItemDetail itemToDiscard; if (Hunters[hunterIndex].ItemsKnownToDracula.FindIndex(i => i.Name == itemName) > -1) { itemToDiscard = Hunters[hunterIndex].ItemsKnownToDracula.Find(i => i.Name == itemName); Hunters[hunterIndex].ItemsKnownToDracula.Remove(itemToDiscard); } else { itemToDiscard = GetItemByNameFromItemDeck(itemName); ItemDeck.Remove(itemToDiscard); } if (Hunters[hunterIndex].ItemShownToDraculaForBeingBitten == itemToDiscard) { Hunters[hunterIndex].ItemShownToDraculaForBeingBitten = null; CheckBittenHunterCards(ui); } ItemDiscard.Add(itemToDiscard); Hunters[hunterIndex].NumberOfItems--; if (itemName == "Dogs") { Hunters[hunterIndex].HasDogsFaceUp = false; } Logger.WriteToDebugLog(Hunters[hunterIndex].Name + " discarded " + itemName + " down to " + Hunters[hunterIndex].NumberOfEvents); Logger.WriteToGameLog(Hunters[hunterIndex].Name + " discarded " + itemName + " down to " + Hunters[hunterIndex].NumberOfEvents); }
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); }
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; }
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; }
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; }
private void PlayLocalRumors(int hunterIndex, UserInterface ui) { int locationIndex = -1; do { locationIndex = ui.GetLocationIndexOfEncounterToReveal(); } while (Dracula.LocationTrail[locationIndex] == null && (locationIndex > 5 ? Dracula.Catacombs[locationIndex - 6] == null : true)); LocationDetail locationWhereEncounterIsBeingRevealed; if (locationIndex < 6) { locationWhereEncounterIsBeingRevealed = Dracula.LocationTrail[locationIndex]; } else { locationWhereEncounterIsBeingRevealed = Dracula.Catacombs[locationIndex - 6]; } int encounterToReveal = 0; if (locationWhereEncounterIsBeingRevealed.Encounters.Count() > 0) { encounterToReveal = ui.GetIndexOfEncounterToReveal(); } locationWhereEncounterIsBeingRevealed.Encounters[encounterToReveal].isRevealed = true; DiscardItemFromHunterAtIndex("Local Rumors", hunterIndex, ui); }