예제 #1
0
        public void TestItemEquipMod()
        {
            ItemViewModel ringOfLeaping    = TestStorageHelper.GetExistingItem("Ring of the Faithful Leap");
            Character     testWizard       = CharacterBuilder.BuildTestWizard();
            const int     initialDexterity = 12;
            const int     initialStrength  = 11;
            const int     initialSpeed     = 30;

            testWizard.baseDexterity = initialDexterity;
            testWizard.baseStrength  = initialStrength;
            testWizard.baseSpeed     = initialSpeed;
            Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.athletics));
            Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.acrobatics));
            Assert.AreEqual(initialDexterity, testWizard.Dexterity);
            Assert.AreEqual(initialStrength, testWizard.Strength);
            Assert.AreEqual(initialSpeed, testWizard.Speed);
            testWizard.Equip(ringOfLeaping);
            Assert.AreEqual(initialDexterity + 1, testWizard.Dexterity);
            Assert.AreEqual(initialStrength + 1, testWizard.Strength);
            Assert.AreEqual(initialSpeed + 5, testWizard.Speed);
            Assert.AreEqual(VantageKind.Advantage, testWizard.GetSkillCheckDice(Skills.athletics));
            Assert.AreEqual(VantageKind.Advantage, testWizard.GetSkillCheckDice(Skills.acrobatics));

            testWizard.Unequip(ringOfLeaping);

            Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.athletics));
            Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.acrobatics));
            Assert.AreEqual(initialDexterity, testWizard.Dexterity);
            Assert.AreEqual(initialStrength, testWizard.Strength);
            Assert.AreEqual(initialSpeed, testWizard.Speed);
        }
예제 #2
0
        public void TestExistingListLoad()
        {
            ItemViewModel breastplate = TestStorageHelper.GetExistingItem("Breastplate");

            Assert.IsNotNull(breastplate);
            Assert.IsFalse(breastplate.consumable);
            Assert.AreEqual(400, breastplate.costValue);
            Assert.AreEqual(5, breastplate.equipTime.Count);
            Assert.AreEqual(TimeMeasure.minutes, breastplate.equipTime.TimeMeasure);
            Assert.AreEqual(1, breastplate.unequipTime.Count);
            Assert.AreEqual(TimeMeasure.minutes, breastplate.unequipTime.TimeMeasure);
            Assert.AreEqual(15, breastplate.minStrengthToCarry);
            ModViewModel modViewModel = breastplate.FindMod("AC 15+Dex");

            Assert.IsNotNull(modViewModel);
            Assert.AreEqual(15, modViewModel.Absolute);
            Assert.AreEqual(ModType.playerProperty, (ModType)modViewModel.ModType.Value);
            Assert.AreEqual(0, modViewModel.Offset);
            Assert.AreEqual(1, modViewModel.Multiplier);
            Assert.AreEqual(Ability.dexterity, modViewModel.AddAbilityModifier);
            Assert.AreEqual(2, modViewModel.ModifierLimit);
            Assert.AreEqual("ArmorClass", modViewModel.TargetName);
            Assert.IsTrue(modViewModel.RequiresEquipped);
            Assert.IsFalse(modViewModel.RequiresConsumption);
            Assert.IsFalse(modViewModel.AddsAdvantage);
            Assert.IsFalse(modViewModel.AddsDisadvantage);
            Assert.AreEqual(DamageType.None, (DamageType)Convert.ToInt32(modViewModel.DamageTypeFilter.DamageType.Value));
            Assert.AreEqual(AttackKind.Any, (AttackKind)Convert.ToInt32(modViewModel.DamageTypeFilter.AttackKind.Value));
        }
예제 #3
0
        public void TestBreastplate()
        {
            ItemViewModel breastplate = TestStorageHelper.GetExistingItem("Breastplate");

            Assert.IsNotNull(breastplate);
            Character    testBarbarian     = CharacterBuilder.BuildTestBarbarian();
            const double initialArmorClass = 12;

            testBarbarian.baseDexterity = 12;
            double dexterityMod = (testBarbarian.Dexterity - 10) / 2;

            testBarbarian.baseArmorClass = initialArmorClass;
            Assert.AreEqual(initialArmorClass, testBarbarian.ArmorClass);

            testBarbarian.Equip(breastplate);

            const double breastplateAbsoluteAC = 15;

            Assert.AreEqual(breastplateAbsoluteAC + Math.Min(dexterityMod, 2), testBarbarian.ArmorClass);

            testBarbarian.Unequip(breastplate);

            Assert.AreEqual(initialArmorClass, testBarbarian.ArmorClass);

            testBarbarian.baseDexterity = 14;
            dexterityMod = (testBarbarian.Dexterity - 10) / 2;
            testBarbarian.Equip(breastplate);

            Assert.AreEqual(breastplateAbsoluteAC + Math.Min(dexterityMod, 2), testBarbarian.ArmorClass);


            testBarbarian.Unequip(breastplate);

            Assert.AreEqual(initialArmorClass, testBarbarian.ArmorClass);

            testBarbarian.baseDexterity = 16;
            dexterityMod = (testBarbarian.Dexterity - 10) / 2;
            Assert.IsTrue(dexterityMod >= 3);
            testBarbarian.Equip(breastplate);

            Assert.AreEqual(breastplateAbsoluteAC + Math.Min(dexterityMod, 2), testBarbarian.ArmorClass);
        }