Skip to content
Closed
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
29 changes: 28 additions & 1 deletion spec/System/TestSkills_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,33 @@ describe("TestSkills", function()
assert.are.equals(16, round(finalCost))
end)

it("does not count active skill internal support effects as socketed support gems", function()
build.itemsTab:CreateDisplayItemFromRaw([[
New Item
Nettle Talisman
Quality: 0
]])
build.itemsTab:AddDisplayItem()
runCallback("OnFrame")

build.skillsTab:PasteSocketGroup("Pounce 20/0 1\nBrutality I 1/0 1\nExecute I 1/0 1\nHeft 1/0 1\nClose Combat I 1/0 1\nRage I 1/0 1")
runCallback("OnFrame")

local socketGroup = build.skillsTab.socketGroupList[#build.skillsTab.socketGroupList]
assert.True(socketGroup.gemList[1].supportEffect ~= nil)

local warnings = build.calcsTab.mainEnv.itemWarnings and build.calcsTab.mainEnv.itemWarnings.socketLimitWarning
assert.is_nil(warnings)

newBuild()
build.skillsTab:PasteSocketGroup("Pounce 20/0 1\nBrutality I 1/0 1\nExecute I 1/0 1\nHeft 1/0 1\nClose Combat I 1/0 1\nRage I 1/0 1\nMagnified Area I 1/0 1")
runCallback("OnFrame")

warnings = build.calcsTab.mainEnv.itemWarnings and build.calcsTab.mainEnv.itemWarnings.socketLimitWarning
assert.True(warnings ~= nil)
assert.are.equals(1, #warnings)
end)

it("Consumed Charge Effect", function()
build.itemsTab:CreateDisplayItemFromRaw([[
New Item
Expand Down Expand Up @@ -245,4 +272,4 @@ describe("TestSkills", function()

assert.True(build.calcsTab.calcsOutput.Cooldown == 10)
end)
end)
end)
15 changes: 11 additions & 4 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1872,19 +1872,26 @@ function calcs.initEnv(build, mode, override, specEnv)
-- Calculate skill gem and support gem counts
-- Currently PoB2 doesn't associate weapon skill supports with the actual weapon sets
-- so it ends up counting all support gems when it should only take into account the active weapon set
local function getSocketedSupportGemEffect(gem)
if gem.gemData and gem.gemData.grantedEffect then
return gem.gemData.grantedEffect.support and gem.gemData.grantedEffect
end
return gem.grantedEffect and gem.grantedEffect.support and gem.grantedEffect
end
local slotSupportGemSocketsCount = { R = 0, G = 0, B = 0 }
-- Loop through socket groups to calculate number of socketed gems
for _, socketGroup in pairs(env.build.skillsTab.socketGroupList) do
local socketedSupportGems = 0
if (socketGroup.enabled and socketGroup.gemList) then
for _, gem in pairs(socketGroup.gemList) do
if gem.supportEffect and gem.supportEffect.grantedEffect then
local supportGrantedEffect = getSocketedSupportGemEffect(gem)
if supportGrantedEffect then
socketedSupportGems = socketedSupportGems + 1
if gem.supportEffect.grantedEffect.color == 1 then
if supportGrantedEffect.color == 1 then
slotSupportGemSocketsCount.R = slotSupportGemSocketsCount.R + 1
elseif gem.supportEffect.grantedEffect.color == 2 then
elseif supportGrantedEffect.color == 2 then
slotSupportGemSocketsCount.G = slotSupportGemSocketsCount.G + 1
elseif gem.supportEffect.grantedEffect.color == 3 then
elseif supportGrantedEffect.color == 3 then
slotSupportGemSocketsCount.B = slotSupportGemSocketsCount.B + 1
end
end
Expand Down