Exemplo n.º 1
0
        static public bool ChangePlanets(Planet destination, Planet CurrentPlanet)
        {
            bool travelAble = true;

            if (destination == CurrentPlanet)
            {
                Console.WriteLine("You are already there. . . . .\n" +
                                  " . . . . . . . . . . . . . . . \n" +
                                  " . . . . . . . . . . . . . . . \n" +
                                  " . . . . . . . . . . . . . . . \n" +
                                  "What did I do to deserve to be\n" +
                                  "stuck with you . . . . . . . . ");
                Console.ReadKey();
            }
            double distance = Equations.DistanceTo(destination, CurrentPlanet);
            double time     = Equations.TravelTime(distance);
            var    fuelCost = Game.NewShip.fuelPerLightYear * distance;

            if ((Game.NewShip.currentFuel - fuelCost) <= 0)
            {
                if (Game.NewShip.currentFuel == Game.NewShip.maxFuel)
                {
                    Console.WriteLine("Do you not understand the concept of fuel?\n" +
                                      "Or is it the idea of fuel capacity that seems to elude you?\n" +
                                      "It's not like there's a universe of tiny people powering our ship.\n" +
                                      "Upgrade and try again.");
                    Console.ReadKey();
                }
                else
                {
                    Console.WriteLine("Just like your crush left you on read,\n" +
                                      "you've left the tank on empty.\n" +
                                      "Fill it up and try again.\n\n" +
                                      "Loser.");
                    Console.ReadKey();
                }
                travelAble = false;
            }
            else
            {
                bool gameWin = MiniGame.Minigame();
                if (gameWin == true)
                {
                    Game.NewShip.currentFuel -= fuelCost;
                    Game.NewPlayer.age       += time;
                    UpdateMarketPrices(CurrentPlanet);
                }
                else
                {
                    travelAble = false;
                }
            }
            return(travelAble);
        }
Exemplo n.º 2
0
        public static void PlanetTravelFunction(int planetSel, Planet CurrentPlanet)
        {
            Console.SetCursorPosition((Console.WindowWidth - planetTravel[planetSel].name.Length - 18) / 2, 8);

            Console.WriteLine($"<----    {planetTravel[planetSel].name}    ---->");

            Draw.DrawImage(planetTravel[planetSel].imageFile, (Console.WindowWidth / 2), Console.WindowHeight / 5, 45);

            Console.SetCursorPosition(Console.CursorLeft, 14);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Description: " + planetTravel[planetSel].description);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Inhabitants: " + planetTravel[planetSel].inhabitants);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Travel Distance: " + Equations.DistanceTo(planetTravel[planetSel], CurrentPlanet) + " light years");
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Travel Time: " + Equations.TravelTime(Equations.DistanceTo(planetTravel[planetSel], CurrentPlanet)) + " years");
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Fuel Cost: " + (NewShip.fuelPerLightYear * Equations.DistanceTo(planetTravel[planetSel], CurrentPlanet)));
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Danger Rating: " + planetTravel[planetSel].dangerRating);
            Console.WriteLine();
            Console.WriteLine();
            //if (planetSel == 3)
            //{
            //    Console.WriteLine(planetTravel[4].screamingProduct);
            //}
            //else
            //{
            //    Market displayMarket = planetMarket[planetSel];
            //    double[] displayMarket2 = {displayMarket.air, displayMarket.fur, displayMarket.robot, displayMarket.doors, displayMarket.seeds };

            //    Console.Write("Product Prices: ");

            //    int cursor = Console.CursorTop;
            //    int i = 0;
            //    foreach (var x in displayMarket2)
            //    {
            //        Console.SetCur +;

            PlanetProducePrint(planetSel + 1);
        }
