Skip to content

Commit a8f8866

Browse files
authored
Add support for Item Requirements on items with Granted Skills and Fix Soul Cores (#1462)
* Add support for Item Requirements on items with Granted Skills * Don't overwrite level if skill has 0 level req * Cursecarver level req * Add table to keep track of unique item minimum level requirement * Prism Guardian level * Fix soulcores and runes not working for all expected slots * Required level changes with runes * More min level reqs * Hopefully fixes test * Slight change, allowing forced lower level reqs on uniques
1 parent cffbd25 commit a8f8866

File tree

13 files changed

+594
-53
lines changed

13 files changed

+594
-53
lines changed

src/Classes/Item.lua

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ local catalystTags = {
2727
{ "attribute" },
2828
}
2929

30+
local minimumReqLevel = { }
31+
3032
local function getCatalystScalar(catalystId, tags, quality)
3133
if not catalystId or type(catalystId) ~= "number" or not catalystTags[catalystId] or not tags or type(tags) ~= "table" or #tags == 0 then
3234
return 1
@@ -358,6 +360,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
358360
self.prefixes = { }
359361
self.suffixes = { }
360362
self.requirements = { }
363+
self.requirements.runeLevel = 0
361364
self.requirements.str = 0
362365
self.requirements.dex = 0
363366
self.requirements.int = 0
@@ -436,6 +439,16 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
436439
self.itemSocketCount = #self.sockets
437440
elseif specName == "Rune" then
438441
t_insert(self.runes, specVal)
442+
local runeLevel = 0
443+
local runeData = data.itemMods.Runes[specVal]
444+
if runeData then
445+
for _, slotData in pairs(runeData) do
446+
runeLevel = math.max(runeLevel, slotData.rank[1])
447+
end
448+
end
449+
if runeLevel > 0 and (not self.requirements.runeLevel or runeLevel > self.requirements.runeLevel) then
450+
self.requirements.runeLevel = runeLevel
451+
end
439452
elseif specName == "Radius" and self.type == "Jewel" then
440453
self.jewelRadiusLabel = specVal:match("^[%a ]+")
441454
if specVal:match("^%a+") == "Variable" then
@@ -484,6 +497,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
484497
self.armourData[specName] = specToNumber(specVal)
485498
elseif specName == "Requires Level" then
486499
self.requirements.level = specToNumber(specVal)
500+
minimumReqLevel = minimumReqLevel or {}
501+
table.insert(minimumReqLevel, { name = self.name, level = specVal })
487502
elseif specName == "Level" then
488503
-- Requirements from imported items can't always be trusted
489504
importedLevelReq = specToNumber(specVal)
@@ -975,6 +990,19 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
975990
self.requirements.level = self.base.req.level
976991
end
977992
end
993+
if self.base and not self.requirements.baseLevel then
994+
-- Add only if not already present, to prevent overwriting original value.
995+
local exists = false
996+
for _, entry in ipairs(minimumReqLevel) do
997+
if entry.name == self.title then
998+
exists = true
999+
break
1000+
end
1001+
end
1002+
if not exists then
1003+
self.requirements.baseLevel = self.base.req.level
1004+
end
1005+
end
9781006
self.affixLimit = 0
9791007
if self.crafted then
9801008
if not self.affixes then
@@ -1765,6 +1793,58 @@ function ItemClass:BuildModList()
17651793
for _, modLine in ipairs(self.explicitModLines) do
17661794
processModLine(modLine)
17671795
end
1796+
self.grantedSkills = { }
1797+
for _, skill in ipairs(baseList:List(nil, "ExtraSkill")) do
1798+
if skill.name ~= "Unknown" then
1799+
t_insert(self.grantedSkills, {
1800+
skillId = skill.skillId,
1801+
level = skill.level,
1802+
noSupports = skill.noSupports,
1803+
source = self.modSource,
1804+
triggered = skill.triggered,
1805+
triggerChance = skill.triggerChance,
1806+
})
1807+
end
1808+
end
1809+
1810+
local reqLevel = 0
1811+
local minReqLevel
1812+
1813+
for _, entry in ipairs(minimumReqLevel) do
1814+
if entry.name == self.title then
1815+
minReqLevel = entry.level
1816+
break
1817+
end
1818+
end
1819+
1820+
if #self.grantedSkills >= 1 then
1821+
local skillDef = data.skills[self.grantedSkills[1].skillId]
1822+
local gemId = data.gemForSkill[skillDef]
1823+
local gem = data.gems[gemId]
1824+
1825+
local skillLevel = self.grantedSkills[1].level or #skillDef.levels
1826+
local chosenLevel = skillDef.levels[skillLevel] or skillDef.levels[#skillDef.levels]
1827+
local gemLevelReq = chosenLevel.levelRequirement
1828+
1829+
reqLevel = m_max(gemLevelReq, minReqLevel or 0, self.requirements.runeLevel or 0, self.requirements.baseLevel or 0)
1830+
1831+
-- Rune level and unique base level don't scale attribute requirements. Example, Cursecarver has 33 minimum required level
1832+
-- but the intelligence requirement will be 21 at level 4 skill.
1833+
local attrLevel = m_max(gemLevelReq, self.requirements.baseLevel or 0)
1834+
1835+
if self.base.type == "Sceptre" or self.base.type == "Wand" or self.base.type == "Staff" then
1836+
self.requirements.int = calcLib.getGemStatRequirement(attrLevel, gem.reqInt)
1837+
self.requirements.dex = calcLib.getGemStatRequirement(attrLevel, gem.reqDex)
1838+
self.requirements.str = calcLib.getGemStatRequirement(attrLevel, gem.reqStr)
1839+
end
1840+
else
1841+
-- If no granted skills, we want to use the "Requires Level" from the unique instead of the base armour type level requirement.
1842+
-- Currently there are no Uniques that use a lower level than the base, but maybe in the future.
1843+
reqLevel = m_max(minReqLevel or 0, self.requirements.runeLevel or 0, self.requirements.baseLevel or 0)
1844+
end
1845+
1846+
self.requirements.level = reqLevel
1847+
17681848
if self.name == "Tabula Rasa, Simple Robe" or self.name == "Skin of the Loyal, Simple Robe" or self.name == "Skin of the Lords, Simple Robe" or self.name == "The Apostate, Cabalist Regalia" then
17691849
-- Hack to remove the energy shield and base int requirement
17701850
baseList:NewMod("ArmourData", "LIST", { key = "EnergyShield", value = 0 })
@@ -1789,20 +1869,6 @@ function ItemClass:BuildModList()
17891869
self.requirements.dexMod = m_floor((self.requirements.dex + calcLocal(baseList, "DexRequirement", "BASE", 0)) * (1 + calcLocal(baseList, "DexRequirement", "INC", 0) / 100))
17901870
self.requirements.intMod = m_floor((self.requirements.int + calcLocal(baseList, "IntRequirement", "BASE", 0)) * (1 + calcLocal(baseList, "IntRequirement", "INC", 0) / 100))
17911871
end
1792-
self.grantedSkills = { }
1793-
for _, skill in ipairs(baseList:List(nil, "ExtraSkill")) do
1794-
if skill.name ~= "Unknown" then
1795-
t_insert(self.grantedSkills, {
1796-
skillId = skill.skillId,
1797-
level = skill.level,
1798-
noSupports = skill.noSupports,
1799-
source = self.modSource,
1800-
triggered = skill.triggered,
1801-
triggerChance = skill.triggerChance,
1802-
})
1803-
end
1804-
end
1805-
18061872
if self.itemSocketCount > 0 then
18071873
-- Ensure that there are the correct number of abyssal sockets present
18081874
local newSockets = { }

src/Data/Bases/soulcore.lua

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ itemBases["Atmohua's Soul Core of Retreat"] = {
2727
type = "SoulCore",
2828
tags = { soul_core = true, soul_core_tier3 = true, default = true, },
2929
implicitModTypes = { },
30-
implicit = "Body Armour: 30% faster start of Energy Shield Recharge",
30+
implicit = "Body Armour: 30% faster start of Energy Shield Recharge\nFocus: 30% faster start of Energy Shield Recharge",
3131
req = { level = 65, },
3232
}
3333
itemBases["Quipolatl's Soul Core of Flow"] = {
@@ -76,7 +76,7 @@ itemBases["Estazunti's Soul Core of Convalescence"] = {
7676
type = "SoulCore",
7777
tags = { soul_core = true, soul_core_tier3 = true, default = true, },
7878
implicitModTypes = { },
79-
implicit = "Boots: 10% increased speed of Recoup Effects",
79+
implicit = "Boots: 10% increased speed of Recoup Effects\nHelmet: 6% of Damage taken Recouped as Life",
8080
req = { level = 65, },
8181
}
8282
itemBases["Tacati's Soul Core of Affliction"] = {
@@ -188,7 +188,7 @@ itemBases["Soul Core of Ticaba"] = {
188188
type = "SoulCore",
189189
tags = { soul_core = true, soul_core_tier2 = true, default = true, },
190190
implicitModTypes = { },
191-
implicit = "Martial Weapons: +5% to Critical Damage Bonus\nBody Armour: Hits against you have 20% reduced Critical Damage Bonus",
191+
implicit = "Martial Weapons: +5% to Critical Damage Bonus\nBody Armour: Hits against you have 20% reduced Critical Damage Bonus\nShield: Hits against you have 20% reduced Critical Damage Bonus",
192192
req = { level = 35, },
193193
}
194194
itemBases["Soul Core of Atmohua"] = {
@@ -212,6 +212,34 @@ itemBases["Soul Core of Zantipi"] = {
212212
implicit = "Martial Weapons: Convert 20% of Requirements to Intelligence\nArmour: Convert 20% of Requirements to Intelligence",
213213
req = { level = 35, },
214214
}
215+
itemBases["Amanamu's Gaze"] = {
216+
type = "SoulCore",
217+
tags = { default = true, },
218+
implicitModTypes = { },
219+
implicit = "Helmet: Remove a Damaging Ailment when you use a Command Skill\nBody Armour: +2 to Armour per 1 Spirit\nBoots: 1% increased Movement Speed per 15 Spirit, up to a maximum of 40%\nOther Modifiers to Movement Speed do not apply",
220+
req = { level = 65, },
221+
}
222+
itemBases["Kurgal's Gaze"] = {
223+
type = "SoulCore",
224+
tags = { default = true, },
225+
implicitModTypes = { },
226+
implicit = "Helmet: Increases and Reductions to Life Regeneration Rate also apply to Mana Regeneration Rate\nGloves: 40% increased effect of Arcane Surge on you\nBoots: 15% increased Mana Cost Efficiency if you haven't Dodge Rolled Recently",
227+
req = { level = 65, },
228+
}
229+
itemBases["Tecrod's Gaze"] = {
230+
type = "SoulCore",
231+
tags = { default = true, },
232+
implicitModTypes = { },
233+
implicit = "Body Armour: Regenerate 1.5% of maximum Life per second\nGloves: 25% increased Life Cost Efficiency\nBoots: 10% increased Movement Speed when on Low Life",
234+
req = { level = 65, },
235+
}
236+
itemBases["Ulaman's Gaze"] = {
237+
type = "SoulCore",
238+
tags = { default = true, },
239+
implicitModTypes = { },
240+
implicit = "Helmet: +1 to Accuracy Rating per 1 Item Evasion Rating on Equipped Helmet\nGloves: Critical Hit chance is Lucky against Parried enemies\nBody Armour: Prevent +3% of Damage from Deflected Hits",
241+
req = { level = 65, },
242+
}
215243

216244
itemBases["Desert Rune"] = {
217245
type = "Rune",
@@ -736,76 +764,76 @@ itemBases["Serpent Talisman"] = {
736764
type = "Talisman",
737765
tags = { primal_talisman = true, talisman = true, default = true, },
738766
implicitModTypes = { },
739-
implicit = "Gloves: 5% increased Curse Magnitudes",
767+
implicit = "Gloves: 5% increased Curse Magnitudes\nSceptre: Allies in your Presence have 8% increased Attack Speed",
740768
req = { },
741769
}
742770
itemBases["Primate Talisman"] = {
743771
type = "Talisman",
744772
tags = { primal_talisman = true, talisman = true, default = true, },
745773
implicitModTypes = { },
746-
implicit = "Helmet: Minions have 12% increased maximum Life",
774+
implicit = "Helmet: Minions have 12% increased maximum Life\nSceptre: Allies in your Presence deal 30% increased Damage",
747775
req = { },
748776
}
749777
itemBases["Owl Talisman"] = {
750778
type = "Talisman",
751779
tags = { primal_talisman = true, talisman = true, default = true, },
752780
implicitModTypes = { },
753-
implicit = "Focus: 10% increased Cooldown Recovery Rate",
781+
implicit = "Focus: 10% increased Cooldown Recovery Rate\nSceptre: Allies in your Presence have 8% increased Cast Speed",
754782
req = { },
755783
}
756784
itemBases["Cat Talisman"] = {
757785
type = "Talisman",
758786
tags = { vivid_talisman = true, talisman = true, default = true, },
759787
implicitModTypes = { },
760-
implicit = "Gloves: 15% increased Accuracy Rating",
788+
implicit = "Gloves: 15% increased Accuracy Rating\nSceptre: Allies in your Presence have 14% increased Critical Hit Chance",
761789
req = { },
762790
}
763791
itemBases["Wolf Talisman"] = {
764792
type = "Talisman",
765793
tags = { vivid_talisman = true, talisman = true, default = true, },
766794
implicitModTypes = { },
767-
implicit = "Gloves: 10% increased Magnitude of Bleeding you inflict",
795+
implicit = "Gloves: 10% increased Magnitude of Bleeding you inflict\nSceptre: Allies in your Presence have 14% increased Critical Damage Bonus",
768796
req = { },
769797
}
770798
itemBases["Stag Talisman"] = {
771799
type = "Talisman",
772800
tags = { vivid_talisman = true, talisman = true, default = true, },
773801
implicitModTypes = { },
774-
implicit = "Helmet: 50% increased Thorns Critical Hit Chance",
802+
implicit = "Helmet: 50% increased Thorns Critical Hit Chance\nSceptre: Allies in your Presence deal 1 to 40 added Attack Lightning Damage",
775803
req = { },
776804
}
777805
itemBases["Boar Talisman"] = {
778806
type = "Talisman",
779807
tags = { wild_talisman = true, talisman = true, default = true, },
780808
implicitModTypes = { },
781-
implicit = "Gloves: Gain 1 Rage on Melee Hit",
809+
implicit = "Gloves: Gain 1 Rage on Melee Hit\nSceptre: Allies in your Presence Regenerate 8 Life per second",
782810
req = { },
783811
}
784812
itemBases["Bear Talisman"] = {
785813
type = "Talisman",
786814
tags = { wild_talisman = true, talisman = true, default = true, },
787815
implicitModTypes = { },
788-
implicit = "Helmet: 8% increased Area of Effect",
816+
implicit = "Helmet: 8% increased Area of Effect\nSceptre: Allies in your Presence deal 12 to 18 added Attack Physical Damage",
789817
req = { },
790818
}
791819
itemBases["Ox Talisman"] = {
792820
type = "Talisman",
793821
tags = { wild_talisman = true, talisman = true, default = true, },
794822
implicitModTypes = { },
795-
implicit = "Shield: 10% increased Block chance",
823+
implicit = "Shield: 10% increased Block chance\nSceptre: Allies in your Presence have +8% to all Elemental Resistances",
796824
req = { },
797825
}
798826
itemBases["Rabbit Talisman"] = {
799827
type = "Talisman",
800828
tags = { sacred_talisman = true, talisman = true, default = true, },
801829
implicitModTypes = { },
802-
implicit = "Body Armour: 8% increased Rarity of Items found",
830+
implicit = "Body Armour: 8% increased Rarity of Items found\nSceptre: 10% increased Spirit",
803831
req = { },
804832
}
805833
itemBases["Fox Talisman"] = {
806834
type = "Talisman",
807835
tags = { sacred_talisman = true, talisman = true, default = true, },
808836
implicitModTypes = { },
809-
implicit = "Body Armour: +2% to Quality of all Skills",
837+
implicit = "Body Armour: +2% to Quality of all Skills\nSceptre: 30% increased Presence Area of Effect",
810838
req = { },
811839
}

0 commit comments

Comments
 (0)