|
| 1 | +describe("Veiled unique affix pools", function() |
| 2 | + local function makeUnique(name) |
| 3 | + for _, typeList in pairs(data.uniques) do |
| 4 | + for _, raw in pairs(typeList) do |
| 5 | + if raw:match("^%s*([^\r\n]+)") == name or raw:find("\n" .. name .. "\n", 1, true) then |
| 6 | + return new("Item"):Item(raw, "UNIQUE") |
| 7 | + end |
| 8 | + end |
| 9 | + end |
| 10 | + end |
| 11 | + |
| 12 | + -- the mods the crafting UI would offer on this item, selected the same way |
| 13 | + -- ItemsTab:UpdateAffixControl does |
| 14 | + local function offeredMods(item) |
| 15 | + local mods = { } |
| 16 | + for modId, mod in pairs(item.affixes) do |
| 17 | + if item:CanHaveMod(mod) then |
| 18 | + mods[modId] = mod |
| 19 | + end |
| 20 | + end |
| 21 | + return mods |
| 22 | + end |
| 23 | + |
| 24 | + local function offeredLines(item) |
| 25 | + local lines = { } |
| 26 | + for _, mod in pairs(offeredMods(item)) do |
| 27 | + for _, line in ipairs(mod) do |
| 28 | + table.insert(lines, line) |
| 29 | + end |
| 30 | + end |
| 31 | + return table.concat(lines, "\n") |
| 32 | + end |
| 33 | + |
| 34 | + it("includes weapon-legal Catarina veiled mods on Cane of Kulemak", function() |
| 35 | + local cane = makeUnique("Cane of Kulemak") |
| 36 | + assert.is_not_nil(cane) |
| 37 | + assert.are.equal(68, cane.requirements.level) |
| 38 | + local lines = offeredLines(cane) |
| 39 | + assert.is_not_nil(lines:find("+2 to Level of Socketed Support Gems", 1, true)) |
| 40 | + assert.is_not_nil(lines:find("+(5-8)% to Quality of Socketed Support Gems", 1, true)) |
| 41 | + assert.is_not_nil(lines:find("chance to Explode", 1, true)) |
| 42 | + end) |
| 43 | + |
| 44 | + it("excludes weapon-illegal Catarina veiled mods from Cane of Kulemak", function() |
| 45 | + local cane = makeUnique("Cane of Kulemak") |
| 46 | + assert.is_not_nil(cane) |
| 47 | + local lines = offeredLines(cane) |
| 48 | + assert.is_nil(lines:find("maximum number of Spectres", 1, true)) |
| 49 | + assert.is_nil(lines:find("Minions are Aggressive", 1, true)) |
| 50 | + end) |
| 51 | + |
| 52 | + it("only offers the base veiled pool on Paradoxica", function() |
| 53 | + local item = makeUnique("Paradoxica") |
| 54 | + assert.is_not_nil(item) |
| 55 | + for modId, mod in pairs(offeredMods(item)) do |
| 56 | + assert.is_true(mod.affix == "Chosen" or mod.affix == "of the Order", |
| 57 | + modId .. " is a master signature mod") |
| 58 | + end |
| 59 | + end) |
| 60 | + |
| 61 | + it("offers weapon-legal signature veiled mods on Replica Paradoxica", function() |
| 62 | + local item = makeUnique("Replica Paradoxica") |
| 63 | + assert.is_not_nil(item) |
| 64 | + local lines = offeredLines(item) |
| 65 | + assert.is_not_nil(lines:find("+(5-8)% to Quality of Socketed Support Gems", 1, true)) |
| 66 | + assert.is_not_nil(lines:find("chance to Explode", 1, true)) |
| 67 | + assert.is_nil(lines:find("maximum number of Spectres", 1, true)) |
| 68 | + assert.is_nil(lines:find("Minions are Aggressive", 1, true)) |
| 69 | + end) |
| 70 | + |
| 71 | + it("only offers attainable modifiers on That Which Was Taken", function() |
| 72 | + local item = makeUnique("That Which Was Taken") |
| 73 | + assert.is_not_nil(item) |
| 74 | + assert.are.equal(1, item.limit) |
| 75 | + assert.are.equal(48, item.requirements.level) |
| 76 | + assert.is_nil(item.affixes.AnimalCharmMaximumRage1) |
| 77 | + assert.is_not_nil(item.affixes.AnimalCharmMaximumRage2) |
| 78 | + end) |
| 79 | +end) |
0 commit comments