Esempio n. 1
0
        public static void BuildArmy(Army army, string armyname)
        {
            List <Unit> units = Units.UnitsLibrary.GetUnits();

            int[] prices = { 20, 50, 400, 200, 400 };
            int   id     = 0;

            foreach (var u in units)
            {
                Console.WriteLine("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
                Console.WriteLine("id=" + id++.ToString());
                Console.WriteLine("___________");
                Console.WriteLine(u.toStr());
                Console.WriteLine("EFFECTS:");

                foreach (var e in u.BaseEffects)
                {
                    Console.WriteLine("--" + e.ToStr());
                }
                Console.WriteLine("ABILITIES:");
                foreach (var s in u.BaseSpells)
                {
                    Console.WriteLine("++" + s.ToStr());
                }
                Console.WriteLine();
            }
            Console.WriteLine("--------------------------------------------------------------------");
            Console.WriteLine("Let's gather {0}", armyname);
            Console.WriteLine("--------------------------------------------------------------------");
            Console.WriteLine("Use format \"id count\" to buy units \n or STOP to stop");
            while (army.StackCount < 5)
            {
                char[]   det   = { ' ' };
                string[] words = Console.ReadLine().Split();
                int      X     = -1;
                int      Y     = -1;
                if (words.Length > 2 ||
                    (words.Length == 1 && words[0] != "STOP") ||
                    (words.Length == 2 && (!int.TryParse(words[0], out X) || !int.TryParse(words[1], out Y))))
                {
                    Error("Invalid format");
                    Console.WriteLine("Use format \"id count\" to buy units \nor STOP to stop");
                    continue;
                }
                else if (words.Length == 1 && words[0] == "STOP")
                {
                    break;
                }
                if (X < units.Count && X >= 0 && Y > 0)
                {
                    army.AddStack(new UnitsStack(units[X], Y));
                    Console.WriteLine(units[X].Name + " " + Y.ToString() + " Added");
                }
                else
                {
                    Error("Invalid format");
                    Console.WriteLine("Use format \"id count\" to buy units \n or STOP to stop");
                }
            }
        }
Esempio n. 2
0
        public GameSession(int[] arm1Id, int[] arm1Count,
                           int[] arm2Id, int[] arm2Count)
        {
            _factory = new FactoryMV();
            Army first = new Army();

            for (int i = 0; i < arm1Id.Length; i++)
            {
                first.AddStack(new UnitsStack(new Unit(_factory.GameUnitsList[arm1Id[i]]), arm1Count[i]));
            }
            Army second = new Army();

            for (int i = 0; i < arm2Id.Length; i++)
            {
                second.AddStack(new UnitsStack(new Unit(_factory.GameUnitsList[arm2Id[i]]), arm2Count[i]));
            }
            Battle = new Battle(first, second);
        }
Esempio n. 3
0
 public void BuyNewStack(UnitStack stack) => Army.AddStack(stack);