Skip to content

Commit 38bb170

Browse files
author
LocalIdentity
committed
Fix Inevitable Critical Hits when dual wielding
When dual wielding the override mod would set the crit chance of the second weapon to 100% which would mess with the calcs and the breakdown Also renamed all the variables to be Inevitable critical hits
1 parent 9c93232 commit 38bb170

4 files changed

Lines changed: 13 additions & 14 deletions

File tree

src/Data/ModCache.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4748,7 +4748,7 @@ c["Increases and Reductions to Minion Attack Speed also affect you"]={{[1]={flag
47484748
c["Increases and Reductions to Minion Damage also affect you"]={{[1]={flags=0,keywordFlags=0,name="MinionDamageAppliesToPlayer",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="ImprovedMinionDamageAppliesToPlayer",type="MAX",value=100}},nil}
47494749
c["Increases and Reductions to Projectile Speed also apply to Damage with Bows"]={{[1]={flags=0,keywordFlags=0,name="ProjectileSpeedAppliesToBowDamage",type="FLAG",value=true}},nil}
47504750
c["Increases and Reductions to Spell damage also apply to Attacks"]={{[1]={flags=0,keywordFlags=0,name="SpellDamageAppliesToAttacks",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="ImprovedSpellDamageAppliesToAttacks",type="MAX",value=100}},nil}
4751-
c["Inevitable Critical Hits"]={{[1]={flags=0,keywordFlags=0,name="ForcedOutcome",type="FLAG",value=true}},nil}
4751+
c["Inevitable Critical Hits"]={{[1]={flags=0,keywordFlags=0,name="InevitableCriticalHits",type="FLAG",value=true}},nil}
47524752
c["Infinite Parry Range"]={nil,"Infinite Parry Range "}
47534753
c["Infinite Parry Range 50% increased Parried Debuff Duration"]={nil,"Infinite Parry Range 50% increased Parried Debuff Duration "}
47544754
c["Inflict Abyssal Wasting on Hit"]={nil,"Inflict Abyssal Wasting on Hit "}

src/Modules/CalcOffence.lua

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3615,7 +3615,7 @@ function calcs.offence(env, actor, activeSkill)
36153615
end
36163616

36173617
-- Calculate crit chance, crit multiplier, and their combined effect
3618-
local forcedOutcomeApplies = false
3618+
local inevitableCrits = false
36193619
if skillModList:Flag(cfg, "NeverCrit") then
36203620
output.PreEffectiveCritChance = 0
36213621
output.CritChance = 0
@@ -3705,9 +3705,9 @@ function calcs.offence(env, actor, activeSkill)
37053705
if env.mode_effective and skillModList:Flag(cfg, "BifurcateCrit") then
37063706
output.CritChance = (1 - (1 - output.CritChance / 100) ^ 2) * 100
37073707
end
3708-
local preForcedOutcomeCritChance = output.CritChance
3709-
if env.mode_effective and skillModList:Flag(cfg, "ForcedOutcome") and output.CritChance > 0 then
3710-
forcedOutcomeApplies = true
3708+
local preInevitableCritChance = output.CritChance
3709+
if env.mode_effective and skillModList:Flag(cfg, "InevitableCriticalHits") and output.CritChance > 0 then
3710+
inevitableCrits = true
37113711
-- Lucky crits use their effective crit chance without an extra roll-down penalty.
37123712
-- Bifurcated crits roll twice per roll-down; only both rolls failing advances the penalty.
37133713
local critChance = output.CritChance / 100
@@ -3731,7 +3731,6 @@ function calcs.offence(env, actor, activeSkill)
37313731

37323732
-- For the sake of any logic that depends on it, every hit is considered a crit
37333733
output.CritChance = 100
3734-
skillModList:NewMod("CritChance", "OVERRIDE", 100, "Tree:55135")
37353734
end
37363735
if breakdown and output.CritChance ~= baseCrit then
37373736
breakdown.CritChance = { }
@@ -3767,10 +3766,10 @@ function calcs.offence(env, actor, activeSkill)
37673766
if env.mode_effective and skillModList:Flag(cfg, "BifurcateCrit") then
37683767
t_insert(breakdown.CritChance, "Critical Strike Bifurcates:")
37693768
t_insert(breakdown.CritChance, s_format("1 - (1 - %.4f) x (1 - %.4f)", preBifurcateCritChance / 100, preBifurcateCritChance / 100))
3770-
t_insert(breakdown.CritChance, s_format("= %.2f%%", preForcedOutcomeCritChance))
3769+
t_insert(breakdown.CritChance, s_format("= %.2f%%", preInevitableCritChance))
37713770
end
3772-
if forcedOutcomeApplies then
3773-
t_insert(breakdown.CritChance, "Inevitable Critical Hits (Forced Outcome):")
3771+
if inevitableCrits then
3772+
t_insert(breakdown.CritChance, "Inevitable Critical Hits:")
37743773
t_insert(breakdown.CritChance, "= 100% ^8(override)")
37753774
end
37763775
end
@@ -3791,7 +3790,7 @@ function calcs.offence(env, actor, activeSkill)
37913790

37923791
output.PreEffectiveCritMultiplier = 1 + extraDamage
37933792
-- if crit bifurcates are enabled, roll for crit twice and add multiplier for each
3794-
if env.mode_effective and skillModList:Flag(cfg, "BifurcateCrit") and not forcedOutcomeApplies then
3793+
if env.mode_effective and skillModList:Flag(cfg, "BifurcateCrit") and not inevitableCrits then
37953794
-- get crit chance and calculate odds of critting twice
37963795
local critChancePercentage = output.PreBifurcateCritChance
37973796
local bifurcateMultiChance = (critChancePercentage ^ 2) / 100

src/Modules/CalcSections.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ return {
557557
}, },
558558
{ label = "Crit Chance", notFlag = "attack", { format = "{2:output:CritChance}%",
559559
{ breakdown = "CritChance" },
560-
{ label = "Player modifiers", modName = {"CritChance", "SpellSkillsCannotDealCriticalStrikesExceptOnFinalRepeat", "SpellSkillsAlwaysDealCriticalStrikesOnFinalRepeat"}, cfg = "skill" },
560+
{ label = "Player modifiers", modName = {"CritChance", "SpellSkillsCannotDealCriticalStrikesExceptOnFinalRepeat", "SpellSkillsAlwaysDealCriticalStrikesOnFinalRepeat", "InevitableCriticalHits"}, cfg = "skill" },
561561
{ label = "Enemy modifiers", modName = "SelfCritChance", enemy = true },
562562
}, },
563563
{ label = "Crit Multiplier", notFlag = "attack", { format = "x {2:output:CritMultiplier}",
@@ -573,7 +573,7 @@ return {
573573
}, },
574574
{ label = "MH Crit Chance", bgCol = colorCodes.MAINHANDBG, flag = "weapon1Attack", { format = "{2:output:MainHand.CritChance}%",
575575
{ breakdown = "MainHand.CritChance" },
576-
{ label = "Player modifiers", modName = { "CritChance", "WeaponBaseCritChance", "MainHandCritIsEqualToParent", "MainHandCritIsEqualToPartyMember", "AttackCritIsEqualToParentMainHand" }, cfg = "weapon1" },
576+
{ label = "Player modifiers", modName = { "CritChance", "WeaponBaseCritChance", "MainHandCritIsEqualToParent", "MainHandCritIsEqualToPartyMember", "AttackCritIsEqualToParentMainHand", "InevitableCriticalHits" }, cfg = "weapon1" },
577577
{ label = "Enemy modifiers", modName = "SelfCritChance", enemy = true },
578578
}, },
579579
{ label = "MH Crit Bifurcates", bgCol = colorCodes.MAINHANDBG, haveOutput = "MainHand.CritBifurcates", flag = "weapon1Attack", { format = "{2:output:MainHand.CritBifurcates}%",
@@ -593,7 +593,7 @@ return {
593593
}, },
594594
{ label = "OH Crit Chance", bgCol = colorCodes.OFFHANDBG, flag = "weapon2Attack", { format = "{2:output:OffHand.CritChance}%",
595595
{ breakdown = "OffHand.CritChance" },
596-
{ label = "Player modifiers", modName = { "CritChance", "WeaponBaseCritChance", "AttackCritIsEqualToParentMainHand" }, cfg = "weapon2" },
596+
{ label = "Player modifiers", modName = { "CritChance", "WeaponBaseCritChance", "AttackCritIsEqualToParentMainHand", "InevitableCriticalHits" }, cfg = "weapon2" },
597597
{ label = "Enemy modifiers", modName = "SelfCritChance", enemy = true },
598598
}, },
599599
{ label = "OH Crit Bifurcates", bgCol = colorCodes.OFFHANDBG, haveOutput = "OffHand.CritBifurcates", flag = "weapon2Attack", { format = "{2:output:OffHand.CritBifurcates}%",

src/Modules/ModParser.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3380,7 +3380,7 @@ local specialModList = {
33803380
mod("EnemyModifier", "LIST", { mod = mod("LightningExposure", "BASE", 20) }, { type = "ActorCondition", actor = "enemy", var = "EnemyInPresence" }),
33813381
},
33823382
-- Druid -- Oracle
3383-
["inevitable critical hits"] = { flag("ForcedOutcome") },
3383+
["inevitable critical hits"] = { flag("InevitableCriticalHits") },
33843384
["walk the paths not taken"] = { },
33853385
["gain the benefits of bonded modifiers on runes and idols"] = {
33863386
flag("Condition:CanUseBondedModifiers"),

0 commit comments

Comments
 (0)