Skip to content

Commit cd1d4d2

Browse files
vaisestLocalIdentity
andauthored
Add support for double Corrupting + fix corruptions removing anoints (#1981)
* Dont wipe enchant modlines when adding corrupted mod * Update corruption to support relics and double corruption properly * Parse glimpse of chaos special modline * Fix glimpse of chaos mod list + corruption slots more regular helmets --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent b468665 commit cd1d4d2

3 files changed

Lines changed: 47 additions & 22 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ for _, entry in pairs(data.flavourText) do
5454
end
5555

5656
local function isAnointable(item)
57-
return (item.canBeAnointed or item.base.type == "Amulet") and not item.sanctified
58-
and not item.corrupted and not item.mirrored
57+
return (item.canBeAnointed or item.base.type == "Amulet")
58+
-- and not item.sanctified and not item.corrupted and not item.mirrored
5959
end
6060

6161
local function buildModSortList()
@@ -958,7 +958,7 @@ holding Shift will put it in the second.]])
958958
if not self.displayItem or not self.displayItem.rangeLineList[1] then
959959
return 0
960960
end
961-
if main.showAllItemAffixes and self.displayItem.rarity == "UNIQUE" then
961+
if main.showAllItemAffixes and (self.displayItem.rarity == "UNIQUE" or self.displayItem.rarity == "RELIC") then
962962
local count = #self.displayItem.rangeLineList
963963
return count * 22 + 4
964964
else
@@ -969,7 +969,8 @@ holding Shift will put it in the second.]])
969969
self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[index].range
970970
end)
971971
self.controls.displayItemRangeLine.shown = function()
972-
return self.displayItem and self.displayItem.rangeLineList[1] ~= nil and not (main.showAllItemAffixes and self.displayItem.rarity == "UNIQUE")
972+
return self.displayItem and self.displayItem.rangeLineList[1] ~= nil and
973+
not (main.showAllItemAffixes and (self.displayItem.rarity == "UNIQUE" or self.displayItem.rarity == "RELIC"))
973974
end
974975
self.controls.displayItemRangeSlider = new("SliderControl", {"LEFT",self.controls.displayItemRangeLine,"RIGHT"}, {8, 0, 100, 18}, function(val)
975976
self.displayItem.rangeLineList[self.controls.displayItemRangeLine.selIndex].range = val
@@ -998,7 +999,9 @@ holding Shift will put it in the second.]])
998999
return ""
9991000
end)
10001001
self.controls["displayItemStackedRangeSlider"..i].shown = function()
1001-
return main.showAllItemAffixes and self.displayItem and self.displayItem.rarity == "UNIQUE" and self.displayItem.rangeLineList[i] ~= nil
1002+
return main.showAllItemAffixes and self.displayItem and
1003+
(self.displayItem.rarity == "UNIQUE" or self.displayItem.rarity == "RELIC") and
1004+
self.displayItem.rangeLineList[i] ~= nil
10021005
end
10031006

10041007
self.controls["displayItemStackedRangeLine"..i].shown = function()
@@ -2067,6 +2070,7 @@ function ItemsTabClass:UpdateDisplayItemRangeLines()
20672070
end
20682071
end
20692072

