Esempio n. 1
0
        public void ChangeMealeUnitAttack(Model M, Dictionary<int, Units> team)
        {
            int pos0 = 0;
            int pos1 = 0;
            int pos2 = 0;

            if (M.CurrentUnitAttack == 5)
            {
                string tostr = M.CanAttack[4].ToString();
                char[] pos = tostr.ToCharArray();
                try
                {
                    int.TryParse(pos[0].ToString(), out pos0);
                    int.TryParse(pos[1].ToString(), out pos1);
                    int.TryParse(pos[2].ToString(), out pos2);
                }
                catch (Exception e) { }
                var Target = team.Where(z => z.Value.Live == true)
                    .Where(y => y.Key == pos0 || y.Key == pos1 || y.Key == pos2)
                    .OrderBy(x => x.Value.HP)
                    .FirstOrDefault();
                M.PositionUnitOfAttack = Target.Key;
            }
            else if (M.CurrentUnitAttack == 4)
            {
                string tostr = M.CanAttack[3].ToString();
                char[] pos = tostr.ToCharArray();
                try
                {
                    int.TryParse(pos[0].ToString(), out pos0);
                    int.TryParse(pos[1].ToString(), out pos1);

                }
                catch (Exception e) { }

                var Target = team.Where(z => z.Value.Live == true)
                    .Where(y => y.Key == pos0 || y.Key == pos1)
                    .OrderBy(x => x.Value.HP)
                    .FirstOrDefault();
                M.PositionUnitOfAttack = Target.Key;
            }
            else
            {
                string tostr = M.CanAttack[5].ToString();
                char[] pos = tostr.ToCharArray();
                try
                {
                    int.TryParse(pos[0].ToString(), out pos0);
                    int.TryParse(pos[1].ToString(), out pos1);

                }
                catch (Exception e) { }

                var Target = team.Where(z => z.Value.Live == true)
                    .Where(y => y.Key == pos0 || y.Key == pos1)
                    .OrderBy(x => x.Value.HP)
                    .FirstOrDefault();
                M.PositionUnitOfAttack = Target.Key;
            }
        }
Esempio n. 2
0
 public string CPUDeffence(Model mod, Dictionary<int,Units> team)
 {
     var Health = team.Where(x => x.Key == mod.CurrentUnitAttack).FirstOrDefault();
     var CanAttack = mod.CanAttack.TakeWhile(x => x != 0).Count();
     if (Health.Value.HP < 35 && Health.Value.HP > 15 && Health.Value.Range == false && CanAttack > 3)
     {
         mod.Deffence = true;
         return "Deffence";
     }
     else { return "Attack";  }
 }
Esempio n. 3
0
        public void AttackU(Model mod, Dictionary<int, Units> Attack, Dictionary<int, Units> Def)
        {
            mod.CounterDmg = 0;
            ///////////////////////////////////////////////////////////////////// исходящий урон
            var AttackUnit = Attack.FirstOrDefault(x => x.Key == mod.CurrentUnitAttack);
            var DefUnit = Def.FirstOrDefault(x => x.Key == mod.PositionUnitOfAttack);
            string Crit = "";
            var Damage = Rand.Next(AttackUnit.Value.LowDmg, AttackUnit.Value.UpDmg);
            if (Rand.Next(1, 100) <= AttackUnit.Value.Crit)
            {
                mod.Damage = Damage * 2;
                Crit = "КРИТИЧЕСКИЙ";
            }
            else { mod.Damage = Damage; }

            /////////////////////////////////////////////////////////////////
            if (DefUnit.Value.Dodge > Rand.Next(1, 100))
            {
                Console.WriteLine("Боец {0} увернулся от атаки {1}.", mod.PositionUnitOfAttack, mod.CurrentUnitAttack);
                mod.Damage = 0;
            }
            else
            {
                if (Crit != "")
                {
                    mod.Damage = mod.Damage;
                }
                else
                {
                    if (DefUnit.Value.DefenceStatus == true)
                    {
                        mod.Damage = mod.Damage - 10 - (mod.Damage * DefUnit.Value.Armor) / 100;
                    }
                    else
                    {
                    mod.Damage = mod.Damage - (mod.Damage * DefUnit.Value.Armor)/100;}
                }
                Console.Write("Боец {0} нанес",mod.CurrentUnitAttack);
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write(" {0} ", Crit);
                Console.ResetColor();
                Console.WriteLine("урон в {0} единиц бойцу {1}.", mod.Damage, mod.PositionUnitOfAttack);
            }
            if (AttackUnit.Value.Range == false && DefUnit.Value.CounterAttack > 0) // расчет возможности ответного удара
            {
                mod.CounterDmg = DefUnit.Value.LowDmg - (DefUnit.Value.LowDmg * AttackUnit.Value.Armor) / 100;
                DefUnit.Value.CounterAttack--;
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Боец {0} КОНТРАТАКОВАЛ и нанес {1} урона бойцу {2}", mod.PositionUnitOfAttack, mod.CounterDmg, mod.CurrentUnitAttack);
                Console.ResetColor();
            }
        }
