public void BuyTV(int currentPlanetTV, PersonalStatus PS, UtilityMethods UM, Ship ship, Fuel fuel) { Console.Clear(); UM.InventoryDisplay(PS, ship, fuel); Console.WriteLine($"" + $"How many Galactic TVs would you like to buy for {currentPlanetTV} GC?"); int quantity = Convert.ToInt32(Console.ReadLine()); if ((quantity + PS.SpaceGold + PS.NoBalanaceShoes + PS.GalacticTVs) > ship.ShipCapacity) { Console.WriteLine($"" + $"You don't have enough room for that many Galactic TVs, you can only" + $" buy {(ship.ShipCapacity - (PS.SpaceGold + PS.NoBalanaceShoes + PS.GalacticTVs))}\n" + $"Press <enter> to return..."); Console.ReadLine(); return; } if ((quantity * currentPlanetTV) > PS.Cash()) { Console.WriteLine($"" + $"You can't afford that many Galactic TVs\n" + $"Press <enter> to return..."); Console.ReadLine(); return; } PS.SpendMoney(quantity * currentPlanetTV); PS.GalacticTVs += quantity; Console.WriteLine($"" + $"You have bought {quantity} bars of Space Gold for {(quantity * currentPlanetTV)} GC.\n" + $"You now have {PS.Cash()} GC and {PS.GalacticTVs} Galactic TVs."); Console.ReadLine(); return; }
public void BuyFuel(PersonalStatus PS, Ship ship) { Console.WriteLine($"Your current fuel level is: {MyCurrentFuel}, fuel costs 5 GC per unit. How much fuel would you like to buy?"); try { int response = Convert.ToInt32(Console.ReadLine()); if (response * 5 > PS.Cash()) { Console.WriteLine($"You can't afford that much fuel. You can only afford {PS.Cash() / 5}"); Console.ReadLine(); BuyFuel(PS, ship); } if (response + MyCurrentFuel > ship.ShipFuelMax) { Console.WriteLine($"You dont have the capacity for that, You are ready have {MyCurrentFuel} and only a max of {ship.ShipFuelMax}"); Console.ReadLine(); BuyFuel(PS, ship); } if (response + MyCurrentFuel <= ship.ShipFuelMax && response * 5 <= PS.Cash()) { MyCurrentFuel += response; PS.SpendMoney(response * 5); Console.WriteLine($"You now have {MyCurrentFuel} amount of fuel.\n" + $"It cost {response * 5} you now have {PS.Cash()}"); return; } else { return; } } catch { return; } }
// travel between the stars can be dangerous public void Travel(PersonalStatus ps) { int travelEvent = rnd.Next(1, 11); Console.Clear(); Console.WriteLine("3...\n2...\n1...\nBlast Off!!"); Console.ReadLine(); Console.Clear(); Console.WriteLine("" + " * . * \n" + " #===> * . \n" + " * * *"); Console.ReadLine(); Console.Clear(); Console.WriteLine("" + " * . . * . \n" + " * ###===> . * \n" + " . . * * \n"); Console.ReadLine(); //random event if (travelEvent > 5) { Console.WriteLine("You found some space gold out there!"); if ((ps.SpaceGold + ps.NoBalanaceShoes + ps.GalacticTVs + 1) > ship.ShipCapacity) { Console.WriteLine("You dont have enough room for it though. Sad day..."); Console.ReadLine(); } if ((ps.SpaceGold + ps.NoBalanaceShoes + ps.GalacticTVs + 1) <= ship.ShipCapacity) { ps.SpaceGold += 1; Console.WriteLine($"You now have {ps.SpaceGold} space gold"); Console.ReadLine(); } } if (travelEvent == 5) { Console.WriteLine($"It's lonely out there in space {ps.NameCall()}. You are doing great! Keep it up!"); Console.ReadLine(); } if (travelEvent < 5 && travelEvent > 1) { if (ps.Cash() < 10) { Console.WriteLine("The Pirates killed you because you couldnt pay their 10 GC toll."); Console.ReadLine(); GO.Died(ps, ship); } else { Console.WriteLine("Pirate attack! You lost 10 GC to them"); } ps.SpendMoney(10); Console.WriteLine($"You now have {ps.Cash()} GCs"); Console.ReadLine(); } if (travelEvent == 1) { Console.WriteLine($"The galaxies worst pirates attack you but you easily overpower them. \n" + $"'Please don't kill us {ps.NameCall()}, we will give you 100 GC if you let us go!' \n" + $"You let them off easy this time..."); ps.EarnMoney(100); Console.ReadLine(); } Console.ReadLine(); Console.Clear(); Console.WriteLine("" + " * * . * \n" + " * . ###===> . * \n" + " * . . * "); Console.ReadLine(); Console.Clear(); Console.WriteLine("" + " * . \n" + " * . ###===>\n" + " * * . . "); Console.ReadLine(); }
public void PurchaseShip(PersonalStatus PS, Ship ship, UtilityMethods UM, Fuel fuel) { Console.Clear(); UM.InventoryDisplay(PS, ship, fuel); //display the users current ship and credits. Ship selections with price Console.WriteLine($"\n\n" + $"\tYou currently own the {ship.ShipName}, which is a great ship, but it's time to upgrade... \n" + $"\tWhat ship are you looking to hop in today?\n" + $"\tYou currently have {PS.Cash()} credits\n" + $"\t 1 The Interstellar Connex 600 GCs\n" + $"\t 2 The StarWagon 1200GCs"); //convert response to numeric value of type int try { int shipUpgrade = Convert.ToInt32(Console.ReadLine()); //If buying the interstellar if (shipUpgrade == 1 && PS.Cash() >= 600) { string myShipUpgrade = "The Interstellar Connex"; Console.Clear(); Console.WriteLine($"You chose the {myShipUpgrade}! That's a great choice. \n" + $"It has a capacity of {ship.InterstellarConnexCapacity} slots. This is our biggest ship! " + $"\nWith a max warp speed of" + $" {ship.InterstellarConnexSpeed}. "); Console.ReadLine(); //ask if user is sure of purchase Console.WriteLine("Would you like to complete this purchase? \nyes or no?"); //user response string userShipAnswer = Console.ReadLine(); //execute the purchase if (userShipAnswer == "yes") { ship.ShipSpeed = ship.InterstellarConnexSpeed; ship.ShipCapacity = ship.InterstellarConnexCapacity; ship.ShipName = myShipUpgrade; //subtract credit after purchase PS.SpendMoney(600); //display ship bought and remaining credit Console.WriteLine($"Congratulations on your new ship purchase! " + $"You now own the {ship.ShipName} and have {PS.Cash()} remaining"); Console.ReadLine(); return; } //stop the purchase else { return; } } //stop purchase. not enough credits if (shipUpgrade == 1 && PS.Cash() < 600) { Console.WriteLine("You do not have enough credits to complete this purchase!"); Console.ReadLine(); return; } //if buying the starwagon if (shipUpgrade == 2 && PS.Cash() >= 1200) { //initialize ship string myShipUpgrade = "The StarWagon"; Console.Clear(); //summary of ship(speed, name, and capacity) Console.WriteLine($"\n\n" + $"\tYou chose the {myShipUpgrade}! That's a great choice. \n" + $"\tIt has a capacity of {ship.StarWagonCapacity} slots.\n" + $"\tWith a max warp speed of {ship.StarWagonSpeed}. This is our fastest ship by far!"); //press enter Console.ReadLine(); //confirm purchase Console.WriteLine("\n\nWould you like to complete this purchase? \nyes or no?"); string userShipAnswer = Console.ReadLine(); //after purchase is confirmed subtract credits if (userShipAnswer == "yes") { ship.ShipName = myShipUpgrade; ship.ShipCapacity = ship.StarWagonCapacity; ship.ShipSpeed = ship.StarWagonSpeed; PS.SpendMoney(1200); //display ship purchased and remaining credits Console.Clear(); Console.WriteLine($"Congratulations on your new ship purchase! You now own the {ship.ShipName} " + $"\nand have {PS.Cash()} credits remaining"); Console.ReadLine(); return; } //stop purchase else { return; } } //stop purchase if (shipUpgrade == 2 && PS.Cash() < 1200) { Console.WriteLine("You do not have enough credits to complete this purchase!"); Console.ReadLine(); return; } } catch { return; } }