コード例 #1
0
        void Attack(int damage, int order, Skill skill, Player player, Enemy randomEnemy)
        {
            string wElement = player.GetWeapon().GetElementBattleText();
            string sElement = "";
            string sName    = "";

            if (skill != null)
            {
                sElement = skill.GetElementText();
                sName    = skill.GetName();
            }
            string eElement = randomEnemy.GetElementText();
            string pName    = player.name;
            string eName    = randomEnemy.GetName();


            Console.WriteLine(border);
            if (order == 1)
            {
                if (!player.GetUsedSkill())
                {
                    Console.WriteLine("|| {0} attacks!", pName);
                    Console.WriteLine(border);
                    if (player.GetDidCrit())
                    {
                        Console.WriteLine("|| CRITICAL HIT!");
                    }
                    Console.WriteLine("|| {0} got {1} {2} damage!", eName, randomEnemy.GetDamaged(damage, wElement), wElement);
                    if (randomEnemy.IsDead())
                    {
                        Console.WriteLine("|| {0} got defeated!", eName);
                    }
                }
                else
                {
                    Console.WriteLine("|| {0} uses {1}!", pName, sName);
                    player.SetUsedSkill(false);
                    Console.WriteLine(border);
                    if (player.GetDidCrit())
                    {
                        Console.WriteLine("|| CRITICAL HIT!");
                    }
                    Console.WriteLine("|| {0} got {1} {2} damage!", eName, randomEnemy.GetDamaged(damage, sElement), sElement);
                    if (randomEnemy.IsDead())
                    {
                        Console.WriteLine("|| {0} got defeated!", eName);
                    }
                }
            }
            else
            {
                if (!randomEnemy.GetUsedSkill())
                {
                    Console.WriteLine("|| {0} attacks!", eName);
                    Console.WriteLine(border);
                    if (randomEnemy.GetDidCrit())
                    {
                        Console.WriteLine("|| CRITICAL HIT!");
                    }
                    Console.WriteLine("|| {0} got {1} {2} damage!", pName, player.GetDamaged(damage, eElement), eElement);
                }
                else
                {
                    Console.WriteLine("|| {0} uses {1}!", eName, sName);
                    randomEnemy.SetUsedSkill(false);
                    if (randomEnemy.GetDidCrit())
                    {
                        Console.WriteLine("|| CRITICAL HIT!");
                    }
                    Console.WriteLine(border);
                    Console.WriteLine("|| {0} got {1} {2} damage!", pName, player.GetDamaged(damage, sElement), sElement);
                }
            }
            Console.WriteLine(border);
        }