コード例 #1
0
 private void InitHero()
 {
     Hero = new Hero("ViewModel");
     Hero.AddLoot(CreateLoot.CreateWeapon.Glaive());
     Hero.AddLoot(CreateLoot.CreateWeapon.Baton());
     Hero.AddLoot(CreateLoot.CreateConsumable.potionDeLampsur());
     Hero.AddLoot(CreateLoot.CreateConsumable.potionDeLampsur());
     Hero.AddLoot(CreateLoot.CreateFood.ration());
     Hero.AddLoot(CreateLoot.CreateSpecialItem.helmet());
     Hero.AddLoot(CreateLoot.CreateSpecialItem.buckler());
     Hero.AddCapacity(CapacityType.Healing);
     Hero.AddCapacity(CapacityType.Hiding);
     Hero.TakeDamage(5);
 }
コード例 #2
0
ファイル: HeroTests.cs プロジェクト: Belterius/LDVELH
        public void HeroStrenghtDifference()
        {
            Hero  Belterius       = new Hero("Belterius");
            Enemy evilHuman       = new Enemy("Common Human", 10, 10, EnemyTypes.Human);
            int   heroBaseAgility = Belterius.BaseAgility;

            //Base test
            int expectedStrenghtDifference = heroBaseAgility - LDVELH_WPF.Hero.UnharmedCombatDebuff - evilHuman.BaseAgility;

            Assert.AreEqual(expectedStrenghtDifference, Belterius.FindStrenghtDifference(evilHuman));

            //Item test
            SpecialItem shield = new SpecialItemCombat("iron shield", 4, 0);

            Belterius.AddLoot(shield);
            expectedStrenghtDifference = (heroBaseAgility + ((SpecialItemCombat)shield).AgilityBonus - LDVELH_WPF.Hero.UnharmedCombatDebuff) - evilHuman.BaseAgility;

            Assert.AreEqual(expectedStrenghtDifference, Belterius.FindStrenghtDifference(evilHuman));

            //PsychicPower test
            Belterius.AddCapacity(CapacityType.PsychicPower);
            expectedStrenghtDifference = (heroBaseAgility + ((SpecialItemCombat)shield).AgilityBonus + Capacity.PhychicPowerStrenght - LDVELH_WPF.Hero.UnharmedCombatDebuff) - evilHuman.BaseAgility;

            Assert.AreEqual(expectedStrenghtDifference, Belterius.FindStrenghtDifference(evilHuman));

            //Weapon Mastery (with and without weapon) test
            Belterius.AddCapacity(CapacityType.WeaponMastery);
            expectedStrenghtDifference = (heroBaseAgility + ((SpecialItemCombat)shield).AgilityBonus + Capacity.PhychicPowerStrenght - LDVELH_WPF.Hero.UnharmedCombatDebuff) - evilHuman.BaseAgility; //No weapon related to the Weapon mastery so no bonus

            Assert.AreEqual(expectedStrenghtDifference, Belterius.FindStrenghtDifference(evilHuman));

            Weapon wmWeapon = new Weapon("perfect weapon", Belterius.WeaponMastery);

            Belterius.WeaponHolder.Add(wmWeapon);
            expectedStrenghtDifference = (heroBaseAgility + ((SpecialItemCombat)shield).AgilityBonus + Capacity.PhychicPowerStrenght + Capacity.WeaponMasteryStrenght) - evilHuman.BaseAgility;

            Assert.AreEqual(expectedStrenghtDifference, Belterius.FindStrenghtDifference(evilHuman));

            //Multiples Items, Weapon Mastery, and psychic immune
            //WARNING TEST WILL FAIL IF ORC IS NOT IMMUN TO PSYCHIC ANYMORE, can check in Ennemy isWeakToPsychic
            SpecialItem ring = new SpecialItemCombat("magic ring", 6, 0);

            Belterius.AddLoot(ring);
            Enemy evilOrc = new Enemy("Common Orc", 15, 10, EnemyTypes.Orc);

            expectedStrenghtDifference = (heroBaseAgility + ((SpecialItemCombat)shield).AgilityBonus + ((SpecialItemCombat)ring).AgilityBonus + Capacity.WeaponMasteryStrenght) - evilOrc.BaseAgility;

            Assert.AreEqual(expectedStrenghtDifference, Belterius.FindStrenghtDifference(evilOrc));
        }
コード例 #3
0
ファイル: HeroTests.cs プロジェクト: Belterius/LDVELH
        public void HeroDoesntPossesCapacity()
        {
            Hero Belterius = new Hero("Belterius");

            Belterius.AddCapacity(CapacityType.Hiding);

            Assert.AreEqual(false, Belterius.PossesCapacity(CapacityType.PsychicPower));
        }
コード例 #4
0
ファイル: HeroTests.cs プロジェクト: Belterius/LDVELH
        public void HeroPossesCapacity()
        {
            Hero Belterius = new Hero("Belterius");

            Belterius.AddCapacity(CapacityType.Hiding);

            Assert.AreEqual(true, Belterius.PossesCapacity(CapacityType.Hiding));
        }
コード例 #5
0
ファイル: HeroTests.cs プロジェクト: Belterius/LDVELH
        public void HeroWeaponMastery()
        {
            Hero heroWeaponMastery   = new Hero("Belterius");
            Hero heroNoWeaponMastery = new Hero("Belterius");

            heroWeaponMastery.AddCapacity(CapacityType.WeaponMastery);
            heroNoWeaponMastery.AddCapacity(CapacityType.Hiding);

            Assert.AreEqual(true, (heroWeaponMastery.WeaponMastery != WeaponTypes.None));
            Assert.AreEqual(true, (heroNoWeaponMastery.WeaponMastery == WeaponTypes.None));
        }
コード例 #6
0
 private void AddCapacity(object capacity)
 {
     try
     {
         Hero.AddCapacity((CapacityType)capacity);
     }
     catch (MaxNumberOfCapacitiesReached ex)
     {
         MessageBox.Show(ex.Message);
     }
 }