Skip to content

Commit d17fb9e

Browse files
authored
(BETA) Fix secondary effect skills being added as supports (#6392)
* FIX:secondary effect skills being added as support * FIX: preemptively fix merge issue
1 parent 66c896b commit d17fb9e

File tree

3 files changed

+38
-18
lines changed

3 files changed

+38
-18
lines changed

src/Modules/CalcSetup.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,7 @@ function calcs.initEnv(build, mode, override, specEnv)
10451045
quality = 0,
10461046
enabled = true,
10471047
}
1048+
activeGemInstance.fromItem = grantedSkill.sourceItem ~= nil
10481049
activeGemInstance.gemId = nil
10491050
activeGemInstance.level = grantedSkill.level
10501051
activeGemInstance.enableGlobal1 = true

src/Modules/CalcTriggers.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ local function addTriggerIncMoreMods(activeSkill, sourceSkill)
3030
end
3131

3232
local function slotMatch(env, skill)
33-
local match1 = (env.player.mainSkill.activeEffect.grantedEffect.fromItem or skill.activeEffect.grantedEffect.fromItem) and skill.socketGroup and skill.socketGroup.slot == env.player.mainSkill.socketGroup.slot
33+
local fromItem = (env.player.mainSkill.activeEffect.grantedEffect.fromItem or skill.activeEffect.grantedEffect.fromItem)
34+
fromItem = fromItem or (env.player.mainSkill.activeEffect.srcInstance.fromItem or skill.activeEffect.srcInstance.fromItem)
35+
local match1 = fromItem and skill.socketGroup and skill.socketGroup.slot == env.player.mainSkill.socketGroup.slot
3436
local match2 = (not env.player.mainSkill.activeEffect.grantedEffect.fromItem) and skill.socketGroup == env.player.mainSkill.socketGroup
3537
return (match1 or match2)
3638
end

src/Modules/ModParser.lua

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,39 @@ local function triggerExtraSkill(name, level, noSupports, sourceSkill, triggerCh
17501750
}
17511751
end
17521752
end
1753-
1753+
local function extraSupport(name, level, slot)
1754+
local skillId = gemIdLookup[name] or gemIdLookup[name:gsub("^increased ","")]
1755+
1756+
if itemSlotName == "main hand" then
1757+
slot = "Weapon 1"
1758+
elseif itemSlotName == "off hand" then
1759+
slot = "Weapon 2"
1760+
elseif slot then
1761+
slot = string.gsub(" "..slot, "%W%l", string.upper):sub(2)
1762+
else
1763+
slot = "{SlotName}"
1764+
end
1765+
1766+
level = tonumber(level)
1767+
if skillId then
1768+
local gemId = data.gemForBaseName[data.skills[skillId].name .. " Support"]
1769+
if gemId then
1770+
local mods = {mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].grantedEffectId, level = level }, { type = "SocketedIn", slotName = slot })}
1771+
if data.gems[gemId].secondaryGrantedEffect then
1772+
if data.gems[gemId].secondaryGrantedEffect.support then
1773+
t_insert(mods, mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].secondaryGrantedEffectId, level = level }, { type = "SocketedIn", slotName = slot }))
1774+
else
1775+
t_insert(mods, mod("ExtraSkill", "LIST", { skillId = data.gems[gemId].secondaryGrantedEffectId, level = level }))
1776+
end
1777+
end
1778+
return mods
1779+
else
1780+
return {
1781+
mod("ExtraSupport", "LIST", { skillId = skillId, level = level }, { type = "SocketedIn", slotName = slot }),
1782+
}
1783+
end
1784+
end
1785+
end
17541786
local explodeFunc = function(chance, amount, type, ...)
17551787
local amountNumber = tonumber(amount) or (amount == "tenth" and 10) or (amount == "quarter" and 25)
17561788
if not amountNumber then
@@ -2691,22 +2723,7 @@ local specialModList = {
26912723
["trigger commandment of inferno on critical strike"] = { mod("ExtraSkill", "LIST", { skillId = "UniqueEnchantmentOfInfernoOnCrit", level = 1, noSupports = true, triggered = true }) },
26922724
["trigger (.+) on critical strike"] = function( _, skill) return triggerExtraSkill(skill, 1, true) end,
26932725
["triggers? (.+) when you take a critical strike"] = function( _, skill) return triggerExtraSkill(skill, 1, true) end,
2694-
["socketed [%a+]* ?gems a?r?e? ?supported by level (%d+) (.+)"] = function(num, _, support)
2695-
local skillId = gemIdLookup[support] or gemIdLookup[support:gsub("^increased ","")]
2696-
if skillId then
2697-
local gemId = data.gemForBaseName[data.skills[skillId].name .. " Support"]
2698-
if gemId then
2699-
return {
2700-
mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].grantedEffectId, level = num }, { type = "SocketedIn", slotName = "{SlotName}" }),
2701-
mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].secondaryGrantedEffectId, level = num }, { type = "SocketedIn", slotName = "{SlotName}" })
2702-
}
2703-
else
2704-
return {
2705-
mod("ExtraSupport", "LIST", { skillId = skillId, level = num }, { type = "SocketedIn", slotName = "{SlotName}" }),
2706-
}
2707-
end
2708-
end
2709-
end,
2726+
["socketed [%a+]* ?gems a?r?e? ?supported by level (%d+) (.+)"] = function(num, _, support) return extraSupport(support, num) end,
27102727
["socketed support gems can also support skills from your e?q?u?i?p?p?e?d? ?([%a%s]+)"] = function (_, itemSlotName)
27112728
local targetItemSlotName = "Body Armour"
27122729
if itemSlotName == "main hand" then

0 commit comments

Comments
 (0)