Esempio n. 4
0
 public void ChangeRangeUnitAttack(Model M, Dictionary<int, Units> team)
 {
     var Target = team.Where(z => z.Value.Live == true).OrderBy(x => x.Value.HP).FirstOrDefault();
     M.PositionUnitOfAttack = Target.Key;
 }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Random Rand = new Random();
            Round R = new Round();
            Model M = new Model();
            Teams Te = new Teams();
            Attack A = new Attack();
            CPU CPU = new CPU();

            Dictionary<int, Units> Red = new Teams().Team;
            Dictionary<int, Units> Green = new Teams().Team;
            for (int i = 1; i < 7; i++)
            {
                Console.WriteLine("Выберите бойца на позицию {0}, 1 - лучник, 2 - воин, 3 - рыцарь:", i);
                int typeFighter = Convert.ToInt32(Console.ReadLine());
                switch (typeFighter)
                {
                    case 1: Red.Add(i, Te.GetRanger()); break;
                    case 2: Red.Add(i, Te.GetSold()); break;
                    case 3: Red.Add(i, Te.GetKnight()); break;
                    default: return;
                }
            }
            /////////////////////////////////////////////////////// вынести в фабрику с установкой уровня сложности, пожже
            Green.Add(1, Te.GetRanger());
            Green.Add(2, Te.GetRanger());
            Green.Add(3, Te.GetRanger());
            Green.Add(4, Te.GetKnight());
            Green.Add(5, Te.GetKnight());
            Green.Add(6, Te.GetSold());
            /////////////////////////////////////////////////////////

            while (!M.Die)
            {
                int j = 1;

                R.ResetOnAction(Red);     ///////////////// обновляем возможность хода
                R.ResetOnAction(Green); ////////////////
                R.ResetCounterAttack(Red); //////////////// обновление контратаки
                R.ResetCounterAttack(Green); //////////////// обновление контратаки

                while (j < 13)
                {

                    switch (j)
                    {

                        case 1:
                        case 3:
                        case 5:
                        case 7:
                        case 9:
                        case 11:
                            Console.Clear();
                            /////////////////////////////////////////////////////////// Vizualization ))))))))))) :D
                            Console.WriteLine("+----------------+-----------------+---+----------------+----------------+");
                            Console.Write("| 1.");
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("{0}.", Red.FirstOrDefault(x => x.Key == 1).Value.Name.ToString());
                            Console.Write("HP {0}", Red.FirstOrDefault(x => x.Key == 1).Value.HP);
                            Console.ResetColor();
                            Console.Write(" | 6.");
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("{0}.", Red.FirstOrDefault(x => x.Key == 6).Value.Name);
                            Console.Write("HP {0}", Red.FirstOrDefault(x => x.Key == 6).Value.HP);
                            Console.ResetColor();
                            Console.Write("|   | 6.");

                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Write("{0}", Green.FirstOrDefault(x => x.Key == 6).Value.Name);
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("HP {0}", Green.FirstOrDefault(x => x.Key == 6).Value.HP);
                            Console.ResetColor();
                            Console.Write("| 1.");
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Write("{0}.", Green.FirstOrDefault(x => x.Key == 1).Value.Name);
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("HP {0}", Green.FirstOrDefault(x => x.Key == 1).Value.HP);
                            Console.ResetColor();
                            Console.WriteLine(" |");
                            Console.WriteLine("+----------------+-----------------+---+----------------+----------------+");
                            Console.Write("| 2.");
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("{0}.", Red.FirstOrDefault(x => x.Key == 2).Value.Name.ToString());
                            Console.Write("HP {0} ", Red.FirstOrDefault(x => x.Key == 2).Value.HP);
                            Console.ResetColor();
                            Console.Write("| 5. ");
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("{0}.", Red.FirstOrDefault(x => x.Key == 5).Value.Name);
                            Console.Write("HP {0}", Red.FirstOrDefault(x => x.Key == 5).Value.HP);
                            Console.ResetColor();
                            Console.Write("|   | 5.");

                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Write("{0}.", Green.FirstOrDefault(x => x.Key == 5).Value.Name);
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("HP {0}", Green.FirstOrDefault(x => x.Key == 5).Value.HP);
                            Console.ResetColor();
                            Console.Write("| 2.");
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Write("{0}.", Green.FirstOrDefault(x => x.Key == 2).Value.Name);
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("HP {0}", Green.FirstOrDefault(x => x.Key == 2).Value.HP);
                            Console.ResetColor();
                            Console.WriteLine(" |");
                            Console.WriteLine("+----------------+-----------------+---+----------------+----------------+");
                            Console.Write("| 3.");
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("{0}.", Red.FirstOrDefault(x => x.Key == 3).Value.Name.ToString());
                            Console.Write("HP {0} ", Red.FirstOrDefault(x => x.Key == 3).Value.HP);
                            Console.ResetColor();
                            Console.Write("| 4.");
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("{0}.", Red.FirstOrDefault(x => x.Key == 4).Value.Name);
                            Console.Write("HP {0}", Red.FirstOrDefault(x => x.Key == 4).Value.HP);
                            Console.ResetColor();
                            Console.Write("|   | 4.");

                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Write("{0}.", Green.FirstOrDefault(x => x.Key == 4).Value.Name);
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("HP {0}", Green.FirstOrDefault(x => x.Key == 4).Value.HP);
                            Console.ResetColor();
                            Console.Write("| 3.");
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Write("{0}.", Green.FirstOrDefault(x => x.Key == 3).Value.Name);
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("HP {0}", Green.FirstOrDefault(x => x.Key == 3).Value.HP);
                            Console.ResetColor();
                            Console.WriteLine(" |");
                            Console.WriteLine("+----------------+-----------------+---+----------------+----------------+");
                            /////////////////////////////////////////////////////////////////////////////

                            R.UnitsCanAttack(Green, M); // проверка кого можно атаковать
                            if (M.CanAttack.Sum() == 0)
                            { j = 15; break; }

                            var UnAttack = Red.FirstOrDefault(x => x.Value.onAction == true && x.Value.Live == true);
                            var DamageReciever = Green.FirstOrDefault(x => x.Key == M.PositionUnitOfAttack);
                            try
                            {
                                UnAttack.Value.DefenceStatus = false;
                                UnAttack.Value.onAction = false;
                            }
                            catch { j++; break; }

                            M.CurrentUnitAttack = UnAttack.Key;
                            Console.WriteLine("Ход бойца {0}",M.CurrentUnitAttack);
                            Console.WriteLine("Стать в защитную стойку? (Дополнительное игнорирование 10 ед. урона). d - защита. Атака - любая клавиша.");
                            string Deffense = Console.ReadKey().KeyChar.ToString();
                            Console.WriteLine("");
                            switch (Deffense)
                            {
                                case "d":
                                    UnAttack.Value.DefenceStatus = true;
                                    Console.ForegroundColor = ConsoleColor.Blue;
                                    Console.WriteLine("Боец {0} занял оборонительную позицию.", M.CurrentUnitAttack);
                                    Console.ResetColor();
                                    break;
                                default:
                                    if (!UnAttack.Value.Range)
                                    { //mDPS unit
                                        R.CanAttackPositopn(M);
                                        R.ChangeMealeUnitAttack(M);
                                    }
                                    else { R.ChangeRangeUnitAttack(M); }
                                    A.AttackU(M, Red, Green);
                                    DamageReciever = Green.FirstOrDefault(x => x.Key == M.PositionUnitOfAttack);
                                    DamageReciever.Value.HP = DamageReciever.Value.HP - M.Damage;
                                    UnAttack.Value.HP = UnAttack.Value.HP - M.CounterDmg;
                                    if (DamageReciever.Value.HP < 0)
                                    {
                                        DamageReciever.Value.HP = 0;
                                    }
                                    if (UnAttack.Value.HP < 0)
                                    {
                                        UnAttack.Value.HP = 0;
                                    }
                                    break;
                            }

                            Console.WriteLine("Для продолжения нажмите любую клавишу.");
                            Console.ReadKey();

                            var DieFighter = Red.FirstOrDefault(x => x.Value.HP <= 0 && x.Value.Live == true);
                            try
                            {
                                DieFighter.Value.Live = false;
                            }
                            catch (Exception e) { }

                            try
                            {
                                DieFighter = Green.FirstOrDefault(x => x.Value.HP <= 0 && x.Value.Live == true);
                                DieFighter.Value.Live = false;
                            }
                            catch (Exception e) { }
                            j++;
                            break;

                        case 2:
                        case 4:
                        case 6:
                        case 8:
                        case 10:
                        case 12:
                            R.UnitsCanAttack(Red, M); // проверка кого можно атаковать
                            if (M.CanAttack.Sum() == 0)
                            { j = 15; break; }

                            UnAttack = Green.FirstOrDefault(x => x.Value.onAction == true && x.Value.Live == true);

                            try
                            {
                                UnAttack.Value.onAction = false;
                                UnAttack.Value.DefenceStatus = false;
                            }
                            catch { j++; break; }

                            M.CurrentUnitAttack = UnAttack.Key;

                            string action = CPU.CPUDeffence(M, Green);
                            switch (action)
                            {
                                case "Attack":
                                    if (!UnAttack.Value.Range)
                                    {
                                        R.CanAttackPositopn(M);
                                        CPU.ChangeMealeUnitAttack(M, Red);
                                    }
                                    else
                                    {
                                        CPU.ChangeRangeUnitAttack(M, Red);
                                    }

                                    A.AttackU(M, Green, Red);

                                    DamageReciever = Red.FirstOrDefault(x => x.Key == M.PositionUnitOfAttack);
                                    DamageReciever.Value.HP = DamageReciever.Value.HP - M.Damage;
                                    UnAttack.Value.HP = UnAttack.Value.HP - M.CounterDmg;
                                    if (DamageReciever.Value.HP < 0)
                                    {
                                        DamageReciever.Value.HP = 0;
                                    }
                                    break;
                                case "Deffence":
                                    UnAttack.Value.DefenceStatus = M.Deffence;
                                    Console.ForegroundColor = ConsoleColor.Blue;
                                    Console.WriteLine("Боец {0} занял оборонительную позицию.", M.CurrentUnitAttack);
                                    Console.ResetColor();
                                    break;
                                default: break;
                            }
                            if (UnAttack.Value.HP < 0)
                            {
                                UnAttack.Value.HP = 0;
                            }

                            Console.WriteLine("Для продолжения нажмите любую клавишу.");
                            Console.ReadKey();

                            DieFighter = Red.FirstOrDefault(x => x.Value.HP <= 0 && x.Value.Live == true);
                            try
                            {
                                DieFighter.Value.Live = false;
                            }
                            catch (Exception e) { }
                            DieFighter = Green.FirstOrDefault(x => x.Value.HP <= 0 && x.Value.Live == true);
                            try
                            {
                                DieFighter.Value.Live = false;
                            }
                            catch (Exception e) { }

                            j++;
                            break;
                        default:
                            break;
                    }

                }

                R.EndRound(M, Red);
                if (M.Die == true) { Console.WriteLine("Green team win"); }

                else
                {
                    R.EndRound(M, Green);
                    if (M.Die == true) { Console.WriteLine("Red team win"); }
                }

            }
            Console.ReadKey();
        }
