Exemplo n.º 1
0
        public void BlasphemyParsesPassiveStatsWithParsedSkillIsActiveSkillCondition(bool isActiveSkill)
        {
            var expected = isActiveSkill ? (NodeValue?)10 : null;

            var(activeDefinition, activeSkill)   = CreateEnfeebleDefinition();
            var(supportDefinition, supportSkill) = CreateBlasphemyDefinition();
            var source      = new ModifierSource.Local.Skill("Enfeeble", null);
            var parseResult = ParseResult.Success(new[]
                                                  { MockModifier(new Stat("Blasphemy.EffectOn(Character)"), value: new Constant(10)) });
            var parameter = new UntranslatedStatParserParameter(source, new[]
                                                                { new UntranslatedStat("curse_effect_+%", 10), });
            var statParser = Mock.Of <IParser <UntranslatedStatParserParameter> >(p =>
                                                                                  p.Parse(parameter) == parseResult &&
                                                                                  p.Parse(EmptyParserParameter(source)) == EmptyParseResult);
            var sut     = CreateSut(activeDefinition, supportDefinition, statParser);
            var context = MockValueCalculationContextForActiveSkill(activeSkill,
                                                                    ("Blasphemy.ActiveSkillItemSlot", isActiveSkill ? (double?)supportSkill.ItemSlot : null),
                                                                    ("Blasphemy.ActiveSkillSocketIndex", 1));

            var result = sut.Parse(activeSkill, supportSkill);

            var actual = GetValueForIdentity(result.Modifiers, "Blasphemy.EffectOn(Character)").Calculate(context);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void GivenNonSpellActiveSkillWithAdditionalSpellLevels_WhenParsing_ThenValueIsZero()
        {
            var active  = CreateSkillFromGem("a");
            var context = MockValueCalculationContextForActiveSkill(active,
                                                                    ("Gem.AdditionalLevels.ActiveSkill.spell.g2", 2));
            var sut = CreateSut();

            var(_, _, modifiers) = sut.Parse(active, new Skill[0], default);

            GetValueForIdentity(modifiers, StatIdentity(active)).Calculate(context).Should().BeEquivalentTo(new NodeValue(0));
        }
Exemplo n.º 3
0
        public void GivenActiveSkillFromItem_WhenParsing_ThenValueIsZero()
        {
            var active  = Skill.FromItem("a", 1, 0, ItemSlot.Belt, 0, true);
            var context = MockValueCalculationContextForActiveSkill(active,
                                                                    ("Gem.AdditionalLevels.Belt", 2));
            var sut = CreateSut();

            var(_, _, modifiers) = sut.Parse(active, new Skill[0], default);

            GetValueForIdentity(modifiers, StatIdentity(active)).Calculate(context).Should().BeEquivalentTo(new NodeValue(0));
        }
Exemplo n.º 4
0
        public void GivenActiveSkillWithoutBaseItem_WhenParsing_ThenNoGemTagsAreUsed()
        {
            var active  = CreateSkillFromGem("b");
            var context = MockValueCalculationContextForActiveSkill(active,
                                                                    ("Gem.AdditionalLevels.Belt", 2), ("Gem.AdditionalLevels.g2.Belt", 3));
            var sut = CreateSut();

            var(_, _, modifiers) = sut.Parse(active, new Skill[0], default);

            GetValueForIdentity(modifiers, StatIdentity(active)).Calculate(context).Should().BeEquivalentTo(new NodeValue(2));
        }
        public void GivenActiveSkillWithAdditionalLevelStatsAndNoSupportingSkills_WhenParsing_ThenValueIsAdditionalLevels()
        {
            var active  = CreateSkillFromGem("a");
            var context = MockValueCalculationContextForActiveSkill(active,
                                                                    ("Gem.AdditionalQuality.Belt", 3));
            var sut = CreateSut();

            var(_, _, modifiers) = sut.Parse(active, Array.Empty <Skill>(), default);

            GetValueForIdentity(modifiers, StatIdentity(active)).Calculate(context).Should().BeEquivalentTo(new NodeValue(3));
        }
Exemplo n.º 6
0
        public void GivenActiveSecondarySkill_WhenParsing_ThenGemTagsOfGemAreUsed()
        {
            var activeGem = new Gem("a", 1, 0, ItemSlot.Belt, 0, 0, true);
            var active    = Skill.SecondaryFromGem("b", activeGem, true);
            var context   = MockValueCalculationContextForActiveSkill(active,
                                                                      ("Gem.AdditionalLevels.Belt", 2));
            var sut = CreateSut();

            var(_, _, modifiers) = sut.Parse(active, new Skill[0], default);

            GetValueForIdentity(modifiers, StatIdentity(active)).Calculate(context).Should().BeEquivalentTo(new NodeValue(2));
        }
Exemplo n.º 7
0
        public void GivenActiveSkillAffectedByDisabledSupportAddingLevels_WhenParsing_ThenValueIsNotIncreased()
        {
            var active           = CreateSkillFromGem("a");
            var support          = CreateSkillFromGem("s1");
            var levelDefinitions = new Dictionary <int, SkillLevelDefinition>
            {
                { 1, CreateLevelDefinition(stats: new[] { new UntranslatedStat("supported_active_skill_gem_level_+", 5), }) }
            };
            var context = MockValueCalculationContextForActiveSkill(active,
                                                                    ($"Belt.{support.SocketIndex}.0.IsEnabled", null));
            var sut = CreateSut(supportLevelDefinitions: levelDefinitions);

            var(_, _, modifiers) = sut.Parse(active, new[] { support }, default);

            GetValueForIdentity(modifiers, StatIdentity(active)).Calculate(context).Should().BeEquivalentTo(new NodeValue(0));
        }
Exemplo n.º 8
0
        public void GivenActiveSkillAffectedBySupportIncreasedToUnavailableLevel_WhenParsing_ThenMaximumAvailableSupportLevelIsUsed()
        {
            var active           = CreateSkillFromGem("a");
            var support          = CreateSkillFromGem("s1");
            var levelDefinitions = new Dictionary <int, SkillLevelDefinition>
            {
                { 1, CreateLevelDefinition(stats: new[] { new UntranslatedStat("supported_active_skill_gem_level_+", 1), }) },
                { 2, CreateLevelDefinition(stats: new[] { new UntranslatedStat("supported_active_skill_gem_level_+", 2), }) },
                { 4, CreateLevelDefinition(stats: new[] { new UntranslatedStat("supported_active_skill_gem_level_+", 4), }) },
            };
            var context = MockValueCalculationContextForActiveSkill(active,
                                                                    ($"Belt.{support.SocketIndex}.0.IsEnabled", 1),
                                                                    ("Gem.AdditionalLevels.g3.Belt", 2));
            var sut = CreateSut(supportLevelDefinitions: levelDefinitions);

            var(_, _, modifiers) = sut.Parse(active, new[] { support }, default);

            GetValueForIdentity(modifiers, StatIdentity(active)).Calculate(context).Should().BeEquivalentTo(new NodeValue(2));
        }