Exemple #1
0
        static bool fight(Party p1, Party p2)
        {
            int averageLevel = 0;

            foreach (IEngageable member in p1)
            {
                averageLevel += member.getLevel();
            }

            averageLevel /= p1.Count;

            for (int i = 0; i < 3; i++)
            {
                switch (RandomPlus.genIntInc(5))
                {
                    case 0: p2.addMember(new Swordsman(averageLevel));  break;
                    case 1: p2.addMember(new Assassin(averageLevel));  break;
                    case 2: p2.addMember(new Tank(averageLevel));       break;
                    case 3: p2.addMember(new Tank(averageLevel));       break;
                    case 4: p2.addMember(new Assassin(averageLevel));  break;
                    case 5: p2.addMember(new Swordsman(averageLevel));  break;
                }
            }

            p2.addMember(new Cleric(averageLevel));

            Battle.engage(p1, p2);

            Console.WriteLine("-----------");

            if (!p1.isDefeated())
            {
                Text.color("You win!\n", ConsoleColor.Cyan);
                return true;
            }
            else
            {
                Text.color("You lose...\n", ConsoleColor.Red);
                return false;
            }
        }