public override double DecideToPurchase(Day day, double sellPrice, Random rng, Player player)
 {
     if (day.weather.actualTemperature >= 78)
     {
         int lowerThreshold = 0;
         int upperThreshold = 101;
         WillBuyChance = 40;
         int purchaseChance = rng.Next(lowerThreshold, upperThreshold);
         if (purchaseChance <= WillBuyChance)
         {
             if (player.inventory.stockCups <= 0 || player.inventory.stockIce <= 0)
             {
                 Console.WriteLine("Sold Out");
                 return(0.00);
             }
             else
             {
                 Console.WriteLine("Yum");
                 player.inventory.stockCups -= 1;
                 player.inventory.stockIce  -= player.recipe.icePerCup;
                 return(sellPrice);
             }
         }
         else
         {
             Console.WriteLine("No Thanks");
             return(0.00);
         }
     }
     if (day.weather.actualOvercast == "Sunny")
     {
         int lowerThreshold = 0;
         var upperThreshold = 101;
         WillBuyChance = 40;
         int purchaseChance = rng.Next(lowerThreshold, upperThreshold);
         if (purchaseChance <= WillBuyChance)
         {
             if (player.inventory.stockCups <= 0 || player.inventory.stockIce <= 0)
             {
                 Console.WriteLine("Sold Out");
                 return(0.00);
             }
             else
             {
                 Console.WriteLine("Yum");
                 player.inventory.stockCups -= 1;
                 player.inventory.stockIce  -= player.recipe.icePerCup;
                 return(sellPrice);
             }
         }
         else
         {
             Console.WriteLine("Not Today, buddy");
             return(0.00);
         }
     }
     else if (day.weather.actualOvercast == "Rainy")
     {
         int lowerThreshold = 0;
         int upperThreshold = 101;
         WillBuyChance = 3;
         int purchaseChance = rng.Next(lowerThreshold, upperThreshold);
         if (purchaseChance <= WillBuyChance)
         {
             if (player.inventory.stockCups <= 0 || player.inventory.stockIce <= 0)
             {
                 Console.WriteLine("Sold Out");
                 return(0.00);
             }
             else
             {
                 Console.WriteLine("Yum");
                 player.inventory.stockCups -= 1;
                 player.inventory.stockIce  -= player.recipe.icePerCup;
                 return(sellPrice);
             }
         }
         else
         {
             Console.WriteLine("No Thanks");
             return(0.00);
         }
     }
     else
     {
         WillBuyChance = 20;
         int lowerThreshold = 0;
         int upperThreshold = 101;
         int purchaseChance = rng.Next(lowerThreshold, upperThreshold);
         if (purchaseChance <= WillBuyChance)
         {
             if (player.inventory.stockCups <= 0 || player.inventory.stockIce <= 0)
             {
                 Console.WriteLine("Sold Out");
                 return(0.00);
             }
             else
             {
                 Console.WriteLine("Yum");
                 player.inventory.stockCups -= 1;
                 player.inventory.stockIce  -= player.recipe.icePerCup;
                 return(sellPrice);
             }
         }
         else
         {
             Console.WriteLine("Not Today, buddy");
             return(0.00);
         }
     }
 }
Exemple #2
0
        void PlayGameMenuInput()
        {
            Console.Clear();
            CheckForGameOver();

            for (int i = 0; i < daysToPlay; i++)
            {
                playMenuLoop = true;
                Day day = new Day();
                weather     = day.weather;
                temperature = day.temperature;

                while (playMenuLoop == true)
                {
                    Console.Clear();
                    UserInterface.WeatherDisplay(dayCount, weather, temperature);
                    UserInterface.DrawPlayMenu();
                    captureInput = Console.ReadLine();
                    while (captureInput != "1" && captureInput != "2" && captureInput != "3" && captureInput != "4" && captureInput != "5" && captureInput != "6" && captureInput != "7")
                    {
                        Console.Clear();
                        UserInterface.InputErrorDisplay();
                        UserInterface.WeatherDisplay(dayCount, weather, temperature);
                        UserInterface.DrawPlayMenu();
                        captureInput = Console.ReadLine();
                    }
                    if (captureInput == "1")
                    {
                        BuyIngredients();
                    }
                    else if (captureInput == "2")
                    {
                        SellIngredients();
                    }
                    else if (captureInput == "3")
                    {
                        SetRecipe();
                    }
                    else if (captureInput == "4")
                    {
                        SetLemonadePrice();
                    }
                    else if (captureInput == "5")
                    {
                        for (int j = 0; j < player.inventory.items.Count; j++)
                        {
                            if (playerLemonadePrice == 0)
                            {
                                UserInterface.CantSellWithoutPrice();
                                break;
                            }
                            else if (player.inventory.items[j].recipeQuantity == 0)
                            {
                                UserInterface.CantSellWithoutRecipe();
                                break;
                            }
                            else if (player.inventory.items[j].quantity < player.inventory.items[j].recipeQuantity)
                            {
                                UserInterface.CantSellWithoutItems();
                                break;
                            }
                            else
                            {
                                SellLemonade();
                                playMenuLoop = false;
                                dayCount++;
                                break;
                            }
                        }
                    }
                    else if (captureInput == "6")
                    {
                        ViewInventory();
                    }
                    else if (captureInput == "7")
                    {
                        Environment.Exit(0);
                    }
                }
            }
        }