Skip to content

Commit

Permalink
Fixed interaction between block replacement effect from Determined Su…
Browse files Browse the repository at this point in the history
…rvivor and Necromantic Aegis (#8417)

* Fixed interaction between block replacement effect from ascendancy with Necromantic Aegis

Fixes interaction between Block Replacement effect granted from Gladiator's "Determined Survivor" ascendency with Necromantic Aegis.

* Improved Changed to allow for more flexibility.

Co-authored-by: Paliak <[email protected]>

* Wrong Variable

Needs to be baseBlockChance or else it doesn't have the complete 50% block chance granted from Ascendency.

* Update CalcDefence.lua

* Corrected Affected Variables.

* Last Fix

---------

Co-authored-by: Paliak <[email protected]>
  • Loading branch information
Jonathan-Dang and Paliak authored Feb 12, 2025
1 parent 195006f commit 4f25340
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,17 @@ function calcs.defence(env, actor)
local baseBlockChance = 0
if actor.itemList["Weapon 2"] and actor.itemList["Weapon 2"].armourData then
baseBlockChance = baseBlockChance + actor.itemList["Weapon 2"].armourData.BlockChance

end
if actor.itemList["Weapon 3"] and actor.itemList["Weapon 3"].armourData then
baseBlockChance = baseBlockChance + actor.itemList["Weapon 3"].armourData.BlockChance
end
output.ShieldBlockChance = baseBlockChance
baseBlockChance = modDB:Override(nil, "ReplaceShieldBlock") or baseBlockChance

-- Apply player block overrides if Necromantic Aegis allocated
baseBlockChance = actor == env.minion and env.keystonesAdded["Necromantic Aegis"] and env.player.modDB:Override(nil, "ReplaceShieldBlock") or baseBlockChance

if modDB:Flag(nil, "BlockAttackChanceIsEqualToParent") then
output.BlockChance = m_min(actor.parent.output.BlockChance, output.BlockChanceMax)
elseif modDB:Flag(nil, "BlockAttackChanceIsEqualToPartyMember") then
Expand All @@ -559,6 +564,7 @@ function calcs.defence(env, actor)
output.BlockChance = m_min(totalBlockChance, output.BlockChanceMax)
output.BlockChanceOverCap = m_max(0, totalBlockChance - output.BlockChanceMax)
end

output.ProjectileBlockChance = m_min(output.BlockChance + modDB:Sum("BASE", nil, "ProjectileBlockChance") * calcLib.mod(modDB, nil, "BlockChance"), output.BlockChanceMax)
if modDB:Flag(nil, "SpellBlockChanceMaxIsBlockChanceMax") then
output.SpellBlockChanceMax = output.BlockChanceMax
Expand Down

0 comments on commit 4f25340

Please sign in to comment.