public static void choiceItemToPick(Creature hero) { right_i = 4; writeOnRightSide("Выберите предмет:"); for (int i = 0; i < hero.getLocation().getItems().Count; i++) { writeOnRightSide(" " + "[" + i + "]" + hero.getLocation().getItems() [i].name); } right_i = 4; }
static void drawSelectTarget(Creature hero) { right_i = 4; writeOnRightSide("Выберите цель"); for (int i = 0; i < hero.getLocation().returnCreatures().Length; i++) { writeOnRightSide(hero.getLocation().returnCreatures() [i]); } right_i = 4; }
public static void drawLocationInfo(Creature hero) { right_i = 4; for (int i = 0; i < hero.getLocation().returnCreatures().Length; i++) { writeOnRightSide(hero.getLocation().returnCreatures() [i]); } for (int i = 0; i < hero.getLocation().returnItems().Length; i++) { writeOnRightSide(hero.getLocation().returnItems() [i]); } right_i = 4; }
static void gameHandler(Creature hero) { ConsoleKeyInfo key; while (hero.isAlive()) { right_i = 4; updateUI(hero, info); key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.L: { resetToDefault(hero); break; } case ConsoleKey.G: { resetToDefault(hero); choiceDirection(); info = "ChoiceDirection"; updateUI(hero, info); resetToDefault(hero); ConsoleKeyInfo choice = Console.ReadKey(true); switch (choice.Key) { case ConsoleKey.W: //Вверх addToLog(hero.goToDirection(0, 1)); break; case ConsoleKey.Q: //Вверх влево addToLog(hero.goToDirection(-1, 1)); break; case ConsoleKey.A: //влево addToLog(hero.goToDirection(-1, 0)); break; case ConsoleKey.Z: //вниз влево addToLog(hero.goToDirection(-1, -1)); break; case ConsoleKey.X: //вниз addToLog(hero.goToDirection(0, -1)); break; case ConsoleKey.C: //Вниз вправо addToLog(hero.goToDirection(1, -1)); break; case ConsoleKey.D: //вправо addToLog(hero.goToDirection(1, 0)); break; case ConsoleKey.E: //вверх вправо addToLog(hero.goToDirection(1, 1)); break; case ConsoleKey.S: break; } resetToDefault(hero); break; } //end of case case ConsoleKey.T: { resetToDefault(hero); info = "SelectTarget"; updateUI(hero, info); int choice_target = Convert.ToInt32(Console.ReadLine()); hero.selectTarget(hero.getLocation().creatures [choice_target]); addToLog(hero.name + " выбрал целью " + hero.getLocation().creatures [choice_target].name); resetToDefault(hero); right_i = 4; updateUI(hero, info); break; } case ConsoleKey.A: { addToLog(hero.attack(hero.getTarget())); if (/* hero.isInBattle && */ hero.getTarget() != null) { info = "FightInfo"; } else { resetToDefault(hero); } break; } case ConsoleKey.P: { info = "ChoiceItemToPick"; updateUI(hero, info); int item = Convert.ToInt32(Console.ReadLine()); addToLog(hero.pickUpItem(hero.getLocation().getItems() [item])); resetToDefault(hero); break; } case ConsoleKey.I: { info = "Inventory"; updateUI(hero, info); right_i = 4; break; } case ConsoleKey.S: { info = "drawHeroStats"; updateUI(hero, info); break; } case ConsoleKey.U: { switch (Console.ReadKey(true).Key) { case ConsoleKey.S: addToLog("Выберите характеристику для улучшения"); updateUI(hero, "drawHeroStats"); string choice = Console.ReadLine(); addToLog(hero.upgradeStat(Convert.ToInt32(choice))); break; } break; } } //end of switch for (int i = 0; i < hero.getLocation().creatures.Count; i++) { if (hero.getLocation().creatures [i].isEnemy) { addToLog(((IEnemy)(hero.getLocation().creatures [i])).AI(hero)); } } for (int i = 0; i < hero.buffs.Count; i++) { hero.buffs [i].update(); } updateUI(hero, info); } Console.WriteLine("Лол ты сдох"); }
public static void updateUI(Creature hero, string action) { Console.Clear(); Console.SetCursorPosition(0, 0); Console.Write(String.Format("HP: {0}/{6} MANA: {7}/{8} LVL: {1} EXP: {2}/{3} POS: [{4},{5}]", hero.getHp() [0], hero.lvl, hero.exp, hero.exp_to_lvl, hero.getLocation().x, hero.getLocation().y, hero.getHp() [1], hero.mana, hero.maxmana)); switch (action) { case "LocationInfo": drawLocationInfo(hero); break; case "ChoiceDirection": choiceDirection(); break; case "FightInfo": drawFightInfo(hero); break; case "ChoiceItemToPick": choiceItemToPick(hero); break; case "Inventory": drawInventory(hero); break; case "SelectTarget": drawSelectTarget(hero); break; case "drawHeroStats": drawHeroStats(hero); break; } Console.SetCursorPosition(0, 4); Console.Write(getLog()); }