Skip to content

Commit 6a7f31d

Browse files
mortentcLocalIdentity
andauthored
Fix Suppression from dagger mastery not applying to ancestral vision (#6191)
* Fix suppression from dagger mastery not applying * undid introduction of old bug * Fixed interaction with Acrobatics * Floor value --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 2ab3970 commit 6a7f31d

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/Modules/CalcDefence.lua

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -725,21 +725,31 @@ function calcs.defence(env, actor)
725725
local weaponsCfg = {
726726
flags = bit.bor(env.player.weaponData1 and env.player.weaponData1.type and ModFlag[env.player.weaponData1.type] or 0, env.player.weaponData2 and env.player.weaponData2.type and ModFlag[env.player.weaponData2.type] or 0)
727727
}
728-
local spellSuppressionChance = modDB:Sum("BASE", weaponsCfg, "SpellSuppressionChance")
729-
local totalSpellSuppressionChance = modDB:Override(weaponsCfg, "SpellSuppressionChance") or spellSuppressionChance
730-
728+
729+
-- Add weapon dependent mods as unflagged mods if the correct weapons are equipped
730+
for _, value in ipairs(modDB:Tabulate("BASE", weaponsCfg, "SpellSuppressionChance")) do
731+
if bit.band(value.mod.flags and weaponsCfg.flags) == value.mod.flags then
732+
local mod = copyTable(value.mod)
733+
mod.flags = 0
734+
modDB:AddMod(mod)
735+
end
736+
end
737+
738+
local spellSuppressionChance = modDB:Sum("BASE", nil, "SpellSuppressionChance")
739+
local totalSpellSuppressionChance = modDB:Override(nil, "SpellSuppressionChance") or spellSuppressionChance
740+
731741
-- Dodge
732742
-- Acrobatics Spell Suppression to Spell Dodge Chance conversion.
733743
if modDB:Flag(nil, "ConvertSpellSuppressionToSpellDodge") then
734744
modDB:NewMod("SpellDodgeChance", "BASE", spellSuppressionChance / 2, "Acrobatics")
735745
end
736746

737747
output.SpellSuppressionChance = m_min(totalSpellSuppressionChance, data.misc.SuppressionChanceCap)
738-
output.SpellSuppressionEffect = data.misc.SuppressionEffect + modDB:Sum("BASE", weaponsCfg, "SpellSuppressionEffect")
748+
output.SpellSuppressionEffect = data.misc.SuppressionEffect + modDB:Sum("BASE", nil, "SpellSuppressionEffect")
739749

740-
if env.mode_effective and modDB:Flag(weaponsCfg, "SpellSuppressionChanceIsUnlucky") then
750+
if env.mode_effective and modDB:Flag(nil, "SpellSuppressionChanceIsUnlucky") then
741751
output.SpellSuppressionChance = output.SpellSuppressionChance / 100 * output.SpellSuppressionChance
742-
elseif env.mode_effective and modDB:Flag(weaponsCfg, "SpellSuppressionChanceIsLucky") then
752+
elseif env.mode_effective and modDB:Flag(nil, "SpellSuppressionChanceIsLucky") then
743753
output.SpellSuppressionChance = (1 - (1 - output.SpellSuppressionChance / 100) ^ 2) * 100
744754
end
745755

@@ -1109,12 +1119,7 @@ function calcs.defence(env, actor)
11091119
if modDB:Flag(nil, "SpellSuppressionAppliesToAilmentAvoidance") then
11101120
local spellSuppressionToAilmentPercent = (modDB:Sum("BASE", nil, "SpellSuppressionAppliesToAilmentAvoidancePercent") or 0) / 100
11111121
-- Ancestral Vision
1112-
for _, value in ipairs(modDB:Tabulate("BASE", weaponsCfg, "SpellSuppressionChance")) do
1113-
local mod = copyTable(value.mod)
1114-
mod.name = "AvoidElementalAilments"
1115-
mod.value = mod.value * spellSuppressionToAilmentPercent
1116-
modDB:AddMod(mod)
1117-
end
1122+
modDB:NewMod("AvoidElementalAilments", "BASE", m_floor(spellSuppressionToAilmentPercent * spellSuppressionChance), "Ancestral Vision")
11181123
end
11191124

11201125
-- This is only used for breakdown purposes

0 commit comments

Comments
 (0)