Skip to content

Commit 6681296

Browse files
update lucky mod parsing (#1298)
1 parent f5a7c75 commit 6681296

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/Modules/CalcDefence.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,13 @@ function calcs.defence(env, actor)
13961396
output.noSplitEvade = true
13971397
end
13981398
output.EvadeChance = m_min(output.EvadeChance, evadeMax)
1399+
if modDB:Flag(nil, "UnluckyEvade") then
1400+
output.EvadeChance = output.EvadeChance * output.EvadeChance / 100
1401+
output.MeleeEvadeChance = output.MeleeEvadeChance * output.MeleeEvadeChance / 100
1402+
output.ProjectileEvadeChance = output.ProjectileEvadeChance * output.ProjectileEvadeChance / 100
1403+
output.SpellEvadeChance = output.SpellEvadeChance * output.SpellEvadeChance / 100
1404+
output.SpellProjectileEvadeChance = output.SpellProjectileEvadeChance * output.SpellProjectileEvadeChance / 100
1405+
end
13991406
if breakdown then
14001407
breakdown.EvadeChance = {
14011408
s_format("Enemy level: %d ^8(%s the Configuration tab)", env.enemyLevel, env.configInput.enemyLevel and "overridden from" or "can be overridden in"),

src/Modules/CalcOffence.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,12 +3545,10 @@ function calcs.offence(env, actor, activeSkill)
35453545
if skillModList:Flag(skillCfg, "LuckyHits")
35463546
or (pass == 2 and damageType == "Lightning" and skillModList:Flag(skillCfg, "LightningNoCritLucky"))
35473547
or (pass == 1 and skillModList:Flag(skillCfg, "CritLucky"))
3548-
or (damageType == "Lightning" and modDB:Flag(nil, "LightningLuckHits"))
3549-
or (damageType == "Chaos" and modDB:Flag(nil, "ChaosLuckyHits"))
35503548
or ((damageType == "Lightning" or damageType == "Cold" or damageType == "Fire") and skillModList:Flag(skillCfg, "ElementalLuckHits")) then
35513549
damageTypeLuckyChance = 1
35523550
else
3553-
damageTypeLuckyChance = m_min(skillModList:Sum("BASE", skillCfg, "LuckyHitsChance"), 100) / 100
3551+
damageTypeLuckyChance = m_min(skillModList:Sum("BASE", skillCfg, damageType.."LuckyHitsChance", "LuckyHitsChance"), 100) / 100
35543552
end
35553553
damageTypeHitAvgNotLucky = (damageTypeHitMin / 2 + damageTypeHitMax / 2)
35563554
damageTypeHitAvgLucky = (damageTypeHitMin / 3 + 2 * damageTypeHitMax / 3)

src/Modules/ModParser.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,10 +2768,10 @@ local specialModList = {
27682768
["chance to block spell damage is equal to chance to block attack damage"] = { flag("SpellBlockChanceIsBlockChance") },
27692769
["maximum chance to block spell damage is equal to maximum chance to block attack damage"] = { flag("SpellBlockChanceMaxIsBlockChanceMax") },
27702770
["attack damage is lucky if you[' ]h?a?ve blocked in the past (%d+) seconds"] = {
2771-
flag("LuckyHits", nil, ModFlag.Attack, { type = "Condition", var = "BlockedRecently" })
2771+
mod("LuckyHitsChance", "BASE", 100, nil, ModFlag.Attack, { type = "Condition", var = "BlockedRecently" })
27722772
},
27732773
["attack damage while dual wielding is lucky if you[' ]h?a?ve blocked in the past (%d+) seconds"] = {
2774-
flag("LuckyHits", nil, ModFlag.Attack, { type = "Condition", var = "BlockedRecently" }, { type = "Condition", var = "DualWielding" })
2774+
mod("LuckyHitsChance", "BASE", 100, nil, ModFlag.Attack, { type = "Condition", var = "BlockedRecently" }, { type = "Condition", var = "DualWielding" })
27752775
},
27762776
["hits ignore enemy monster physical damage reduction if you[' ]h?a?ve blocked in the past (%d+) seconds"] = {
27772777
flag("IgnoreEnemyPhysicalDamageReduction", { type = "Condition", var = "BlockedRecently" })
@@ -3824,11 +3824,12 @@ local specialModList = {
38243824
["%+(%d+)%% to off hand critical damage bonus per murderous eye jewel affecting you, up to a maximum of %+(%d+)%%"] = function(num, _, limit) return {
38253825
mod("CritMultiplier", "BASE", num, { type = "Multiplier", var = "MurderousEyeJewel", globalLimit = tonumber(limit), globalLimitKey = "TecrodGazeOffHand" }, { type = "Condition", var = "OffHandAttack" })
38263826
} end,
3827-
["nearby allies' damage with hits is lucky"] = { mod("ExtraAura", "LIST", { onlyAllies = true, mod = flag("LuckyHits") }) },
3828-
["damage with hits is lucky against heavy stunned enemies"] = { flag("LuckyHits", { type = "ActorCondition", actor = "enemy", var = "HeavyStunned" }) },
3829-
["damage with hits is lucky against enemies that are on low life"] = { flag("LuckyHits", { type = "ActorCondition", actor = "enemy", var = "LowLife" }) },
3830-
["your damage with hits is lucky"] = { flag("LuckyHits") },
3831-
["chaos damage with hits is lucky"] = { flag("ChaosLuckyHits") },
3827+
["nearby allies' damage with hits is lucky"] = { mod("ExtraAura", "LIST", { onlyAllies = true, mod = mod("LuckyHitsChance", "BASE", 100) }) },
3828+
["damage with hits is lucky against heavy stunned enemies"] = { mod("LuckyHitsChance", "BASE", 100, { type = "ActorCondition", actor = "enemy", var = "HeavyStunned" }) },
3829+
["damage with hits is lucky against enemies that are on low life"] = { mod("LuckyHitsChance", "BASE", 100, { type = "ActorCondition", actor = "enemy", var = "LowLife" }) },
3830+
["your damage with hits is lucky"] = { mod("LuckyHitsChance", "BASE", 100) },
3831+
["(%w+) damage with hits is lucky"] = function(_, damageType) return { mod(firstToUpper(damageType).."LuckyHitsChance", "BASE", 100) } end,
3832+
["(%d+)%% chance for (%w*) ?damage with hits to be lucky"] = function(num, _, damageType) return { mod(firstToUpper(damageType).."LuckyHitsChance", "BASE", num) } end,
38323833
["elemental damage with hits is lucky while you are shocked"] = { flag("ElementalLuckHits", { type = "Condition", var = "Shocked" }) },
38333834
["break (%d+)%% of armour on heavy stunning an enemy"] = { flag("Condition:CanArmourBreak", { type = "GlobalEffect", effectType = "Buff", effectName = "ArmourBreak" }) },
38343835
["break (%d+)%% increased armour"] = function(num) return { mod("ArmourBreakPerHit", "INC", num)} end,
@@ -3898,7 +3899,7 @@ local specialModList = {
38983899
["you are at maximum chance to block attack damage if you have not blocked recently"] = { flag("MaxBlockIfNotBlockedRecently", { type = "Condition", var = "BlockedRecently", neg = true }) },
38993900
["you are at maximum chance to block spell damage if you have not blocked recently"] = { flag("MaxSpellBlockIfNotBlockedRecently", { type = "Condition", var = "BlockedRecently", neg = true }) },
39003901
["%+(%d+)%% chance to block attack damage if you have not blocked recently"] = function(num) return { mod("BlockChance", "BASE", num, { type = "Condition", var = "BlockedRecently", neg = true }) } end,
3901-
["block chance is lucky"] = { flag("BlockChanceIsLucky") },
3902+
["chance to block damage is lucky"] = { flag("BlockChanceIsLucky") },
39023903
["y?o?u?r? ?chance to block is lucky"] = { flag("BlockChanceIsLucky"), flag("ProjectileBlockChanceIsLucky"),flag("SpellBlockChanceIsLucky"), flag("SpellProjectileBlockChanceIsLucky") },
39033904
["y?o?u?r? ?chance to block is unlucky"] = { flag("BlockChanceIsUnlucky"), flag("ProjectileBlockChanceIsUnlucky"), flag("SpellBlockChanceIsUnlucky"), flag("SpellProjectileBlockChanceIsUnlucky") },
39043905
["chance to block attack or spell damage is lucky if you've blocked recently"] = {
@@ -4524,6 +4525,7 @@ local specialModList = {
45244525
["attacks cannot hit you"] = { flag("AlwaysEvade") },
45254526
["attacks against you always hit"] = { flag("CannotEvade") },
45264527
["maximum chance to evade is (%d+)%%"] = function(num) return { mod("EvadeChanceMax", "MAX", num) } end,
4528+
["chance to evade is unlucky"] = { flag("UnluckyEvade") },
45274529
["modifiers to maximum block chance instead apply to maximum resistances"] = { flag("MaxBlockChanceModsApplyMaxResist") },
45284530
["you cannot block"] = { flag("CannotBlockAttacks")},
45294531
["cannot block"] = { flag("CannotBlockAttacks"), flag("CannotBlockSpells") },

0 commit comments

Comments
 (0)