diff --git a/spec/System/TestGeneratedUniques_spec.lua b/spec/System/TestGeneratedUniques_spec.lua new file mode 100644 index 0000000000..a68f5935bb --- /dev/null +++ b/spec/System/TestGeneratedUniques_spec.lua @@ -0,0 +1,33 @@ +describe("Generated uniques", function() + local function findGeneratedItem(name) + for _, itemText in ipairs(data.uniques.generated) do + if itemText:sub(1, #name + 1) == name .. "\n" then + return itemText + end + end + end + + it("includes weapon-legal Catarina veiled mods on Cane of Kulemak", function() + local cane = findGeneratedItem("Cane of Kulemak") + assert.is_not_nil(cane) + assert.is_not_nil(cane:find("+2 to Level of Socketed Support Gems", 1, true)) + assert.is_not_nil(cane:find("+(5-8)% to Quality of Socketed Support Gems", 1, true)) + assert.is_not_nil(cane:find("chance to Explode", 1, true)) + end) + + it("excludes weapon-illegal Catarina veiled mods from Cane of Kulemak", function() + local cane = findGeneratedItem("Cane of Kulemak") + assert.is_not_nil(cane) + assert.is_nil(cane:find("maximum number of Spectres", 1, true)) + assert.is_nil(cane:find("Minions are Aggressive", 1, true)) + end) + + it("does not add Catarina signature mods to Paradoxica or Replica Paradoxica", function() + for _, name in ipairs({ "Paradoxica", "Replica Paradoxica" }) do + local item = findGeneratedItem(name) + assert.is_not_nil(item) + assert.is_nil(item:find("to Quality of Socketed Support Gems", 1, true)) + assert.is_nil(item:find("chance to Explode", 1, true)) + end + end) +end) diff --git a/src/Data/Uniques/Special/Generated.lua b/src/Data/Uniques/Special/Generated.lua index 72fb68e188..007222a3ab 100644 --- a/src/Data/Uniques/Special/Generated.lua +++ b/src/Data/Uniques/Special/Generated.lua @@ -18,17 +18,22 @@ local parseVeiledModName = function(string) gsub("(%d)", " %1 ")) end -local veiledModIsActive = function(mod, baseType, specificType1, specificType2) +local veiledModIsActive = function(mod, baseType, specificType1, specificType2, poolKey) local baseIndex = isValueInTable(mod.weightKey, baseType) local typeIndex1 = isValueInTable(mod.weightKey, specificType1) local typeIndex2 = isValueInTable(mod.weightKey, specificType2) + -- Master signature mods (e.g. Catarina's) carry their weight on a pool key such as "catarina_veiled_prefix" + -- and only list the slots they are excluded from, so the pool key only applies when no slot key matched + local poolIndex = poolKey and isValueInTable(mod.weightKey, poolKey) return (typeIndex1 and mod.weightVal[typeIndex1] > 0) or (typeIndex2 and mod.weightVal[typeIndex2] > 0) or (not typeIndex1 and not typeIndex2 and baseIndex and mod.weightVal[baseIndex] > 0) + or (not typeIndex1 and not typeIndex2 and not baseIndex and poolIndex and mod.weightVal[poolIndex] > 0) end local getVeiledMods = function (veiledPool, baseType, specificType1, specificType2) local veiledMods = { } + local poolKey = veiledPool == "catarina" and "catarina_veiled_prefix" or nil for veiledModIndex, veiledMod in pairs(data.veiledMods) do - if veiledModIsActive(veiledMod, baseType, specificType1, specificType2) then + if veiledModIsActive(veiledMod, baseType, specificType1, specificType2, poolKey) then local veiledName = parseVeiledModName(veiledModIndex) veiledName = "("..veiledMod.type..") "..veiledName @@ -112,9 +117,9 @@ local caneOfKulemak = { "Has Alt Variant Two: true", "Has Alt Variant Three: true", "Selected Variant: 1", - "Selected Alt Variant: 2", - "Selected Alt Variant Two: 20", - "Selected Alt Variant Three: 21", + "Selected Alt Variant: 3", + "Selected Alt Variant Two: 25", + "Selected Alt Variant Three: 26", } for _, mod in pairs(caneOfKulemakMods) do