public void TravelToSpacePort(PlayerCharacter player, SpacePort spacePort, Travel travel, SolarSystem solarSystem, Planet planet, JumpGate jumpGate, OptionSelector optionSelector) { // I think this is where I need to use the interface for options. //optionSelector.GetOption<SpacePort>(); player.Location = spacePort; spacePort.SpacePortOptions(player, planet, travel, solarSystem, spacePort, jumpGate); Console.WriteLine("You are now in " + player.Location.Name); }
public static void Main(string[] args) { // Fighting things Creation var fight = new Fight(); var playerAttackCalculator = new PlayerAttackCalculator(); var roller = new Roller(); // Player Creation var player = new PlayerCharacter(); player.Name = "Player01"; player.CurrentHitPoints = 100; player.TotalHitPoints = 100; player.WeaponSkill = 1; var stats = new PlayerStats(); var playerCreater = new PlayerCreator(); var playerInventory = new Inventory(); var diamondDrive = new DiamondDrive(); // Story Creation var story = new Story(); // Factory Creation var monsterMaker = new MonsterMaker(); var weaponMaker = new WeaponMaker(); // Solar System Creation var alpha = new SolarSystem("Alpha", "Universe"); ////alpha.Name = "Alpha"; ////alpha.Location = "Universe"; // not a constructor but initialization syntax var beta = new SolarSystem { Name = "Beta", Location = "Universe", }; ////alpha.Name = "Beta"; ////alpha.Location = "Universe"; var gamma = new SolarSystem(); alpha.Name = "Gamma"; alpha.Location = "Universe"; // JumpGate Creation var jumpGateAlpha = new JumpGate(); jumpGateAlpha.Name = "Jump Gate Alpha"; jumpGateAlpha.Location = "Alpha"; var jumpGateBeta = new JumpGate(); jumpGateAlpha.Name = "Jump Gate Beta"; jumpGateAlpha.Location = "Beta"; var jumpGateGamma = new JumpGate(); jumpGateAlpha.Name = "Jump Gate Gamma"; jumpGateAlpha.Location = "Gamma"; // Planet Creation var brettopia = new Planet(); brettopia.Name = "Brettopia"; brettopia.Location = "Alpha"; var kathaven = new Planet(); brettopia.Name = "Kathaven"; brettopia.Location = "Alpha"; var libraria = new Planet(); brettopia.Name = "Libraria"; brettopia.Location = "Alpha"; // SpacePort creation var spacePortBrettopia = new SpacePort(); spacePortBrettopia.Name = "Space Port Brettopia"; spacePortBrettopia.Location = "Brettopia"; var spacePortKathaven = new SpacePort(); spacePortBrettopia.Name = "Space Port Kathaven"; spacePortBrettopia.Location = "Brettopia"; var spacePortLibraria = new SpacePort(); spacePortBrettopia.Name = "Space Port Libraria"; spacePortBrettopia.Location = "Brettopia"; // Instance Creation // Travel/Map Creation var travel = new Travel(); var universeMap = new UniverseMap(); var playerMap = new PlayerMap(); var optionSelector = new OptionSelector(); // Alpha Maps var alphaMap = new Map(); alphaMap.Name = "Alpha"; // this is the null exception right here alphaMap.SolarSystem.Add(alpha); // this probably, name should be fine. Did you new up a list before adding a solarsystem? alphaMap.JumpGates.Add(jumpGateAlpha); // shit that is probably it. Forgot I had to new up those damn lists alphaMap.Planets.Add(brettopia); // as a matter of practice I generally just new up a list whenever I make the property. There is very rarely ever a good reason to have a null list. A collection is generally empty or not. I wish they built it into the language actually. alphaMap.Planets.Add(kathaven); alphaMap.Planets.Add(libraria); alphaMap.SpacePorts.Add(spacePortBrettopia); alphaMap.SpacePorts.Add(spacePortKathaven); alphaMap.SpacePorts.Add(spacePortLibraria); // Beta Maps var betaMap = new Map(); betaMap.Name = "Beta"; betaMap.SolarSystem.Add(beta); betaMap.JumpGates.Add(jumpGateBeta); // Gamma Maps var gammaMap = new Map(); gammaMap.Name = "Gamma"; gammaMap.SolarSystem.Add(gamma); gammaMap.JumpGates.Add(jumpGateGamma); // Universe Map filled out universeMap.UniverseMaps.Add(alphaMap); universeMap.UniverseMaps.Add(betaMap); universeMap.UniverseMaps.Add(gammaMap); var selector = new OptionSelector(); var selectedMapId = selector.GetOption <Map>(universeMap.UniverseMaps); // Monster Creation var whiteMonster01 = monsterMaker.CreateWhiteMonster(player); var whiteMonster02 = monsterMaker.CreateWhiteMonster(player); var whiteMonster03 = monsterMaker.CreateWhiteMonster(player); var greenMonster01 = monsterMaker.CreateGreenMonster(player); var greenMonster02 = monsterMaker.CreateGreenMonster(player); var greenMonster03 = monsterMaker.CreateGreenMonster(player); var redMonster01 = monsterMaker.CreateRedMonster(player); var redMonster02 = monsterMaker.CreateRedMonster(player); var redMonster03 = monsterMaker.CreateRedMonster(player); whiteMonster01.Attack = 10; // This is the Quality Assurance section for temporary testing //Console.WriteLine("monster health" + whiteMonster01.CurrentHitPoints); //Console.WriteLine("monster attack" + whiteMonster01.Attack); //Console.ReadLine(); //stats.PrintPlayerStats(player); //Console.WriteLine(roller.GetRandomNumber(1, 100)); //Console.WriteLine(whiteMonster01.CurrentHitPoints); //fight.DoFight(player, whiteMonster01, stats); //weaponMaker.CreateWeaponBlaster(playerInventory); //weaponMaker.CreateWeaponDoubleBlaster(playerInventory); //weaponMaker.CreateWeaponPhotonSword(playerInventory); //fight.DoFight(player, whiteMonster01, stats, playerInventory); //playerInventory.WeaponEnumerator(); universeMap.EnumerateJumpGates(); //spacePortBrettopia.SpacePortOptions(player, brettopia, travel, alpha, spacePortBrettopia); //Player creation part. playerCreater.CreatePlayer(player, stats); // The story begins story.TheBegining01(player, playerInventory, weaponMaker, playerMap, alphaMap, travel, spacePortBrettopia, alpha, brettopia, jumpGateAlpha); Console.WriteLine("Time for your first battle! \n"); fight.DoFight(player, whiteMonster01, stats, playerInventory); }
public void TheBegining01(PlayerCharacter player, Inventory playerInventory, WeaponMaker weaponMaker, PlayerMap playerMap, Map alphaMap, Travel travel, SpacePort spacePort, SolarSystem solarSystem, Planet planet, JumpGate jumpGate) { // need to fix the formating of all this text Console.WriteLine("After a childhood of loving protection, and peace, an evil race of Space Sharks have/n shown up at your home planet of" + "Fae. In their invasion they have decapitated your parents, disembowled your siblings, and stolen everything you ever had. You are" + "left to torment, and starvation in a blood bath."); Console.WriteLine("Return to continue..."); Console.ReadLine(); Console.WriteLine("After the carnage, a pilot shows up to find you. He shepards you onto his spaceship " + "and flies you to the Capital, Brettopia, where you are presented to the Space King of Knowledge."); Console.WriteLine("Return to continue..."); Console.ReadLine(); Console.WriteLine($"SPACE KING BRETT: Young { player.Name} I have heard the tale of your strife at the hand of " + "the Space Sharks. I weep for your misfortune. I would avenge your family for you, but our vast " + "library, The Great Database, does not have the knowledge needed to combat the cruel and ruthless " + "Space Sharks. I task you to become a noble Space Knight of Knowledge, and seek the data we need " + "to combat this oppressive enemy. To help you on your travels, I shall grant you 3 things...First " + "I will give you a DiamondDrive in which you will collect as much Data as you can find. Second I will give " + "you a space map of our SolarSytem so you may navigate on your quest for Data. And finally I shall send " + "with you my most trusted advisor... Mr. Piddles. Go forth, collect the data, and find a way to defeat " + "the cruel Space Sharks!\n"); Console.WriteLine("Return to continue..."); Console.ReadLine(); Console.WriteLine("You gratefully accept your quest, thank the king, and begin to leave with Mr. Piddles. " + "when you are almost to the door the pilot who found you stops you.\n"); Console.WriteLine("Return to continue..."); Console.ReadLine(); Console.WriteLine($"PILOT: {player.Name} you will need 3 more things on your journey. Here take my Blaster to " + $"protect yourself and smite your enemies. You will also need some Credits and a Map if you are going to venture " + $"across the stars\n"); Console.WriteLine(@"Hey thanks for the Cash, Map and Gun man!"); // Weapon Made/Received weaponMaker.CreateWeaponBlaster(playerInventory); // Map Received playerMap.PlayerMaps.Add(alphaMap); if (player.Credits < 100) { player.Credits += 100; } Console.WriteLine($"{player.Name} has {player.Credits} Credits\n"); Console.WriteLine($"{player.Name} has received the map for Alpha solar system"); Console.WriteLine("Return to continue..."); Console.ReadLine(); Console.WriteLine($"{player.Name.ToUpper()}: Come on Mr. Piddles, Let's go Shark hunting!"); Console.WriteLine("Return to continue..."); Console.ReadLine(); Console.WriteLine("MR. PIDDLES: Meow meow meow, meow meow meow meow!\n"); Console.WriteLine("Return to continue..."); Console.ReadLine(); travel.TravelToSpacePort(player, spacePort, travel, solarSystem, planet, jumpGate); }
public void SpacePortOptions(PlayerCharacter player, Planet planet, Travel travel, SolarSystem solarSystem, SpacePort spacePort, JumpGate jumpGate) { string playerSelection; Console.WriteLine("You are in " + spacePort.Name); Console.WriteLine("0) Save Game (Not yet implimented)"); Console.WriteLine("1) Load Game (Not yet implimented)"); Console.WriteLine("2) Quit Game (Not yet impliment)"); Console.WriteLine("3) Buy Consumable (Not yet implimented)"); Console.WriteLine("4) Repair (Not yet implimented)"); Console.WriteLine("5) Go to instance01 (Not yet implimented)"); Console.WriteLine("6) Go to instance02 (Not yet implimented)"); Console.WriteLine("7) Go to instance03 (Not yet implimented)"); Console.WriteLine("8) Travel to SpacePort in solar system (Not yet implimented)"); Console.WriteLine("9) Travel to JumpGate in solar system (Not yet implimented)"); Console.WriteLine(); Console.WriteLine("Please enter your selection"); playerSelection = Console.ReadLine(); switch (playerSelection) { case "0": // save game method here Console.WriteLine("Game Saved (not really)"); break; case "1": // load game method here Console.WriteLine("Game Loaded (not really)"); break; case "2": // quit game method here Console.WriteLine("Game Quit (not really)"); break; case "3": // open store method here Console.WriteLine("Store Loaded (not really)"); break; case "4": // repair method here Console.WriteLine("Stuff Repaired (not really)"); break; case "5": // TravelToInstance method here Console.WriteLine("Instance01 Loaded (not really)"); break; case "6": // TravelToInstance method here Console.WriteLine("Instance02 Loaded (not really)"); break; case "7": // TravelToInstance method here Console.WriteLine("Instance03 Loaded (not really)"); break; case "8": // TravelToSpacePorts method here (this line will be the caller) travel.TravelToSpacePort(player, spacePort, travel, solarSystem, planet, jumpGate); Console.WriteLine("Travel to JumpGate (not really)"); break; case "9": // TravelToJumpGate method here travel.TravelToJumpGate(player, solarSystem, jumpGate, planet, travel, spacePort); Console.WriteLine("Travel to JumpGate (not really)"); break; } }
public void JumpGateOptions(PlayerCharacter player, Planet planet, Travel travel, SolarSystem solarSystem, SpacePort spacePort, JumpGate jumpGate) { string playerSelection; Console.WriteLine("You are in " + jumpGate.Name); Console.WriteLine("0) Travel to JumpGate in another SolarSystem (Not yet implimented)"); Console.WriteLine("1) Travel to Planet in this SolarSystem (Not yet implimented)"); playerSelection = Console.ReadLine(); switch (playerSelection) { case "0": // TravelToJumpGate method here travel.TravelToJumpGate(player, solarSystem, jumpGate, planet, travel, spacePort); Console.WriteLine("Travel to JumpGate (not really)"); break; case "1": // TravelToSpacePort method here travel.TravelToSpacePort(player, spacePort, travel, solarSystem, planet, jumpGate); Console.WriteLine("Game Loaded (not really)"); break; } }
public void TravelToJumpGate(PlayerCharacter player, SolarSystem solarSystem, JumpGate jumpGate, Planet planet, Travel travel, SpacePort spaceport) { player.Location = solarSystem; Console.WriteLine("you are now in " + player.Location.Name); jumpGate.JumpGateOptions(player, planet, travel, solarSystem, spaceport, jumpGate); }