Skip to content
Merged
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
6 changes: 5 additions & 1 deletion src/Modules/CalcActiveSkill.lua
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,11 @@ function calcs.buildActiveSkillModList(env, activeSkill)
skillTypes = activeSkill.skillTypes,
skillCond = { },
skillDist = env.mode_effective and effectiveRange,
slotName = activeSkill.slotName,
slotName = activeSkill.slotName or (activeSkill.activeEffect.gemCfg and activeSkill.activeEffect.gemCfg.slotName),
socketColor = activeSkill.activeEffect.gemCfg and activeSkill.activeEffect.gemCfg.socketColor,
socketNum = activeSkill.activeEffect.gemCfg and activeSkill.activeEffect.gemCfg.socketNum
}

if skillFlags.weapon1Attack then
activeSkill.weapon1Cfg = copyTable(activeSkill.skillCfg, true)
activeSkill.weapon1Cfg.skillCond = setmetatable({ ["MainHandAttack"] = true }, { __index = activeSkill.skillCfg.skillCond })
Expand Down Expand Up @@ -510,6 +513,7 @@ function calcs.buildActiveSkillModList(env, activeSkill)

-- Apply gem/quality modifiers from support gems
skillModList:NewMod("GemLevel", "BASE", activeSkill.activeEffect.srcInstance and activeSkill.activeEffect.srcInstance.level or activeSkill.activeEffect.level, "Max Level")
skillModList:NewMod("GemQuality", "BASE", activeSkill.activeEffect.srcInstance and activeSkill.activeEffect.srcInstance.quality or activeSkill.activeEffect.quality, "Max Quality")
for _, supportProperty in ipairs(skillModList:Tabulate("LIST", activeSkill.skillCfg, "SupportedGemProperty")) do
local value = supportProperty.value
if value.keyword == "grants_active_skill" and activeSkill.activeEffect.gemData and not activeSkill.activeEffect.gemData.tags.support then
Expand Down
60 changes: 43 additions & 17 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3366,27 +3366,53 @@ function calcs.perform(env, skipEHP)
env.build.partyTab:setBuffExports(buffExports)
end

-- calculate Gem Level of MainSkill

if env.player.mainSkill then
local mainSkill = env.player.mainSkill
if mainSkill.activeEffect and mainSkill.activeEffect.level and mainSkill.activeEffect.srcInstance then
local baseLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemLevel")
local totalItemLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemItemLevel")
local totalSupportLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemSupportLevel")

output.GemHasLevel = true
output.GemLevel = baseLevel + totalSupportLevel + totalItemLevel

if env.player.breakdown then
env.player.breakdown.GemLevel = {}
t_insert(env.player.breakdown.GemLevel, s_format("%d ^8(level from gem)", baseLevel))
if totalSupportLevel > 0 then
t_insert(env.player.breakdown.GemLevel, s_format("+ %d ^8(level from support)", totalSupportLevel))
if mainSkill.activeEffect and mainSkill.activeEffect.srcInstance then

-- calculate Gem Level of MainSkill
if mainSkill.activeEffect.level then
local baseLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemLevel")
local totalItemLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemItemLevel")
local totalSupportLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemSupportLevel")

output.GemHasLevel = true
output.GemLevel = baseLevel + totalSupportLevel + totalItemLevel

if env.player.breakdown then
env.player.breakdown.GemLevel = {}
t_insert(env.player.breakdown.GemLevel, s_format("%d ^8(level from gem)", baseLevel))
if totalSupportLevel > 0 then
t_insert(env.player.breakdown.GemLevel, s_format("+ %d ^8(level from support)", totalSupportLevel))
end
if totalItemLevel > 0 then
t_insert(env.player.breakdown.GemLevel, s_format("+ %d ^8(level from items)", totalItemLevel))
end
t_insert(env.player.breakdown.GemLevel, s_format("= %d", output.GemLevel))
end
if totalItemLevel > 0 then
t_insert(env.player.breakdown.GemLevel, s_format("+ %d ^8(level from items)", totalItemLevel))
end

-- calculate Gem Quality of MainSkill
if mainSkill.activeEffect.quality then
local baseQuality = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemQuality")
local totalItemQuality = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemItemQuality")
local totalSupportQuality = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemSupportQuality")

output.GemHasQuality = true
output.GemQuality = baseQuality + totalSupportQuality + totalItemQuality

