Skip to content

Commit f026305

Browse files
author
LocalIdentity
committed
Fix parsing for runeseekers call
Add scaling for the runes mod too
1 parent 1054f0d commit f026305

6 files changed

Lines changed: 116 additions & 44 deletions

File tree

spec/System/TestItemParse_spec.lua

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,69 @@ describe("TestItemParse", function()
476476
assert.are.equals("Bonded: +20 to maximum Mana", item.runeModLines[3].line)
477477
end)
478478

479+
it("applies increased effect of socketed runes", function()
480+
local item = new("Item", [[
481+
Test Wand
482+
Runic Fork
483+
Sockets: S
484+
Rune: Lesser Desert Rune
485+
Implicits: 1
486+
{enchant}{rune}Gain 6% of Damage as Extra Fire Damage
487+
200% increased effect of Socketed Runes
488+
]])
489+
item:BuildAndParseRaw()
490+
491+
local damageGainAsFire = 0
492+
for _, mod in ipairs(item.slotModList[1]) do
493+
if mod.name == "DamageGainAsFire" and mod.type == "BASE" then
494+
damageGainAsFire = damageGainAsFire + mod.value
495+
end
496+
end
497+
assert.are.equals(18, damageGainAsFire)
498+
end)
499+
500+
it("does not double-scale imported socketed rune text", function()
501+
local item = new("Item", [[
502+
Runeseeker's Call
503+
Runic Fork
504+
Unique ID: bbcd083b0a9da5650f3ac0a001364b1c99d6b866c1f52f0568fafab863b44ccb
505+
Item Level: 86
506+
Quality: 20
507+
Sockets: S S S S S S
508+
Rune: Hedgewitch Assandra's Rune of Wisdom
509+
Rune: Saqawal's Rune of the Sky
510+
Rune: Perfect Iron Rune
511+
Rune: Perfect Iron Rune
512+
Rune: Perfect Vision Rune
513+
Rune: Legacy of Lifesprig
514+
LevelReq: 90
515+
Implicits: 11
516+
{enchant}{rune}210% increased Spell Damage
517+
{enchant}{rune}+9 to Level of all Spell Skills
518+
{enchant}{rune}84% increased Critical Hit Chance for Spells
519+
{enchant}{rune}Gain 15% of Damage as Extra Damage of all Elements
520+
{enchant}{rune}Bonded: 75% increased Critical Damage Bonus
521+
{enchant}{rune}Bonded: 36% chance when collecting an Elemental Infusion to gain an
522+
{enchant}{rune}additional Elemental Infusion of the same type
523+
{enchant}{rune}Bonded: Archon recovery period expires 90% faster
524+
{enchant}{rune}Bonded: Break Armour on Critical Hit with Spells equal to 72% of Physical Damage dealt
525+
{enchant}{rune}Bonded: Leeches 3% of maximum Life when you Cast a Spell
526+
Grants Skill: Level 20 The Stars Answer
527+
Only Runes can be Socketed in this item
528+
200% increased effect of Socketed Runes
529+
Corrupted
530+
]])
531+
item:BuildAndParseRaw()
532+
533+
local spellDamage = 0
534+
for _, mod in ipairs(item.slotModList[1]) do
535+
if mod.name == "Damage" and mod.type == "INC" and mod.flags == ModFlag.Spell then
536+
spellDamage = spellDamage + mod.value
537+
end
538+
end
539+
assert.are.equals(210, spellDamage)
540+
end)
541+
479542
it("multi-line rune mod", function()
480543
-- Thruldana is Bow-only as well
481544
local item = new("Item", [[
@@ -697,4 +760,4 @@ describe("TestAdvancedItemParse #item", function()
697760
Note: ~b/o 2 chaos
698761
]])
699762
end)
700-
end)
763+
end)

src/Classes/Item.lua

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,18 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
10141014
if self.base then
10151015
if self.base.weapon or self.base.armour or self.base.tags.wand or self.base.tags.staff or self.base.tags.sceptre then
10161016
local shouldFixRunesOnItem = #self.runes == 0
1017+
if not shouldFixRunesOnItem and #self.runeModLines > 0 then
1018+
local canRebuildRunes = true
1019+
for _, rune in ipairs(self.runes) do
1020+
if rune ~= "None" and not data.itemMods.Runes[rune] then
1021+
canRebuildRunes = false
1022+
break
1023+
end
1024+
end
1025+
if canRebuildRunes then
1026+
self:UpdateRunes()
1027+
end
1028+
end
10171029