Exemplo n.º 3
0
        public static bool StoryCheck(int wFactor, Planet CurrentPlanet, bool gameFinish)
        {
            bool travelAvailable = true;

            if (NewPlayer.wallet < Actions.UpdateFuelPrice(CurrentPlanet) && NewShip.currentInventory == 0)
            {
                travelAvailable = false;
                foreach (Planet a in Universe.planetTravel)
                {
                    if ((NewShip.currentFuel - (NewShip.fuelPerLightYear * Equations.DistanceTo(a, CurrentPlanet))) > 0)
                    {
                        travelAvailable = true;
                    }
                }
            }
            else if (NewPlayer.age >= 60)
            {
                travelAvailable = false;
            }

            if (travelAvailable == false)
            {
                TextOutput(story_GameOver, gameEnd: true);
                gameFinish = false;
            }
            if (travelAvailable == true)
            {
                if (wFactor >= 1 && NewPlayer.storyTracker == 1)
                {
                    TextOutput(story_1);
                    NewPlayer.storyTracker++;
                }

                else if (wFactor >= 2 && NewPlayer.storyTracker == 2)
                {
                    TextOutput(story_2);
                    NewPlayer.storyTracker++;
                }

                else if (wFactor >= 3 && NewPlayer.storyTracker == 3)
                {
                    TextOutput(story_3);
                    NewPlayer.storyTracker++;
                }

                else if (wFactor >= 4 && NewPlayer.storyTracker == 4)
                {
                    TextOutput(story_4, 300, true);
                    NewPlayer.storyTracker++;
                }

                else if (wFactor >= 5 && NewPlayer.storyTracker == 5)
                {
                    TextOutput(story_5);
                    NewPlayer.storyTracker++;
                }
                else if (wFactor >= 6 && NewPlayer.storyTracker == 6)
                {
                    TextOutput(story_6);
                    NewPlayer.storyTracker++;
                }
                else if (wFactor >= 7 && NewPlayer.storyTracker == 7)
                {
                    TextOutput(story_7);
                    NewPlayer.storyTracker++;
                }
                else if (wFactor >= 8 && NewPlayer.storyTracker == 8)
                {
                    TextOutput(story_8);
                    NewPlayer.storyTracker++;
                }
                else if (wFactor >= 9 && NewPlayer.storyTracker == 9)
                {
                    TextOutput(story_9);
                    TextOutput(story_glitch, 0);
                    TextOutput(story_ending);
                    gameFinish = true;
                }
            }
            return(gameFinish);
        }
