Skip to content

Commit

Permalink
(BETA) Fix secondary effect skills being added as supports (#6392)
Browse files Browse the repository at this point in the history
* FIX:secondary effect skills being added as support

* FIX: preemptively fix merge issue
  • Loading branch information
Paliak authored Aug 23, 2023
1 parent 66c896b commit d17fb9e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ function calcs.initEnv(build, mode, override, specEnv)
quality = 0,
enabled = true,
}
activeGemInstance.fromItem = grantedSkill.sourceItem ~= nil
activeGemInstance.gemId = nil
activeGemInstance.level = grantedSkill.level
activeGemInstance.enableGlobal1 = true
Expand Down
4 changes: 3 additions & 1 deletion src/Modules/CalcTriggers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ local function addTriggerIncMoreMods(activeSkill, sourceSkill)
end

local function slotMatch(env, skill)
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
local fromItem = (env.player.mainSkill.activeEffect.grantedEffect.fromItem or skill.activeEffect.grantedEffect.fromItem)
fromItem = fromItem or (env.player.mainSkill.activeEffect.srcInstance.fromItem or skill.activeEffect.srcInstance.fromItem)
local match1 = fromItem and skill.socketGroup and skill.socketGroup.slot == env.player.mainSkill.socketGroup.slot
local match2 = (not env.player.mainSkill.activeEffect.grantedEffect.fromItem) and skill.socketGroup == env.player.mainSkill.socketGroup
return (match1 or match2)
end
Expand Down
51 changes: 34 additions & 17 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,39 @@ local function triggerExtraSkill(name, level, noSupports, sourceSkill, triggerCh
}
end
end

local function extraSupport(name, level, slot)
local skillId = gemIdLookup[name] or gemIdLookup[name:gsub("^increased ","")]

if itemSlotName == "main hand" then
slot = "Weapon 1"
elseif itemSlotName == "off hand" then
slot = "Weapon 2"
elseif slot then
slot = string.gsub(" "..slot, "%W%l", string.upper):sub(2)
else
slot = "{SlotName}"
end

level = tonumber(level)
if skillId then
local gemId = data.gemForBaseName[data.skills[skillId].name .. " Support"]
if gemId then
local mods = {mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].grantedEffectId, level = level }, { type = "SocketedIn", slotName = slot })}
if data.gems[gemId].secondaryGrantedEffect then
if data.gems[gemId].secondaryGrantedEffect.support then
t_insert(mods, mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].secondaryGrantedEffectId, level = level }, { type = "SocketedIn", slotName = slot }))
else
t_insert(mods, mod("ExtraSkill", "LIST", { skillId = data.gems[gemId].secondaryGrantedEffectId, level = level }))
end
end
return mods
else
return {
mod("ExtraSupport", "LIST", { skillId = skillId, level = level }, { type = "SocketedIn", slotName = slot }),
}
end
end
end
local explodeFunc = function(chance, amount, type, ...)
local amountNumber = tonumber(amount) or (amount == "tenth" and 10) or (amount == "quarter" and 25)
if not amountNumber then
Expand Down Expand Up @@ -2691,22 +2723,7 @@ local specialModList = {
["trigger commandment of inferno on critical strike"] = { mod("ExtraSkill", "LIST", { skillId = "UniqueEnchantmentOfInfernoOnCrit", level = 1, noSupports = true, triggered = true }) },
["trigger (.+) on critical strike"] = function( _, skill) return triggerExtraSkill(skill, 1, true) end,
["triggers? (.+) when you take a critical strike"] = function( _, skill) return triggerExtraSkill(skill, 1, true) end,
["socketed [%a+]* ?gems a?r?e? ?supported by level (%d+) (.+)"] = function(num, _, support)
local skillId = gemIdLookup[support] or gemIdLookup[support:gsub("^increased ","")]
if skillId then
local gemId = data.gemForBaseName[data.skills[skillId].name .. " Support"]
if gemId then
return {
mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].grantedEffectId, level = num }, { type = "SocketedIn", slotName = "{SlotName}" }),
mod("ExtraSupport", "LIST", { skillId = data.gems[gemId].secondaryGrantedEffectId, level = num }, { type = "SocketedIn", slotName = "{SlotName}" })
}
else
return {
mod("ExtraSupport", "LIST", { skillId = skillId, level = num }, { type = "SocketedIn", slotName = "{SlotName}" }),
}
end
end
end,
["socketed [%a+]* ?gems a?r?e? ?supported by level (%d+) (.+)"] = function(num, _, support) return extraSupport(support, num) end,
["socketed support gems can also support skills from your e?q?u?i?p?p?e?d? ?([%a%s]+)"] = function (_, itemSlotName)
local targetItemSlotName = "Body Armour"
if itemSlotName == "main hand" then
Expand Down

0 comments on commit d17fb9e

Please sign in to comment.