Esempio n. 6
0
        public void CanAttackPositopn(Model M)
        {
            if (!M.CanAttack.Contains(4) && !M.CanAttack.Contains(5) && !M.CanAttack.Contains(6)) // нет переднего ряда
            {
                if (M.CanAttack.Contains(1) && M.CanAttack.Contains(2) && M.CanAttack.Contains(3))
                {
                    M.CanAttack[3] = 23;
                    M.CanAttack[5] = 12;
                    M.CanAttack[4] = 123;
                }
                else if (!M.CanAttack.Contains(1) && M.CanAttack.Contains(2) && M.CanAttack.Contains(3))
                {
                    M.CanAttack[3] = 23;
                    M.CanAttack[5] = 2;
                    M.CanAttack[4] = 23;
                }
                else if (!M.CanAttack.Contains(3) && M.CanAttack.Contains(1) && M.CanAttack.Contains(2))
                {
                    M.CanAttack[3] = 2;
                    M.CanAttack[5] = 12;
                    M.CanAttack[4] = 12;
                }
                else if (!M.CanAttack.Contains(2) && M.CanAttack.Contains(1) && M.CanAttack.Contains(3))
                {
                    M.CanAttack[3] = 13;
                    M.CanAttack[5] = 13;
                    M.CanAttack[4] = 13;
                }
                else
                {
                    var LastOfLine = M.CanAttack.FirstOrDefault(x => x > 0);
                    M.CanAttack[3] = LastOfLine;
                    M.CanAttack[5] = LastOfLine;
                    M.CanAttack[4] = LastOfLine;
                }
            }
            else
            {
                if (M.CanAttack.Contains(4) && M.CanAttack.Contains(5) && M.CanAttack.Contains(6))
                {
                    M.CanAttack[3] = 45;
                    M.CanAttack[5] = 56;
                    M.CanAttack[4] = 456;
                }
                else if (!M.CanAttack.Contains(4) && M.CanAttack.Contains(6) && M.CanAttack.Contains(5))
                {
                    M.CanAttack[3] = 5;
                    M.CanAttack[5] = 56;
                    M.CanAttack[4] = 56;

                }
                else if (!M.CanAttack.Contains(5) && M.CanAttack.Contains(6) && M.CanAttack.Contains(4))
                {
                    M.CanAttack[3] = 4;
                    M.CanAttack[5] = 6;
                    M.CanAttack[4] = 46;
                }
                else if (!M.CanAttack.Contains(6) && M.CanAttack.Contains(4) && M.CanAttack.Contains(5))
                {
                    M.CanAttack[3] = 45;
                    M.CanAttack[5] = 5;
                    M.CanAttack[4] = 45;
                }
                else
                {
                    var LastOfLine = M.CanAttack.FirstOrDefault(x => x > 3);
                    M.CanAttack[3] = LastOfLine;
                    M.CanAttack[5] = LastOfLine;
                    M.CanAttack[4] = LastOfLine;
                }
            }
        }
