static void AddHero() { CyanWriteLine("Enter your Hero's name."); string heroName = Console.ReadLine(); if (!HeroInList(heroName)) { Hero hero; switch (heroName) { case "Superman": hero = new Superman(); break; case "Batman": hero = new Batman(); break; case "Wonderwoman": hero = new Wonderwoman(); break; case "Deadpool": hero = new Deadpool(); break; default: CyanWriteLine("What's your hero's secret identity?"); hero = new CustomHero(heroName, Console.ReadLine()); break; } Heroes.Add(hero); } else { throw new Exception("Hero already exists."); } }
private static void RefreshBoard(Board board) { // Clear board board.Clear(); string[] inputs; board.MyGold = int.Parse(Console.ReadLine()); board.EnnemyGold = int.Parse(Console.ReadLine()); board.RoundType = int.Parse(Console.ReadLine()); // a positive value will show the number of heroes that await a command // Units int entityCount = int.Parse(Console.ReadLine()); for (int i = 0; i < entityCount; i++) { inputs = Console.ReadLine().Split(' '); int unitId = int.Parse(inputs[0]); int team = int.Parse(inputs[1]); string unitType = inputs[2]; // UNIT, HERO, TOWER, can also be GROOT from wood1 int x = int.Parse(inputs[3]); int y = int.Parse(inputs[4]); int attackRange = int.Parse(inputs[5]); int health = int.Parse(inputs[6]); int maxHealth = int.Parse(inputs[7]); int shield = int.Parse(inputs[8]); // useful in bronze int attackDamage = int.Parse(inputs[9]); int movementSpeed = int.Parse(inputs[10]); int stunDuration = int.Parse(inputs[11]); // useful in bronze int goldValue = int.Parse(inputs[12]); int countDown1 = int.Parse(inputs[13]); // all countDown and mana variables are useful starting in bronze int countDown2 = int.Parse(inputs[14]); int countDown3 = int.Parse(inputs[15]); int mana = int.Parse(inputs[16]); int maxMana = int.Parse(inputs[17]); int manaRegeneration = int.Parse(inputs[18]); string heroType = inputs[19]; // DEADPOOL, VALKYRIE, DOCTOR_STRANGE, HULK, IRONMAN int isVisible = int.Parse(inputs[20]); // 0 if it isn't int itemsOwned = int.Parse(inputs[21]); // useful from wood1 Unit u; switch (unitType) { case "UNIT": u = new Minion(); break; case "HERO": switch (heroType) { case "DEADPOOL": u = new Deadpool(); break; case "VALKYRIE": u = new Valkyrie(); break; case "DOCTOR_STRANGE": u = new DoctorStrange(); break; case "HULK": u = new Hulk(); break; case "IRONMAN": default: u = new Ironman(); break; } //u.CountDown123 u.Mana = mana; u.MaxMana = maxMana; //u.ManaRegen //u.IsVisible //u.Items break; case "TOWER": u = new Tower(); break; case "GROOT": default: u = new NeutralMonster(); break; } u.Id = unitId; u.TeamId = team; u.X = x; u.Y = y; u.AttackRange = attackRange; u.Health = health; u.MaxHealth = maxHealth; //u.Shield = u.BaseAttackDamage = attackDamage; u.BaseMovementSpeed = movementSpeed; //u.StunDuration //u.Gold board.Units.Add(u); } }