PathOfBuilding icon indicating copy to clipboard operation
PathOfBuilding copied to clipboard

Add support for Kingmaker ally rarity mod

Open Blitz54 opened this issue 9 months ago • 1 comments

Description of the problem being solved:

EDIT: Needs work. Reasons below. image If this is still true, then a few things need to be fixed. Necromantic Aegis currently applies INC rarity to the minion from a shield, like Wheel of the Stormsail. Animated Guardian also should not gain rarity from his gear. PoB currently let's AG gain rarity. Still unsure if Kingmaker Aura should give minions rarity or not. Can't find an answer about auras giving rarity.

Kingmaker give allies 30% inc rarity. Implemented now

Steps taken to verify a working solution:

  • Equipped Kingmaker and made sure rarity for player does not increase, but minion does.
  • Imported a support build into the party and the player correctly gets the rarity, along with the minions.

Link to a build that showcases this PR:

https://pobb.in/X7roDK_p0zJD

After screenshot:

image

Blitz54 avatar Mar 06 '25 09:03 Blitz54

Example on how you could filter out IIQ/IIR mods. May need to be modified as right now it just removes all IIQ and IIR mods from extra auras and items.

diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua
index 0f89c7ea..d4f8168b 100644
--- a/src/Modules/CalcPerform.lua
+++ b/src/Modules/CalcPerform.lua
@@ -1108,7 +1108,11 @@ function calcs.perform(env, skipEHP)
                                        end
                                        if item then
                                                env.minion.itemList[slotName] = item
-                                               env.minion.modDB:AddList(item.modList or item.slotModList[slot.slotNum])
+                                               for _, mod in ipairs(item.modList or item.slotModList[slot.slotNum]) do
+                                                   if mod.name ~= "LootRarity" and mod.name ~= "LootQuantity" then
+                                                       env.minion.modDB:AddMod(mod)
+                                                   end
+                                               end
                                        end
                                end
                        end
@@ -2941,9 +2945,13 @@ function calcs.perform(env, skipEHP)
                end
                if not modDB:Flag(nil, "SelfAurasCannotAffectAllies") then
                        if env.minion then
-                               local inc = env.minion.modDB:Sum("INC", nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
-                               local more = env.minion.modDB:More(nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
-                               env.minion.modDB:ScaleAddList(modList, (1 + inc / 100) * more)
+                               for _, mod in ipairs(modList) do
+                                       if mod.name ~= "LootRarity" and mod.name ~= "LootQuantity" then
+                                               local inc = env.minion.modDB:Sum("INC", nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
+                                               local more = env.minion.modDB:More(nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
+                                               env.minion.modDB:ScaleAddList(mod, (1 + inc / 100) * more)
+                                       end
+                               end
                        end
                        buffExports["Aura"]["extraAura"].modList:AddMod(value.mod)
                        local totemModBlacklist = value.mod.name and (value.mod.name == "Speed" or value.mod.name == "CritMultiplier" or value.mod.name == "CritChance")
@@ -2965,9 +2973,13 @@ function calcs.perform(env, skipEHP)
                        local more = modDB:More(nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
                        modDB:ScaleAddList(modList, (1 + inc / 100) * more)
                        if env.minion then
-                               local inc = env.minion.modDB:Sum("INC", nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
-                               local more = env.minion.modDB:More(nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
-                               env.minion.modDB:ScaleAddList(modList, (1 + inc / 100) * more)
+                               for _, mod in ipairs(modList) do
+                                       if mod.name ~= "LootRarity" and mod.name ~= "LootQuantity" then
+                                               local inc = env.minion.modDB:Sum("INC", nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
+                                               local more = env.minion.modDB:More(nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
+                                               env.minion.modDB:ScaleAddList(mod, (1 + inc / 100) * more)
+                                       end
+                               end
                        end
                end
        end
diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua
index fb87b788..7bd98e7f 100644
--- a/src/Modules/CalcSetup.lua
+++ b/src/Modules/CalcSetup.lua
@@ -900,12 +900,14 @@ function calcs.initEnv(build, mode, override, specEnv)
                                        -- Special handling for Necromantic Aegis
                                        env.aegisModList = new("ModList")
                                        for _, mod in ipairs(srcList) do
-                                               -- Filter out mods that apply to socketed gems, or which add supports
-                                               local add = true
-                                               for _, tag in ipairs(mod) do
-                                                       if tag.type == "SocketedIn" then
-                                                               add = false
-                                                               break
+                                               -- Filter out mods that apply to socketed gems, which add supports, or modify IIQ/IIR
+                                               local add = mod.name ~= "LootRarity" and mod.name ~= "LootQuantity"
+                                               if add then
+                                                       for _, tag in ipairs(mod) do
+                                                               if tag.type == "SocketedIn" then
+                                                                       add = false
+                                                                       break
+                                                               end
                                                        end
                                                end
                                                if add then
diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua
index 6eec4fb7..e4ce2674 100644
--- a/src/Modules/ModParser.lua
+++ b/src/Modules/ModParser.lua
@@ -5026,6 +5026,7 @@ local specialModList = {
        -- Conditional Player Quantity / Rarity
        ["(%d+)%% increased quantity of items dropped by slain normal enemies"] = function(num) return { mod("LootQuantityNormalEnemies", "INC", num) } end,
        ["(%d+)%% increased rarity of items dropped by slain magic enemies"] = function(num) return { mod("LootRarityMagicEnemies", "INC", num) } end,
+       ["nearby allies have (%d+)%% increased item rarity"] = function(num) return { mod("ExtraAura", "LIST", {onlyAllies = true, mod = mod("LootRarity", "INC", num) }) } end,
        -- Pantheon: Soul of Tukohama support
        ["while stationary, gain ([%d%.]+)%% of life regenerated per second every second, up to a maximum of (%d+)%%"] = function(num, _, limit) return {
                mod("LifeRegenPercent", "BASE", num, { type = "Multiplier", var = "StationarySeconds", limit = tonumber(limit), limitTotal = true }, { type = "Condition", var = "Stationary" }),

Paliak avatar Mar 14 '25 15:03 Paliak