Esempio n. 7
0
        public void BuffActivations(Model mod)
        {
            //DebuffActivation

            //BuffActivation
        }
Esempio n. 8
0
 // проверка юнитов, которых можно атаковать, по критерию(жив - мертв)
 public void UnitsCanAttack(Dictionary<int, Units> team, Model mod)
 {
     for (int m = 0; m < 6; m++)
     {
         mod.CanAttack[m] = 0;
     }
     int j = 0;
     foreach (int i in team.Keys)
     {
         if (team[i].Live == true)
         {
             mod.CanAttack[j] = i;
             j++;
         }
     }
 }
Esempio n. 9
0
 // по окончанию раунда проверка на количество убитых, и победу команды
 public void EndRound(Model mod, Dictionary<int, Units> team)
 {
     int j = 0;
     foreach (int i in team.Keys)
     {
         if (!team[i].Live)
         { j++; }
     }
     if (j == 6) { mod.Die = true; }
 }
Esempio n. 10
0
 public void ChangeRangeUnitAttack(Model M)
 {
     while (true)
     {
         int[] array = { 0 };
         int position = 0;
         Console.WriteLine("Ход воина на позиции {0}", M.CurrentUnitAttack);
         Console.WriteLine("Вы можете атаковать вражеские позиции {0}. Выберите цель для атаки:", string.Join(", ", M.CanAttack.Except<int>(array)));
         try
         {
             position = Convert.ToInt32(Console.ReadLine());
         }
         catch (Exception e) { }
         if (M.CanAttack.Any(x => x == position))
         {
             M.PositionUnitOfAttack = position;
             return;
         }
     }
 }
