Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }