From 39a8f1af05631482a421c3035bdda4265b058e03 Mon Sep 17 00:00:00 2001 From: unrealdreamz <132005717+unrealdreamz@users.noreply.github.com> Date: Mon, 18 May 2026 19:38:20 -0400 Subject: [PATCH] Use totem actor level for totem life --- spec/System/TestTotems_spec.lua | 25 +++++++++++++++++++++++++ src/Modules/CalcActiveSkill.lua | 22 +++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 spec/System/TestTotems_spec.lua diff --git a/spec/System/TestTotems_spec.lua b/spec/System/TestTotems_spec.lua new file mode 100644 index 0000000000..21b36f3b80 --- /dev/null +++ b/spec/System/TestTotems_spec.lua @@ -0,0 +1,25 @@ +describe("TestTotems", function() + before_each(function() + newBuild() + end) + + teardown(function() + -- newBuild() takes care of resetting everything in setup() + end) + + it("uses exported actor level for Shockwave Totem life", function() + build.skillsTab:PasteSocketGroup("Shockwave Totem 20/0 1") + runCallback("OnFrame") + + local checkedTotems = 0 + for _, activeSkill in ipairs(build.calcsTab.calcsEnv.player.activeSkillList) do + local totemBase = activeSkill.skillData.totemBase + if totemBase and totemBase.grantedEffect and totemBase.grantedEffect.name == "Shockwave Totem" then + checkedTotems = checkedTotems + 1 + assert.are.equals(98, activeSkill.skillData.totemLevel) + end + end + assert.True(checkedTotems > 0) + assert.are.equals(data.monsterAllyLifeTable[98], build.calcsTab.mainOutput.TotemLife) + end) +end) diff --git a/src/Modules/CalcActiveSkill.lua b/src/Modules/CalcActiveSkill.lua index d5b8ccee3f..a5ef697ca3 100644 --- a/src/Modules/CalcActiveSkill.lua +++ b/src/Modules/CalcActiveSkill.lua @@ -289,6 +289,26 @@ local function getTotemBaseStats(activeSkill) return totemBase end +local function getTotemLevel(totemBase) + if not totemBase.skillLevel then + return 1 + end + local grantedEffectLevel = totemBase.grantedEffect and totemBase.grantedEffect.levels + and totemBase.grantedEffect.levels[totemBase.skillLevel] + local actorLevel = grantedEffectLevel and grantedEffectLevel.actorLevel + if not actorLevel and totemBase.grantedEffect and totemBase.grantedEffect.statSets then + for _, statSet in ipairs(totemBase.grantedEffect.statSets) do + local statSetLevel = statSet.levels and statSet.levels[totemBase.skillLevel] + if statSetLevel and statSetLevel.actorLevel then + actorLevel = statSetLevel.actorLevel + break + end + end + end + local totemLevel = actorLevel and round(actorLevel) or data.minionLevelTable[totemBase.skillLevel] or 1 + return m_min(m_max(totemLevel, 1), #data.monsterAllyLifeTable) +end + --- Applies additional modifiers to skills with the "Empowered" flag. --- Checks for "ExtraEmpoweredMod" mods and applies them --- if they match the conditions set by the empowering effect. @@ -539,7 +559,7 @@ function calcs.buildActiveSkillModList(env, activeSkill) if totemBase.grantedEffect and totemBase.gemData then activeSkill.skillData.totemBase = totemBase end - activeSkill.skillData.totemLevel = data.minionLevelTable[totemBase.skillLevel] or 1 + activeSkill.skillData.totemLevel = getTotemLevel(totemBase) -- Get skill totem ID for totem skills -- This is used to calculate totem life