2073+
---@param line string
20702074
local function checkLineForAllocates(line, nodes)
20712075
if nodes and string.match(line, "Allocates") then
20722076
local nodeId = tonumber(string.match(line, "%d+"))
@@ -2400,7 +2404,7 @@ end
24002404
function ItemsTabClass:getAnoint(item)
24012405
local result = { }
24022406
if item then
2403-
for _, modList in ipairs{item.enchantModLines, item.implicitModLines, item.explicitModLines} do
2407+
for _, modList in ipairs{item.enchantModLines} do
24042408
for _, mod in ipairs(modList) do
24052409
local line = mod.line
24062410
local anoint = line:find("Allocates ([a-zA-Z ]+)")
@@ -2531,23 +2535,28 @@ end
25312535
function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outcomes this code is for poe 1
25322536
local controls = { }
25332537
local enchantList = { }
2534-
local enchantNum = 1
2538+
local enchantNum = 2
25352539
local shownExplicits = {}
25362540
local explicitOffset = 0
25372541
local corruptedRanges = {}
25382542
local currentModType = "Corrupted"
25392543
local sourceList = { "Corrupted" }
25402544
local sortList, sortTransforms = buildModSortList()
2545+
25412546
if self.displayItem.base.type == "Helmet" then
25422547
t_insert(sourceList, "Glimpse of Chaos")
2548+
if self.displayItem.title == "Glimpse of Chaos" then
2549+
currentModType = "SpecialCorrupted"
2550+
enchantNum = 8
2551+
end
25432552
end
25442553
local function buildEnchantList(modType)
25452554
if enchantList[modType] then
25462555
return
25472556
end
25482557
enchantList[modType] = {}
25492558
for modId, mod in pairs(data.itemMods.Corruption) do
2550-
if mod.type == modType and self.displayItem:GetModSpawnWeight(mod) > 0 then
2559+
if mod.type == modType and (modType == "SpecialCorrupted" or self.displayItem:GetModSpawnWeight(mod) > 0) then
25512560
t_insert(enchantList[modType], { mod = mod })
25522561
end
25532562
end
@@ -2594,11 +2603,21 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
25942603
end
25952604
end
25962605
end
2606+
2607+
local temp = {}
2608+
-- currently enchants are always either corruptions or anoints, so we
2609+
-- can just save the anoints
2610+
for _, mod in ipairs(item.enchantModLines) do
2611+
if mod.line:match("Allocates .*") then
2612+
table.insert(temp, mod)
2613+
end
2614+
end
2615+
item.enchantModLines = temp
2616+
25972617
if #newEnchant > 0 then
25982618
table.sort(newEnchant, function(a, b)
25992619
return a.order < b.order
26002620
end)
2601-
wipeTable(item.enchantModLines)
26022621
for i, enchant in ipairs(newEnchant) do
26032622
enchant.order = nil
26042623
t_insert( item.enchantModLines, i, enchant)
@@ -2638,7 +2657,7 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
26382657
end
26392658
end
26402659
end
2641-
local function corruptItem()
2660+
local function corruptItem(enchanting)
26422661
local item = new("Item", self.displayItem:BuildRaw())
26432662
item.id = self.displayItem.id
26442663
item.corrupted = true
@@ -2649,14 +2668,20 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
26492668
t_insert(mods, control.list[control.selIndex].mod)
26502669
end
26512670
end
2652-
applyCorruptionMods(item, mods)
2653-
for i, modLine in ipairs(item.explicitModLines) do
2654-
if corruptedRanges[i] ~= 1 then modLine.corruptedRange = corruptedRanges[i] end
2671+
-- avoid removing corruption mods or rolls so that the user can make a
2672+
-- vaal rolled item with enchants
2673+
if enchanting then
2674+
applyCorruptionMods(item, mods)
2675+
2676+
else
2677+
for i, modLine in ipairs(item.explicitModLines) do
2678+
if corruptedRanges[i] ~= 1 then modLine.corruptedRange = corruptedRanges[i] end
2679+
end
26552680
end
26562681
item:BuildAndParseRaw()
26572682
return item
26582683
end
2659-
if self.displayItem.rarity == "UNIQUE" then
2684+
if self.displayItem.rarity == "UNIQUE" or self.displayItem.rarity == "RELIC" then
26602685
local item = new("Item", self.displayItem:BuildRaw())
26612686
local offset = 20
26622687
for i, mod in ipairs(item.explicitModLines) do
@@ -2727,7 +2752,7 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
27272752
controls.save.y = 73 + 20 * enchantNum
27282753
end)
27292754
controls.enchants.shown = function ()
2730-
return self.displayItem.rarity == "UNIQUE"
2755+
return self.displayItem.rarity == "UNIQUE" or self.displayItem.rarity == "RELIC"
27312756
end
27322757
controls.rolls = new("ButtonControl", {"LEFT", controls.enchants, "RIGHT"}, {5, 0, 80, 20}, "Roll Ranges", function()
27332758
for i = 1, 8 do
@@ -2748,13 +2773,13 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
27482773
controls.save.y = 25 + explicitOffset
27492774
end)
27502775
controls.rolls.shown = function ()
2751-
return self.displayItem.rarity == "UNIQUE"
2776+
return self.displayItem.rarity == "UNIQUE" or self.displayItem.rarity == "RELIC"
27522777
end
27532778
controls.sourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 30, 0, 16}, "^7Source:")
27542779
controls.source = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 30, 150, 18}, sourceList, function(index, value)
27552780
if value == "Corrupted" then
27562781
currentModType = "Corrupted"
2757-
enchantNum = 1
2782+
enchantNum = 2
27582783
elseif value == "Glimpse of Chaos" and self.displayItem.base.type == "Helmet" then -- special corruption enchants
27592784
currentModType = "SpecialCorrupted"
27602785
if self.displayItem.title == "Glimpse of Chaos" then -- glimpse of chaos can have all 8 special enchants
@@ -2763,7 +2788,6 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
27632788
enchantNum = 2
27642789
end
27652790
end
2766-
27672791
if controls.sort then
27682792
sortEnchantList(controls.sort.list[controls.sort.selIndex].stat)
27692793
end
@@ -2772,6 +2796,7 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
27722796
controls.close.y = 73 + 20 * enchantNum
27732797
controls.save.y = 73 + 20 * enchantNum
27742798
end)
2799+
controls.source:SelByValue(currentModType == "SpecialCorrupted" and "Glimpse of Chaos" or "Corrupted")
27752800
controls.sortLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {350, 30, 0, 16}, "^7Sort by:")
27762801
controls.sort = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {355, 30, 240, 18}, sortList, function(index, value)
27772802
sortEnchantList(value.stat)
@@ -2804,12 +2829,12 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
28042829
end
28052830
rebuildEnchantControls()
28062831
controls.save = new("ButtonControl", nil, {-45, 69 + enchantNum * 20, 80, 20}, "Corrupted", function()
2807-
self:SetDisplayItem(corruptItem())
2832+
self:SetDisplayItem(corruptItem(controls.enchant1.shown))
28082833
main:ClosePopup()
28092834
end)
28102835
controls.save.tooltipFunc = function(tooltip)
28112836
tooltip:Clear()
2812-
self:AddItemTooltip(tooltip, corruptItem(), nil, true)
2837+
self:AddItemTooltip(tooltip, corruptItem(controls.enchant1.shown), nil, true)
28132838
end
28142839
controls.close = new("ButtonControl", nil, {45, 69 + enchantNum * 20, 80, 20}, "Cancel", function()
28152840
main:ClosePopup()

src/Data/ModCache.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4548,8 +4548,7 @@ c["Can Attack as though using a Quarterstaff while both of your hand slots are e
45484548
c["Can Attack as though using a Quarterstaff while both of your hand slots are empty Unarmed Attacks that would use your Quarterstaff's damage gain: Physical damage based on their Skill Level 1% more Attack Speed per 75 Item Evasion Rating on Equipped Armour Items"]={nil,"Can Attack as though using a Quarterstaff while both of your hand slots are empty Unarmed Attacks that would use your Quarterstaff's damage gain: Physical damage based on their Skill Level 1% more Attack Speed per 75 Item Evasion Rating on Equipped Armour Items "}
45494549
c["Can Attack as though using a Quarterstaff while both of your hand slots are empty Unarmed Attacks that would use your Quarterstaff's damage gain: Physical damage based on their Skill Level 1% more Attack Speed per 75 Item Evasion Rating on Equipped Armour Items +0.1% to Critical Hit Chance per 10 Item Energy Shield on Equipped Armour Items"]={{[1]={[1]={type="Condition",var="HollowPalm"},[2]={div=75,stat="EvasionOnAllArmourItems",type="PerStat"},flags=1,keywordFlags=0,name="Speed",type="MORE",value=1},[2]={[1]={type="Condition",var="HollowPalm"},[2]={div="10",stat="EnergyShieldOnAllArmourItems",type="PerStat"},flags=1,keywordFlags=0,name="CritChance",type="BASE",value=0.1}},nil}
45504550
c["Can Socket a non-Unique Basic Jewel into the Phylactery"]={{},nil}
4551-
c["Can be modified while Corrupted"]={nil,"Can be modified while Corrupted "}
4552-
c["Can be modified while Corrupted +150 to maximum Life"]={nil,"Can be modified while Corrupted +150 to maximum Life "}
4551+
c["Can be modified while Corrupted"]={{},nil}
45534552
c["Can have 2 additional Instilled Modifiers"]={{},nil}
45544553
c["Can have 3 additional Instilled Modifiers"]={{},nil}
45554554
c["Can instead consume 25% of maximum Mana to trigger Charms with insufficient charges"]={nil,"Can instead consume 25% of maximum Mana to trigger Charms with insufficient charges "}

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6095,6 +6095,7 @@ local specialModList = {
60956095
} end,
60966096
["you can socket an additional copy of each lineage support gem, in different skills"] = { mod("MaxLineageCount", "BASE", 1) },
60976097
["you can socket (%d+) additional copies of each lineage support gem, in different skills"] = function(num) return { mod("MaxLineageCount", "BASE", num) } end,
6098+
["can be modified while corrupted"] = {}
60986099
}
60996100
for _, name in pairs(data.keystones) do
61006101
specialModList[name:lower()] = { mod("Keystone", "LIST", name) }

0 commit comments

Comments
 (0)