From 4928023c616934daf955c7dd95fbbaafe9fcb925 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Sun, 14 Dec 2025 19:13:33 +0100 Subject: [PATCH 1/7] Enhance block value calculation with enchant bonuses Refactor GetBlockValue to include enchant bonuses --- Modules/Data/Defense.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Modules/Data/Defense.lua b/Modules/Data/Defense.lua index 3a7e460..b4dfb18 100755 --- a/Modules/Data/Defense.lua +++ b/Modules/Data/Defense.lua @@ -240,9 +240,11 @@ end ---@return number function Data:GetBlockValue() - local setBonus = _Defense:GetItemModifierBlockValue() - local blockValue = GetShieldBlock() + setBonus - + local blockValue = 0 + if C_SpellBook.IsSpellKnown(107) and C_PaperDollInfo.OffhandHasShield() then + local enchantBonus = _Defense:GetEnchantsBlockValue() + local blockValue = GetShieldBlock() + enchantBonus + end return DataUtils:Round(blockValue, 2) end @@ -251,12 +253,17 @@ function Data:GetResilienceRating() return DataUtils:Round(GetCombatRating(15), 2) end -function _Defense:GetItemModifierBlockValue() +---@return number +function _Defense:GetEnchantsBlockValue() local mod = 0 - - if Data:HasSetBonusModifierBlockValue() then - mod = mod + 30 + for i = 1, 18 do + local itemLink = GetInventoryItemLink("player", i) + if itemLink then + local enchant = DataUtils:GetEnchantFromItemLink(itemLink) + if enchant then + mod = mod + (Data.enchantsBlockValue[itemLink] or 0) + end + end end - return mod end From aab055e374f1e60b3592240da6e555096948d2d0 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Sun, 14 Dec 2025 19:14:52 +0100 Subject: [PATCH 2/7] Add C_SpellBook and IsSpellKnown to luacheck config --- .luacheckrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.luacheckrc b/.luacheckrc index 14a4642..4bf2c01 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -535,6 +535,8 @@ stds.ecs = { "C_Spell.DoesSpellExist", "C_Spell.IsSpellDataCached", "C_Spell.RequestLoadSpellData", + "C_SpellBook", + "C_SpellBook.IsSpellKnown", "C_StorePublic.DoesGroupHavePurchaseableProducts", "C_StorePublic.IsDisabledByParentalControls", "C_StorePublic.IsEnabled", From 166929f6b6b69e32408942ac87f0f6a66813ef2c Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Sun, 14 Dec 2025 19:26:36 +0100 Subject: [PATCH 3/7] Update Constants.lua Removed 'Battlegear of Might' from setNames and added enchantsBlockValue table. --- Modules/Data/Constants.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Modules/Data/Constants.lua b/Modules/Data/Constants.lua index c605b21..3d91171 100755 --- a/Modules/Data/Constants.lua +++ b/Modules/Data/Constants.lua @@ -22,7 +22,6 @@ Data.DRUID = 11 Data.setNames = { AUGURS_REGALIA = "Augur's Regalia", - BATTLEGEAR_OF_MIGHT = "Battlegear of Might", BLOODSOUL_EMBRACE = "Bloodsoul Embrace", FEL_IRON_CHAIN = "Fel Iron Chain", FREETHINKERS_ARMOR = "Freethinker's Armor", @@ -49,6 +48,14 @@ Data.enchantIds = { MINOR_MANA_OIL = "2624", -- 4 MP5 } +Data.enchantsBlockValue = { + ["2583"] = 15, -- Presence of Might + ["2653"] = 18, -- Enchant Shield - Tough Shield + ["2655"] = 15, -- Enchant Shield - Shield Block + ["3849"] = 81, -- Titanium Plating + ["7633"] = 15, -- Presence of Valor +} + Data.gemIds = { FOUR_MP5_GEMS = {"32202"}, THREE_MP5_GEMS = {"24037"}, From 6442ab30046bde7b4c429f83dfe823421e518421 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Sun, 14 Dec 2025 19:27:27 +0100 Subject: [PATCH 4/7] Delete BATTLEGEAR_OF_MIGHT set from ItemSets Removed BATTLEGEAR_OF_MIGHT set and related bonus check. --- Modules/Data/ItemSets.lua | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Modules/Data/ItemSets.lua b/Modules/Data/ItemSets.lua index ff868be..c252349 100755 --- a/Modules/Data/ItemSets.lua +++ b/Modules/Data/ItemSets.lua @@ -12,16 +12,6 @@ local itemSets = { [19830] = true, [19956] = true }, - [setNames.BATTLEGEAR_OF_MIGHT] = { - [16861] = true, - [16862] = true, - [16863] = true, - [16864] = true, - [16865] = true, - [16866] = true, - [16867] = true, - [16868] = true - }, [setNames.BLOODSOUL_EMBRACE] = { [19690] = true, [19691] = true, @@ -188,14 +178,6 @@ function Data:HasNatureCritBonusModifier() return false end -function Data:HasSetBonusModifierBlockValue() - if classId == Data.WARRIOR then - return Data:IsSetBonusActive(setNames.BATTLEGEAR_OF_MIGHT, 3) - end - - return false -end - function Data:IsSetBonusActive(setName, bonusLevel) local setItems = itemSets[setName] if (not setItems) then From 66c95fc22a7e45e1d033b0c1e7372d389335ffce Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Sun, 14 Dec 2025 19:30:42 +0100 Subject: [PATCH 5/7] Fix block value calculation in GetBlockValue function --- Modules/Data/Defense.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/Data/Defense.lua b/Modules/Data/Defense.lua index b4dfb18..72b5712 100755 --- a/Modules/Data/Defense.lua +++ b/Modules/Data/Defense.lua @@ -242,8 +242,7 @@ end function Data:GetBlockValue() local blockValue = 0 if C_SpellBook.IsSpellKnown(107) and C_PaperDollInfo.OffhandHasShield() then - local enchantBonus = _Defense:GetEnchantsBlockValue() - local blockValue = GetShieldBlock() + enchantBonus + blockValue = blockValue + GetShieldBlock() + _Defense:GetEnchantsBlockValue() end return DataUtils:Round(blockValue, 2) end From 13f920aab0a7d2b9b2a83482c17fb11684fceddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Hei=C3=9F?= Date: Tue, 23 Dec 2025 08:03:07 +0100 Subject: [PATCH 6/7] Apply suggestions from code review --- Modules/Data/Defense.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Data/Defense.lua b/Modules/Data/Defense.lua index 716fbf0..4cb3115 100755 --- a/Modules/Data/Defense.lua +++ b/Modules/Data/Defense.lua @@ -242,7 +242,7 @@ function _Defense:GetEnchantsBlockValue() if itemLink then local enchant = DataUtils:GetEnchantFromItemLink(itemLink) if enchant then - mod = mod + (Data.enchantsBlockValue[itemLink] or 0) + mod = mod + (Data.Encaht.BlockValue[itemLink] or 0) end end end From 698550b3902e10c103d1c6eb495d77a65dd2a051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Hei=C3=9F?= Date: Tue, 23 Dec 2025 08:04:21 +0100 Subject: [PATCH 7/7] Whoops --- Modules/Data/Constants.lua | 2 +- Modules/Data/Defense.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Data/Constants.lua b/Modules/Data/Constants.lua index c902784..9899cfc 100755 --- a/Modules/Data/Constants.lua +++ b/Modules/Data/Constants.lua @@ -374,7 +374,7 @@ Data.Enchant.MP5 = { [3836] = 8, -- Master's Inscription of the Crag [7099] = 12, -- Blackfathom Mana Oil. This effect only applies within Blackfathom Deeps. } -Data.Encaht.BlockValue = { +Data.Enchant.BlockValue = { ["2583"] = 15, -- Presence of Might ["2653"] = 18, -- Enchant Shield - Tough Shield ["2655"] = 15, -- Enchant Shield - Shield Block diff --git a/Modules/Data/Defense.lua b/Modules/Data/Defense.lua index 4cb3115..d64054a 100755 --- a/Modules/Data/Defense.lua +++ b/Modules/Data/Defense.lua @@ -242,7 +242,7 @@ function _Defense:GetEnchantsBlockValue() if itemLink then local enchant = DataUtils:GetEnchantFromItemLink(itemLink) if enchant then - mod = mod + (Data.Encaht.BlockValue[itemLink] or 0) + mod = mod + (Data.Enchant.BlockValue[itemLink] or 0) end end end