Example #1
0
        public void SaludDeEnanoTrasSerAtacadoPorArquero()
        {
            dwarf1.ReceiveAttack(archer1.AttackValue);
            string expected = "85";

            Assert.Pass(expected, dwarf1.Health);
        }
        static void Main(string[] args)
        {
            Dwarf Dwarf1 = new Dwarf("Dwarf1");
            Dwarf Dwarf2 = new Dwarf("Dwarf2");

            Console.WriteLine(Dwarf1.Health);
            Console.WriteLine(Dwarf2.Health);
            Dwarf1.ReceiveAttack(Dwarf2);
            Console.WriteLine(Dwarf1.Health);
            Console.WriteLine(Dwarf1.ReceiveAttack(Dwarf2));
            Elf Elf  = new Elf("Elf");
            Elf Elf1 = new Elf("Elf");

            Elf.ReceiveOther(Elf.Attack);
            Console.WriteLine(Elf.Health);
            Wizard Pedro = new Wizard("Pedro");
            Wizard Pepe  = new Wizard("Pepe");

            Console.WriteLine(Pepe.Health);
            Pepe.ReceiveAttack(Pedro.Attack);
            Pepe.ReceiveAttack(Pedro.Attack);
            Console.WriteLine(Pepe.Magic);
            Pepe.Spellbook.AdquirirConocimiento(Pepe);
            Console.WriteLine(Pepe.Magic);
        }
        // El test verifica que el ataque al Dwarf se efecúa correctamente, cuando ataque < vida
        public void ReceiveAttack_Test()
        {
            enano.ReceiveAttack(15);
            int expected = 85;
            int actual   = enano.Health;

            Assert.AreEqual(expected, actual);
        }
        public void CorrectHealthRestore()
        {
            int dummy1InitialHealth = this.dummy.Health;
            int damage = 50;

            dummy.ReceiveAttack(damage);
            dummy.Cure();
            Assert.AreEqual(dummy1InitialHealth, dummy.Health);
        }
Example #5
0
        public void Health_Is_Modified_By_Attack()      //Prueba que el metodo ReceiveAttack modifica la vida
        {
            int initialLife = gimli.Health;

            legolas.AddItem(bow);
            legolas.AddItem(bow);
            gimli.ReceiveAttack(legolas);

            Assert.AreNotEqual(initialLife, gimli.Health);
        }
Example #6
0
        static void Main(string[] args)
        {
            SpellsBook book = new SpellsBook();

            book.Spells = new Spell[] { new Spell() };

            Wizard gandalf = new Wizard("Gandalf");

            gandalf.Staff      = new Staff();
            gandalf.SpellsBook = book;

            Dwarf gimli = new Dwarf("Gimli");

            gimli.Axe    = new Axe();
            gimli.Helmet = new Helmet();
            gimli.Shield = new Shield();

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
            Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}");

            gimli.ReceiveAttack(gandalf.AttackValue);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            gimli.Cure();

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
        }
Example #7
0
        static void Main(string[] args)
        {
            SpellsBook book = new SpellsBook();

            book.AddSpell("Bola de fuego", 10, 0);
            book.AddSpell("Escudo de maná", 0, 20);

            Wizard gandalf = new Wizard("Gandalf");

            gandalf.SpellsBook = book;
            gandalf.AddItem("Staff", 30, 20);

            Dwarf gimli = new Dwarf("Gimli");

            gimli.AddItem("Helmet", 0, 20);
            gimli.AddItem("Axe", 40, 0);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
            Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}");

            gimli.ReceiveAttack(gandalf.AttackValue);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            gimli.Cure();

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
        }
Example #8
0
        static void Main(string[] args)
        {
            SpellsBook book = new SpellsBook();

            book.AddSpell(new SpellOne());
            book.AddSpell(new SpellOne());

            Wizard gandalf = new Wizard("Gandalf");

            gandalf.AddItem(book);

            Dwarf gimli = new Dwarf("Gimli");

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
            Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}");

            gimli.ReceiveAttack(gandalf.AttackValue);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            gimli.Cure();

            Console.WriteLine($"Someone cured Gimli. Gimli now has ❤️ {gimli.Health}");

            DarkArcher darkArcher = new DarkArcher("Orc Commander");

            darkArcher.Pv = 5;
            DarkBow darkBow = new DarkBow();

            darkArcher.AddItem(darkBow);
            darkArcher.ReceiveAttack(gimli.AttackValue);
            gimli.MorePv(darkArcher.ChechHealth());
        }
        static void Main(string[] args)
        {
            SpellsBook book   = new SpellsBook();
            WhirlWind  spell1 = new WhirlWind();
            FireBall   spell2 = new FireBall();

            book.AddSpell(spell1);
            book.AddSpell(spell2);

            Wizard gandalf = new Wizard("Gandalf");

            gandalf.AddItem(new Staff());
            gandalf.AddItem(book);

            Dwarf gimli = new Dwarf("Gimli");

            gimli.AddItem(new Axe());
            gimli.AddItem(new Helmet());
            gimli.AddItem(new Shield());

            Console.WriteLine($"Gimli has {gimli.Health} HP points");
            Console.WriteLine($"Gandalf attacks Gimli with {gandalf.AttackValue} points.");

            gimli.ReceiveAttack(gandalf.AttackValue);

            Console.WriteLine($"Gimli has {gimli.Health} HP");

            gimli.Cure();

            Console.WriteLine($"Gimli has {gimli.Health} HP");
        }
