Skip to content

Commit

Permalink
Fix ES Bypass not overriding sources of negative bypass (#6965)
Browse files Browse the repository at this point in the history
* fix es bypass

* Revert to using the correct mods, but make them override mods

* Satisfy spellchecker

* Add tests

* Fix spelling

---------

Co-authored-by: Wires77 <Wires77@users.noreply.github.com>
  • Loading branch information
mortentc and Wires77 authored Dec 11, 2023
1 parent 8a01d38 commit ec6a17e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
41 changes: 41 additions & 0 deletions spec/System/TestDefence_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -601,4 +601,45 @@ describe("TestDefence", function()
assert.are.equals(0, round(poolsRemaining.Life))
assert.are.equals(1000, round(poolsRemaining.Mana))
end)

it("energy shield bypass tests #pet", function()
-- Negative overrides positive
build.configTab.input.customMods = [[
+40 to maximum life
+100 to energy shield
Chaos damage does not bypass energy shield
You have no intelligence
+60% to all resistances
]]
build.configTab:BuildModList()
runCallback("OnFrame")
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
assert.are.equals(200, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
-- Chaos damage should still bypass
build.configTab.input.customMods = build.configTab.input.customMods .. "\nAll damage taken bypasses energy shield"
build.configTab:BuildModList()
runCallback("OnFrame")
assert.are.equals(100, build.calcsTab.calcsOutput.FireMaximumHitTaken)
assert.are.equals(100, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)

-- Make sure we can't reach over 100% bypass
build.configTab.input.customMods = [[
+40 to maximum life
+100 to energy shield
Chaos damage does not bypass energy shield
50% of chaos damage taken does not bypass energy shield
You have no intelligence
+60% to all resistances
]]
build.configTab:BuildModList()
runCallback("OnFrame")
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
assert.are.equals(200, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
-- Chaos damage should still bypass
build.configTab.input.customMods = build.configTab.input.customMods .. "\nAll damage taken bypasses energy shield"
build.configTab:BuildModList()
runCallback("OnFrame")
assert.are.equals(100, build.calcsTab.calcsOutput.FireMaximumHitTaken)
assert.are.equals(100, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
end)
end)
8 changes: 3 additions & 5 deletions src/Data/ModCache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6467,7 +6467,7 @@ c["All Damage can Shock"]={{[1]={flags=0,keywordFlags=0,name="PhysicalCanShock",
c["All Damage from Hits with This Weapon can Poison"]={{[1]={[1]={type="Condition",var="{Hand}Attack"},[2]={skillType=1,type="SkillType"},flags=0,keywordFlags=0,name="FireCanPoison",type="FLAG",value=true},[2]={[1]={type="Condition",var="{Hand}Attack"},[2]={skillType=1,type="SkillType"},flags=0,keywordFlags=0,name="ColdCanPoison",type="FLAG",value=true},[3]={[1]={type="Condition",var="{Hand}Attack"},[2]={skillType=1,type="SkillType"},flags=0,keywordFlags=0,name="LightningCanPoison",type="FLAG",value=true}},nil}
c["All Damage inflicts Poison against Enemies affected by at least 3 Grasping Vines"]={{[1]={[1]={threshold=3,type="MultiplierThreshold",var="GraspingVinesAffectingEnemy"},flags=0,keywordFlags=0,name="PoisonChance",type="BASE",value=100},[2]={[1]={threshold=3,type="MultiplierThreshold",var="GraspingVinesAffectingEnemy"},flags=0,keywordFlags=0,name="FireCanPoison",type="FLAG",value=true},[3]={[1]={threshold=3,type="MultiplierThreshold",var="GraspingVinesAffectingEnemy"},flags=0,keywordFlags=0,name="ColdCanPoison",type="FLAG",value=true},[4]={[1]={threshold=3,type="MultiplierThreshold",var="GraspingVinesAffectingEnemy"},flags=0,keywordFlags=0,name="LightningCanPoison",type="FLAG",value=true}},nil}
c["All Damage inflicts Poison while affected by Glorious Madness"]={{[1]={[1]={type="Condition",var="AffectedByGloriousMadness"},flags=0,keywordFlags=0,name="PoisonChance",type="BASE",value=100},[2]={[1]={type="Condition",var="AffectedByGloriousMadness"},flags=0,keywordFlags=0,name="FireCanPoison",type="FLAG",value=true},[3]={[1]={type="Condition",var="AffectedByGloriousMadness"},flags=0,keywordFlags=0,name="ColdCanPoison",type="FLAG",value=true},[4]={[1]={type="Condition",var="AffectedByGloriousMadness"},flags=0,keywordFlags=0,name="LightningCanPoison",type="FLAG",value=true}},nil}
c["All Damage taken bypasses Energy Shield"]={{[1]={flags=0,keywordFlags=0,name="PhysicalEnergyShieldBypass",type="BASE",value=100},[2]={flags=0,keywordFlags=0,name="LightningEnergyShieldBypass",type="BASE",value=100},[3]={flags=0,keywordFlags=0,name="ColdEnergyShieldBypass",type="BASE",value=100},[4]={flags=0,keywordFlags=0,name="FireEnergyShieldBypass",type="BASE",value=100}},nil}
c["All Damage taken bypasses Energy Shield"]={{[1]={flags=0,keywordFlags=0,name="PhysicalEnergyShieldBypass",type="OVERRIDE",value=100},[2]={flags=0,keywordFlags=0,name="LightningEnergyShieldBypass",type="OVERRIDE",value=100},[3]={flags=0,keywordFlags=0,name="ColdEnergyShieldBypass",type="OVERRIDE",value=100},[4]={flags=0,keywordFlags=0,name="FireEnergyShieldBypass",type="OVERRIDE",value=100},[5]={flags=0,keywordFlags=0,name="ChaosEnergyShieldBypass",type="OVERRIDE",value=100}},nil}
c["All Damage with Hits can Chill"]={{[1]={flags=0,keywordFlags=0,name="PhysicalCanChill",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="FireCanChill",type="FLAG",value=true},[3]={flags=0,keywordFlags=0,name="LightningCanChill",type="FLAG",value=true},[4]={flags=0,keywordFlags=0,name="ChaosCanChill",type="FLAG",value=true}},nil}
c["All Damage with Maces and Sceptres inflicts Chill"]={{[1]={[1]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="PhysicalCanChill",type="FLAG",value=true},[2]={[1]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="LightningCanChill",type="FLAG",value=true},[3]={[1]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="FireCanChill",type="FLAG",value=true},[4]={[1]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="ChaosCanChill",type="FLAG",value=true}},nil}
c["All Elemental Damage Converted to Chaos Damage"]={{[1]={flags=0,keywordFlags=0,name="ColdDamageConvertToChaos",type="BASE",value=100},[2]={flags=0,keywordFlags=0,name="FireDamageConvertToChaos",type="BASE",value=100},[3]={flags=0,keywordFlags=0,name="LightningDamageConvertToChaos",type="BASE",value=100}},nil}
Expand Down Expand Up @@ -7389,10 +7389,8 @@ c["Damage of Enemies Hitting you is Unlucky while you are on Full Life"]={nil,"D
c["Damage of Enemies Hitting you is Unlucky while you have a Magic Ring Equipped"]={nil,"Damage of Enemies Hitting you is Unlucky while you have a Magic Ring Equipped "}
c["Damage of Enemies Hitting you is Unlucky while you have a Magic Ring Equipped You are Hexproof if you have a Magic Ring in right slot"]={nil,"Damage of Enemies Hitting you is Unlucky while you have a Magic Ring Equipped You are Hexproof if you have a Magic Ring in right slot "}
c["Damage of Hits against you is Lucky"]={nil,"Damage of Hits is Lucky "}
c["Damage taken from Blocked Hits cannot bypass Energy Shield"]={nil,"Damage taken from Blocked Hits cannot bypass Energy Shield "}
c["Damage taken from Blocked Hits cannot bypass Energy Shield Damage taken from Unblocked hits always bypasses Energy Shield"]={nil,"Damage taken from Blocked Hits cannot bypass Energy Shield Damage taken from Unblocked hits always bypasses Energy Shield "}
c["Damage taken from Unblocked hits always bypasses Energy Shield"]={nil,"Damage taken from Unblocked hits always bypasses Energy Shield "}
c["Damage taken from Unblocked hits always bypasses Energy Shield Glancing Blows"]={nil,"Damage taken from Unblocked hits always bypasses Energy Shield Glancing Blows "}
c["Damage taken from Blocked Hits cannot bypass Energy Shield"]={{[1]={[1]={neg=true,type="Condition",var="EVBypass"},flags=0,keywordFlags=0,name="BlockedDamageDoesntBypassES",type="FLAG",value=true}},nil}
c["Damage taken from Unblocked hits always bypasses Energy Shield"]={{[1]={[1]={neg=true,type="Condition",var="EVBypass"},flags=0,keywordFlags=0,name="UnblockedDamageDoesBypassES",type="FLAG",value=true}},nil}
c["Damage to Surrounding Targets"]={nil,"Damage to Surrounding Targets "}
c["Damage with Hits from Socketed Vaal Skills is Lucky"]={{[1]={[1]={slotName="{SlotName}",type="SocketedIn"},[2]={skillType=42,type="SkillType"},flags=0,keywordFlags=0,name="ExtraSkillMod",type="LIST",value={mod={flags=0,keywordFlags=0,name="LuckyHits",type="FLAG",value=true}}}},nil}
c["Damage with Weapons Penetrates 2% Elemental Resistances"]={{[1]={flags=8192,keywordFlags=0,name="ElementalPenetration",type="BASE",value=2}},nil}
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1886,7 +1886,7 @@ function calcs.buildDefenceEstimations(env, actor)
output[damageType.."EnergyShieldBypass"] = 100
output.AnyBypass = true
else
output[damageType.."EnergyShieldBypass"] = modDB:Sum("BASE", nil, damageType.."EnergyShieldBypass") or 0
output[damageType.."EnergyShieldBypass"] = m_max(modDB:Sum("BASE", nil, damageType.."EnergyShieldBypass") or 0, modDB:Sum("OVERRIDE", nil, damageType.."EnergyShieldBypass") or 0)
if output[damageType.."EnergyShieldBypass"] ~= 0 then
output.AnyBypass = true
end
Expand Down
13 changes: 7 additions & 6 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2065,10 +2065,11 @@ local specialModList = {
["gain no inherent bonuses from dexterity"] = { flag("NoDexterityAttributeBonuses") },
["gain no inherent bonuses from intelligence"] = { flag("NoIntelligenceAttributeBonuses") },
["all damage taken bypasses energy shield"] = {
mod("PhysicalEnergyShieldBypass", "BASE", 100),
mod("LightningEnergyShieldBypass", "BASE", 100),
mod("ColdEnergyShieldBypass", "BASE", 100),
mod("FireEnergyShieldBypass", "BASE", 100),
mod("PhysicalEnergyShieldBypass", "OVERRIDE", 100),
mod("LightningEnergyShieldBypass", "OVERRIDE", 100),
mod("ColdEnergyShieldBypass", "OVERRIDE", 100),
mod("FireEnergyShieldBypass", "OVERRIDE", 100),
mod("ChaosEnergyShieldBypass", "OVERRIDE", 100), -- Allows override of "chaos damage does not bypass energy shield" and similar mods
},
["physical damage taken bypasses energy shield"] = {
mod("PhysicalEnergyShieldBypass", "BASE", 100),
Expand Down Expand Up @@ -3913,8 +3914,8 @@ local specialModList = {
["cannot block spells"] = { flag("CannotBlockSpells") },
["cannot block spell damage"] = { flag("CannotBlockSpells") },
["monsters cannot block your attacks"] = { mod("EnemyModifier", "LIST", { mod = flag("CannotBlockAttacks") }) },
["damage from blocked hits cannot bypass energy shield"] = { flag("BlockedDamageDoesntBypassES", { type = "Condition", var = "EVBypass", neg = true }) },
["damage from unblocked hits always bypasses energy shield"] = { flag("UnblockedDamageDoesBypassES", { type = "Condition", var = "EVBypass", neg = true }) },
["damage t?a?k?e?n? from blocked hits cannot bypass energy shield"] = { flag("BlockedDamageDoesntBypassES", { type = "Condition", var = "EVBypass", neg = true }) },
["damage t?a?k?e?n? from unblocked hits always bypasses energy shield"] = { flag("UnblockedDamageDoesBypassES", { type = "Condition", var = "EVBypass", neg = true }) },
["recover (%d+) life when you block"] = function(num) return { mod("LifeOnBlock", "BASE", num) } end,
["recover (%d+) energy shield when you block spell damage"] = function(num) return { mod("EnergyShieldOnSpellBlock", "BASE", num) } end,
["recover (%d+) energy shield when you suppress spell damage"] = function(num) return { mod("EnergyShieldOnSuppress", "BASE", num) } end,
Expand Down

0 comments on commit ec6a17e

Please sign in to comment.