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); }