Example #10
0
        static void Main(string[] args)
        {
            Character character = new Archer("Test Archer");

            character.Attack = -100;
            SpellsBook book = new SpellsBook();

            book.Spells = new Spell[] { new Spell("Hechizo 1", 50, 10) };

            Wizard gandalf = new Wizard("Gandalf");

            gandalf.Staff      = new Staff();
            gandalf.SpellsBook = book;

            Dwarf gimli = new Dwarf("Gimli");

            gimli.Axe    = new Axe(32);
            gimli.Helmet = new Helmet(12);
            gimli.Shield = new Shield(21);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
            Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.Attack}");

            gimli.ReceiveAttack(gandalf.Attack);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            gimli.Cure();

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
        }
        public void Test_attack()
        {
            Wizard gandalf = new Wizard("Gandalf");
            Dwarf  gimli   = new Dwarf("Gimli");

            gimli.ReceiveAttack(gandalf.AttackValue);

            int healthAfterAttack = gimli.Health;

            Assert.AreEqual(0, healthAfterAttack);
        }
        static void Main(string[] args)
        {
            SpellsBook book = new SpellsBook();

            book.Spells = new Spell[] { new Spell() };

            Wizard     gandalf    = new Wizard("Gandalf");
            Staff      staff      = new Staff();
            SpellsBook spellsBook = book;

            gandalf.AddItem(spellsBook);
            gandalf.AddItem(staff);

            Dwarf  gimli  = new Dwarf("Gimli");
            Axe    axe    = new Axe();
            Helmet helmet = new Helmet();
            Shield shield = new Shield();

            gimli.AddItem(axe);
            gimli.AddItem(helmet);
            gimli.AddItem(shield);

            Archer legolas       = new Archer("Legolas");
            Bow    bow           = new Bow();
            Shield legolasShield = new Shield();
            Helmet legolasHelmet = new Helmet();

            legolas.AddItem(bow);
            legolas.AddItem(legolasShield);
            legolas.AddItem(legolasHelmet);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
            Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}");

            gimli.ReceiveAttack(gandalf);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            gimli.Cure();

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            legolas.RemoveItem(legolasHelmet);

            gandalf.ReceiveAttack(legolas);
            Console.WriteLine($"Legolas attacks Gandalf with ⚔️ {legolas.AttackValue}");

            Console.WriteLine($"Gandalf has ❤️ {gandalf.Health}");

            legolas.ReceiveAttack(gimli);
            Console.WriteLine($"Gimli attacks Legolas with ⚔️ {gimli.AttackValue}");
            Console.WriteLine($"Legolas has ❤️ {legolas.Health}");
        }
Example #13
0
        public void ReceiveAttackCheck()

        /*Se prueba que el valor total de la vida (con su protección) del enano
         * sea el esperado despues de recibir un daño de ataque en especifico.*/
        {
            int expectedDwarfHealth = 15;

            //Act
            dwarf.ReceiveAttack(100);

            //Assert
            Assert.AreEqual(expectedDwarfHealth, dwarf.Health);
        }
        static void Main(string[] args)
        {
            Wizard gandalf = new Wizard("Gandalf");


            Dwarf gimli = new Dwarf("Gimli");

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
            Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}");

            gimli.ReceiveAttack(gandalf.AttackValue);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            gimli.Cure();

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
        }
Example #15
0
        public void TestReceiveNegativeAttack()
        {
            // Arrange.
            dwarfProof.Shield = shield;
            dwarfProof.Helmet = helmet;

            // Act.
            int healthBeforeAttack = dwarfProof.Health;

            dwarfProof.ReceiveAttack(-10000);
            int healthAfterAttack = dwarfProof.Health;

            // Assert.
            Assert.AreEqual(healthBeforeAttack, healthAfterAttack);
        }
Example #16
0
        static void Main(string[] args)
        {
            SpellsBook book = new SpellsBook();

            book.Spells = new Spell[] { new Spell() };

            Wizard gandalf    = new Wizard("Gandalf");
            IItem  magicStaff = new Staff();

            gandalf.SpellsBook = book;
            Dwarf gimli = new Dwarf("Gimli");

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
            Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.Attack}");

            gimli.ReceiveAttack(gandalf.Attack);

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");

            gimli.Cure();

            Console.WriteLine($"Gimli has ❤️ {gimli.Health}");
        }
 public void Test2()
 {
     Dwarf20.ReceiveAttack(Dwarf30);
     Assert.AreEqual(Dwarf20.Health, 80);
 }
Example #18
0
 public void TestHealth()
 {
     dwarf.ReceiveAttack(101);
     Assert.AreEqual(dwarf.Health, 31);
 }
Example #19
0
 /*
  *  Este test prueba que si se realiza un ataque y
  *  el atacado tiene más defensa que el ataque del atacante la vida se mantiene
  */
 public void More_armor_than_attack()
 {
     dwarf.ReceiveAttack(knight.AttackValue);
     Assert.True(dwarf.Health == 100);
 }
Example #20
0
 public void Test1()
 {
     dwarf.ReceiveAttack(dwarf1.AttackValue);
     Assert.AreEqual(dwarf.Health, 100);
 }
Example #21
0
 public void TestReceiveDamage()
 {
     Gimli.ReceiveAttack(20);
     Assert.AreEqual(80, Gimli.Health);
 }