diff --git a/spec/System/TestSkills_spec.lua b/spec/System/TestSkills_spec.lua index 3afa41ce0..6ef3214d0 100644 --- a/spec/System/TestSkills_spec.lua +++ b/spec/System/TestSkills_spec.lua @@ -245,4 +245,42 @@ describe("TestSkills", function() assert.True(build.calcsTab.calcsOutput.Cooldown == 10) end) -end) \ No newline at end of file + + it("Test conditional exposure supports make exposure configurable", function() + build.itemsTab:CreateDisplayItemFromRaw([[ + New Item + Razor Quarterstaff + Quality: 0 + ]]) + build.itemsTab:AddDisplayItem() + runCallback("OnFrame") + + build.skillsTab:PasteSocketGroup("Killing Palm 20/0 1\nLightning Attunement 1/0 1\nLightning Exposure 1/0 1") + runCallback("OnFrame") + + assert.True(build.calcsTab.mainEnv.player.modDB:Flag(nil, "Condition:CanApplyLightningExposure")) + end) + + it("Test exposure supports on other active skills make exposure configurable", function() + build.itemsTab:CreateDisplayItemFromRaw([[ + New Item + Razor Quarterstaff + Quality: 0 + ]]) + build.itemsTab:AddDisplayItem() + runCallback("OnFrame") + + build.skillsTab:PasteSocketGroup("Spark 20/0 1") + build.skillsTab:PasteSocketGroup("Killing Palm 20/0 1\nLightning Attunement 1/0 1\nLightning Exposure 1/0 1") + runCallback("OnFrame") + + assert.are.equals("Spark", build.calcsTab.mainEnv.player.mainSkill.activeEffect.grantedEffect.name) + assert.True(build.calcsTab.mainEnv.player.modDB:Flag(nil, "Condition:CanApplyLightningExposure")) + + build.configTab.input.conditionEnemyLightningExposure = true + build.configTab:BuildModList() + runCallback("OnFrame") + + assert.are.equals(-20, build.calcsTab.mainEnv.enemyDB:Sum("BASE", nil, "LightningExposure")) + end) +end) diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index 29e111f29..02ffe86af 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -340,13 +340,29 @@ local function doActorAttribsConditions(env, actor) end end if env.mode_effective then - if env.player.mainSkill.skillModList:Sum("BASE", env.player.mainSkill.skillCfg, "FireExposureChance") > 0 or modDB:Sum("BASE", nil, "FireExposureChance") > 0 then + local function hasActiveSkillExposureSource(activeSkill, modName) + return activeSkill.skillModList and activeSkill.skillCfg + and activeSkill.skillModList:HasMod("BASE", activeSkill.skillCfg, modName) + end + local function hasExposureSource(element) + local modName = element .. "ExposureChance" + if modDB:Sum("BASE", nil, modName) > 0 then + return true + end + for _, activeSkill in ipairs(env.player.activeSkillList) do + if hasActiveSkillExposureSource(activeSkill, modName) then + return true + end + end + return false + end + if hasExposureSource("Fire") then condList["CanApplyFireExposure"] = true end - if env.player.mainSkill.skillModList:Sum("BASE", env.player.mainSkill.skillCfg, "ColdExposureChance") > 0 or modDB:Sum("BASE", nil, "ColdExposureChance") > 0 then + if hasExposureSource("Cold") then condList["CanApplyColdExposure"] = true end - if env.player.mainSkill.skillModList:Sum("BASE", env.player.mainSkill.skillCfg, "LightningExposureChance") > 0 or modDB:Sum("BASE", nil, "LightningExposureChance") > 0 then + if hasExposureSource("Lightning") then condList["CanApplyLightningExposure"] = true end end