Skip to content

Commit e42520b

Browse files
vaisestLocalIdentity
andauthored
Add support for some 3.29 wordings (#9950)
* Port support for cost efficiency * Add multiplier for maximum power charge (3.29 assassin) * 3.29 Fanaticism more cost * Add of attacks/spells for cost efficiency * Have it apply to raw total costs for soul costs --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 4c963c6 commit e42520b

4 files changed

Lines changed: 95 additions & 3 deletions

File tree

spec/System/TestSkills_spec.lua

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,66 @@ describe("TestAttacks", function()
150150

151151
assert.True(preAdrenalineMaxStages < build.calcsTab.mainEnv.player.activeSkillList[1].skillModList:Sum("BASE", nil, "Multiplier:BlightMaxStages"))
152152
end)
153+
it("Test cost efficiency modifiers", function()
154+
-- Test Mana Cost Efficiency
155+
build.skillsTab:PasteSocketGroup("Ball Lightning 1/0 1\n")
156+
runCallback("OnFrame")
157+
158+
-- Get base mana cost (Ball Lightning level 1 has 12 mana cost)
159+
local baseCost = build.calcsTab.mainOutput.ManaCost
160+
assert.are.equals(12, baseCost)
161+
162+
-- Add 50% mana cost efficiency (should reduce cost to 12/1.5 = 8)
163+
build.configTab.input.customMods = "50% increased Mana Cost Efficiency"
164+
build.configTab:BuildModList()
165+
runCallback("OnFrame")
166+
167+
local reducedCost = build.calcsTab.mainOutput.ManaCost
168+
assert.are.equals(8, reducedCost)
169+
170+
-- Test generic cost efficiency (should also affect mana)
171+
newBuild()
172+
build.skillsTab:PasteSocketGroup("Ball Lightning 1/0 1\n")
173+
build.configTab.input.customMods = "25% increased Cost Efficiency"
174+
build.configTab:BuildModList()
175+
runCallback("OnFrame")
176+
177+
local genericEfficiencyCost = build.calcsTab.mainOutput.ManaCost
178+
-- Test actual behavior: 12/1.25 = 9.6 (not rounded)
179+
assert.True(math.abs(genericEfficiencyCost - 9.6) < 0.001)
180+
181+
-- Test multiple efficiency sources stacking additively
182+
build.configTab.input.customMods = "25% increased Cost Efficiency\n25% increased Mana Cost Efficiency"
183+
build.configTab:BuildModList()
184+
runCallback("OnFrame")
185+
186+
local stackedCost = build.calcsTab.mainOutput.ManaCost
187+
assert.are.equals(8, stackedCost) -- 12/(1 + 0.25 + 0.25) = 12/1.5 = 8
188+
end)
189+
190+
it("Test cost efficiency with cost modifiers", function()
191+
-- Test interaction between cost efficiency and cost multipliers
192+
build.skillsTab:PasteSocketGroup("Ball Lightning 1/0 1\n")
193+
194+
-- Add cost multiplier and efficiency
195+
build.configTab.input.customMods = "50% increased Mana Cost\n50% increased Mana Cost Efficiency"
196+
build.configTab:BuildModList()
197+
runCallback("OnFrame")
198+
199+
local finalCost = build.calcsTab.mainOutput.ManaCost
200+
assert.True(math.abs(finalCost - 12) < 0.1) -- floor(12 * 1.5) / 1.5
201+
end)
202+
203+
it("Test mana cost efficiency with support gems", function()
204+
-- Test interaction between cost efficiency and cost multipliers
205+
build.skillsTab:PasteSocketGroup("Contagion 6/0 1\nMagnified Area I 1/0 1")
206+
207+
-- Add efficiency
208+
build.configTab.input.customMods = "36% increased Mana Cost Efficiency"
209+
build.configTab:BuildModList()
210+
runCallback("OnFrame")
211+
212+
local finalCost = build.calcsTab.mainOutput.ManaCost
213+
assert.are.equals(7, round(finalCost))
214+
end)
153215
end)

