public static void MainLoop() { game_state = 0; Place currPlace; while (Player.hp > 0) { if (slimecounter == 100) { ach.Get("100slimes"); } if (goblincounter == 100) { ach.Get("100goblins"); } if (banditcounter == 100) { ach.Get("100bandits"); } if (drakecounter == 100) { ach.Get("100drakes"); } Tuple <int, int> xy = Map.CoordinatesOf(typeof(Nomad)); Map.map[xy.Item1, xy.Item2] = new Place(); Tuple <int, int> nextNomad = Map.getRandomBlankTile(); Map.map[nextNomad.Item1, nextNomad.Item2] = new Nomad(); foreach (Place p in Map.map) { if (p.GetType() == typeof(Place)) { p.is_npc_active = false; } } Tuple <int, int> randomTile = Map.getRandomBlankTile(); if (rand.NextDouble() <= .1) { Map.map[randomTile.Item1, randomTile.Item2].is_npc_active = true; } if (devmode) { Interface.type("Dev Powers!", ConsoleColor.DarkMagenta); Player.primary = new phantasmal_claymore(); Player.secondary = new spectral_bulwark(); Player.armor = new illusory_plate(); Player.accessory = new void_cloak(); hasmap = true; } Player.applybonus(); Enemy enemy = new Enemy(); Player.levelup(); currPlace = Map.map[Map.PlayerPosition.x, Map.PlayerPosition.y]; if (Player.hp > Player.maxhp) { Player.hp = Player.maxhp; } if (loop_number >= 1) { if (Combat.CheckBattle() && currPlace.getEnemyList() != null && !devmode) { enemy = currPlace.getEnemyList(); Combat.BattleLoop(enemy); } } Item pc = new phantasmal_claymore(); Item sb = new spectral_bulwark(); Item ip = new illusory_plate(); Item vc = new void_cloak(); if ((Player.backpack.Contains(pc) && Player.backpack.Contains(sb) && Player.backpack.Contains(ip) && Player.backpack.Contains(vc)) || devmode) { if (!Player.abilities.commandChars.Contains('*')) { Player.abilities.AddCommand(new Combat.EndtheIllusion("End the Illusion", '*')); } ach.Get("set"); } if (devmode) { Interface.type(Map.PlayerPosition.x + " " + Map.PlayerPosition.y); } if (!devmode) { Player.applybonus(); } else { Player.applydevbonus(); } if (gbooks >= 3 && !Player.abilities.commandChars.Contains('@')) { Interface.type("Having read all of the Ramsay books, you are enlightened in the ways of Gordon Ramsay."); Player.abilities.AddCommand(new Combat.HellsKitchen("Hell's Kitchen", '@')); } if (!devmode) { Interface.type(currPlace.Description); } else { Interface.type(currPlace.ToString()); } char[] currcommands = currPlace.getAvailableCommands(); Interface.typeOnSameLine("\r\nYour current commands are x", ConsoleColor.Cyan); foreach (char c in currcommands) { Interface.typeOnSameLine(", " + c, ConsoleColor.Cyan); } Interface.type(""); ConsoleKeyInfo command = Interface.readkey(); if (command.KeyChar == 'x') { Interface.type("\r\nAre you sure?", ConsoleColor.Red); char surecommand = Interface.readkey().KeyChar; if (surecommand == 'y') { End.GameOver(); } } else if (command.Key == ConsoleKey.Escape) { Environment.Exit(0); } else if (command.KeyChar == '-' && devmode) { string input = Interface.readinput(); if (input == "end") { End.Endgame(); } else if (input == "combat") { string combat_input = Interface.readinput(); Type etype = Type.GetType("Realm." + combat_input); try { Enemy e = (Enemy)Activator.CreateInstance(etype); Combat.BattleLoop(e); } catch (ArgumentNullException) { Interface.type("Invalid Enemy."); } } else if (input == "name") { Player.name = Interface.readinput(); } else if (input == "additem") { string add_input = Interface.readinput(); Type atype = Type.GetType("Realm." + add_input); try { Item i = (Item)Activator.CreateInstance(atype); if (Player.backpack.Count <= 10) { Player.backpack.Add(i); Interface.type("Obtained '" + i.name + "'!"); } else { Interface.type("Not enough space."); } } catch (ArgumentNullException) { Interface.type("Invalid Item."); } } else if (input == "droploot") { if (Main.rand.NextDouble() <= .1d) { Main.Player.backpack.Add(MainItemList[Main.rand.Next(0, MainItemList.Count - 1)]); Interface.type("Obtained " + MainItemList[Main.rand.Next(0, MainItemList.Count - 1)].name + "!", ConsoleColor.Green); } else { Interface.type("Nothing dropped."); } } else if (input == "teleport") { int xcoord = Int32.Parse(Interface.readinput()); int ycoord = Int32.Parse(Interface.readinput()); Map.PlayerPosition.x = xcoord; Map.PlayerPosition.y = ycoord; } else if (input == "level") { Main.Player.level = Convert.ToInt32(Interface.readinput()); } else if (input == "levelup") { Main.Player.xp += Main.Player.xp_next; } else if (input == "getach") { ach.Get(Interface.readinput()); } else if (input == "suicide") { End.GameOver(); } } else { currPlace.handleInput(command.KeyChar); } loop_number++; } }