Skip to content

Commit deb16ef

Browse files
jokker23LocalIdentity
andauthored
Fix Amuelt Aura's having a Spirit cost (#2353)
* Absent Amulet grants a reservation-free skill When the Absent Amulet grants a reserving skill (Archmage), the skill is provided for free in-game and reserves no Spirit. PoB was still charging the granted skill's full base reservation (100 Spirit for Archmage), overstating reserved Spirit and understating unreserved Spirit for any build using the amulet. * Fix implementation The implementation now correctly handles supported gems that add spirit costs and gems that convert the cost to a life cost It was also not working with the Lament of Portent Amulet bases and was not using the field from the game files to set the flag on the item base * Move into inherentSkillType block --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 93f023b commit deb16ef

7 files changed

Lines changed: 74 additions & 2 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
describe("TestBirthedReservation", function()
2+
before_each(function()
3+
newBuild()
4+
build.configTab.input.customMods = "+1000 to Spirit"
5+
build.configTab:BuildModList()
6+
end)
7+
8+
local function grantAmulet(baseName, skillLine)
9+
build.itemsTab:CreateDisplayItemFromRaw("New Item\n"..baseName.."\nImplicits: 1\nGrants Skill: "..skillLine.."\n")
10+
build.itemsTab:AddDisplayItem()
11+
end
12+
13+
it("Absent Amulet grants a reservation-free skill", function()
14+
grantAmulet("Absent Amulet", "Level 20 Archmage")
15+
runCallback("OnFrame")
16+
assert.are.equals(0, build.calcsTab.mainOutput.SpiritReserved)
17+
end)
18+
19+
it("other Birthed amulets also grant reservation-free skills", function()
20+
grantAmulet("Lament Amulet", "Level 20 Arctic Armour")
21+
runCallback("OnFrame")
22+
assert.are.equals(0, build.calcsTab.mainOutput.SpiritReserved)
23+
24+
newBuild()
25+
build.configTab.input.customMods = "+1000 to Spirit"
26+
build.configTab:BuildModList()
27+
grantAmulet("Portent Amulet", "Level 20 Wolf Pack")
28+
runCallback("OnFrame")
29+
assert.are.equals(0, build.calcsTab.mainOutput.SpiritReserved)
30+
end)
31+
32+
it("support gems added to a birthed-granted skill still reserve", function()
33+
grantAmulet("Absent Amulet", "Level 20 Archmage")
34+
build.skillsTab:PasteSocketGroup("Slot: Amulet\nClarity I 1/0 1\n")
35+
runCallback("OnFrame")
36+
assert.are.equals(10, build.calcsTab.mainOutput.SpiritReserved)
37+
end)
38+
39+
it("support reservation conversions still apply", function()
40+
grantAmulet("Absent Amulet", "Level 20 Archmage")
41+
build.skillsTab:PasteSocketGroup("Slot: Amulet\nClarity I 1/0 1\nAtziri's Communion 1/0 1\n")
42+
runCallback("OnFrame")
43+
assert.is_true(build.calcsTab.mainOutput.LifeReservedPercent > 0)
44+
assert.are.equals(0, build.calcsTab.mainOutput.SpiritReserved)
45+
end)
46+
47+
it("a non-birthed item granting the same skill still reserves normally", function()
48+
grantAmulet("Lapis Amulet", "Level 20 Archmage")
49+
runCallback("OnFrame")
50+
assert.are.equals(100, build.calcsTab.mainOutput.SpiritReserved)
51+
end)
52+
53+
it("a socketed copy of the skill still reserves normally", function()
54+
build.skillsTab:PasteSocketGroup("Archmage 20/0 1\n")
55+
runCallback("OnFrame")
56+
assert.are.equals(100, build.calcsTab.mainOutput.SpiritReserved)
57+
end)
58+
end)

src/Classes/Item.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,7 @@ function ItemClass:BuildModList()
21492149
skillId = skill.skillId,
21502150
level = skill.level,
21512151
noSupports = skill.noSupports,
2152+
noReservation = self.base and self.base.grantedSkillsHaveNoReservation or nil,
21522153
source = self.modSource,
21532154
triggered = skill.triggered,
21542155
triggerChance = skill.triggerChance,