Exemplo n.º 4
0
        public static void ShipUpgradesMenu(Planet CurrentPlanet)
        {
            int  selected = 0;
            bool finished = false;

            List <double> upgradePrices = new List <double>()
            {
                Math.Round(Actions.UpdateFuelPrice(CurrentPlanet), 2),
                Equations.UpgradeCost(NewShip.fuelFactor),
                Equations.UpgradeCost(NewShip.fuelEfficiencyFactor),
                Equations.UpgradeCost(NewShip.storageFactor),
                Equations.UpgradeCost(NewShip.warpFactor)
            };

            List <string> upgradeStrings = new List <string>()
            {
                $"Purchase Fuel: #{upgradePrices[0]}",
                $"Increase Fuel Capacity: #{upgradePrices[1]}",
                $"Increase Fuel Efficiency: #{upgradePrices[2]}",
                $"Increase Storage Capacity: #{upgradePrices[3]}",
                $"Increase Warp Factor: #{upgradePrices[4]}"
            };

            List <string> toBuyStrings = new List <string>()
            {
                "more fuel",
                "a larger fuel tank",
                "better fuel efficiency",
                "more inventory space",
                "a faster Warp Factor"
            };

            List <double> upgradeAdds = new List <double>()
            {
                0,
                250,
                10,
                10,
                1
            };

            Console.Clear();
            UserMenu(CurrentPlanet);

            Console.ForegroundColor = ConsoleColor.DarkGreen;
            string upgradeQuestion1 = "Use the UP and DOWN arrow keys to select a ship upgrade " +
                                      ", then press enter.";
            string upgradeQuestion2 = "Press ESC to cancel";

            Console.SetCursorPosition((Console.WindowWidth - upgradeQuestion1.Length) / 2, 6);
            Console.WriteLine(upgradeQuestion1);
            Console.SetCursorPosition((Console.WindowWidth - upgradeQuestion2.Length) / 2, 7);
            Console.WriteLine(upgradeQuestion2);

            (finished, selected) = ListNavigation.scrollList(upgradeStrings, 9, finished);

            int toBuy  = 1;
            int maxBuy = (int)(NewPlayer.wallet / upgradePrices[selected]);

            ConsoleKeyInfo cki;

            Console.TreatControlCAsInput = true;
            if (finished != true)
            {
                do
                {
                    Console.Clear();
                    UserMenu(CurrentPlanet);
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    string howMuch1 = $"So you'd like to buy {toBuyStrings[selected]} for #{upgradePrices[selected]}?";

                    Console.SetCursorPosition((Console.WindowWidth - howMuch1.Length) / 2, 6);
                    Console.WriteLine(howMuch1);

                    if (selected == 0)
                    {
                        do
                        {
                            Console.SetCursorPosition(0, 10);
                            Console.Write("Buy ");
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.BackgroundColor = ConsoleColor.DarkGreen;
                            Console.Write(toBuy);
                            Console.ResetColor();
                            Console.ForegroundColor = ConsoleColor.DarkGreen;
                            Console.Write($" Kerbal gallons of rocket fuel for ");
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.BackgroundColor = ConsoleColor.DarkGreen;
                            Console.Write($"#{toBuy * upgradePrices[selected]}");
                            Console.ResetColor();
                            Console.ForegroundColor = ConsoleColor.DarkGreen;
                            Console.Write("?                                   ");
                            cki = Console.ReadKey(true);
                            switch (cki.Key)
                            {
                            case ConsoleKey.DownArrow:

                                if (toBuy > 0)
                                {
                                    toBuy -= 1;
                                    break;
                                }
                                else
                                {
                                    break;
                                }

                            case ConsoleKey.UpArrow:

                                if (toBuy < maxBuy)
                                {
                                    toBuy += 1;
                                    break;
                                }
                                else
                                {
                                    break;
                                }

                            case ConsoleKey.LeftArrow:

                                if (toBuy > 24)
                                {
                                    toBuy -= 25;
                                    break;
                                }
                                else
                                {
                                    break;
                                }

                            case ConsoleKey.RightArrow:

                                if (toBuy + 24 < maxBuy)
                                {
                                    toBuy += 25;
                                    break;
                                }
                                else
                                {
                                    break;
                                }

                            case ConsoleKey.Escape:
                                finished = true;
                                break;
                            }
                        } while (cki.Key != ConsoleKey.Enter);
                    }
                    else
                    {
                        if (finished != true && NewPlayer.wallet >= upgradePrices[selected])
                        {
                            toBuy             = 1;
                            NewPlayer.wallet -= (upgradePrices[selected] * toBuy);
                            if (selected == 1)
                            {
                                NewShip.maxFuel += upgradeAdds[selected];
                            }
                            else if (selected == 2)
                            {
                                NewShip.fuelPerLightYear -= NewShip.fuelPerLightYear / upgradeAdds[selected]; //reduces fuel/lightyear by 10%
                            }
                            else if (selected == 3)
                            {
                                NewShip.maxInventory += (int)upgradeAdds[selected];
                            }
                            else if (selected == 4)
                            {
                                NewShip.warpFactor += 1;
                            }
                            finished = true;
                        }
                        else
                        {
                            Console.SetCursorPosition(0, 10);
                            Console.WriteLine("You can not afford this upgrade. Keep trading.");
                            Console.ReadLine();
                            finished = true;
                        }
                    }

                    if (finished != true && selected == 0)
                    {
                        if ((Game.NewShip.currentFuel + toBuy) > Game.NewShip.maxFuel)
                        {
                            Console.WriteLine("\nYou can't store that much fuel.");
                            Console.ReadKey();
                            finished = true;
                        }
                        else
                        {
                            NewPlayer.wallet    -= (upgradePrices [selected] * toBuy);
                            NewShip.currentFuel += toBuy;
                            finished             = true;
                        }
                    }
                } while (finished != true);
            }
            Actions.UpdateInventoryTotal();
            Console.Clear();
            UserMenu(CurrentPlanet);
        }