Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions spec/System/testItemsTab_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
describe("TestItemsTab", function ()
describe("CopyAnointsAndEldritchImplicits", function ()
before_each(function()
newBuild()
end)

local function equip(item)
build.itemsTab:AddItem(item)
build.itemsTab:EquipItemInSet(item, build.itemsTab.activeItemSetId)
end
it("does not copy an anoint onto a talisman", function()
local amulet = new("Item", "Rarity: Rare\nAnointed\nOnyx Amulet\n+8 to Strength (enchant)")
assert.are.equals(1, #amulet.enchantModLines)
equip(amulet)

local talisman = new("Item", "Rarity: Rare\nCharm\nBlack Maw Talisman")
local originalCount = #talisman.enchantModLines

build.itemsTab:CopyAnointsAndEldritchImplicits(talisman, false, false)

assert.are.equals(originalCount, #talisman.enchantModLines)
for _, modLine in ipairs(talisman.enchantModLines) do
assert.are_not.equals("+8 to Strength", modLine.line)
end
end)

it("does not copy an anoint from a talisman", function()
local talisman = new("Item", "Rarity: Rare\nCharm\nBlack Maw Talisman\n+8 to Strength (enchant)")
assert.are.equals(1, #talisman.enchantModLines)
equip(talisman)

-- new amulet must not inherit the talisman's enchant as an anoint
local amulet = new("Item", "Rarity: Rare\nPlain\nOnyx Amulet")
assert.are.equals(0, #amulet.enchantModLines)

build.itemsTab:CopyAnointsAndEldritchImplicits(amulet, false, false)

assert.are.equals(0, #amulet.enchantModLines)
end)
end)
end)
19 changes: 10 additions & 9 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1821,25 +1821,27 @@ function ItemsTabClass:CopyAnointsAndEldritchImplicits(newItem, copyEldritchImpl
-- if you don't have an equipped item that matches the type of the newItem, no need to do anything
if currentItem then
-- if the new item is anointable and does not have an anoint and your current respective item does, apply that anoint to the new item
if isAnointable(newItem) and (#newItem.enchantModLines == 0 or overwrite) and self.activeItemSet[newItemType].selItemId > 0 then
if isAnointable(currentItem) and isAnointable(newItem) and (#newItem.enchantModLines == 0 or overwrite) and self.activeItemSet[newItemType].selItemId > 0 then
local currentAnoint = currentItem.enchantModLines
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
newItem.enchantModLines = currentAnoint
end
end
-- if the new item is a non-corrupted Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any influence
-- and your current respective item is Eater and/or Exarch, apply those implicits and influence to the new item
local eldritchBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" }
local eldritchRarities = { "NORMAL", "MAGIC", "RARE" }
for _, influence in ipairs(itemLib.influenceInfo.default) do
if newItem[influence.key] then
return
end
end

local modifiableItem = not (newItem.corrupted or newItem.mirrored)
if copyEldritchImplicits and isValueInTable(eldritchBaseTypes, newItem.base.type) and isValueInTable(eldritchRarities, newItem.rarity)
and (#newItem.implicitModLines == 0 or overwrite) and modifiableItem and (currentItem.cleansing or currentItem.tangle) and currentItem.implicitModLines then
if copyEldritchImplicits and
isValueInArray(data.eldritch.baseTypes, newItem.base.type)
and isValueInArray(data.eldritch.rarities, newItem.rarity)
and (#newItem.implicitModLines == 0 or overwrite)
and modifiableItem and (currentItem.cleansing or currentItem.tangle)
and currentItem.implicitModLines then
newItem.implicitModLines = currentItem.implicitModLines
newItem.tangle = currentItem.tangle
newItem.cleansing = currentItem.cleansing
Expand Down Expand Up @@ -1990,7 +1992,7 @@ function ItemsTabClass:SetDisplayItem(item)
local influence1 = 1
local influence2 = 1
local influenceDisplayList = { "Influence" }
for i, curInfluenceInfo in ipairs((item.canHaveEldritchInfluence or item.type == "Helmet" or item.type == "Body Armour" or item.type == "Gloves" or item.type == "Boots") and itemLib.influenceInfo.all or itemLib.influenceInfo.default) do
for i, curInfluenceInfo in ipairs((item.canHaveEldritchInfluence or (isValueInArray(data.eldritch.baseTypes, item.type))) and itemLib.influenceInfo.all or itemLib.influenceInfo.default) do
influenceDisplayList[i + 1] = curInfluenceInfo.display
end
self.controls.displayItemInfluence.list = influenceDisplayList
Expand Down Expand Up @@ -3769,7 +3771,6 @@ function ItemsTabClass:AddCrucibleModifierToDisplayItem()
end)
main:OpenPopup(710, 185, "Add Crucible Modifier to Item", controls, "save")
end

-- Opens the custom Implicit popup
function ItemsTabClass:AddImplicitToDisplayItem()
local controls = { }
Expand Down Expand Up @@ -3798,7 +3799,7 @@ function ItemsTabClass:AddImplicitToDisplayItem()
local groupIndexes = {}
if sourceId == "EXARCH" or sourceId == "EATER" then
for i, mod in pairs(self.displayItem.affixes) do
if self.displayItem:GetModSpawnWeight(mod) > 0 and sourceId:lower() == mod.type:lower() then
if self.displayItem:GetModSpawnWeight(mod) > 0 and (sourceId:lower() == (mod.type and mod.type:lower() or nil)) then
local modLabel = table.concat(mod, "/")
local group = mod.group:gsub("PinnaclePresence", ""):gsub("UniquePresence", "")
if not groupIndexes[group] then
Expand Down Expand Up @@ -3917,7 +3918,7 @@ function ItemsTabClass:AddImplicitToDisplayItem()
end
setDefaultSortOrder()
end
if (self.displayItem.rarity ~= "UNIQUE" and self.displayItem.rarity ~= "RELIC") and (self.displayItem.type == "Helmet" or self.displayItem.type == "Body Armour" or self.displayItem.type == "Gloves" or self.displayItem.type == "Boots") then
if (self.displayItem.rarity ~= "UNIQUE" and self.displayItem.rarity ~= "RELIC") and (isValueInArray(data.eldritch.baseTypes, self.displayItem.base.type)) then
if self.displayItem.cleansing then
t_insert(sourceList, { label = "Searing Exarch", sourceId = "EXARCH" })
end
Expand Down
6 changes: 6 additions & 0 deletions src/Modules/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,12 @@ data.enchantmentSource = {
{ name = "NORMAL", label = "Normal Labyrinth" },
}

-- a list of base types which can contain eldritch implicits
data.eldritch = {}
data.eldritch.baseTypes = { "Helmet", "Body Armour", "Gloves", "Boots", "Amulet" }
-- a list of rarities which can contain eldritch implicits
data.eldritch.rarities = { "NORMAL", "MAGIC", "RARE" }

-- Misc data tables
LoadModule("Data/Misc", data)

Expand Down
Loading