コード例 #1
0
        public void Cure_Test()
        {
            enano.ReceiveAttack(100);
            enano.Cure();
            int actual   = enano.Health;
            int expected = 100;

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void Healyh_Is_Modified_By_Cure()        //Prueba que el metodo Cure modifica la vida
        {
            legolas.AddItem(bow);
            legolas.AddItem(bow);
            legolas.AddItem(bow);
            legolas.AddItem(bow);
            gimli.ReceiveAttack(legolas);
            int actualLife = gimli.Health;

            gimli.Cure();

            Assert.AreNotEqual(actualLife, gimli.Health);
        }
コード例 #3
0
        public void TestHealthAfterCure()
        {
            // Arrange.
            dwarfProof.Shield = shield;
            dwarfProof.Helmet = helmet;

            // Act.
            dwarfProof.ReceiveAttack(10000);
            dwarfProof.Cure();

            // Assert.
            Assert.AreEqual(100, dwarfProof.Health);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: ilima12091/RoleplayGame2
        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}");
        }
コード例 #5
0
        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");
        }
コード例 #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}");
        }
コード例 #7
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}");
        }
コード例 #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());
        }
コード例 #9
0
        public void SaludDelEnanoIgualA100TrasSerCurado()
        {
            dwarf1.ReceiveAttack(archer1.AttackValue);
            dwarf1.Cure();
            string expected = "100";

            Assert.Pass(expected, dwarf1.Health);
        }
コード例 #10
0
        public void CorrectHealthRestore()
        {
            int dummy1InitialHealth = this.dummy.Health;
            int damage = 50;

            dummy.ReceiveAttack(damage);
            dummy.Cure();
            Assert.AreEqual(dummy1InitialHealth, dummy.Health);
        }
コード例 #11
0
        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}");
        }
コード例 #12
0
        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}");
        }
コード例 #13
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}");
        }
コード例 #14
0
 public void TestCure()
 {
     dwarf.ReceiveAttack(101);
     dwarf.Cure();
     Assert.AreEqual(dwarf.Health, 100);
 }
コード例 #15
0
 public void TestCure()
 {
     Gimli.ReceiveAttack(200000);
     Gimli.Cure();
     Assert.AreEqual(100, Gimli.Health);
 }
コード例 #16
0
 /*
  *  Este test prueba que si un personaje es atacado y se le usa medotodo Revive
  *  la salud del personaje se recupera a la inicial
  */
 public void Revive()
 {
     dwarf.ReceiveAttack(knight2.AttackValue);
     dwarf.Cure();
     Assert.True(dwarf.Health == 100);
 }
コード例 #17
0
 public void Test4()
 {
     dwarf.ReceiveAttack(dwarf.AttackValue);
     dwarf.Cure();
     Assert.AreEqual(dwarf.Health, 100);
 }