Skip to content

Commit f8d531e

Browse files
committed
Add support for Baryanic Leylines (Disciple of Varashta)
Parse "Non-Unique Time-Lost Jewels have X% increased radius" into a NonUniqueTimeLostJewelRadius modifier. When the build has the modifier, non-unique Time-Lost Jewels swap to a precomputed +40% radius tier for the in-radius passive computation and for the socket ring drawn on the tree. Regenerated ModCache.lua accordingly.
1 parent 1c107fe commit f8d531e

6 files changed

Lines changed: 115 additions & 8 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
describe("BaryanicLeylines", function()
2+
before_each(function()
3+
newBuild()
4+
end)
5+
6+
teardown(function()
7+
-- newBuild() takes care of resetting everything in setup()
8+
end)
9+
10+
it("parses Non-Unique Time-Lost Jewel radius modifier", function()
11+
build.configTab.input.customMods = "\z
12+
Non-Unique Time-Lost Jewels have 40% increased radius\n\z
13+
"
14+
build.configTab:BuildModList()
15+
runCallback("OnFrame")
16+
17+
assert.are.equals(40, build.calcsTab.mainEnv.modDB:Sum("INC", nil, "NonUniqueTimeLostJewelRadius"))
18+
end)
19+
20+
it("resolveTimeLostRadiusIndex returns upgraded tier at 40% and falls back otherwise", function()
21+
-- Each base tier (Small..Very Large) maps to a +40% counterpart whose outer
22+
-- radius is base * 1.4 (Small 1000 -> 1400).
23+
assert.are.equals(1400, data.jewelRadius[data.resolveTimeLostRadiusIndex(1, 40)].outer)
24+
assert.are.equals(1610, data.jewelRadius[data.resolveTimeLostRadiusIndex(2, 40)].outer)
25+
assert.are.equals(1820, data.jewelRadius[data.resolveTimeLostRadiusIndex(3, 40)].outer)
26+
assert.are.equals(2100, data.jewelRadius[data.resolveTimeLostRadiusIndex(4, 40)].outer)
27+
28+
-- No upgrade tier exists below 40%, so the base index is returned unchanged.
29+
assert.are.equals(1, data.resolveTimeLostRadiusIndex(1, 0))
30+
assert.are.equals(1, data.resolveTimeLostRadiusIndex(1, 39))
31+
assert.are.equals(1, data.resolveTimeLostRadiusIndex(1, nil))
32+
end)
33+
end)

src/Classes/PassiveTreeView.lua

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,14 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
10131013
end
10141014
elseif node.alloc then
10151015
if jewel and jewel.jewelRadiusIndex then
1016-
-- Draw only the selected jewel radius
1017-
local radData = build.data.jewelRadius[jewel.jewelRadiusIndex]
1016+
-- Draw only the selected jewel radius (factoring in Time-Lost upgrades such as Baryanic Leylines)
1017+
local effectiveRadiusIndex = jewel.jewelRadiusIndex
1018+
if jewel.base and jewel.base.subType == "Radius"
1019+
and jewel.rarity ~= "UNIQUE" and jewel.rarity ~= "RELIC"
1020+
and build.calcsTab and build.calcsTab.mainEnv and build.calcsTab.mainEnv.modDB then
1021+
effectiveRadiusIndex = data.resolveTimeLostRadiusIndex(effectiveRadiusIndex, build.calcsTab.mainEnv.modDB:Sum("INC", nil, "NonUniqueTimeLostJewelRadius"))
1022+
end
1023+
local radData = build.data.jewelRadius[effectiveRadiusIndex]
10181024
local outerSize = radData.outer * data.gameConstants["PassiveTreeJewelDistanceMultiplier"] * scale
10191025
local innerSize = radData.inner * data.gameConstants["PassiveTreeJewelDistanceMultiplier"] * scale * 1.06
10201026
SetDrawColor(1,1,1,0.7)
@@ -1505,11 +1511,38 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build, incSmallPassi
15051511
-- we only want to run the timeLost function on a node that can could be in a jewel socket radius of up to Large
15061512
-- essentially trying to avoid calling ProcessStats for a Normal/Notable node that can't possibly be affected
15071513
-- loops potentially every socket (24) until itemsTab is loaded or a jewel socket is hovered, then it will only loop the allocated sockets
1508-
local function isNodeInARadius(node)
1514+
-- Radius indexes to probe: Very Large (4) plus any Time-Lost upgrade tiers (e.g. Baryanic Leylines'
1515+
-- "Very Large +40%" at 16) so nodes only reachable via an increased radius still show jewel mods.
1516+
local radiusProbeIndexes = { 4 }
1517+
if data.nonUniqueTimeLostJewelRadiusUpgrades then
1518+
for _, map in pairs(data.nonUniqueTimeLostJewelRadiusUpgrades) do
1519+
for _, upgradedIndex in pairs(map) do
1520+
local seen = false
1521+
for _, existing in ipairs(radiusProbeIndexes) do
1522+
if existing == upgradedIndex then
1523+
seen = true
1524+
break
1525+
end
1526+
end
1527+
if not seen then
1528+
t_insert(radiusProbeIndexes, upgradedIndex)
1529+
end
1530+
end
1531+
end
1532+
end
1533+
local function isNodeInARadius(node)
15091534
local isInRadius = false
15101535
for id, socket in pairs(build.itemsTab.sockets) do
15111536
if build.itemsTab.activeSocketList and socket.inactive == false or socket.inactive == nil then
1512-
isInRadius = isInRadius or (build.spec.nodes[id] and build.spec.nodes[id].nodesInRadius and build.spec.nodes[id].nodesInRadius[4][node.id] ~= nil)
1537+
local socketNode = build.spec.nodes[id]
1538+
if socketNode and socketNode.nodesInRadius then
1539+
for _, radiusIndex in ipairs(radiusProbeIndexes) do
1540+
if socketNode.nodesInRadius[radiusIndex] and socketNode.nodesInRadius[radiusIndex][node.id] ~= nil then
1541+
isInRadius = true
1542+
break
1543+
end
1544+
end
1545+
end
15131546
if isInRadius then break end
15141547
end
15151548
end

