Ejemplo n.º 1
0
        // Dragoon attack dragon doubles damage
        public static void TestDragoonSpecial()
        {
            // 龙骑对龙伤害加倍
            var dragoon = new Dragoon("龙骑");
            var sword   = new Sword("亚瑟王的神剑", 10);
            var dragon  = new Dragon("龙", 100L);

            dragoon.Equip(sword);
            dragoon.Attack(dragon);

            if (dragon.Health != 80)
            {
                throw new InvalidOperationException();
            }

            Console.WriteLine();
        }
Ejemplo n.º 2
0
        // Dragon is immune to attacks
        public static void TestDragonImmunity()
        {
            // 龙对物理和魔法攻击免疫
            var fighter = new Fighter("战士");
            var sword   = new Sword("亚瑟王的神剑", 10);
            var dragon  = new Dragon("龙", 100L);

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

            if (dragon.Health != 100)
            {
                throw new InvalidOperationException();
            }

            Console.WriteLine();
        }