Skip to content

Commit 6bf9591

Browse files
committed
Allow Zorath to replace Opportunistic on Assassin
1 parent bfee69d commit 6bf9591

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

‎spec/System/TestAbyssTimelessJewel_spec.lua‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,36 @@ local function equipJewel(spec, socketId, item)
108108
return slot
109109
end
110110

111+
local function loadBundledZorathData()
112+
local ffi = require("ffi")
113+
ffi.cdef[[
114+
int uncompress(unsigned char *dest, unsigned long *destLen,
115+
const unsigned char *source, unsigned long sourceLen);
116+
]]
117+
local library = ({ Windows = "../runtime/zlib1.dll", Linux = "libz.so.1" })[ffi.os] or "z"
118+
local zlib = ffi.load(library)
119+
local originalInflate = _G.Inflate
120+
_G.Inflate = function(compressed)
121+
-- The headless runtime stubs Inflate. Use zlib to exercise the real archive.
122+
local capacity = #compressed * 4
123+
while true do
124+
local buffer = ffi.new("unsigned char[?]", capacity)
125+
local length = ffi.new("unsigned long[1]", capacity)
126+
local status = zlib.uncompress(buffer, length, compressed, #compressed)
127+
if status == 0 then
128+
return ffi.string(buffer, length[0])
129+
end
130+
assert(status == -5, "Could not inflate bundled Zorath data (zlib status " .. status .. ")")
131+
capacity = capacity * 2
132+
end
133+
end
134+
local loadJewelFile = LoadModule("Modules/DataJewelFileLoader")
135+
local ok, contents = pcall(loadJewelFile, "AbyssZorath", false)
136+
_G.Inflate = originalInflate
137+
assert(ok, contents)
138+
return parseAbyssJewel(11, assert(contents, "Missing bundled Zorath data"))
139+
end
140+
111141
describe("Abyss timeless jewels", function()
112142
before_each(function()
113143
newBuild()
@@ -364,6 +394,43 @@ describe("Abyss timeless jewels", function()
364394
assert.are.equal("From Below", spec.nodes[50692].dn)
365395
end)
366396

397+
it("applies the in-game Zorath seed 6696 to the Assassin's Opportunistic notable", function()
398+
-- https://github.com/PathOfBuildingCommunity/PathOfBuilding/issues/10584
399+
local spec = build.spec
400+
spec:SelectClass(spec.tree.classNameMap.Shadow)
401+
spec:SelectAscendClass(spec.tree.ascendNameMap.Assassin.ascendClassId)
402+
local socketId, opportunistic, toxicDelivery = 41263, 19083, 19598
403+
assert.is_true(allocatePathToNode(spec, spec.nodes[socketId]))
404+
spec:BuildAllDependsAndPaths()
405+
data.timelessJewelLUTs[11] = loadBundledZorathData()
406+
equipJewel(spec, socketId, newAbyssTimelessJewel("Reclaimed Malevolence", "Assembled Eye Jewel",
407+
"Binding 6696 souls to phylacteries to sustain Zorath"))
408+
spec:BuildAllDependsAndPaths()
409+
410+
assert.are.equal("From Below", spec.nodes[opportunistic].dn)
411+
assert.are.equal("Toxic Delivery", spec.nodes[toxicDelivery].dn)
412+
local stats = table.concat(spec.nodes[opportunistic].sd, "\n")
413+
assert.matches("Insufficient Mana doesn't prevent your Spells", stats, nil, true)
414+
assert.matches("Cannot recover Mana", stats, nil, true)
415+
416+
local timelessData = build.timelessData
417+
local fromBelow = "abyss_special_ascendancy_notable_3"
418+
timelessData.jewelType = { id = 11 }
419+
timelessData.conquerorType = { }
420+
timelessData.jewelSocket = { id = socketId }
421+
timelessData.searchList = fromBelow .. ", 1, 0, 1"
422+
timelessData.searchListFallback = ""
423+
build.treeTab:FindTimelessJewel()
424+
main.popups[1].controls.searchButton.onClick()
425+
for _, result in ipairs(timelessData.searchResults) do
426+
if result.seed == 6696 then
427+
assert.are.same({ "Opportunistic" }, result[fromBelow].targetNodeNames)
428+
return
429+
end
430+
end
431+
error("The seed finder must return seed 6696 for From Below on Assassin")
432+
end)
433+
367434
it("can protect an allocated ascendancy notable from Zorath", function()
368435
local spec = build.spec
369436
spec:SelectClass(spec.tree.classNameMap.Templar)
96 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)