Skip to content

Commit

Permalink
Fix socket count logic and add Oath of Maji Ascendancy support
Browse files Browse the repository at this point in the history
  • Loading branch information
sida-wang committed Dec 3, 2023
1 parent 4a0944d commit 9fb58b7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,29 @@ local function applySocketMods(env, gem, groupCfg, socketNum, modSource)
end

local function calcSocketStats(env, build)
for _, socketGroup in pairs(build.skillsTab.socketGroupList) do
if socketGroup.slot then
local socketedGems = 0
for _, gem in pairs(socketGroup.gemList) do
if gem.enabled then
socketedGems = socketedGems + 1
local activeItemSlots
if env.build.itemsTab.activeItemSet.useSecondWeaponSet then
activeItemSlots = {"Weapon 1 Swap", "Weapon 2 Swap", "Helmet", "Gloves", "Boots", "Body Armour", "Amulet", "Ring 1", "Ring 2"}
else
activeItemSlots = {"Weapon 1", "Weapon 2", "Helmet", "Gloves", "Boots", "Body Armour", "Amulet", "Ring 1", "Ring 2"}
end
for _, slot in pairs(activeItemSlots) do
local slotSocketsCount = 0
local socketedGems = 0
local item = build.itemsTab.items[build.itemsTab.activeItemSet[slot].selItemId]
if item then
slotSocketsCount = #item.sockets
end
for _, socketGroup in pairs(build.skillsTab.socketGroupList) do
if (socketGroup.enabled and socketGroup.slot and socketGroup.slot == slot and socketGroup.gemList) then
for _, gem in pairs(socketGroup.gemList) do
if (gem.gemData and gem.enabled) then
socketedGems = socketedGems + 1
end
end
end
socketedGems = math.min(socketedGems, #build.itemsTab.items[build.itemsTab.activeItemSet[socketGroup.slot].selItemId].sockets)
env.modDB:NewMod("Multiplier:SocketedGemsIn"..socketGroup.slot, "BASE", socketedGems)
end
env.modDB:NewMod("Multiplier:SocketedGemsIn"..slot, "BASE", math.min(slotSocketsCount, socketedGems))
end
end

Expand Down
5 changes: 5 additions & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2558,6 +2558,11 @@ local specialModList = {
mod("DamageTakenOverTime", "MORE", -num, { type = "Condition", var = "HeartstopperDOT" }),
mod("DamageTakenOverTime", "MORE", -num * tonumber(duration) / 10, { type = "Condition", var = "HeartstopperAVERAGE" })
} end,
-- Oath of the Maji
["defences from equipped body armour are doubled if it has no socketed gems"] = { flag("Unbreakable", { type = "MultiplierThreshold", var = "SocketedGemsInBody Armour", threshold = 0, upper = true }) },
["([%+%-]%d+)%% to all elemental resistances if you have an equipped helmet with no socketed gems"] = function(num) return { mod("ElementalResist", "BASE", num, { type = "MultiplierThreshold", var = "SocketedGemsInHelmet", threshold = 0, upper = true}) } end,
["(%d+)%% increased maximum life if you have equipped gloves with no socketed gems"] = function(num) return { mod("Life", "INC", num, { type = "MultiplierThreshold", var = "SocketedGemsInGloves", threshold = 0, upper = true}) } end,
["(%d+)%% increased movement speed if you have equipped boots with no socketed gems"] = function(num) return { mod("MovementSpeed", "INC", num, { type = "MultiplierThreshold", var = "SocketedGemsInBoots", threshold = 0, upper = true}) } end,
-- Item local modifiers
["has no sockets"] = { flag("NoSockets") },
["reflects your other ring"] = {
Expand Down

0 comments on commit 9fb58b7

Please sign in to comment.