10181030
local function getRuneLineParts(modLine)
10191031
local values = { }
@@ -1105,17 +1117,17 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11051117
local broadItemType = self.base.weapon and "weapon" or (self.base.tags.wand or self.base.tags.staff) and "caster" or "armour" -- minor optimisation
11061118
local specificItemType = self.base.type:lower()
11071119
for runeName, runeMods in pairs(data.itemMods.Runes) do
1108-
local addModToGroupedRunes = function (modLine)
1120+
local addModToGroupedRunes = function (modLine, augmentType)
11091121
local runeStrippedModLine, runeValues = getRuneLineParts(modLine)
11101122
if statGroupedRunes[runeStrippedModLine] == nil then
11111123
statGroupedRunes[runeStrippedModLine] = { }
11121124
end
1113-
t_insert(statGroupedRunes[runeStrippedModLine], { name = runeName, values = runeValues })
1125+
t_insert(statGroupedRunes[runeStrippedModLine], { name = runeName, type = augmentType, values = runeValues })
11141126
end
11151127
for slotType, slotMod in pairs(runeMods) do
11161128
if slotType == broadItemType or slotType == specificItemType then
11171129
for _, mod in ipairs(slotMod) do
1118-
addModToGroupedRunes(mod)
1130+
addModToGroupedRunes(mod, slotMod.type)
11191131
end
11201132
end
11211133
end
@@ -1137,7 +1149,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11371149
remainingRunes = remainingRunes - numRunes
11381150
-- this code should probably be refactored to based off stored self.runes rather than the recomputed amounts off the runeModLines this
11391151
-- is too avoid having to run the relatively expensive recomputation every time the item is parsed even if we know the runes on the item already.
1140-
modLine.soulCore = groupedRunes[1].name:match("Soul Core") ~= nil
1152+
modLine.augmentType = groupedRunes[1].type
11411153
modLine.runeCount = numRunes
11421154

11431155
if shouldFixRunesOnItem then
@@ -1526,7 +1538,7 @@ function ItemClass:UpdateRunes()
15261538
for _, mod in ipairs(gatheredMods) do
15271539
for i, modLine in ipairs(mod) do
15281540
local order = mod.statOrder[i]
1529-
local orderKey = modLine:match("^Bonded:") and "Bonded:"..order or order
1541+
local orderKey = mod.type .. ":" .. (modLine:match("^Bonded:") and "Bonded:"..order or order)
15301542
if statOrder[orderKey] then
15311543
-- Combine stats
15321544
local start = 1
@@ -1535,8 +1547,12 @@ function ItemClass:UpdateRunes()
15351547
start = e + 1
15361548
return tonumber(num) + tonumber(other)
15371549
end)
1550+
local modList, extra = modLib.parseMod(statOrder[orderKey].line)
1551+
statOrder[orderKey].modList = modList or { }
1552+
statOrder[orderKey].extra = extra
15381553
else
1539-
local modLine = { line = modLine, order = order, rune = true, enchant = true }
1554+
local modList, extra = modLib.parseMod(modLine)
1555+
local modLine = { line = modLine, order = order, modList = modList or { }, extra = extra, rune = true, enchant = true, augmentType = mod.type }
15401556
for l = 1, #self.runeModLines + 1 do
15411557
if not self.runeModLines[l] or self.runeModLines[l].order > order then
15421558
t_insert(self.runeModLines, l, modLine)
@@ -2020,6 +2036,17 @@ function ItemClass:BuildModList()
20202036
for _, modLine in ipairs(self.explicitModLines) do
20212037
processModLine(modLine)
20222038
end
2039+
self.socketedSoulCoreEffectModifier = calcLocal(baseList, "SocketedSoulCoreEffect", "INC", 0) / 100
2040+
self.socketedRuneEffectModifier = calcLocal(baseList, "SocketedRuneEffect", "INC", 0) / 100
2041+
for _, modLine in ipairs(self.runeModLines) do
2042+
local effectModifier = modLine.augmentType == "SoulCore" and self.socketedSoulCoreEffectModifier
2043+
or modLine.augmentType == "Rune" and self.socketedRuneEffectModifier
2044+
if effectModifier and effectModifier ~= 0 and self:CheckModLineVariant(modLine) and not modLine.extra then
2045+
for _, mod in ipairs(modLine.modList) do
2046+
baseList:ScaleAddMod(mod, effectModifier)
2047+
end
2048+
end
2049+
end
20232050
self.grantedSkills = { }
20242051
for _, skill in ipairs(baseList:List(nil, "ExtraSkill")) do
20252052
if skill.name ~= "Unknown" then
@@ -2129,5 +2156,4 @@ function ItemClass:BuildModList()
21292156
else
21302157
self.modList = self:BuildModListForSlotNum(baseList)
21312158
end
2132-
self.socketedSoulCoreEffectModifier = calcLocal(baseList, "SocketedSoulCoreEffect", "INC", 0) / 100
21332159
end

