Example #1
0
        public void NotEnoughItemsExchangeEncounterTest()
        {
            Dwarf            gimli   = new Dwarf();
            Elf              legolas = new Elf();
            BasicSword       sword   = new BasicSword();
            StygianBlade     blade   = new StygianBlade();
            HearthSeekingBow bow     = new HearthSeekingBow();

            gimli.AddItem(blade);
            gimli.AddItem(bow);

            List <string> itemList = new List <string>()
            {
                sword.Name, blade.Name, bow.Name
            };
            ExchangeEncounter encounter = new ExchangeEncounter(gimli, legolas, itemList);

            try
            {
                encounter.PlayEncounter();
                Assert.Fail();
            }
            //Si hay una excepción al tratar de intercambiar un item que no se tiene, se pasa al bloque catch y por ende se cumple el test.
            catch
            {
                Assert.Pass();
            }
        }
Example #2
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}");
        }
        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");
        }
        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 #5
0
        public void AsclepiosWandTest()
        {
            AsclepiosWand wand  = new AsclepiosWand();
            Excalibur     sword = new Excalibur();
            Dwarf         gimli = new Dwarf();

            gimli.AddItem(wand);
            gimli.AddItem(sword);

            gimli.UseAsclepiosWand(wand, sword);

            Assert.AreEqual(1, gimli.ItemList.Count);
        }
Example #6
0
        public void ItemCombinationTest()
        {
            Dwarf        gimli = new Dwarf();
            StygianBlade blade = new StygianBlade();
            FrostMourne  sword = new FrostMourne();

            gimli.AddItem(blade);
            gimli.AddItem(sword);

            gimli.FuseItems(blade, sword);

            Assert.AreEqual(1, gimli.ItemList.Count);
        }
Example #7
0
 public void Setup()
 {
     this.legolas = new Archer("Legolas");
     this.bow     = new Bow();
     legolas.AddItem(bow);
     this.gimli  = new Dwarf("Gimli");
     this.axe    = new Axe();
     this.helmet = new Helmet();
     this.shield = new Shield();
     gimli.AddItem(axe);
     gimli.AddItem(helmet);
     gimli.AddItem(shield);
 }
Example #8
0
        public void TwoAttackItemsTest()
        {
            Dwarf gimli  = new Dwarf();
            Orc   dummy1 = new Orc();

            dummy1.ReceiveDamage(gimli.Attack());

            Orc          dummy2 = new Orc();
            BasicSword   sword  = new BasicSword();
            StygianBlade sword2 = new StygianBlade();

            gimli.AddItem(sword);
            gimli.AddItem(sword2);

            dummy2.ReceiveDamage(gimli.Attack());

            Assert.AreEqual(dummy1.HealthActual - dummy2.HealthActual, sword.AttackPower + sword2.AttackPower);
        }
Example #9
0
        public void NonWizardCantUseMagicalItemsTest()
        {
            Dwarf gimli = new Dwarf();

            Excalibur sword = new Excalibur();

            gimli.AddItem(sword);

            Assert.AreEqual(0, gimli.ItemList.Count);
        }
Example #10
0
        public void Setup()
        {
            dwarf = new Dwarf("Nacho");
            dwarf.AddItem("Helmet", 0, 20);
            dwarf.AddItem("Shield", 0, 10);

            wizard = new Wizard("Jero");
            SpellsBook book = new SpellsBook();

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

            knight = new Knight("Rodri");
            knight.AddItem("Sword", 10, 0);

            knight2 = new Knight("Rodrialter");
            knight2.AddItem("Sword", 50, 0);
        }
Example #11
0
        public void TwoDefenseItemsTest()
        {
            Dwarf  gimli = new Dwarf();
            Dragon dummy = new Dragon();

            gimli.ReceiveDamage(dummy.Attack());
            int checkPoint1 = gimli.HealthMax - gimli.HealthActual;

            gimli.Healing(1000);
            ChainMail  armor = new ChainMail();
            GoldenCoat coat  = new GoldenCoat();

            gimli.AddItem(armor);
            gimli.AddItem(coat);

            gimli.ReceiveDamage(dummy.Attack());
            int checkPoint2 = gimli.HealthMax - gimli.HealthActual;

            Assert.AreEqual(checkPoint1 - checkPoint2, armor.DefensePower + coat.DefensePower);
        }
