public void CreatePlayer(PlayerCharacter player, PlayerStats stats) { var genderValid = false; var raceValid = false; var jobValid = false; Console.WriteLine("Welcome to CelestialTravels...What is your name?"); player.Name = Console.ReadLine(); Console.WriteLine($"Hello { player.Name} \n"); do { foreach (string gender in Options.Genders) { Console.WriteLine(gender); } Console.WriteLine($"\nWhat is your gender? "); var enteredGender = Console.ReadLine(); if (enteredGender == "Male") { player.Gender = "Male"; Console.WriteLine($"\n{ player.Name} is {player.Gender}\n"); genderValid = true; } else if (enteredGender == "Female") { player.Gender = "Female"; Console.WriteLine($"\n{ player.Name} is {player.Gender}\n"); genderValid = true; } else if (enteredGender == "NonBinary") { player.Gender = "NonBinary"; Console.WriteLine($"\n{ player.Name} is {player.Gender}\n"); genderValid = true; } }while (genderValid == false); do { foreach (string race in Options.Races) { Console.WriteLine(race); } Console.WriteLine("\nWhat is your race?"); var enteredRace = Console.ReadLine(); if (enteredRace == "Lizarian") { player.Race = "Lizarian"; Console.WriteLine($"\n{ player.Name} is a {player.Gender} {player.Race}\n"); raceValid = true; } else if (enteredRace == "Cepholarian") { player.Race = "Cepholarian"; Console.WriteLine($"\n{ player.Name} is a {player.Gender} {player.Race}\n"); raceValid = true; } else if (enteredRace == "Fuzzarian") { player.Race = "Fuzzarian"; Console.WriteLine($"\n{ player.Name} is a {player.Gender} {player.Race}\n"); raceValid = true; } }while (raceValid == false); do { foreach (string job in Options.Jobs) { Console.WriteLine(job); } Console.WriteLine("\nWhat is your job?"); var enteredJob = Console.ReadLine(); if (enteredJob == "Navigator") { player.Job = "Navigator"; Console.WriteLine($"\n{ player.Name} is a {player.Gender} {player.Race} {player.Job}\n"); player.NavigationSkill += 5; if (player.Race == "Lizarian") { Console.WriteLine($"{player.Name} the Navi >*^,^,^~~~"); } Console.WriteLine("NavigationSkill +5\n"); stats.PrintPlayerStats(player); Console.WriteLine("Return any key to continue..."); Console.ReadLine(); jobValid = true; } else if (enteredJob == "Gunslinger") { player.Job = "Gunslinger"; Console.WriteLine($"\n{ player.Name} is a {player.Gender} {player.Race} {player.Job}\n"); player.WeaponSkill += 5; Console.WriteLine("WeaponSkill +5\n"); stats.PrintPlayerStats(player); Console.WriteLine("Return any key to continue..."); Console.ReadLine(); jobValid = true; } else if (enteredJob == "Timebender") { player.Job = "Timebender"; Console.WriteLine($"\n{ player.Name} is a {player.Gender} {player.Race} {player.Job}\n"); player.TimeSkill += 5; Console.WriteLine("TimeSkill +5\n"); stats.PrintPlayerStats(player); Console.WriteLine("Return any key to continue..."); Console.ReadLine(); jobValid = true; } }while (jobValid == false); }
public void DoFight(PlayerCharacter player, Monster whiteMonster, PlayerStats stats, Inventory playerInventory) { var roller = new Roller(); var monster = whiteMonster; var fightOver = false; Character winner = player; Character looser = player; PreBattleRoll(roller, player, monster, out Character attacker, out Character defender); while (fightOver == false) { // Select Weapon ChooseWeaponToAttackWith(attacker, player, playerInventory); // Rolling attacker.Roll = roller.GetRandomNumber(1, 12); Console.WriteLine("attacker's roll " + attacker.Roll + "\n"); // Calculate Damage var damage = (attacker.Roll / 10) * attacker.Attack; Console.WriteLine("Damage " + (damage) + "\n"); // Apply damage to defender defender.CurrentHitPoints = defender.CurrentHitPoints - damage; Console.WriteLine("Defender's HP " + defender.CurrentHitPoints + "\n"); Console.ReadLine(); // End fight and declare winner or switch roles if (defender.CurrentHitPoints <= 0) { // End the fight fightOver = true; winner = attacker; looser = defender; } else { // Switch roles var temporaryCharacter = attacker; attacker = defender; defender = temporaryCharacter; Console.WriteLine("the Attacker is now " + attacker.Name + "\n"); } } // Post battle stuff. if (winner.Name == player.Name) { player = (PlayerCharacter)winner; player.Experience += looser.TotalHitPoints; player.CurrentHitPoints = player.TotalHitPoints; Console.WriteLine("YOU ARE A WINNER"); Console.WriteLine("You received " + looser.TotalHitPoints + " Experience Points."); stats.PrintPlayerStats(player); } else { player = (PlayerCharacter)looser; Console.WriteLine("YOU ARE A LOOSER!"); } }