Skip to content
Open
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
50 changes: 50 additions & 0 deletions spec/System/TestBirthedReservation_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
describe("TestBirthedReservation", function()
before_each(function()
newBuild()
build.configTab.input.customMods = "+1000 to Spirit"
build.configTab:BuildModList()
end)

local function grantAmulet(baseName, skillLine)
build.itemsTab:CreateDisplayItemFromRaw("New Item\n"..baseName.."\nImplicits: 1\nGrants Skill: "..skillLine.."\n")
build.itemsTab:AddDisplayItem()
end

it("Absent Amulet grants a reservation-free skill", function()
grantAmulet("Absent Amulet", "Level 20 Archmage")
runCallback("OnFrame")
assert.are.equals(0, build.calcsTab.mainOutput.SpiritReserved)
end)

it("other Birthed amulets (Lament, Portent) are not affected and still reserve", function()
grantAmulet("Lament Amulet", "Level 20 Archmage")
runCallback("OnFrame")
assert.are.equals(100, build.calcsTab.mainOutput.SpiritReserved)

newBuild()
build.configTab.input.customMods = "+1000 to Spirit"
build.configTab:BuildModList()
grantAmulet("Portent Amulet", "Level 20 Archmage")
runCallback("OnFrame")
assert.are.equals(100, build.calcsTab.mainOutput.SpiritReserved)
end)

it("support gems added to a birthed-granted skill still reserve", function()
grantAmulet("Absent Amulet", "Level 20 Archmage")
build.skillsTab:PasteSocketGroup("Slot: Amulet\nClarity I 1/0 1\n")
runCallback("OnFrame")
assert.are.equals(10, build.calcsTab.mainOutput.SpiritReserved)
end)

it("a non-birthed item granting the same skill still reserves normally", function()
grantAmulet("Lapis Amulet", "Level 20 Archmage")
runCallback("OnFrame")
assert.are.equals(100, build.calcsTab.mainOutput.SpiritReserved)
end)

it("a socketed copy of the skill still reserves normally", function()
build.skillsTab:PasteSocketGroup("Archmage 20/0 1\n")
runCallback("OnFrame")
assert.are.equals(100, build.calcsTab.mainOutput.SpiritReserved)
end)
end)
1 change: 1 addition & 0 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,7 @@ function ItemClass:BuildModList()
skillId = skill.skillId,
level = skill.level,
noSupports = skill.noSupports,
noReservation = self.base and self.base.grantedSkillsReserveNoSpirit or nil,
source = self.modSource,
triggered = skill.triggered,
triggerChance = skill.triggerChance,
Expand Down
1 change: 1 addition & 0 deletions src/Data/Bases/amulet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ itemBases["Portent Amulet"] = {
itemBases["Absent Amulet"] = {
type = "Amulet",
tags = { amulet = true, default = true, },
grantedSkillsReserveNoSpirit = true,
variantList = { "Cast on Elemental Ailment", "Cast on Critical", "Cast on Dodge", "Rhoa Mount", "Archmage", "Trinity", "Eternal Rage", },
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",
implicitModTypes = { { }, { }, },
Expand Down
3 changes: 3 additions & 0 deletions src/Export/Scripts/bases.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ directiveTable.base = function(state, args, out)
out:write(tag, ' = true, ')
end
out:write('},\n')
if baseTypeId == "Metadata/Items/Amulets/FourAmuletB1c" then
out:write('\tgrantedSkillsReserveNoSpirit = true,\n')
end
local implicitLines = { }
local implicitModTypes = { }
local variantList = { }
Expand Down
4 changes: 4 additions & 0 deletions src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ function calcs.doActorLifeManaSpiritReservation(actor)
pool.Life.basePercent = pool.Life.basePercent + pool.Spirit.basePercent * spiritToLifeReservation
pool.Spirit.basePercent = 0
end
if activeSkill.activeEffect.srcInstance and activeSkill.activeEffect.srcInstance.noReservation then
for _, values in pairs(pool) do values.baseFlat, values.basePercent = 0, 0 end
pool.Spirit.baseFlat = skillModList:Sum("BASE", skillCfg, "ExtraSpirit")
end
for name, values in pairs(pool) do
values.more = skillModList:More(skillCfg, name.."Reserved", "Reserved")
values.inc = skillModList:Sum("INC", skillCfg, name.."Reserved", "Reserved")
Expand Down
1 change: 1 addition & 0 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,7 @@ function calcs.initEnv(build, mode, override, specEnv)
activeGemInstance.enableGlobal1 = true
activeGemInstance.noSupports = grantedSkill.noSupports
group.noSupports = grantedSkill.noSupports
activeGemInstance.noReservation = grantedSkill.noReservation
activeGemInstance.triggered = grantedSkill.triggered
activeGemInstance.triggerChance = grantedSkill.triggerChance
wipeTable(group.gemList)
Expand Down