public void Start() { Console.WriteLine("\nEncounter Start!"); bool stillFighting = true; while (stillFighting) { //check if team 1 is alive bool goodAlive = true; int totalGoodHealth = 0; for (int i = 0; i < _goodMonsters.Length; i++) { Creature currentMonster = _goodMonsters[i]; //total up the health of each monster totalGoodHealth += currentMonster.Health; } goodAlive = totalGoodHealth > 0; //check if team 2 is alive bool badAlive = true; for (int i = 0; i < _badMonsters.Length; i++) { Creature currentMonster = _badMonsters[i]; if (currentMonster.Health > 0) { badAlive = true; break; } else if (currentMonster.Health <= 0) { badAlive = false; } } //if both teams are alive if (goodAlive && badAlive) { //fight stillFighting = true; BeginRound(); } else { //stop stillFighting = false; if (goodAlive) { //Give XP to each character in good team //For each creature in good team foreach (Creature cr in _goodMonsters) { //If that Creature is a character if (cr is Charater) { //Give it XP from bad team Charater ch = (Charater)cr; ch.EXP += GetTotalXP(_badMonsters); } } } } } }
static void Main(string[] args) { //monster and player list Monster slime = new Monster("Green Slime", 100, 10, 10); Monster slime2 = new Monster("Red Slime", 120, 12, 12); Monster skeleton = new Monster("Skeleton", 150, 20, 20); Monster zombie = new Monster("Zombie", 200, 5, 15); Monster wolf = new Monster("Wolf", 120, 15, 25); Charater myself = new Rogue("Aigis"); Charater party1 = new Knight("Chie"); //Arrays used to make teams Creature[] playersTeam = { myself, party1 }; Creature[] undeadTeam = { zombie, skeleton }; Creature[] slimeTeam = { slime, slime2 }; Creature[] Empty = { }; //0: Courtyard //1: Castle Gate //2: Graveyard //3: Village // N S E W Scene courtyard = new Scene("Courtyard", 1, 3, -1, 2, Empty, "The courtyard is wide and open. There are exits to the north, south, east, and west."); Scene castleGate = new Scene("Castle Gate", -1, 0, -1, -1, slimeTeam, "There is a large entrance to the \ncastle. It appears to be locked. There is an exit to the south"); Scene graveyard = new Scene("Graveyard", -1, -1, 0, -1, undeadTeam, "The graveyard is covered in a thin layer of fog. There is an exit to the east."); Scene village = new Scene("Village", 0, -1, -1, -1, Empty, "This is the village. There are a bunch of buildings, there is an exit to the north."); Scene[] scenes = { courtyard, castleGate, graveyard, village }; Map map = new Map(0, scenes, playersTeam); map.Menu(); Console.ReadKey(); return; //Inventory inventory = new Inventory(); //inventory.Menu(); string name = ""; string choice = ""; //start Console.WriteLine("Enter the name of party member 1: "); name = Console.ReadLine(); //Player Creation while (choice != "1" && choice != "2") { //display menu Console.WriteLine("\nChoose a job:"); Console.WriteLine("1: Knight"); Console.WriteLine("2: Rogue"); choice = Console.ReadLine(); } Charater player; if (choice == "1") { player = new Knight(name); } else if (choice == "2") { player = new Rogue(name); } else { player = new Charater(name); } player.Print(); player.OpenInventory(); //party memebers //Charater party1 = new Charater("Chie"); Charater party2 = new Charater("Futaba"); party1.Print(); Console.WriteLine(""); party2.Print(); //inventory menu selection while (choice != "0") { Console.WriteLine("\nWhose inventory?"); Console.WriteLine("0: Exit"); Console.WriteLine("1: " + player.GetName()); Console.WriteLine("2: " + party1.GetName()); Console.WriteLine("3: " + party2.GetName()); choice = Console.ReadLine(); if (choice == "1") { player.OpenInventory(); } else if (choice == "2") { party1.OpenInventory(); } else if (choice == "3") { party2.OpenInventory(); } if (choice == "1") { player = new Knight(name); } else if (choice == "2") { player = new Rogue(name); } else { player = new Charater(name); } } //EXP gains player.EXP = 30; player.EXP = player.EXP = 50; player.EXP++; player.EXP += 40; //Arrays int[] testArray = new int[4]; testArray[0] = 1; testArray[1] = 3; testArray[2] = 5; testArray[3] = 7; int[] testArray2 = { 2, 4, 6, 8 }; string[] stringArray = new string[3]; Charater[] party = { player, party1, party2, new Charater("Lonk") }; Console.ReadKey(); }