Esempio n. 11
0
        public void ChangeMealeUnitAttack(Model M)
        {
            Console.WriteLine("Ход воина на позиции {0}", M.CurrentUnitAttack);
            int position = 0;
            int pos0 = 0;
            int pos1 = 0;
            int pos2 = 0;
            string VariantAtatck = "";
            if (M.CurrentUnitAttack == 5)
            {
                string tostr = M.CanAttack[4].ToString();
                char[] pos = tostr.ToCharArray();
                try
                {
                    int.TryParse(pos[0].ToString(), out pos0);
                    int.TryParse(pos[1].ToString(), out pos1);
                    int.TryParse(pos[2].ToString(), out pos2);
                }
                catch (Exception e) { }

                if (pos1 == 0 && pos2 == 0)
                {
                    VariantAtatck = "Вы можете атаковать вражеские позиции {0}. Выберите цель для атаки:";
                }
                else if (pos2 == 0)
                {
                    VariantAtatck = "Вы можете атаковать вражеские позиции {0}, {1}. Выберите цель для атаки:";
                }
                else VariantAtatck = "Вы можете атаковать вражеские позиции {0}, {1}, {2}. Выберите цель для атаки:";

                while (pos0 > 0)
                {
                    Console.WriteLine(VariantAtatck, pos0, pos1, pos2);
                    try
                    {
                        position = int.Parse(Console.ReadLine());
                    }
                    catch (Exception e) { }
                    if (position != null && position != 0)
                    {
                        if (position == Convert.ToInt32(pos0) || position == Convert.ToInt32(pos2) || position == Convert.ToInt32(pos1))
                        {
                            M.PositionUnitOfAttack = position;
                            pos0 = -100;
                        }
                    }
                }

            }
            else if (M.CurrentUnitAttack == 4)
            {
                string tostr = M.CanAttack[3].ToString();
                char[] pos = tostr.ToCharArray();
                try
                {
                    int.TryParse(pos[0].ToString(), out pos0);
                    int.TryParse(pos[1].ToString(), out pos1);

                }
                catch (Exception e) { }

                if (pos1 == 0)
                {
                    VariantAtatck = "Вы можете атаковать вражеские позиции {0}. Выберите цель для атаки:";
                }
                else VariantAtatck = "Вы можете атаковать вражеские позиции {0}, {1}. Выберите цель для атаки:";

                while (pos0 > 0)
                {
                    Console.WriteLine(VariantAtatck, pos0, pos1);
                    try
                    {
                        position = int.Parse(Console.ReadLine());
                    }
                    catch (Exception e) { }
                    if (position != null && position != 0)
                    {
                        if (position == Convert.ToInt32(pos0) || position == Convert.ToInt32(pos1))
                        {
                            M.PositionUnitOfAttack = position;
                            pos0 = -100;
                        }
                    }
                }
            }
            else
            {
                string tostr = M.CanAttack[5].ToString();
                char[] pos = tostr.ToCharArray();
                try
                {
                    int.TryParse(pos[0].ToString(), out pos0);
                    int.TryParse(pos[1].ToString(), out pos1);
                }
                catch (Exception e) { }

                if (pos1 == 0)
                {
                    VariantAtatck = "Вы можете атаковать вражеские позиции {0}. Выберите цель для атаки:";
                }
                else VariantAtatck = "Вы можете атаковать вражеские позиции {0}, {1}. Выберите цель для атаки:";

                while (pos0 > 0)
                {
                    Console.WriteLine(VariantAtatck, pos0, pos1);
                    try
                    {
                        position = int.Parse(Console.ReadLine());
                    }
                    catch (Exception e) { }
                    if (position != null && position != 0)
                    {
                        if (position == Convert.ToInt32(pos0) || position == Convert.ToInt32(pos1))
                        {
                            M.PositionUnitOfAttack = position;
                            pos0 = -100;
                        }
                    }
                }
            }
        }