src/Data/ModCache.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5665,7 +5665,7 @@ c["Non-Channelling Spells have 3% increased Critical Hit Chance per 100 maximum
56655665
c["Non-Channelling Spells have 5% increased Critical Hit Chance per 100 maximum Life"]={{[1]={[1]={neg=true,skillType=48,type="SkillType"},[2]={div=100,stat="Life",type="PerStat"},flags=2,keywordFlags=0,name="CritChance",type="INC",value=5}},nil}
56665666
c["Non-Keystone Passive Skills in Medium Radius of allocated Keystone Passive Skills can be allocated without being connected to your tree"]={{[1]={flags=0,keywordFlags=0,name="AllocateFromNodeRadius",type="LIST",value={from="Keystone",radiusIndex=2,to={[1]="Notable",[2]="Normal"}}}},nil}
56675667
c["Non-Minion Skills have 50% less Reservation Efficiency"]={{[1]={[1]={neg=true,skillType=6,type="SkillType"},flags=0,keywordFlags=0,name="ReservationEfficiency",type="MORE",value=-50}},nil}
5668-
c["Non-Unique Time-Lost Jewels have 40% increased radius"]={nil,"Non-Unique Time-Lost Jewels have 40% increased radius "}
5668+
c["Non-Unique Time-Lost Jewels have 40% increased radius"]={{[1]={flags=0,keywordFlags=0,name="NonUniqueTimeLostJewelRadius",type="INC",value=40}},nil}
56695669
c["Offering Skills have 15% increased Buff effect"]={{[1]={[1]={skillType=154,type="SkillType"},flags=0,keywordFlags=0,name="BuffEffect",type="INC",value=15}},nil}
56705670
c["Offering Skills have 20% increased Area of Effect"]={{[1]={[1]={skillType=154,type="SkillType"},flags=0,keywordFlags=0,name="AreaOfEffect",type="INC",value=20}},nil}
56715671
c["Offering Skills have 20% increased Duration"]={{[1]={[1]={skillType=154,type="SkillType"},flags=0,keywordFlags=0,name="Duration",type="INC",value=20}},nil}

src/Modules/CalcSetup.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,13 @@ function calcs.initEnv(build, mode, override, specEnv)
868868
end
869869
end
870870
if item and ( item.jewelRadiusIndex or (override and override.extraJewelFuncs and #override.extraJewelFuncs > 0) ) then
871+
-- Non-unique Time-Lost Jewels use an upgraded radius tier when the build
872+
-- has e.g. Baryanic Leylines allocated.
873+
local effectiveRadiusIndex = item.jewelRadiusIndex
874+
if effectiveRadiusIndex and item.base and item.base.subType == "Radius"
875+
and item.rarity ~= "UNIQUE" and item.rarity ~= "RELIC" then
876+
effectiveRadiusIndex = data.resolveTimeLostRadiusIndex(effectiveRadiusIndex, nodesModsList:Sum("INC", nil, "NonUniqueTimeLostJewelRadius"))
877+
end
871878
-- Jewel has a radius, add it to the list
872879
local funcList = (item.jewelData and item.jewelData.funcList) or { { type = "Self", func = function(node, out, data)
873880
-- Default function just tallies all stats in radius
@@ -880,19 +887,19 @@ function calcs.initEnv(build, mode, override, specEnv)
880887
for _, func in ipairs(funcList) do
881888
local node = env.spec.nodes[slot.nodeId]
882889
t_insert(env.radiusJewelList, {
883-
nodes = node.nodesInRadius and node.nodesInRadius[item.jewelRadiusIndex] or { },
890+
nodes = node.nodesInRadius and node.nodesInRadius[effectiveRadiusIndex] or { },
884891
func = func.func,
885892
type = func.type,
886893
item = item,
887894
nodeId = slot.nodeId,
888-
attributes = node.attributesInRadius and node.attributesInRadius[item.jewelRadiusIndex] or { },
895+
attributes = node.attributesInRadius and node.attributesInRadius[effectiveRadiusIndex] or { },
889896
data = { },
890897
-- store this to compare with cache later
891898
jewelHash = getHashFromString(item.modSource..item.raw)
892899
})
893900
if func.type ~= "Self" and node.nodesInRadius then
894901
-- Add nearby unallocated nodes to the extra node list
895-
for nodeId, node in pairs(node.nodesInRadius[item.jewelRadiusIndex]) do
902+
for nodeId, node in pairs(node.nodesInRadius[effectiveRadiusIndex]) do
896903
if not env.allocNodes[nodeId] then
897904
env.extraRadiusNodeList[nodeId] = env.spec.nodes[nodeId]
898905
end

src/Modules/Data.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,42 @@ data.jewelRadii = {
605605
{ inner = 1400, outer = 1700, col = "^xFFCC00", label = "Variable" },
606606
{ inner = 1650, outer = 1950, col = "^xFF6600", label = "Variable" },
607607
{ inner = 1800, outer = 2100, col = "^x0099FF", label = "Variable" },
608+
609+
-- Baryanic Leylines (Disciple of Varashta): non-unique Time-Lost radius +40%
610+
{ inner = 0, outer = 1400, col = "^xBB6600", label = "Small" },
611+
{ inner = 0, outer = 1610, col = "^x66FFCC", label = "Medium" },
612+
{ inner = 0, outer = 1820, col = "^x2222CC", label = "Large" },
613+
{ inner = 0, outer = 2100, col = "^xC100FF", label = "Very Large" },
608614
}
609615
}
610616

617+
-- Maps a base Time-Lost Jewel radius index to the upgraded index granted by
618+
-- "Non-Unique Time-Lost Jewels have X% increased radius" effects. Keyed by
619+
-- percentage so additional tiers can be added later.
620+
data.nonUniqueTimeLostJewelRadiusUpgrades = {
621+
[40] = { [1] = 13, [2] = 14, [3] = 15, [4] = 16 },
622+
}
623+
624+
-- Returns the radius index that should be used for a non-unique Time-Lost Jewel
625+
-- given the base index and the total "% increased radius" value in effect.
626+
-- Picks the largest supported tier at or below upgradePct; returns baseIndex
627+
-- unchanged when no tier applies.
628+
function data.resolveTimeLostRadiusIndex(baseIndex, upgradePct)
629+
if not baseIndex or not upgradePct or upgradePct <= 0 then
630+
return baseIndex
631+
end
632+
local bestPct
633+
for pct, map in pairs(data.nonUniqueTimeLostJewelRadiusUpgrades) do
634+
if pct <= upgradePct and map[baseIndex] and (not bestPct or pct > bestPct) then
635+
bestPct = pct
636+
end
637+
end
638+
if bestPct then
639+
return data.nonUniqueTimeLostJewelRadiusUpgrades[bestPct][baseIndex]
640+
end
641+
return baseIndex
642+
end
643+
611644
data.jewelRadius = data.setJewelRadiiGlobally(latestTreeVersion)
612645

613646
-- Stat descriptions

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5350,6 +5350,7 @@ local specialModList = {
53505350
["only affects passives in massive ring"] = { mod("JewelData", "LIST", { key = "radiusIndex", value = 12 }) },
53515351
["upgrades radius to medium"] = { mod("JewelData", "LIST", { key = "timeLostJewelRadiusOverride", value = 2 })},
53525352
["upgrades radius to large"] = { mod("JewelData", "LIST", { key = "timeLostJewelRadiusOverride", value = 3 })},
5353+
["non%-unique time%-lost jewels have (%d+)%% increased radius"] = function(num) return { mod("NonUniqueTimeLostJewelRadius", "INC", num) } end,
53535354
["primordial"] = { mod("Multiplier:PrimordialItem", "BASE", 1) },
53545355
["spectres have a base duration of (%d+) seconds"] = { mod("SkillData", "LIST", { key = "duration", value = 6 }, { type = "SkillName", skillName = "Raise Spectre", includeTransfigured = true }) },
53555356
["flasks applied to you have (%d+)%% increased effect"] = function(num) return { mod("FlaskEffect", "INC", num, { type = "ActorCondition", actor = "player"}) } end,

0 commit comments

Comments
 (0)