示例#1
0
        public void TestMagicDamagetoHealth()
        {
            Player attacker = new Player("Dave", Races.Human, Classes.Knight);
            Player defender = new Player("Steve-O", Races.Dwarf, Classes.Mage);

            attacker.MagicPower = 21;
            defender.MagicResistance = 9;
            defender.Health = 100;

            _repo.AddPlayerToDirectory(attacker);
            _repo.AddPlayerToDirectory(defender);

            Console.WriteLine($"{attacker.PlayerName} starts with attack of {attacker.MagicPower}.");
            Console.WriteLine($"{attacker.PlayerName} rolls, and now has attack value of {_repo.AttackWithMagic(attacker.PlayerName, attacker)}.");
            Console.WriteLine();
            Console.WriteLine($"{defender.PlayerName} starts with defense of {defender.MagicResistance}.");
            Console.WriteLine($"{defender.PlayerName} rolls, and now has defense value of {_repo.DefendAgainstMagic(defender.PlayerName, defender)}.");
            Console.WriteLine();

            Console.WriteLine(_repo.CombatMagic(attacker.PlayerName, defender.PlayerName));
            Console.WriteLine();
            Console.WriteLine(_repo.MagicDamageToHealth(attacker.PlayerName, defender.PlayerName, defender));
            Thread.Sleep(1000);
            //next iteration
            Console.WriteLine($"{attacker.PlayerName} starts with attack of {attacker.MagicPower}.");
            Console.WriteLine($"{attacker.PlayerName} rolls, and now has attack value of {_repo.AttackWithMagic(attacker.PlayerName, attacker)}.");
            Console.WriteLine();
            Console.WriteLine($"{defender.PlayerName} starts with defense of {defender.MagicResistance}.");
            Console.WriteLine($"{defender.PlayerName} rolls, and now has defense value of {_repo.DefendAgainstMagic(defender.PlayerName, defender)}.");
            Console.WriteLine();

            Console.WriteLine(_repo.CombatMagic(attacker.PlayerName, defender.PlayerName));
            Console.WriteLine();
            Console.WriteLine(_repo.MagicDamageToHealth(attacker.PlayerName, defender.PlayerName, defender));
            Thread.Sleep(1000);
            //next iteration
            Console.WriteLine($"{attacker.PlayerName} starts with attack of {attacker.MagicPower}.");
            Console.WriteLine($"{attacker.PlayerName} rolls, and now has attack value of {_repo.AttackWithMagic(attacker.PlayerName, attacker)}.");
            Console.WriteLine();
            Console.WriteLine($"{defender.PlayerName} starts with defense of {defender.MagicResistance}.");
            Console.WriteLine($"{defender.PlayerName} rolls, and now has defense value of {_repo.DefendAgainstMagic(defender.PlayerName, defender)}.");
            Console.WriteLine();

            Console.WriteLine(_repo.CombatMagic(attacker.PlayerName, defender.PlayerName));
            Console.WriteLine();
            Console.WriteLine(_repo.MagicDamageToHealth(attacker.PlayerName, defender.PlayerName, defender));
            Thread.Sleep(1000);
            //next iteration

        }