src/Classes/ItemsTab.lua

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,14 @@ end)
19181918

19191919
function ItemsTabClass:GetValidRunesForItem(item)
19201920
local runes = { }
1921+
local socketedItemType
1922+
if item.baseModList then
1923+
if item.baseModList:Flag(nil, "SocketedSoulCoresOnly") then
1924+
socketedItemType = "SoulCore"
1925+
elseif item.baseModList:Flag(nil, "SocketedRunesOnly") then
1926+
socketedItemType = "Rune"
1927+
end
1928+
end
19211929
for _, rune in pairs(runeModLines) do
19221930
local subType = item.base.subType and item.base.subType:lower()
19231931
local itemType = item.base.type:lower()
@@ -1939,17 +1947,9 @@ function ItemsTabClass:GetValidRunesForItem(item)
19391947
end
19401948
end
19411949
if isRuneValidForSlot(rune.slot) then
1942-
if item.title == "Atziri's Splendour" then
1943-
if rune.slot == "None" or rune.type == "SoulCore" then
1944-
table.insert(runes, rune)
1945-
end
1946-
elseif item.title == "Runeseeker's Call" then
1947-
if rune.slot == "None" or rune.type == "Rune" then
1948-
table.insert(runes, rune)
1949-
end
1950-
else
1951-
table.insert(runes, rune)
1952-
end
1950+
if rune.slot == "None" or not socketedItemType or rune.type == socketedItemType then
1951+
table.insert(runes, rune)
1952+
end
19531953
end
19541954
end
19551955
return runes