src/Modules/CalcOffence.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,12 +1747,13 @@ function calcs.offence(env, actor, activeSkill)
17471747
local moreType = 1
17481748
local moreCost = 1
17491749
local inc = 0
1750+
local costEfficiency = calcLib.mod(skillModList, skillCfg, val.type .. "CostEfficiency", "CostEfficiency")
17501751
if not val.unaffectedByGenericCostMults then
17511752
output[costName] = val.finalBaseCost
17521753
moreType = skillModList:More(skillCfg, val.type.."Cost")
17531754
moreCost = skillModList:More(skillCfg, "Cost")
17541755
inc = skillModList:Sum("INC", skillCfg, val.type.."Cost", "Cost")
1755-
output[costNameRaw] = val.baseCostRaw and m_max(0, m_max(0, (1 + inc / 100) * val.baseCostRaw * moreType * moreCost) + val.totalCost)
1756+
output[costNameRaw] = val.baseCostRaw and m_max(0, m_max(0, (1 + inc / 100) * val.baseCostRaw * moreType * moreCost / costEfficiency) + val.totalCost)
17561757
if inc < 0 then
17571758
output[costName] = m_max(0, m_ceil((1 + inc / 100) * output[costName]))
17581759
else
@@ -1768,6 +1769,8 @@ function calcs.offence(env, actor, activeSkill)
17681769
else
17691770
output[costName] = m_max(0, m_floor(moreCost * output[costName]))
17701771
end
1772+
-- Apply cost efficiency (similar to reservation efficiency)
1773+
output[costName] = m_max(0, output[costName] / costEfficiency)
17711774
output[costName] = m_max(0, output[costName] + val.totalCost)
17721775
if val.type == "Mana" and hybridLifeCost > 0 then -- Life/Mana Mastery
17731776
output[costName] = m_max(0, m_floor((1 - hybridLifeCost) * output[costName]))
@@ -1779,8 +1782,10 @@ function calcs.offence(env, actor, activeSkill)
17791782
output[costName] = m_floor(val.baseCost + val.baseCostNoMult)
17801783
output[costName] = m_max(0, (1 + inc / 100) * output[costName])
17811784
output[costName] = m_max(0, moreType * output[costName])
1785+
-- Apply cost efficiency for unaffected costs too
1786+
output[costName] = m_max(0, output[costName] / costEfficiency)
17821787
output[costName] = m_max(0, output[costName] + val.totalCost)
1783-
output[costNameRaw] = val.baseCostRaw and m_max(0, m_max(0, (1 + inc / 100) * (val.baseCostRaw + val.baseCostNoMult) * moreType) + val.totalCost)
1788+
output[costNameRaw] = val.baseCostRaw and m_max(0, m_max(0, (1 + inc / 100) * (val.baseCostRaw + val.baseCostNoMult) * moreType / costEfficiency) + val.totalCost)
17841789
end
17851790
if breakdown and hasCost then
17861791
breakdown[costName] = {
@@ -1807,6 +1812,9 @@ function calcs.offence(env, actor, activeSkill)
18071812
if moreType ~= 1 then
18081813
t_insert(breakdown[costName], s_format("x %.2f ^8(more/less "..val.text.." cost)", moreType))
18091814
end
1815+
if costEfficiency ~= 1 then
1816+
t_insert(breakdown[costName], s_format("/ %.2f ^8(" .. val.text .. " cost efficiency)", costEfficiency))
1817+
end
18101818
if val.totalCost ~= 0 then
18111819
t_insert(breakdown[costName], s_format("%+d ^8(total "..val.text.." cost)", val.totalCost))
18121820
end

src/Modules/CalcPerform.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ local function doActorMisc(env, actor)
705705
if modDB:Flag(nil, "Fanaticism") and actor.mainSkill and actor.mainSkill.skillFlags.selfCast then
706706
local effect = m_floor(75 * (1 + modDB:Sum("INC", nil, "BuffEffectOnSelf") / 100))
707707
modDB:NewMod("Speed", "MORE", effect, "Fanaticism", ModFlag.Cast)
708-
modDB:NewMod("Cost", "INC", -effect, "Fanaticism", ModFlag.Cast)
708+
modDB:NewMod("Cost", "MORE", -effect, "Fanaticism", ModFlag.Cast)
709709
modDB:NewMod("AreaOfEffect", "INC", effect, "Fanaticism", ModFlag.Cast)
710710
end
711711
if modDB:Flag(nil, "UnholyMight") then

src/Modules/ModParser.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,27 @@ local modNameList = {
188188
["cost of skills"] = "Cost",
189189
["cost of attacks"] = { "Cost", tag = { type = "SkillType", skillType = SkillType.Attack } },
190190
["cost of retaliation skills"] = { "Cost", tag = { type = "SkillType", skillType = SkillType.Retaliation } },
191+
-- Cost efficiency
192+
["cost efficiency"] = "CostEfficiency",
193+
["cost efficiency of skills"] = "CostEfficiency",
194+
["cost efficiency of attacks"] = { "CostEfficiency", tag = { type = "SkillType", skillType = SkillType.Attack } },
195+
["cost efficiency of spells"] = { "CostEfficiency", tag = { type = "SkillType", skillType = SkillType.Spell } },
196+
["mana cost efficiency"] = "ManaCostEfficiency",
197+
["mana cost efficiency of skills"] = "ManaCostEfficiency",
198+
["mana cost efficiency of attacks"] = { "ManaCostEfficiency", tag = { type = "SkillType", skillType = SkillType.Attack } },
199+
["mana cost efficiency of spells"] = { "ManaCostEfficiency", tag = { type = "SkillType", skillType = SkillType.Spell } },
200+
["life cost efficiency"] = "LifeCostEfficiency",
201+
["life cost efficiency of skills"] = "LifeCostEfficiency",
202+
["life cost efficiency of attacks"] = { "LifeCostEfficiency", tag = { type = "SkillType", skillType = SkillType.Attack } },
203+
["life cost efficiency of spells"] = { "LifeCostEfficiency", tag = { type = "SkillType", skillType = SkillType.Spell } },
204+
["energy shield cost efficiency"] = "ESCostEfficiency",
205+
["energy shield cost efficiency of skills"] = "ESCostEfficiency",
206+
["es cost efficiency"] = "ESCostEfficiency",
207+
["es cost efficiency of skills"] = "ESCostEfficiency",
208+
["soul cost efficiency"] = "SoulCostEfficiency",
209+
["soul cost efficiency of skills"] = "SoulCostEfficiency",
210+
["rage cost efficiency"] = "RageCostEfficiency",
211+
["rage cost efficiency of skills"] = "RageCostEfficiency",
191212
["mana reserved"] = "ManaReserved",
192213
["mana reservation"] = "ManaReserved",
193214
["mana reservation of skills"] = { "ManaReserved", tag = { type = "SkillType", skillType = SkillType.Aura } },
@@ -1293,6 +1314,7 @@ local modTagList = {
12931314
["per siphoning charge"] = { tag = { type = "Multiplier", var = "SiphoningCharge" } },
12941315
["per spirit charge"] = { tag = { type = "Multiplier", var = "SpiritCharge" } },
12951316
["per challenger charge"] = { tag = { type = "Multiplier", var = "ChallengerCharge" } },
1317+
["per maximum power charge"] = { tag = { type = "Multiplier", var = "PowerChargeMax" } },
12961318
["per gale force"] = { tag = { type = "Multiplier", var = "GaleForce" } },
12971319
["per intensity"] = { tag = { type = "Multiplier", var = "Intensity" } },
12981320
["per brand"] = { tag = { type = "Multiplier", var = "ActiveBrand" } },

0 commit comments

Comments
 (0)