Beispiel #1
0
        // Orc should receive half damage from physical weapons
        public static void TestFighterOrc()
        {
            // 兽人对物理攻击伤害减半。
            var fighter = new Fighter("战士");
            var sword   = new Sword("亚瑟王的神剑", 10);
            var orc     = new Orc("兽人", 100L);

            fighter.Equip(sword);
            fighter.Attack(orc);

            if (orc.Health != 95)
            {
                throw new InvalidOperationException();
            }

            Console.WriteLine();
        }
Beispiel #2
0
        // Orc receive full damage from magic attacks
        public static void TestMageOrc()
        {
            Console.WriteLine();

            // 兽人应该遭受完整的魔法攻击
            var mage  = new Mage("法师");
            var staff = new Staff("火焰法杖", 10);
            var orc   = new Orc("兽人", 100L);

            mage.Equip(staff);
            mage.Attack(orc);

            if (orc.Health != 90)
            {
                throw new InvalidOperationException();
            }

            Console.WriteLine();
        }