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
16 changes: 16 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,22 @@ describe("TestItemParse", function()
end
end)

it("keeps bonded rune stats separate from normal rune stats", function()
local item = new("Item", [[
Rarity: Rare
Test Body
Rusted Cuirass
]])
item.itemSocketCount = 1
item.runes = { "Lesser Body Rune" }
item:UpdateRunes()

assert.are.equals(3, #item.runeModLines)
assert.are.equals("+30 to maximum Life", item.runeModLines[1].line)
assert.are.equals("Bonded: +20 to maximum Life", item.runeModLines[2].line)
assert.are.equals("Bonded: +20 to maximum Mana", item.runeModLines[3].line)
end)

it("multi-line rune mod", function()
-- Thruldana is Bow-only as well
local item = new("Item", [[
Expand Down
7 changes: 4 additions & 3 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1519,10 +1519,11 @@ function ItemClass:UpdateRunes()
for _, mod in ipairs(gatheredMods) do
for i, modLine in ipairs(mod) do
local order = mod.statOrder[i]
if statOrder[order] then
local orderKey = modLine:match("^Bonded:") and "Bonded:"..order or order
if statOrder[orderKey] then
-- Combine stats
local start = 1
statOrder[order].line = statOrder[order].line:gsub("(%d%.?%d*)", function(num)
statOrder[orderKey].line = statOrder[orderKey].line:gsub("(%d%.?%d*)", function(num)
local s, e, other = mod[i]:find("(%d%.?%d*)", start)
start = e + 1
return tonumber(num) + tonumber(other)
Expand All @@ -1535,7 +1536,7 @@ function ItemClass:UpdateRunes()
break
end
end
statOrder[order] = modLine
statOrder[orderKey] = modLine
end
end
end
Expand Down
Loading