static void Main(string[] args) { Human human1 = new Human("Bob"); Console.WriteLine("Hello World!"); Ninja someninja = new Ninja("NINJA1"); Ninja someninja2 = new Ninja("NINJA2"); System.Console.WriteLine(someninja.name); someninja.steal(); System.Console.WriteLine(someninja.dexterity); System.Console.WriteLine(someninja.health); System.Console.WriteLine(someninja2.health); }
static void Main(string[] args) { Human jack = new Human("Jack Sprat"); Ninja jill = new Ninja("Jill Sprat"); Wizard tom = new Wizard("Tom Jones"); Samurai hei = new Samurai("Hei Chi"); hei.Attack(jack); System.Console.WriteLine(jack.Health); tom.Heal(jack); tom.Heal(jack); jill.Steal(jack); tom.Attack(jack); System.Console.WriteLine($"How is {jack.Name} doing? HP: {jack.Health}"); }
static void Main(string[] args) { Human Dave = new Human("Dave"); Wizard Gandolf = new Wizard("Gandolf"); Ninja Shredder = new Ninja("Shredder"); Samurai Kyoto = new Samurai("Kyoto"); Dave.Attack(Shredder); Gandolf.Attack(Shredder); Kyoto.Attack(Gandolf); Shredder.Attack(Gandolf); Gandolf.Heal(Kyoto); Shredder.Steal(Kyoto); Kyoto.Meditate(); }
static void Main(string[] args) { Wizard wizard1 = new Wizard("Gandalph"); Ninja ninja1 = new Ninja("Ninjjja"); Samurai samurai1 = new Samurai("Samurrraiiii"); // ninja1.Attack(wizard1); // samurai1.Attack(wizard1); // samurai1.Attack(wizard1); // wizard1.Heal(samurai1); // wizard1.Heal(samurai1); wizard1.Attack(samurai1); samurai1.Meditate(); ninja1.Steal(samurai1); }
static void Main(string[] args) { Wizard Nat = new Wizard("Nat"); Ninja Josh = new Ninja("Josh"); Human Balazs = new Human("Balazs"); Samurai Will = new Samurai("Will"); Nat.Attack(Josh); Nat.Fireball(Josh); Josh.Steal(Nat); Will.Attack(Balazs); Josh.getAway(); Nat.Heal(); Will.Meditate(); Will.deathBlow(Nat); Will.deathBlow(Josh); }
static void Main(string[] args) { Wizard jack = new Wizard("Jack", 3, 3); Ninja tom = new Ninja("Tom", 3, 3, 100); Samurai ben = new Samurai("Ben", 3, 3, 3); jack.Health = 4; int jackHealth = jack.Attack(tom); Console.WriteLine("jackHealth = " + jackHealth); int samuariHealth = tom.Attack(ben); Console.WriteLine("samuariHealth = " + samuariHealth); jack.Heal(tom); ben.Meditate(100); tom.Steal(jack); }
static void Main(string[] args) { Human me = new Human("me"); Ninja tokyo = new Ninja("tokyo"); Wizard pine = new Wizard("pine"); Samurai king = new Samurai("king"); me.Attack(tokyo); System.Console.WriteLine($"tokyo's health: {tokyo.Health}"); pine.Heal(tokyo); System.Console.WriteLine($"tokyo's health: {tokyo.Health}"); tokyo.Steal(king); System.Console.WriteLine($"tokyo's health: {tokyo.Health}"); System.Console.WriteLine($"king's health: {king.Health}"); king.Meditate(); System.Console.WriteLine($"king's health: {king.Health}"); }
static void Main(string[] args) { Human John = new Human("John"); Console.WriteLine(John.health); Human Juan = new Human("Juan", 75, 10, 10, 75); John.attack(Juan); Wizard joe = new Wizard("joe"); Wizard jack = new Wizard("jack"); Ninja Leo = new Ninja("Leo"); // Leo.Steal(John); // Leo.Get_Away(); //Console.WriteLine(Leo.name + "'s health is now, " + Leo.health); //Console.WriteLine("A ninja has a dexterity of: "+Leo.dexterity + " and health is: "+ Leo.health); // Console.WriteLine("\n" + joe.health + " dexterity: " + joe.dexterity); //Console.WriteLine("Joe's intelligence is " + joe.intelligence); //joe.Heal(); //joe.attack(Juan); // Console.WriteLine("Johns health b4 wizards attack: "+ John.health); joe.Fireball(John); Console.WriteLine("Johns health after wizard attack " + John.health); // Console.WriteLine("Jacks health b4 wizards attack: "+ jack.health); //joe.Fireball(jack); //Console.WriteLine($"Jacks health after {joe.name} the wizard attacked is {jack.health}"); Samurai Billy = new Samurai("Billy the Samurai"); Samurai Chuck = new Samurai("Chuck the Samurai"); Samurai Dave = new Samurai("Dave the Samurai"); // Console.WriteLine("The Samurai's health is: " + Billy.health + ". His intelligence is: " + Billy.intelligence); // Billy.Mediatate(); Billy.Death_Blow(joe); Billy.Death_Blow(John); Billy.Death_Blow(Billy); // int count = Samurai.How_Many(); // Console.WriteLine(count); // Samurai.How_Many(); Billy.Death_Blow(Chuck); // Billy.Mediatate(); string InputLine = Console.ReadLine(); Console.WriteLine(InputLine); }
static void Main(string[] args) { // Test wizard Attack method: Wizard GoodWizard = new Wizard("Dumbledore"); Wizard BadWizard = new Wizard("Saruman"); // Console.WriteLine($"{GoodWizard.Name}, {GoodWizard.Health}"); // Console.WriteLine($"{BadWizard.Name}, {BadWizard.Health}"); // GoodWizard.Attack(BadWizard); // Console.WriteLine($"{GoodWizard.Name}, {GoodWizard.Health}"); // Console.WriteLine($"{BadWizard.Name}, {BadWizard.Health}"); // Test wizard Attack method: Ninja GoodNinja = new Ninja("Jackie Chan"); Ninja BadNinja = new Ninja("Jet Lee"); // Console.WriteLine($"{GoodNinja.Name} {GoodNinja.Health}"); // Console.WriteLine($"{BadNinja.Name} {BadNinja.Health}"); // GoodNinja.Attack(BadNinja); // Console.WriteLine($"{GoodNinja.Name} {GoodNinja.Health}"); // Console.WriteLine($"{BadNinja.Name} {BadNinja.Health}"); // Test Samurai Attack method: Samurai GoodSamurai = new Samurai("Chuck Norris"); Samurai BadSamurai = new Samurai("Darth Vader"); BadSamurai.Health = 64; // Console.WriteLine($"{GoodSamurai.Name} {GoodSamurai.Health}"); // Console.WriteLine($"{BadSamurai.Name} {BadSamurai.Health}"); // GoodSamurai.Attack(BadSamurai); // Console.WriteLine($"{GoodSamurai.Name} {GoodSamurai.Health}"); // Console.WriteLine($"{BadSamurai.Name} {BadSamurai.Health}"); // Test Wizard Heal method GoodWizard.Heal(GoodSamurai); Console.WriteLine(GoodSamurai.Health); // Test Samurai Mediate method BadSamurai.Meditate(); Console.WriteLine(BadSamurai.Health); // Test Ninja Steal method GoodNinja.Steal(BadWizard); Console.WriteLine(GoodNinja.Health); Console.WriteLine(BadWizard.Health); }
static void Main(string[] args) { Wizard w1 = new Wizard("Tom"); Wizard w2 = new Wizard("Tim"); Ninja n1 = new Ninja("Frank"); Samurai s1 = new Samurai("Josh"); // w1.Attack(w2); s1.Attack(w1); n1.Attack(s1); n1.Attack(s1); n1.Attack(s1); n1.Attack(s1); n1.Attack(s1); n1.Attack(s1); n1.Attack(s1); n1.Attack(s1); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Ninja ninja1 = new Ninja("Ninja Hanzo"); Wizard wizard1 = new Wizard("Wizard Merlin"); Samurai samurai1 = new Samurai("Samurai Tomoe"); Ninja ninja2 = new Ninja("Ninja Kotaro"); wizard1.Attack(ninja1); wizard1.Heal(ninja2); wizard1.Stats(); ninja1.Stats(); ninja1.Steal(samurai1); ninja1.Stats(); samurai1.Stats(); samurai1.Meditate(); samurai1.Stats(); }
static void Main(string[] args) { Wizard wizard1 = new Wizard("Wizard 1"); Ninja ninja1 = new Ninja("Ninja 1"); Samurai samurai1 = new Samurai("Samurai 1"); Console.WriteLine(wizard1.Health); ninja1.Attack(wizard1); ninja1.Attack(samurai1); samurai1.Attack(wizard1); Console.WriteLine(samurai1.Health); samurai1.Meditate("Samurai 1"); Console.WriteLine(samurai1.Health); wizard1.Heal(ninja1); Console.WriteLine(ninja1.Health); ninja1.Steal(wizard1); Console.WriteLine(ninja1.Health); }
static void Main(string[] args) { Human one = new Human("Jonathan"); System.Console.WriteLine($"{one.Name}, strength: {one.Strength}, intelligence: {one.Intelligence}, dexterity: {one.Dexterity}, health: {one.health}"); Wizard two = new Wizard("Harry"); System.Console.WriteLine($"{two.Name}, strength: {two.Strength}, intelligence: {two.Intelligence}, dexterity: {two.Dexterity}, health: {two.health}"); Ninja three = new Ninja("Naruto"); System.Console.WriteLine($"{three.Name}, strength: {three.Strength}, intelligence: {three.Intelligence}, dexterity: {three.Dexterity}, health: {three.health}"); Samurai four = new Samurai("Jack"); System.Console.WriteLine($"{four.Name}, strength: {four.Strength}, intelligence: {four.Intelligence}, dexterity: {four.Dexterity}, health: {four.health}"); // two.Attack(four); // System.Console.WriteLine(two.health); // three.Attack(one); // System.Console.WriteLine(one.health); // four.Attack(two); // System.Console.WriteLine(two.health); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // four.Attack(two); // System.Console.WriteLine(two.health); // two.Heal(two); // System.Console.WriteLine(two.health); // four.Meditate(); // System.Console.WriteLine(four.health); // three.Steal(one); // System.Console.WriteLine(one.health); // System.Console.WriteLine(three.health); }
static void Main(string[] args) { Human joe = new Human("Joe"); Wizard gandalf = new Wizard("Gandalf"); Ninja naruto = new Ninja("Naruto"); Samurai hanzo = new Samurai("Hanzo"); Console.WriteLine(hanzo.Health); gandalf.Attack(hanzo); gandalf.Attack(hanzo); naruto.Attack(gandalf); hanzo.Attack(naruto); gandalf.Heal(gandalf); hanzo.Meditate(); naruto.Steal(hanzo); Console.WriteLine(hanzo.Health); Console.WriteLine(gandalf.Health); Console.WriteLine(naruto.Health); }
// Use a switch statement for attack or heal. public void Action(string do_this, Wizard w1, Samurai s1, Ninja n1, Human mon) { Random rand = new Random(); System.Console.WriteLine("_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_"); switch (do_this) { case "a": w1.Attack(mon); int x = rand.Next(3); int y = rand.Next(2); if (x == 1) { System.Console.WriteLine($"{s1.Name} has decided to help you attack!"); s1.Attack(mon); } else if (x == 2) { System.Console.WriteLine($"{n1.Name} has decided to help you attack!"); n1.Attack(mon); } System.Console.WriteLine("-------------------------------------------------"); if (y == 0) { mon.Attack(w1); } if (y == 1) { mon.Attack1(w1); } break; case "h": w1.Heal(w1); System.Console.WriteLine("-------------------------------------------------"); mon.Attack(w1); break; } System.Console.WriteLine("-------------------------------------------------"); mon.GetInfo(); w1.GetInfo(); System.Console.WriteLine("_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_"); }
static void Main(string[] args) { Wizard claire = new Wizard("Claire"); Wizard troy = new Wizard("Troy"); Ninja frank = new Ninja("Frank"); Samurai evan = new Samurai("Evan"); Samurai phil = new Samurai("Phil"); Console.WriteLine(frank.current_health); claire.Fireball(frank); claire.Fireball(3); evan.Attack(claire); claire.Heal(); evan.DeathBlow(claire); evan.HowMany(claire, troy, frank, evan, phil); frank.GetAway(); frank.Stealth(phil); troy.Fireball(frank); troy.Fireball(frank); }
static void Main(string[] args) { Human Ashe = new Human("Ashe"); Wizard Temo = new Wizard("Temo"); Ninja MasterYi = new Ninja("MasterYi"); Samurai Yasuo = new Samurai("Yasuo"); // ----------------------------------- Game to see points ---------------------- MasterYi.Steal(Temo); Console.WriteLine("MasterYi steals from {0}. {1} goes to MasterYi!", Temo.name, MasterYi.health); MasterYi.get_away(); Console.WriteLine("MasterYi tries to get away! Health decrease {0}", MasterYi.health); Temo.fireball(MasterYi); Console.WriteLine("Temo fire back at {0}, and {0} health decrease to {1}", MasterYi.name, MasterYi.health); Yasuo.meditate(); Console.WriteLine("Yasuo does not want to fight! His health is {0}", Yasuo.health); // Console.WriteLine(count); // Yasuo.how_many(); }
static void Main(string[] args) { var player1 = new Human("Kevin"); System.Console.WriteLine(player1); //var player2 = new Wizard("Gandalf"); //System.Console.WriteLine(player2); var player3 = new Ninja("Ninja"); System.Console.WriteLine(player3); //var player4 = new Samurai("Samurai"); //System.Console.WriteLine(player4); //player1.Attack(player2); //System.Console.WriteLine(player1); //System.Console.WriteLine(player2); //player2.CastSpell(player1); //player2.Heal(player2); //System.Console.WriteLine(player1); //System.Console.WriteLine(player2); //player3.Attack(player1); player3.Steal(player1); System.Console.WriteLine(player3); System.Console.WriteLine(player1); //player1.Attack(player4); //player4.Meditate(); //System.Console.WriteLine(player4); //System.Console.WriteLine(player1); }
static void Main(string[] args) { Human richard = new Human("Richard"); // Console.WriteLine("Human {0} info: {1} is strength", richard.name, richard.strength); Wizard john = new Wizard("John"); // Console.WriteLine("Wizard {0} info: {1} is strength", john.name, john.strength); Ninja brad = new Ninja("Brad"); // john.attack(richard); // john.heal(); // brad.Steal(john); // brad.GetAway(); Samurai virginia = new Samurai("Virginia"); virginia.DeathBlow(richard); for (int i = 0; i < 3; i++) { john.attack(richard); } virginia.DeathBlow(richard); }
static void Main(string[] args) { Console.Clear(); Console.WriteLine("* INIT *"); Ninja Shinobi = new Ninja("Ninja"); Wizard Gendalf = new Wizard("Wizzard"); Samurai Jack = new Samurai("Samurai"); Shinobi.ShowStats(); Gendalf.ShowStats(); Jack.ShowStats(); // // **** NINJA BLOCK *** // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Shinobi.Attack(Jack); // Jack.ShowStats(); // Shinobi.Attack(Gendalf); // Shinobi.Attack(Gendalf); // Shinobi.Steal(Gendalf); // Shinobi.ShowStats(); // // *** END OF NINJA BLOCK *** // // *** SAMURAI BLOCK *** // Jack.Attack(Gendalf); // Jack.Attack(Gendalf); // Jack.Attack(Shinobi); // Jack.Attack(Shinobi); // Jack.Attack(Shinobi); // Jack.Attack(Shinobi); // Jack.Attack(Shinobi); // Jack.Attack(Shinobi); // Jack.Attack(Shinobi); // Jack.Attack(Shinobi); // Jack.Meditate(); // Jack.ShowStats(); // // *** SAMURAI BLOCK *** // *** END OF WIZZARD BLOCK *** // Gendalf.Attack(Jack); // Console.WriteLine("Okay that's enought Gendalf !"); // Jack.ShowStats(); // Gendalf.Attack(Shinobi); // Shinobi.ShowStats(); // Console.WriteLine("c'mon dude that was a prank"); // Gendalf.Heal(Shinobi); // Shinobi.ShowStats(); // *** END OF WIZZARD BLOCK *** }
// -------------------- CLASS METHODS ------------------------------ public void Death_Blow(object obj) // this function has a parameter that will be a generic object { if (obj is Wizard) // checking to see if the parameter object being passed is of type: Wizard { Wizard enemy = obj as Wizard; //Safe Explicit Casting if (enemy.health > 50) //this will access the Property setter method on the Wizard.cs Line 8 { enemy.health = health; Console.WriteLine("Attacking a wizard! His health is: " + enemy.health); } else { enemy.health = health; Console.WriteLine("DEATH BLOW!! Enemies health is now: " + enemy.health); } } else if (obj is Samurai) // checking to see if the parameter object being passed is of type: Wizard // or Unboxing { Samurai enemy = obj as Samurai; //Safe Explicit Casting if (enemy.health > 50) { enemy.health = health; Console.WriteLine("Attacking a samurai! His health is: " + enemy.health); } else { enemy.health = health; Console.WriteLine("DEATH BLOW!! You KILLED your fellow SAMURAI UP!: " + enemy.health); } } else if (obj is Ninja) // checking to see if the parameter object being passed is of type: Wizard // or Unboxing { Ninja enemy = obj as Ninja; //Safe Explicit Casting if (enemy.health > 50) { enemy.health = health; Console.WriteLine("Attacking a Ninja! His health is: " + enemy.health); } else { enemy.health = health; Console.WriteLine("DEATH BLOW!! Enemies health is now: " + enemy.health); } } else if (obj is Human) // checking to see if the parameter object being passed is of type: Human //NOTE: THE PARENT CLASS SHOULD GO ON BOTTOM SINCE ALL THE ABOVE INHERIT FROM THE HUMAN // I HAD HUMAN ABOVE NINJA EARLIER AND IT KEPT PRINTING "Attacking a human" { Human enemy = obj as Human; //Safe Explicit Casting if (enemy.health > 50) { enemy.health = health; Console.WriteLine("Attacking a Human! His health is: " + enemy.health); } else { enemy.health = health; Console.WriteLine("DEATH BLOW!! Enemies health is now: " + enemy.health); } } }
static void Main(string[] args) { System.Console.WriteLine(@" , \ / , "); System.Console.WriteLine(@" / \ )\__/( / \ "); System.Console.WriteLine(@" / \ (_\ /_) / \ "); System.Console.WriteLine(@" ____/_____\__\@ @/___/_____\____ "); System.Console.WriteLine(@"| |\../| |"); System.Console.WriteLine(@"| \VV/ |"); System.Console.WriteLine(@"| The Tale of a Young Wizard |"); System.Console.WriteLine(@"|_________________________________|"); System.Console.WriteLine(@" | /\ / \\ \ /\ | "); System.Console.WriteLine(@" | / V )) V \ | "); System.Console.WriteLine(@" |/ ` // ' \| "); System.Console.WriteLine(@" ` V ' "); System.Console.WriteLine("Welcome Wizard! You are on a journey from becoming a weak peasant wizard to Supreme Wizard with ultimate powers. But to do that, you must first defeat Chronus and his monster friends. On your journey, you will be accompanied by two adventurers - Samurai and Ninja"); System.Console.WriteLine("--------------------------------------------------"); System.Console.WriteLine("To start your adventure. Type your name, then press enter"); string pname = (Console.ReadLine()); System.Console.WriteLine("--------------------------------------------------"); Wizard w1 = new Wizard(pname); Samurai s1 = new Samurai("Samurai Sam"); Ninja n1 = new Ninja("Ninja Nina"); System.Console.WriteLine($"Hello {pname}. Here are your current stats, and the stats of your friends:"); w1.GetInfoStart(); s1.GetInfoStart(); n1.GetInfoStart(); System.Console.WriteLine("--------------------------------------------------"); System.Console.WriteLine("You are about to face your first challenge. Press any key to continue."); Console.ReadLine(); // !!!!!! Modify to monster !!!!!!!! Bandos m1 = new Bandos("Bandos"); Human mon = m1; System.Console.WriteLine($"You have encountered your first monster!"); mon.GetInfo(); DoThis act = new DoThis(); while (mon.Health > 0 && w1.Health > 0) { // Ask the user to choose an option. System.Console.WriteLine("What do you want to do?"); Console.WriteLine("\ta - Attack!"); Console.WriteLine("\th - Load up on some health points."); string do_this = Console.ReadLine(); act.Action(do_this, w1, s1, n1, mon); } act.CheckHealth(w1); System.Console.WriteLine("You have defeated Bandos!!"); w1.Heal(w1); System.Console.WriteLine("Sorry you're forced to continue. Press any key."); Console.ReadLine(); // MONSTER 2 Wyvern m2 = new Wyvern("Wyvern"); mon = m2; System.Console.WriteLine("Your new opponent Wyvern has appeared!"); mon.GetInfo(); w1.GetInfo(); while (mon.Health > 0 && w1.Health > 0) { // Ask the user to choose an option. System.Console.WriteLine("What do you want to do?"); Console.WriteLine("\ta - Attack!"); Console.WriteLine("\th - Load up on some health points."); string do_this = Console.ReadLine(); act.Action(do_this, w1, s1, n1, mon); } act.CheckHealth(w1); // MONSTER 3 System.Console.WriteLine("You have defeated Wyvern!!"); w1.Heal(w1); System.Console.WriteLine("Sorry you're forced to continue. Press any key."); Console.ReadLine(); Arcanis m3 = new Arcanis("Arcanis"); mon = m3; System.Console.WriteLine("Your new opponent Arcanis has appeared!"); mon.GetInfo(); w1.GetInfo(); while (mon.Health > 0 && w1.Health > 0) { // Ask the user to choose an option. System.Console.WriteLine("What do you want to do?"); Console.WriteLine("\ta - Attack!"); Console.WriteLine("\th - Load up on some health points."); string do_this = Console.ReadLine(); act.Action(do_this, w1, s1, n1, mon); } act.CheckHealth(w1); // BOSSS!!!!!! System.Console.WriteLine("You have defeated Arcanis!!"); w1.Heal(w1); System.Console.WriteLine("Sorry you're forced to continue. Press any key."); Console.ReadLine(); Chronus B1 = new Chronus("Chronus"); mon = B1; System.Console.WriteLine("Your last opponent Chronus has appeared!"); mon.GetInfo(); w1.GetInfo(); while (mon.Health > 0 && w1.Health > 0) { // Ask the user to choose an option. System.Console.WriteLine("What do you want to do?"); Console.WriteLine("\ta - Attack!"); Console.WriteLine("\th - Load up on some health points."); string do_this = Console.ReadLine(); act.BossAction(do_this, w1, s1, n1, mon); } act.CheckHealth(w1); System.Console.WriteLine(" __ __ _______ __ __ _ _ _______ __ _ __ "); System.Console.WriteLine(" | | | || || | | | | | _ | || || | | || | "); System.Console.WriteLine(" | |_| || _ || | | | | || || || _ || |_| || | "); System.Console.WriteLine(" | || | | || |_| | | || | | || || | "); System.Console.WriteLine(" |_ _|| |_| || | | || |_| || _ ||__| "); System.Console.WriteLine(" | | | || | | _ || || | | | __ "); System.Console.WriteLine(" |___| |_______||_______| |__| |__||_______||_| |__||__| "); }