public static List <BaseCriminal> IceAssociateCheck(List <BaseCriminal> crew, List <BaseLocation> locations, bool splitCashMenu) { Console.Clear(); string name = "not empty for a base value"; if (!splitCashMenu) { while (name != "" && crew.Count() > 1) { Console.Clear(); Console.WriteLine(Heading.DisplayIce()); CrewManagement.DisplayCrewInfo(crew); DisplayIceAssociateWarning(crew); name = Console.ReadLine(); // Store the criminal who was iced for use in display BaseCriminal whoWasIced = crew.Find(c => c.Name == name); // Make a new list of criminals WITHOUT the iced crew member List <BaseCriminal> icedCrew = crew.Where(c => c.Name != name || c.IsPlayer == true).ToList(); // Only lower morale if we have iced a crew member if (icedCrew.Count() < crew.Count()) { // Lower the crews morale List <BaseCriminal> newCrew = LowerMoraleFromIce(icedCrew); // Display Who was iced, if not null if (whoWasIced != null) { DisplayWhoWasIced(whoWasIced); } WillCrewMemberRunAfterIce(newCrew, locations); crew = newCrew; } // We didn't type in a name, so return the new crew else { crew = icedCrew; } } } else if (splitCashMenu) { Console.Clear(); Console.WriteLine(Heading.DisplayIce()); CrewManagement.DisplayCrewInfoShortened(crew); DisplayIceAssociateWarning(crew); name = Console.ReadLine(); // Store the criminal who was iced for use in display BaseCriminal whoWasIced = crew.Find(c => c.Name == name); // Make a new list of criminals WITHOUT the iced crew member List <BaseCriminal> icedCrew = crew.Where(c => c.Name != name || c.IsPlayer == true).ToList(); // Only lower morale if we have iced a crew member if (icedCrew.Count() < crew.Count()) { // Lower the crews morale List <BaseCriminal> newCrew = LowerMoraleFromIce(icedCrew); // Display Who was iced, if not null if (whoWasIced != null) { DisplayWhoWasIced(whoWasIced); } newCrew.ForEach(c => { if (c.IsPlayer) { c.PlayerFiredWeapon = true; } }); crew = newCrew; } // We didn't type in a name, so return the new crew, and do not let anyone shoot else { crew = icedCrew.Select(c => { if (c.IsPlayer) { c.PlayerFiredWeapon = false; return(c); } else { return(c); } }).ToList(); } } // If the first check is false, return a crew return(crew); }
public static void WillCrewMemberRunAfterIce(List <BaseCriminal> crew, List <BaseLocation> locations) { // SIMILAR to WillCrewMemberTurnAfterHeist // But this checks EVERY member instead of until one turns List <BaseCriminal> checkedCrew = new List <BaseCriminal>(); List <BaseCriminal> notScaredCrew = new List <BaseCriminal>(); BaseCriminal player = crew.Find(c => c.IsPlayer); int currentCashTotal = player.CrewTotalCash; // Loop through criminals & check their morale checkedCrew = crew.Select(c => { if (!c.IsPlayer) { int morale = c.Morale; // if morale is less than 40, chance to run if (morale <= 40) { BaseCriminal possibleTraitor = c; // Get new random Random r = new Random(); int randFrom100 = r.Next(101); int chance10 = 0; int chance20 = 0; int chance40 = 0; int chance100 = 0; // Based on this member's morale, generate a number by chance if (morale >= 30 && morale <= 40) { chance10 = r.Next(11); } else if (morale >= 20 && morale <= 29) { chance20 = r.Next(21); } else if (morale >= 10 && morale <= 19) { chance40 = r.Next(41); } // Chance100 equals the randomNumber so if they're at that level, they'll always turn else if (morale <= 9) { chance100 = randFrom100; } possibleTraitor = ChanceToRun(chance10, randFrom100, possibleTraitor); possibleTraitor = ChanceToRun(chance20, randFrom100, possibleTraitor); possibleTraitor = ChanceToRun(chance40, randFrom100, possibleTraitor); possibleTraitor = ChanceToRun(chance100, randFrom100, possibleTraitor); return(possibleTraitor); } } return(c); }).ToList(); // Check if any traitors stole cash if (currentCashTotal > 2) { checkedCrew.ForEach(c => { // Did anyone run in fear? if (c.HasRanInFear) { // Reset the cash to the current amount c.CrewTotalCash = currentCashTotal; // Remove 50% of cash currentCashTotal = currentCashTotal - (currentCashTotal / 2); } }); } // Updated everyone's cash amount checkedCrew.ForEach(c => c.CrewTotalCash = currentCashTotal); // Filter only the crew members who didn't run in fear notScaredCrew = checkedCrew.Where(c => c.HasRanInFear == false).ToList(); CrewManagement.ManageCrew(notScaredCrew, locations); }
public static void LevelSelect(List <BaseCriminal> crew, List <BaseLocation> locations) { Color.DefaultGray(); // While there are levels not yet completed, allow user to continue selecting levels List <BaseLocation> locationsLeftToRob = locations.Where(l => l.Completed == false).ToList(); BaseCriminal player = crew.Find(c => c.IsPlayer); while (locationsLeftToRob.Count() > 0) { Console.Clear(); Console.Write(Heading.DisplayPlanning()); CrewManagement.DisplayCrewInfo(crew); Console.WriteLine(LevelArt.DisplayNashville()); if (player.PlayerContactCount == 0 && crew.Count() == 1) { Console.WriteLine("No crew left to manage"); Console.WriteLine("______________________"); Console.WriteLine(""); } else { Console.WriteLine("1) manage crew"); Console.WriteLine("______________"); Console.WriteLine(""); } // Iterate through locations, for those that are not completed, then show those options locations.ForEach(l => { if (!l.Completed) { if (l.Name == "Annoying Neighbor's House") { Console.WriteLine("2) stakeout Annoying Neighbor's House"); } if (l.Name == "Corner Evan-Eleven") { Console.WriteLine("3) stock-up at Corner Evan-Eleven"); } if (l.Name == "Welts Fargo") { Console.WriteLine("4) stakeout Welts Fargo"); } if (l.Name == "Pinnackle National Bank") { Console.WriteLine("5) stakeout Pinnackle National Bank"); } if (l.Name == "Bank of Amereeka") { Console.WriteLine("6) stakeout Bank of Amereeka"); } } }); // IF you have ANY money, option 7 is available if (player.CrewTotalCash > 0) { Console.WriteLine("____________"); Console.WriteLine(""); if (crew.Count() == 1) { Console.WriteLine("7) end heist spree"); } else { Console.WriteLine("7) end heist spree and split cash"); } } // Check to ensure user typed only a number int selection = Menu.MenuInput(7); switch (selection) { case 1: if (player.PlayerContactCount == 0 && crew.Count() == 1) { LevelSelect(crew, locations); } else { CrewManagement.ManageCrew(crew, locations); } break; case 2: // Annoying Neighbor StakeOutLocation(crew, locations, 2); break; case 3: // Evan-Eleven StakeOutLocation(crew, locations, 3); break; case 4: // Welts Fargo StakeOutLocation(crew, locations, 4); break; case 5: // Pinnackle StakeOutLocation(crew, locations, 5); break; case 6: // Amereeka StakeOutLocation(crew, locations, 6); break; case 7: // End game - split cash if (player.CrewTotalCash > 0) { Outro.SplitCash(Outro.PrepCrewForEndGame(crew), locations); } break; } locationsLeftToRob = locations.Where(l => l.Completed == false).ToList(); } Outro.SplitCash(Outro.PrepCrewForEndGame(crew), locations); }
public static void LocationInfo(List <BaseLocation> locations, string locName, List <BaseCriminal> crew) { Color.DefaultGray(); // Get the selected location BaseLocation selectedLoc = locations.Find(l => l.Name == locName); // Display the Stakeout heading Console.WriteLine(Heading.DisplayStakeout()); CrewManagement.DisplayCrewInfo(crew); //Split the difficulty description on the '[' for easier reading List <string> diffDesciptions = selectedLoc.DifficultyDescription.Split("[").ToList(); // Display location info Console.WriteLine($@" {selectedLoc.Image} {selectedLoc.Name} _____ {selectedLoc.Summary} {diffDesciptions[0]} [{diffDesciptions[1]} _____ "); // Options for stakeouts if (selectedLoc.WaitsInVanAvailable >= 1) { if (selectedLoc.WaitsInVanAvailable > 1) { Console.WriteLine($"1) keep watching from van [{selectedLoc.WaitsInVanAvailable} waits left]"); } else { Console.WriteLine($"1) keep watching from van [{selectedLoc.WaitsInVanAvailable} wait left]"); } } else if (selectedLoc.WaitsInVanAvailable == 0) { Console.WriteLine("Come back later to continue staking out from van. You don't wait to raise suspicion."); } Console.WriteLine("2) begin heist"); Console.WriteLine("3) return to planning"); int selection = Menu.MenuInput(3); // Switch based on user input switch (selection) { case 1: LocationInfo(WaitInVan(locations, locName), locName, crew); break; case 2: Heist.CountDown(); Heist.BeginHeist(crew, locations, locName); break; case 3: LevelSelect(crew, locations); break; } }
// Main view for managing crew public static void ManageCrew(List <BaseCriminal> crew, List <BaseLocation> locations) // Must always return the current crew and the current locations { Color.DefaultGray(); List <BaseCriminal> modifiedCrew = crew; DisplayCurrentCrew(modifiedCrew); BaseCriminal player = crew.Find(c => c.IsPlayer); // If only the player is in the crew & player has 0 contacts, return to level select if (crew.Count == 1 && player.PlayerContactCount == 0) { Level.LevelSelect(crew, locations); } Console.WriteLine(); if (player.PlayerContactCount > 0) { Console.WriteLine($"1) recruit an associate [{player.PlayerContactCount} associates available to contact]"); } else if (player.PlayerContactCount == 0) { Console.WriteLine("You've contacted every associate you know."); } if (crew.Count() > 1) { if (player.HasPlayerEncouragedCrew == false) { Console.WriteLine("2) give an encouraging speech"); } else if (player.HasPlayerEncouragedCrew == true) { Console.WriteLine("You can give another speech after a successful heist."); } Console.WriteLine("3) ice crew member"); } ; Console.WriteLine("4) return to planning"); int input = Menu.MenuInput(4); switch (input) { case 1: modifiedCrew = CrewManagement.ModifyCrew(modifiedCrew); ManageCrew(modifiedCrew, locations); break; case 2: if (crew.Count() > 1) { modifiedCrew = EncourageCrew(modifiedCrew, false); } ManageCrew(modifiedCrew, locations); break; case 3: modifiedCrew = Ice.IceCrewMember(modifiedCrew, locations, false); ManageCrew(modifiedCrew, locations); break; case 4: Level.LevelSelect(modifiedCrew, locations); break; } }