private void Button1_Click(object sender, EventArgs e) { using (game gameForm = new game()) { gameForm.ShowDialog(); } }
public int chooseMove(string type, game g) { int choice = 0; bool check = false; while (check == false) { Console.WriteLine("\nWhat would you like to do?"); if (type == "fire") { Console.WriteLine(" 1) Punch - Basic attack \n 2) Flame Ball - Special move, more effective against 'Earth' types. \n " + "3) Lava Flow - Another special move. Damage increases the more you charge. \n 4) Charge - Charging increases the damage when 'Lava Flow' is used"); } else if (type == "water") { Console.WriteLine(" 1) Punch - Basic attack \n 2) Drench - Special move, more effective against 'Fire' types. \n " + "3) Tsunami - Another special move. Damage increases the more you charge. \n 4) Charge - Charging increases the damage when 'Tsunami' is used"); } else { Console.WriteLine(" 1) Punch - Basic attack \n 2) Rock Throw - Special move, more effective against 'Water' types. \n " + "3) Mudslide - Another special move. Damage increases the more you charge. \n 4) Charge - Charging increases the damage when 'Mudslide' is used"); } try { choice = Convert.ToInt32(Console.ReadLine()); if (choice > 0 && choice < 5) { check = true; } else { Console.WriteLine("Please try again"); } } catch (FormatException) { Console.WriteLine("Please try again"); } } return(choice); }
static void Main(string[] args) { // display rules x // create players x // create gesture scenarios x // win condition game gameStart = new game(); gameStart.RunGame(); Console.ReadLine(); //gameStart.DisplayRules(); //string NumberOfPlayers = gameStart.ChooseNumberPlayers(); //gameStart.CreatePlayers(NumberOfPlayers); //gameStart.player1.ChooseGesture(); //gameStart.player2.ChooseGesture(); }
static void Main(string[] args) { /*character test = new character("fire"); * test.punch(); * test.displayHP(); * Console.ReadLine();*/ string characterName = "", characterType = "", opponentType = "", opponentName = ""; int characterNumber = 0, opponentNumber = 0, first = 0; int choice = 0; bool p1XPCheck, oXPCheck, chargeCheck1 = false, chargeCheck2 = false; game test2 = new game(); //creates a new game test2.chooseCharacter(ref characterName, ref characterType, ref characterNumber, test2); //user picks character test2.opponentNumber(characterNumber, ref opponentNumber); //opponent's character is randomised test2.opponentChar(opponentNumber, ref opponentType, ref opponentName); //opponent's character details are set var P1 = characterFactory.Create(characterType); //player's character is created var Opponent = characterFactory.Create(opponentType); //opponent's character is created Console.WriteLine("The opponent has chosen to use {0}", Opponent.returnName()); first = test2.whoGoesFirst(); if (first == 1) { Console.WriteLine("You get to take the first turn!"); do { oXPCheck = Opponent.checkHP(); p1XPCheck = P1.checkHP(); choice = test2.chooseMove(characterType, test2); test2.moveExecution(choice, P1, opponentType, P1.getCharge(), Opponent, test2, ref chargeCheck1); Console.WriteLine("Opponent's HP is now {0}", Opponent.displayHP()); oXPCheck = Opponent.checkHP(); p1XPCheck = P1.checkHP(); if (oXPCheck == false) { break; } test2.opponentMoveExecution(test2.opponentMoveNum(), Opponent.getCharge(), P1, Opponent, characterType, opponentType, test2, ref chargeCheck2); Console.WriteLine("Players 1's HP is now {0}", P1.displayHP()); p1XPCheck = P1.checkHP(); chargeCheck1 = false; chargeCheck2 = false; } while ((p1XPCheck == true) && (oXPCheck == true)); } else { Console.WriteLine("The computer will take the first turn"); do { test2.opponentMoveExecution(test2.opponentMoveNum(), Opponent.getCharge(), P1, Opponent, characterType, opponentType, test2, ref chargeCheck2); Console.WriteLine("Players 1's HP is now {0}", P1.displayHP()); p1XPCheck = P1.checkHP(); if (p1XPCheck == false) { break; } choice = test2.chooseMove(characterType, test2); test2.moveExecution(choice, P1, opponentType, P1.getCharge(), Opponent, test2, ref chargeCheck1); Console.WriteLine("Opponent's HP is now {0}", Opponent.displayHP()); oXPCheck = Opponent.checkHP(); chargeCheck1 = false; chargeCheck2 = false; } while ((p1XPCheck == true) && (oXPCheck == true)); } if (p1XPCheck == false) { Console.WriteLine("You Lose!"); } else { Console.WriteLine("You Win!"); } Console.ReadLine(); }
public void opponentMoveExecution(int moveNum, int chargeNum, character player, character opponent, string pType, string oType, game g, ref bool check) { while (check == false) { switch (moveNum) { case 1: Console.WriteLine("Opponent used Punch!"); player.changeHP(opponent.punch()); check = true; break; case 2: Console.WriteLine("Opponent used {0}!", SM1MoveName(oType)); player.changeHP(opponent.SM1(pType)); check = true; break; case 3: Console.WriteLine("Opponent used {0}!", SM2MoveName(oType)); player.changeHP(opponent.SM2(pType, chargeNum)); check = true; break; case 4: Console.WriteLine("Opponent used Charge!"); if (opponent.Charge() == false) { g.opponentMoveExecution(g.opponentMoveNum(), opponent.getCharge(), player, opponent, pType, oType, g, ref check); } else { check = true; } break; } } }
public void moveExecution(int moveNum, character player, string oType, int chargeNum, character Opponent, game g, ref bool check) { while (check == false) { switch (moveNum) { case 1: Opponent.changeHP(player.punch()); check = true; break; case 2: Opponent.changeHP(player.SM1(oType)); check = true; break; case 3: Opponent.changeHP(player.SM2(oType, chargeNum)); check = true; break; case 4: if (player.Charge() == false) { Console.WriteLine("Please enter something else"); int option = Convert.ToInt32(Console.ReadLine()); g.moveExecution(option, player, oType, chargeNum, Opponent, g, ref check); } else { player.Displaychargestatus(); check = true; } break; } } }
public void chooseCharacter(ref string character, ref string type, ref int characternum, game g)//Player gets to choose their character { firetype a = new firetype("fire"); watertype b = new watertype("water"); earthtype c = new earthtype("earth"); Console.WriteLine("Please choose your character and enter the appropriate number \n 1) {0} - Fire Type \n 2) {1} - Water Type \n 3) {2} - Earth Type" , a.returnName(), b.returnName(), c.returnName()); try { int number = Convert.ToInt32(Console.ReadLine()); switch (number) { case 1: characternum = 1; character = a.returnName(); type = "fire"; break; case 2: characternum = 2; character = b.returnName(); type = "water"; break; case 3: characternum = 3; character = c.returnName();; type = "earth"; break; default: Console.WriteLine("Try Again"); g.chooseCharacter(ref character, ref type, ref characternum, g); break; } } catch (FormatException) { Console.WriteLine("Try Again"); g.chooseCharacter(ref character, ref type, ref characternum, g); } }