src/Data/Bases/amulet.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ itemBases["Runemastered Veridical Chain"] = {
114114
itemBases["Lament Amulet"] = {
115115
type = "Amulet",
116116
tags = { amulet = true, default = true, },
117+
grantedSkillsHaveNoReservation = true,
117118
variantList = { "Arctic Armour", "Herald of Ash", "Herald of Ice", "Herald of Thunder", "Plague Bearer", "Barrier Invocation", "Lingering Illusion", "Ghost Dance", "Mana Remnants", "Magma Barrier", "Raging Spirits", "Wind Dancer", "Cast on Minion Death", "Scavenged Plating", "War Banner", "Defiance Banner", "Dread Banner", "Time of Need", "Attrition", "Charge Regulation", "Shard Scavenger", "Overwhelming Presence", "Alchemist's Boon", "Reaper's Invocation", "Berserk", "Herald of Plague", "Herald of Blood", "Withering Presence", "Ravenous Swarm", "Combat Frenzy", "Trail of Caltrops", "Convalescence", "Iron Ward", "Siphon Elements", "Briarpatch", "Savage Fury", "Barkskin", },
118119
implicit = "-1 Prefix Modifier allowed\n{variant:1}Grants Skill: Level (1-20) Arctic Armour\n{variant:2}Grants Skill: Level (1-20) Herald of Ash\n{variant:3}Grants Skill: Level (1-20) Herald of Ice\n{variant:4}Grants Skill: Level (1-20) Herald of Thunder\n{variant:5}Grants Skill: Level (1-20) Plague Bearer\n{variant:6}Grants Skill: Level (1-20) Barrier Invocation\n{variant:7}Grants Skill: Level (1-20) Lingering Illusion\n{variant:8}Grants Skill: Level (1-20) Ghost Dance\n{variant:9}Grants Skill: Level (1-20) Mana Remnants\n{variant:10}Grants Skill: Level (1-20) Magma Barrier\n{variant:11}Grants Skill: Level (1-20) Raging Spirits\n{variant:12}Grants Skill: Level (1-20) Wind Dancer\n{variant:13}Grants Skill: Level (1-20) Cast on Minion Death\n{variant:14}Grants Skill: Level (1-20) Scavenged Plating\n{variant:15}Grants Skill: Level (1-20) War Banner\n{variant:16}Grants Skill: Level (1-20) Defiance Banner\n{variant:17}Grants Skill: Level (1-20) Dread Banner\n{variant:18}Grants Skill: Level (1-20) Time of Need\n{variant:19}Grants Skill: Level (1-20) Attrition\n{variant:20}Grants Skill: Level (1-20) Charge Regulation\n{variant:21}Grants Skill: Level (1-20) Shard Scavenger\n{variant:22}Grants Skill: Level (1-20) Overwhelming Presence\n{variant:23}Grants Skill: Level (1-20) Alchemist's Boon\n{variant:24}Grants Skill: Level (1-20) Reaper's Invocation\n{variant:25}Grants Skill: Level (1-20) Berserk\n{variant:26}Grants Skill: Level (1-20) Herald of Plague\n{variant:27}Grants Skill: Level (1-20) Herald of Blood\n{variant:28}Grants Skill: Level (1-20) Withering Presence\n{variant:29}Grants Skill: Level (1-20) Ravenous Swarm\n{variant:30}Grants Skill: Level (1-20) Combat Frenzy\n{variant:31}Grants Skill: Level (1-20) Trail of Caltrops\n{variant:32}Grants Skill: Level (1-20) Convalescence\n{variant:33}Grants Skill: Level (1-20) Iron Ward\n{variant:34}Grants Skill: Level (1-20) Siphon Elements\n{variant:35}Grants Skill: Level (1-20) Briarpatch\n{variant:36}Grants Skill: Level (1-20) Savage Fury\n{variant:37}Grants Skill: Level (1-20) Barkskin",
119120
implicitModTypes = { { }, },
@@ -122,6 +123,7 @@ itemBases["Lament Amulet"] = {
122123
itemBases["Portent Amulet"] = {
123124
type = "Amulet",
124125
tags = { amulet = true, default = true, },
126+
grantedSkillsHaveNoReservation = true,
125127
variantList = { "Wolf Pack", "Blink", "Elemental Invocation", "Elemental Conflux", "Sacrifice", "Mirage Archer", "Feral Invocation", },
126128
implicit = "-1 Suffix Modifier allowed\n{variant:1}Grants Skill: Level (1-20) Wolf Pack\n{variant:2}Grants Skill: Level (1-20) Blink\n{variant:3}Grants Skill: Level (1-20) Elemental Invocation\n{variant:4}Grants Skill: Level (1-20) Elemental Conflux\n{variant:5}Grants Skill: Level (1-20) Sacrifice\n{variant:6}Grants Skill: Level (1-20) Mirage Archer\n{variant:7}Grants Skill: Level (1-20) Feral Invocation",
127129
implicitModTypes = { { }, },
@@ -130,6 +132,7 @@ itemBases["Portent Amulet"] = {
130132
itemBases["Absent Amulet"] = {
131133
type = "Amulet",
132134
tags = { amulet = true, default = true, },
135+
grantedSkillsHaveNoReservation = true,
133136
variantList = { "Cast on Elemental Ailment", "Cast on Critical", "Cast on Dodge", "Rhoa Mount", "Archmage", "Trinity", "Eternal Rage", },
134137
implicit = "-1 Prefix Modifier allowed\n-1 Suffix Modifier allowed\n{variant:1}Grants Skill: Level (1-20) Cast on Elemental Ailment\n{variant:2}Grants Skill: Level (1-20) Cast on Critical\n{variant:3}Grants Skill: Level (1-20) Cast on Dodge\n{variant:4}Grants Skill: Level (1-20) Rhoa Mount\n{variant:5}Grants Skill: Level (1-20) Archmage\n{variant:6}Grants Skill: Level (1-20) Trinity\n{variant:7}Grants Skill: Level (1-20) Eternal Rage",
135138
implicitModTypes = { { }, { }, },

src/Export/Scripts/bases.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ directiveTable.base = function(state, args, out)
171171
end
172172
local inherentSkillType = dat("ItemInherentSkills"):GetRow("BaseItemType", baseItemType)
173173
if inherentSkillType then
174+
if inherentSkillType.NoReservation then
175+
out:write('\tgrantedSkillsHaveNoReservation = true,\n')
176+
end
174177
local hasVariants = #inherentSkillType.Skill > 1
175178
for index, skill in ipairs(inherentSkillType.Skill) do
176179
local skillGem = dat("SkillGems"):GetRow("BaseItemType", skill.BaseItemType)

src/Export/spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31728,10 +31728,10 @@ return {
3172831728
},
3172931729
[3]={
3173031730
list=false,
31731-
name="Mainhand",
31731+
name="NoReservation",
3173231732
refTo="",
3173331733
type="Bool",
31734-
width=50
31734+
width=80
3173531735
}
3173631736
},
3173731737
itemisedcorpse={

src/Modules/CalcActiveSkill.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,12 @@ function calcs.buildActiveSkillModList(env, activeSkill)
795795
grantedEffectLevel[k] = v
796796
end
797797
end
798+
if activeEffect.srcInstance and activeEffect.srcInstance.noReservation then
799+
for _, resource in ipairs({ "mana", "life", "spirit" }) do
800+
grantedEffectLevel[resource.."ReservationFlat"] = 0
801+
grantedEffectLevel[resource.."ReservationPercent"] = 0
802+
end
803+
end
798804
activeEffect.grantedEffectLevel = grantedEffectLevel
799805

800806
-- Add extra modifiers from granted effect level

src/Modules/CalcSetup.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,7 @@ function calcs.initEnv(build, mode, override, specEnv)
15341534
activeGemInstance.enableGlobal1 = true
15351535
activeGemInstance.noSupports = grantedSkill.noSupports
15361536
group.noSupports = grantedSkill.noSupports
1537+
activeGemInstance.noReservation = grantedSkill.noReservation
15371538
activeGemInstance.triggered = grantedSkill.triggered
15381539
activeGemInstance.triggerChance = grantedSkill.triggerChance
15391540
wipeTable(group.gemList)

0 commit comments

Comments
 (0)