public void ShadowShot(Jedi hero) { if (hero == null || hero.Health < 1) { Console.WriteLine($"{Name}'s attack failed"); Console.WriteLine(" "); } else { Random rand = new Random(); int damage = rand.Next(35, 55); Console.WriteLine($"{Name} is attacking..."); Console.WriteLine($"{Name} attacked {hero.Name} with shadow shot"); hero.Health -= damage; Console.WriteLine($"{Name} dealt {damage} health damage"); Console.WriteLine(" "); if (hero.Health > 0) { Console.WriteLine($"{hero.Name} has {hero.Health} health remaining"); Console.WriteLine(" "); } else { Console.WriteLine($"{hero.Name} has benn eliminated from the battlefield"); } Console.WriteLine("Press enter to continue..."); Console.ReadLine(); } }
public void Attack(Jedi hero) { if (hero == null || hero.Health < 1) { Console.WriteLine($"{Name}'s attack failed"); Console.WriteLine(" "); } else { int damage = Strength * 5; Console.WriteLine($"{Name} attacked {hero.Name} with blaster rifle"); hero.Health -= damage; Console.WriteLine($"{Name} dealt {damage} damage"); Console.WriteLine(" "); if (hero.Health > 0) { Console.WriteLine($"{hero.Name} has {hero.Health} health remaining"); Console.WriteLine(" "); } else { Console.WriteLine($"{hero.Name} has benn eliminated from the battlefield"); } Console.WriteLine("Press enter to continue..."); Console.ReadLine(); } }
// create a system where the user selects an action to perform public static string UserActionSelection(Jedi jedi) { Console.WriteLine($"It is {jedi.Name}'s turn..."); Console.WriteLine(" "); jedi.DisplayStats(); Console.WriteLine(" "); Console.WriteLine($"Enter the number of the action {jedi.Name} should use?"); List <string> actionList = jedi.Actions(); for (int i = 0; i < actionList.Count; i++) { Console.WriteLine($"{i} - {actionList[i]} "); } Console.WriteLine(" "); string inputAttack = Console.ReadLine(); return(inputAttack); }
public void BlasterCannon(Jedi hero) { int damage = Strength * 4; Console.WriteLine($"{Name} attacked {hero.Name} with blaster cannon"); hero.Health -= damage; Console.WriteLine($"{Name} dealt {damage} damage"); Console.WriteLine(" "); if (hero.Health > 0) { Console.WriteLine($"{hero.Name} has {hero.Health} health remaining"); Console.WriteLine(" "); } else { Console.WriteLine($"{hero.Name} has benn eliminated from the battlefield"); } Console.WriteLine("Press enter to continue..."); Console.ReadLine(); }