From fa9b2258d3c0d4df4f21e1a33c359960073b3cc1 Mon Sep 17 00:00:00 2001 From: unrealdreamz <132005717+unrealdreamz@users.noreply.github.com> Date: Mon, 18 May 2026 20:52:48 -0400 Subject: [PATCH] Fix Pounce support socket counting --- spec/System/TestSkills_spec.lua | 29 ++++++++++++++++++++++++++++- src/Modules/CalcSetup.lua | 15 +++++++++++---- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/spec/System/TestSkills_spec.lua b/spec/System/TestSkills_spec.lua index 3afa41ce06..f45069c4a2 100644 --- a/spec/System/TestSkills_spec.lua +++ b/spec/System/TestSkills_spec.lua @@ -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 @@ -245,4 +272,4 @@ describe("TestSkills", function() assert.True(build.calcsTab.calcsOutput.Cooldown == 10) end) -end) \ No newline at end of file +end) diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 5e24c13397..faf68efeaf 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -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