Skip to content

Commit 083e82b

Browse files
authored
Add support for "Critical Strike" (Amazon Ascendancy Notable) (#879)
* Add support for Hit Chance exceeding 100 percent * Add uncapped hit chance to BuildDisplayStats * Add support for additional crit chance from excess hit chance * Improve base crit bonus calculation and readability --------- Co-authored-by: majochem <majochem@users.noreply.github.com>
1 parent 57b67f4 commit 083e82b

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

src/Modules/BuildDisplayStats.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ local displayStats = {
3333
{ stat = "CritMultiplier", label = "Crit Multiplier", fmt = "d%%", pc = true, condFunc = function(v,o) return (o.CritChance or 0) > 0 end },
3434
{ stat = "HitChance", label = "Hit Chance", fmt = ".0f%%", flag = "attack" },
3535
{ stat = "HitChance", label = "Hit Chance", fmt = ".0f%%", condFunc = function(v,o) return o.enemyHasSpellBlock end },
36+
{ stat = "AccuracyHitChanceUncapped", label = "Uncap. Hit Chance", fmt = ".0f%%", flag = "attack", condFunc = function(v,o) if o.AccuracyHitChanceUncapped then return o.AccuracyHitChanceUncapped > 100 end end },
3637
{ stat = "TotalDPS", label = "Hit DPS", fmt = ".1f", compPercent = true, flag = "notAverage" },
3738
{ stat = "PvpTotalDPS", label = "PvP Hit DPS", fmt = ".1f", compPercent = true, flag = "notAveragePvP" },
3839
{ stat = "TotalDPS", label = "Hit DPS", fmt = ".1f", compPercent = true, flag = "showAverage", condFunc = function(v,o) return (o.TriggerTime or 0) ~= 0 end },

src/Modules/CalcDefence.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ function calcs.hitChance(evasion, accuracy)
3636
return m_max(m_min(round(rawChance), 100), 5)
3737
end
3838

39+
-- Calculate uncapped hit chance for mods that enable "Chance to hit with Attacks can exceed 100%"
40+
function calcs.hitChanceUncapped(evasion, accuracy)
41+
if accuracy < 0 then
42+
return 5
43+
end
44+
local rawChance = ( accuracy * 1.5 ) / ( accuracy + evasion ) * 100
45+
return m_max(round(rawChance), 5)
46+
end
3947
-- Calculate damage reduction from armour, float
4048
function calcs.armourReductionF(armour, raw)
4149
if armour == 0 and raw == 0 then

src/Modules/CalcOffence.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,6 +2194,26 @@ function calcs.offence(env, actor, activeSkill)
21942194
}
21952195
end
21962196
end
2197+
-- Accounting for mods that enable "Chance to hit with Attacks can exceed 100%"
2198+
if skillModList:Flag(nil,"Condition:HitChanceCanExceed100") and output.AccuracyHitChance == 100 then
2199+
local enemyEvasion = m_max(round(calcLib.val(enemyDB, "Evasion")), 0)
2200+
output.AccuracyHitChanceUncapped = m_max(calcs.hitChanceUncapped(enemyEvasion, accuracyVsEnemy) * calcLib.mod(skillModList, cfg, "HitChance"), output.AccuracyHitChance) -- keep higher chance in case of "CannotBeEvaded"
2201+
if breakdown and breakdown.AccuracyHitChance then
2202+
t_insert(breakdown.AccuracyHitChance, "Uncapped hit chance: " .. output.AccuracyHitChanceUncapped .. "%")
2203+
elseif breakdown then
2204+
breakdown.AccuracyHitChance = {
2205+
"Enemy level: "..env.enemyLevel..(env.configInput.enemyLevel and " ^8(overridden from the Configuration tab" or " ^8(can be overridden in the Configuration tab)"),
2206+
"Enemy evasion: "..enemyEvasion,
2207+
"Approximate hit chance: "..output.AccuracyHitChance.."%",
2208+
"Uncapped hit chance: " .. output.AccuracyHitChanceUncapped .. "%"
2209+
}
2210+
end
2211+
local handCondition = (pass.label == "Off Hand") and "OffHandAttack" or "MainHandAttack"
2212+
if output.AccuracyHitChanceUncapped - 100 > 0 then
2213+
skillModList:NewMod("Multiplier:ExcessHitChance", "BASE", round(output.AccuracyHitChanceUncapped - 100, 2), "HitChanceCanExceed100", { type = "Condition", var = handCondition})
2214+
end
2215+
2216+
end
21972217
--enemy block chance
21982218
output.enemyBlockChance = m_max(m_min((enemyDB:Sum("BASE", cfg, "BlockChance") or 0), 100) - skillModList:Sum("BASE", cfg, "reduceEnemyBlock"), 0)
21992219
if enemyDB:Flag(nil, "CannotBlockAttacks") and isAttack then
@@ -2451,6 +2471,7 @@ function calcs.offence(env, actor, activeSkill)
24512471
-- Combine hit chance and attack speed
24522472
combineStat("AccuracyHitChance", "AVERAGE")
24532473
combineStat("HitChance", "AVERAGE")
2474+
combineStat("AccuracyHitChanceUncapped", "AVERAGE")
24542475
combineStat("Speed", "AVERAGE")
24552476
combineStat("HitSpeed", "OR")
24562477
combineStat("HitTime", "OR")

src/Modules/ModParser.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,6 +2380,9 @@ local specialModList = {
23802380
["leeche?s? ([%d%.]+)%% of (%a+) attack damage as life"] = function(num, _, dmgType) return {
23812381
mod(firstToUpper(dmgType) .. "DamageLifeLeech", "BASE", num, nil, ModFlag.Attack, 0),
23822382
} end,
2383+
-- Amazon
2384+
["chance to hit with attacks can exceed 100%%"] = {flag("Condition:HitChanceCanExceed100", { type = "Skilltype", skillType = SkillType.Attack})},
2385+
["gain additional critical hit chance equal to (%d+)%% of excess chance to hit with attacks"] = function(num) return { mod("CritChance", "BASE", 0.01 * num, { type = "Multiplier", var = "ExcessHitChance" }, { type = "SkillType", skillType = SkillType.Attack})} end,
23832386
-- Ascendant
23842387
["grants (%d+) passive skill points?"] = function(num) return { mod("ExtraPoints", "BASE", num) } end,
23852388
["can allocate passives from the %a+'s starting point"] = { },

0 commit comments

Comments
 (0)