Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion spec/System/TestSkills_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,42 @@ describe("TestSkills", function()

assert.True(build.calcsTab.calcsOutput.Cooldown == 10)
end)
end)

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)
22 changes: 19 additions & 3 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down