if env.player.breakdown then
env.player.breakdown.GemQuality = {}
t_insert(env.player.breakdown.GemQuality, s_format("%d ^8(quality from gem)", baseQuality))
if totalSupportQuality > 0 then
t_insert(env.player.breakdown.GemQuality, s_format("+ %d ^8(quality from support)", totalSupportQuality))
end
if totalItemQuality > 0 then
t_insert(env.player.breakdown.GemQuality, s_format("+ %d ^8(quality from items)", totalItemQuality))
end
t_insert(env.player.breakdown.GemQuality, s_format("= %d", output.GemQuality))
end
t_insert(env.player.breakdown.GemLevel, s_format("= %d", output.GemLevel))
end
end
end
Expand Down
1 change: 1 addition & 0 deletions src/Modules/CalcSections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ return {
} },
{ 1, "SkillTypeStats", 1, colorCodes.OFFENCE, {{ defaultCollapsed = false, label = "Skill type-specific Stats", data = {
{ label = "Gem Level", haveOutput = "GemHasLevel", { format = "{0:output:GemLevel}", { breakdown = "GemLevel" }, { modName = { "GemLevel" }, cfg = "skill" },{ modName = { "GemSupportLevel" }, cfg = "skill" }, { modName = { "GemItemLevel" }, cfg = "skill" }, }, },
{ label = "Gem Quality", haveOutput = "GemHasQuality", { format = "{0:output:GemQuality}", { breakdown = "GemQuality" }, { modName = { "GemQuality" }, cfg = "skill" },{ modName = { "GemSupportQuality" }, cfg = "skill" }, { modName = { "GemItemQuality" }, cfg = "skill" }, }, },
{ label = "Mana Cost", color = colorCodes.MANA, haveOutput = "ManaHasCost", { format = "{0:output:ManaCost}", { breakdown = "ManaCost" }, { modName = { "ManaCost", "Cost", "ManaCostNoMult" }, cfg = "skill" }, }, },
{ label = "Mana % Cost", color = colorCodes.MANA, haveOutput = "ManaPercentHasCost", { format = "{0:output:ManaPercentCost}", { breakdown = "ManaPercentCost" }, { modName = { "ManaCost", "Cost", "ManaCostNoMult" }, cfg = "skill" }, }, },
{ label = "Mana per second", color = colorCodes.MANA, haveOutput = "ManaPerSecondHasCost", { format = "{2:output:ManaPerSecondCost}", { breakdown = "ManaPerSecondCost" }, { modName = { "ManaCost", "Cost", "ManaCostNoMult" }, cfg = "skill" }, }, },
Expand Down
17 changes: 8 additions & 9 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,6 @@ function wipeEnv(env, accelerate)
end
end

local function getGemModList(env, groupCfg, socketColor, socketNum)
local gemCfg = copyTable(groupCfg, true)
gemCfg.socketColor = socketColor
gemCfg.socketNum = socketNum
return env.modDB:Tabulate("LIST", gemCfg, "GemProperty")
end

local function applyGemMods(effect, modList)
for _, mod in ipairs(modList) do
local match = true
Expand Down Expand Up @@ -1464,7 +1457,10 @@ function calcs.initEnv(build, mode, override, specEnv)
if gemInstance.gemData then
local playerItems = env.player.itemList
local socketedIn = playerItems[groupCfg.slotName] and playerItems[groupCfg.slotName].sockets and playerItems[groupCfg.slotName].sockets[gemIndex]
applyGemMods(supportEffect, socketedIn and getGemModList(env, groupCfg, socketedIn.color, gemIndex) or propertyModList)
supportEffect.gemCfg = copyTable(groupCfg, true)
supportEffect.gemCfg.socketColor = socketedIn and socketedIn.color
supportEffect.gemCfg.socketNum = gemIndex
applyGemMods(supportEffect, socketedIn and env.modDB:Tabulate("LIST", supportEffect.gemCfg, "GemProperty") or propertyModList)
if not processedSockets[gemInstance] then
processedSockets[gemInstance] = true
applySocketMods(env, gemInstance.gemData, groupCfg, gemIndex, playerItems[groupCfg.slotName] and playerItems[groupCfg.slotName].name)
Expand Down Expand Up @@ -1526,7 +1522,10 @@ function calcs.initEnv(build, mode, override, specEnv)
if gemInstance.gemData then
local playerItems = env.player.itemList
local socketedIn = playerItems[groupCfg.slotName] and playerItems[groupCfg.slotName].sockets and playerItems[groupCfg.slotName].sockets[gemIndex]
applyGemMods(activeEffect, socketedIn and getGemModList(env, groupCfg, socketedIn.color, gemIndex) or propertyModList)
activeEffect.gemCfg = copyTable(groupCfg, true)
activeEffect.gemCfg.socketColor = socketedIn and socketedIn.color
activeEffect.gemCfg.socketNum = gemIndex
applyGemMods(activeEffect, socketedIn and env.modDB:Tabulate("LIST", activeEffect.gemCfg, "GemProperty") or propertyModList)
if not processedSockets[gemInstance] then
processedSockets[gemInstance] = true
applySocketMods(env, gemInstance.gemData, groupCfg, gemIndex, playerItems[groupCfg.slotName] and playerItems[groupCfg.slotName].name)
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/CalcTriggers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ local configTable = {
end}
end,
["maloney's mechanism"] = function(env)
local _, _, uniqueTriggerName = env.player.itemList[env.player.mainSkill.slotName].modSource:find(".*:.*:(.*),.*")
local _, _, uniqueTriggerName = env.player.itemList[env.player.mainSkill.skillCfg.slotName].modSource:find(".*:.*:(.*),.*")
local isReplica = uniqueTriggerName:match("Replica.")
return {triggerOnUse = true, triggerName = uniqueTriggerName, useCastRate = isReplica,
triggerSkillCond = function(env, skill)
Expand Down