Example #12
0
        public void ExchangeEncounterTest()
        {
            Dwarf      gimli   = new Dwarf();
            Elf        legolas = new Elf();
            BasicSword sword   = new BasicSword();

            gimli.AddItem(sword);

            ExchangeEncounter encounter = new ExchangeEncounter(gimli, legolas, sword.Name);

            Assert.AreEqual(1, encounter.PlayEncounter()[1][0].ItemList.Count);
        }
Example #13
0
        public void ManyItemsExchangeEncounterTest()
        {
            Dwarf            gimli   = new Dwarf();
            Elf              legolas = new Elf();
            BasicSword       sword   = new BasicSword();
            StygianBlade     blade   = new StygianBlade();
            HearthSeekingBow bow     = new HearthSeekingBow();

            gimli.AddItem(sword);
            gimli.AddItem(blade);
            gimli.AddItem(bow);

            List <string> itemList = new List <string>()
            {
                sword.Name, blade.Name, bow.Name
            };

            ExchangeEncounter encounter = new ExchangeEncounter(gimli, legolas, itemList);

            Assert.AreEqual(3, encounter.PlayEncounter()[1][0].ItemList.Count);
        }
Example #14
0
        public void Successful_exchange()
        {
            Dwarf dwarf = new Dwarf(9, 1, 0);
            Demon demon = new Demon(23, 6547, 24);

            Sword sword = new Sword(999999999);

            dwarf.AddItem(sword);

            ExchangeEncounter encounter = new ExchangeEncounter(dwarf, demon, sword);

            Assert.IsTrue(encounter.RunEncounter());
        }
Example #15
0
        public void HealthReductedTest()
        {
            Dwarf        gimli = new Dwarf();
            StygianBlade sword = new StygianBlade();
            Orc          dummy = new Orc();
            GoldenCoat   coat  = new GoldenCoat();

            gimli.AddItem(sword);
            dummy.AddItem(coat);

            dummy.ReceiveDamage(gimli.Attack());

            Assert.AreEqual(dummy.HealthMax - dummy.HealthActual, gimli.BaseAttackPower + sword.AttackPower - dummy.BaseDefensePower - coat.DefensePower);
        }
Example #16
0
        public void PuttingAttackItemInTest()
        {
            Dwarf gimli  = new Dwarf();
            Orc   dummy1 = new Orc();

            dummy1.ReceiveDamage(gimli.Attack());

            Orc        dummy2 = new Orc();
            BasicSword sword  = new BasicSword();

            gimli.AddItem(sword);

            dummy2.ReceiveDamage(gimli.Attack());

            Assert.AreEqual(dummy1.HealthActual - dummy2.HealthActual, sword.AttackPower);
        }
Example #17
0
        public void TakingDefenseItemOutTest()
        {
            Dwarf     gimli = new Dwarf();
            Dragon    dummy = new Dragon();
            ChainMail armor = new ChainMail();

            gimli.AddItem(armor);

            gimli.ReceiveDamage(dummy.Attack());
            int checkPoint1 = gimli.HealthMax - gimli.HealthActual;

            gimli.RemoveItem(armor);
            gimli.Healing(1000);

            gimli.ReceiveDamage(dummy.Attack());
            int checkPoint2 = gimli.HealthMax - gimli.HealthActual;

            Assert.AreEqual(checkPoint2 - checkPoint1, armor.DefensePower);
        }
Example #18
0
        public void DarkSwordTest()
        {
            Gem       gem1   = new Gem("Fire Gem");
            Gem       gem2   = new Gem("Earth Gem");
            DarkSword sword  = new DarkSword();
            Dwarf     gimli  = new Dwarf();
            Orc       dummy1 = new Orc();
            Orc       dummy2 = new Orc();
            Orc       dummy3 = new Orc();

            gimli.AddItem(sword);
            dummy1.ReceiveDamage(gimli.Attack());

            sword.AddGem(gem1);
            dummy2.ReceiveDamage(gimli.Attack());

            sword.AddGem(gem2);
            dummy3.ReceiveDamage(gimli.Attack());

            Assert.IsTrue(dummy3.HealthActual < dummy2.HealthActual && dummy2.HealthActual < dummy1.HealthActual);
        }
Example #19
0
 public void TestAgregarItem()
 {
     Gimli.AddItem(helmet);
     Assert.IsNotEmpty(Gimli.Items);
 }