src/Data/ModCache.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@ c["200% increased Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="Physical
22002200
c["200% increased Stun Recovery"]={{[1]={flags=0,keywordFlags=0,name="StunRecovery",type="INC",value=200}},nil}
22012201
c["200% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=200}},nil}
22022202
c["200% increased bonuses gained from Equipped Quiver"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromQuiver",type="INC",value=200}},nil}
2203-
c["200% increased effect of Socketed Runes"]={{[1]={flags=0,keywordFlags=0,name="LocalEffect",type="INC",value=200}}," of Socketed Runes "}
2203+
c["200% increased effect of Socketed Runes"]={{[1]={flags=0,keywordFlags=0,name="SocketedRuneEffect",type="INC",value=200}},nil}
22042204
c["200% increased effect of Socketed Soul Cores"]={{[1]={flags=0,keywordFlags=0,name="SocketedSoulCoreEffect",type="INC",value=200}},nil}
22052205
c["21% increased Chaos Damage"]={{[1]={flags=0,keywordFlags=0,name="ChaosDamage",type="INC",value=21}},nil}
22062206
c["21% increased Elemental Ailment Threshold"]={{[1]={flags=0,keywordFlags=0,name="AilmentThreshold",type="INC",value=21}},nil}
@@ -6336,8 +6336,8 @@ c["On Hitting an Enemy while a Life Flask is at full Charges, 40% of its Charges
63366336
c["On Hitting an enemy, gains maximum added Lightning damage equal to"]={nil,"On Hitting an enemy, gains maximum added Lightning damage equal to "}
63376337
c["On Hitting an enemy, gains maximum added Lightning damage equal to the enemy's Power for 20 seconds, up to a total of 500"]={nil,"On Hitting an enemy, gains maximum added Lightning damage equal to the enemy's Power for 20 seconds, up to a total of 500 "}
63386338
c["On-Kill Effects happen twice"]={nil,"On-Kill Effects happen twice "}
6339-
c["Only Runes can be Socketed in this item"]={{},nil}
6340-
c["Only Soul Cores can be Socketed in this item"]={{},nil}
6339+
c["Only Runes can be Socketed in this item"]={{[1]={flags=0,keywordFlags=0,name="SocketedRunesOnly",type="FLAG",value=true}},nil}
6340+
c["Only Soul Cores can be Socketed in this item"]={{[1]={flags=0,keywordFlags=0,name="SocketedSoulCoresOnly",type="FLAG",value=true}},nil}
63416341
c["Only affects Passives in Large Ring"]={{[1]={flags=0,keywordFlags=0,name="JewelData",type="LIST",value={key="radiusIndex",value=10}}},nil}
63426342
c["Only affects Passives in Massive Ring"]={{[1]={flags=0,keywordFlags=0,name="JewelData",type="LIST",value={key="radiusIndex",value=12}}},nil}
63436343
c["Only affects Passives in Medium Ring"]={{[1]={flags=0,keywordFlags=0,name="JewelData",type="LIST",value={key="radiusIndex",value=8}}},nil}

src/Modules/CalcSetup.lua

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,20 +1117,6 @@ function calcs.initEnv(build, mode, override, specEnv)
11171117
end
11181118
env.itemModDB.multipliers["RunesSocketedIn"..slotName] = socketed
11191119

1120-
if item.socketedSoulCoreEffectModifier ~= 0 then
1121-
for _, modLine in ipairs(item.runeModLines) do
1122-
if modLine.soulcore then
1123-
for _, mod in ipairs(modLine.modList) do
1124-
local modCopy = copyTable(mod)
1125-
modCopy.value = round(modCopy.value / modLine.runeCount)
1126-
for i = 1, modLine.runeCount do
1127-
env.itemModDB:ScaleAddMod(modCopy, item.socketedSoulCoreEffectModifier)
1128-
end
1129-
end
1130-
end
1131-
end
1132-
end
1133-
11341120
if item.type == "Jewel" and item.base.subType == "Abyss" then
11351121
-- Update Abyss Jewel conditions/multipliers
11361122
local cond = "Have"..item.baseName:gsub(" ","")

src/Modules/ModParser.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ local modNameList = {
896896
["effect of the socketed jewel"] = "SocketedJewelEffect",
897897
["effect of socketed abyss jewels"] = "SocketedJewelEffect",
898898
["effect of socketed soul cores"] = "SocketedSoulCoreEffect",
899+
["effect of socketed runes"] = "SocketedRuneEffect",
899900
["to inflict fire exposure on hit"] = "FireExposureChance",
900901
["to apply fire exposure on hit"] = "FireExposureChance",
901902
["to inflict cold exposure on hit"] = "ColdExposureChance",
@@ -3432,17 +3433,13 @@ local specialModList = {
34323433
-- Display only. For Breach Rings and Serle's Grit.
34333434
},
34343435
["can have (%d+) additional instilled modifiers?"] = function(num) return {
3435-
-- Display only. For Strugglescream.
3436+
-- For Strugglescream. Handled in Item.lua
34363437
} end,
34373438
["can have an additional instilled modifier"] = function(num) return {
3438-
-- Display only.
3439-
} end,
3440-
["only soul cores can be socketed in this item"] = function(num) return {
3441-
-- Display only.
3442-
} end,
3443-
["only runes can be socketed in this item"] = function(num) return {
3444-
-- Display only.
3439+
-- Handled in Item.lua
34453440
} end,
3441+
["only soul cores can be socketed in this item"] = { flag("SocketedSoulCoresOnly") },
3442+
["only runes can be socketed in this item"] = { flag("SocketedRunesOnly") },
34463443
["has (%d+) sockets?"] = function(num) return { mod("SocketCount", "BASE", num) } end,
34473444
["no physical damage"] = { mod("WeaponData", "LIST", { key = "PhysicalMin" }), mod("WeaponData", "LIST", { key = "PhysicalMax" }), mod("WeaponData", "LIST", { key = "PhysicalDPS" }) },
34483445
["cannot load or fire ammunition"] = { mod("WeaponData", "LIST", { key = "cannotUseGemTag", value = "ammunition" }) },

0 commit comments

Comments
 (0)