//Overload for attack, since it has one parameter, it's signature is different than the regular Attack. public int Attack(IAdversary guyWereFighting) { Random r = new Random(); int weaponDamage = r.Next(EquipedWeapon.MinDamage, EquipedWeapon.MaxDamage + 1); int ActualDamage = weaponDamage + this.Mass; ActualDamage -= guyWereFighting.Defense; return(ActualDamage); }
public static void RegularFight(LilCletus lilCleet, IAdversary Bloke) { Console.WriteLine($"A wildly aggressive {Bloke.Name} appears!"); while (true) { Console.WriteLine($"You have {Bloke.Health} health left"); Console.WriteLine("What are you going to do about it?\n" + "\n1 Bash him in\n" + "\n2 Super run away"); string response = Console.ReadLine(); int cleetdmg = 0; int blokedmg = 0; if (response == "1") { cleetdmg = lilCleet.Attack(); blokedmg = Bloke.Attack(); } else if (response == "2") { Random r = new Random(); int flipACoin = r.Next(1, 3); if (flipACoin == 2) { Console.WriteLine("You trip and fall over your own Cleet feet"); cleetdmg = 0; blokedmg = Bloke.Attack(); } else { Console.WriteLine("You scuttled off"); break; } } else { Console.WriteLine("Enter a number between 1 and 2. You life is at stake here."); Console.ReadKey(); } Console.WriteLine($"You did {cleetdmg.ToString()}\n" + $"{Bloke.Name} did {blokedmg.ToString()}"); lilCleet.Health -= blokedmg; Bloke.Health -= cleetdmg; if (lilCleet.Health <= 0 || Bloke.Health <= 0) { if (lilCleet.Health <= 0) { Console.WriteLine("YOU DIED"); } else { Console.WriteLine($"{Bloke.Name} has been defeated. You bashed his fookin' head in I swear on me mum"); } break; } ConsoleStuff.Break(); } }
//for regular blow for blow battles public static void RegularFight(LilCleetus lilCleet, IAdversary bloke) { Console.WriteLine($"You've been confronted with {bloke.Name}, they don't look friendly"); bool isRunning = true; while (isRunning) { Console.WriteLine($"You have {lilCleet.Health} health"); Console.WriteLine("What would you like to do?\n" + "\n1. Attack that sucka" + "\n2. Let's get out of here (run)"); string response = Console.ReadLine(); int yourDamage = 0; int theirDamage = 0; if (response == "1") { //damage is calculated here for yourDamage = lilCleet.Attack(); theirDamage = bloke.Attack(); } else if (response == "2") { //you get a %50 chance to run. Random r = new Random(); int flipACoin = r.Next(1, 3); if (flipACoin == 2) { Console.WriteLine("If you want to run so much, learn to run."); yourDamage = 0; theirDamage = bloke.Attack(); } else { Console.WriteLine("You got away!"); isRunning = false; break; } } else { Console.WriteLine("Enter a number 1 or 2 please thaaaaaanks."); Console.ReadKey(); } Console.WriteLine($"You did {yourDamage.ToString()}\n" + $"{bloke.Name} did {theirDamage.ToString()}"); //take any damage away. lilCleet.Health -= theirDamage; bloke.Health -= yourDamage; if (lilCleet.Health <= 0 || bloke.Health <= 0) { if (lilCleet.Health <= 0) { Console.WriteLine("Dang it ya died!"); } else { Console.WriteLine($"{bloke.Name} fell to his knees, staring longingly at the setting sun and dies peacefully"); } isRunning = false; break; } ConsoleStuff.Break(); } }