Skip to content

Commit 430c4ea

Browse files
author
LocalIdentity
committed
Azadi Crest
1 parent 86920f6 commit 430c4ea

4 files changed

Lines changed: 87 additions & 48 deletions

File tree

src/Data/ModCache.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12095,7 +12095,7 @@ c["Your Lightning Damage can Poison"]={{[1]={flags=0,keywordFlags=0,name="Lightn
1209512095
c["Your Lucky or Unlucky effects are instead Unexciting"]={nil,"Your Lucky or Unlucky effects are instead Unexciting "}
1209612096
c["Your Lucky or Unlucky effects are instead Unexciting Limited to 1 Runegraft of Stability"]={nil,"Your Lucky or Unlucky effects are instead Unexciting Limited to 1 Runegraft of Stability "}
1209712097
c["Your Lucky or Unlucky effects use the best or"]={nil,"Your Lucky or Unlucky effects use the best or "}
12098-
c["Your Lucky or Unlucky effects use the best or worst from three rolls instead of two"]={nil,"Your Lucky or Unlucky effects use the best or worst from three rolls instead of two "}
12098+
c["Your Lucky or Unlucky effects use the best or worst from three rolls instead of two"]={{[1]={flags=0,keywordFlags=0,name="ExtremeLuck",type="FLAG",value=true}},nil}
1209912099
c["Your Mark Transfers to another Enemy when Marked Enemy dies"]={nil,"Your Mark Transfers to another Enemy when Marked Enemy dies "}
1210012100
c["Your Mark transfers to another Enemy when Marked Enemy dies"]={nil,"Your Mark transfers to another Enemy when Marked Enemy dies "}
1210112101
c["Your Mark transfers to another Enemy when Marked Enemy dies 8% of Damage from Hits is taken from Marked Target's Life before you"]={nil,"Your Mark transfers to another Enemy when Marked Enemy dies 8% of Damage from Hits is taken from Marked Target's Life before you "}
@@ -12160,6 +12160,5 @@ c["to surrounding targets while wielding a Mace With at least 40 Dexterity in Ra
1216012160
c["until you take no Damage to Life for 2 seconds"]={nil,"until you take no Damage to Life for 2 seconds "}
1216112161
c["until you take no Damage to Life for 2 seconds 30% more Maximum Life"]={nil,"until you take no Damage to Life for 2 seconds 30% more Maximum Life "}
1216212162
c["used if you've Hit an enemy with a Weapon Recently"]={nil,"used if you've Hit an enemy with a Weapon Recently "}
12163-
c["worst from three rolls instead of two"]={nil,"worst from three rolls instead of two "}
1216412163
c["your maximum number of Crab Barriers"]={nil,"your maximum number of Crab Barriers "}
1216512164
c["your maximum number of Power Charges"]={nil,"your maximum number of Power Charges "}

src/Modules/CalcDefence.lua

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -707,23 +707,32 @@ function calcs.defence(env, actor)
707707
output.SpellBlockChance = 0
708708
output.SpellProjectileBlockChance = 0
709709
end
710-
do
711-
for _, blockType in ipairs({"BlockChance", "ProjectileBlockChance", "SpellBlockChance", "SpellProjectileBlockChance"}) do
712-
output["Effective"..blockType] = env.mode_effective and m_max(output[blockType] - enemyDB:Sum("BASE", nil, "reduceEnemyBlock"), 0) or output[blockType]
713-
local luck = 1
714-
if env.mode_effective then
715-
luck = luck * (modDB:Flag(nil, blockType.."IsLucky") and 2 or 1) / (modDB:Flag(nil, blockType.."IsUnlucky") and 2 or 1)
716-
end
717-
-- unlucky config to lower the value of block, dodge, evade etc for ehp
718-
luck = luck / (env.configInput.EHPUnluckyWorstOf or 1)
719-
while luck ~= 1 do
720-
if luck > 1 then
721-
luck = luck / 2
722-
output["Effective"..blockType] = (1 - (1 - output["Effective"..blockType] / 100) ^ 2) * 100
723-
else
724-
luck = luck * 2
725-
output["Effective"..blockType] = output["Effective"..blockType] / 100 * output["Effective"..blockType]
726-
end
710+
for _, blockType in ipairs({"BlockChance", "ProjectileBlockChance", "SpellBlockChance", "SpellProjectileBlockChance"}) do
711+
output["Effective"..blockType] = env.mode_effective and m_max(output[blockType] - enemyDB:Sum("BASE", nil, "reduceEnemyBlock"), 0) or output[blockType]
712+
local blockRolls = 0
713+
if env.mode_effective then
714+
if modDB:Flag(nil, blockType.."IsLucky") then
715+
blockRolls = blockRolls + 1
716+
end
717+
if modDB:Flag(nil, blockType.."IsUnlucky") then
718+
blockRolls = blockRolls - 1
719+
end
720+
if modDB:Flag(nil, "ExtremeLuck") then
721+
blockRolls = blockRolls * 2
722+
end
723+
if modDB:Flag(nil, "Unexciting") then
724+
blockRolls = 0
725+
end
726+
end
727+
-- unlucky config to lower the value of block, dodge, evade etc for ehp
728+
if env.configInput.EHPUnluckyWorstOf and env.configInput.EHPUnluckyWorstOf ~= 1 then
729+
blockRolls = -env.configInput.EHPUnluckyWorstOf / 2
730+
end
731+
if blockRolls ~= 0 then
732+
if blockRolls > 0 then
733+
output["Effective"..blockType] = (1 - (1 - output["Effective"..blockType] / 100) ^ (blockRolls + 1)) * 100
734+
else
735+
output["Effective"..blockType] = (output["Effective"..blockType] / 100) ^ m_abs(blockRolls) * output["Effective"..blockType]
727736
end
728737
end
729738
end
@@ -1077,22 +1086,31 @@ function calcs.defence(env, actor)
10771086
output.SpellSuppressionChance = m_min(totalSpellSuppressionChance, data.misc.SuppressionChanceCap)
10781087
output.SpellSuppressionEffect = m_max(data.misc.SuppressionEffect + modDB:Sum("BASE", nil, "SpellSuppressionEffect"), 0)
10791088

1080-
do
1081-
output.EffectiveSpellSuppressionChance = enemyDB:Flag(nil, "CannotBeSuppressed") and 0 or output.SpellSuppressionChance
1082-
local luck = 1
1083-
if env.mode_effective then
1084-
luck = luck * (modDB:Flag(nil, "SpellSuppressionChanceIsLucky") and 2 or 1) / (modDB:Flag(nil, "SpellSuppressionChanceIsUnlucky") and 2 or 1)
1089+
output.EffectiveSpellSuppressionChance = enemyDB:Flag(nil, "CannotBeSuppressed") and 0 or output.SpellSuppressionChance
1090+
local suppressRolls = 0
1091+
if env.mode_effective then
1092+
if modDB:Flag(nil, "SpellSuppressionChanceIsLucky") then
1093+
suppressRolls = suppressRolls + 1
10851094
end
1086-
-- unlucky config to lower the value of block, dodge, evade etc for ehp
1087-
luck = luck / (env.configInput.EHPUnluckyWorstOf or 1)
1088-
while luck ~= 1 do
1089-
if luck > 1 then
1090-
luck = luck / 2
1091-
output.EffectiveSpellSuppressionChance = (1 - (1 - output.EffectiveSpellSuppressionChance / 100) ^ 2) * 100
1092-
else
1093-
luck = luck * 2
1094-
output.EffectiveSpellSuppressionChance = output.EffectiveSpellSuppressionChance / 100 * output.EffectiveSpellSuppressionChance
1095-
end
1095+
if modDB:Flag(nil, "SpellSuppressionChanceIsUnlucky") then
1096+
suppressRolls = suppressRolls - 1
1097+
end
1098+
if modDB:Flag(nil, "ExtremeLuck") then
1099+
suppressRolls = suppressRolls * 2
1100+
end
1101+
if modDB:Flag(nil, "Unexciting") then
1102+
suppressRolls = 0
1103+
end
1104+
end
1105+
-- unlucky config to lower the value of block, dodge, evade etc for ehp
1106+
if env.configInput.EHPUnluckyWorstOf and env.configInput.EHPUnluckyWorstOf ~= 1 then
1107+
suppressRolls = -env.configInput.EHPUnluckyWorstOf / 2
1108+
end
1109+
if suppressRolls ~= 0 then
1110+
if suppressRolls > 0 then
1111+
output.EffectiveSpellSuppressionChance = (1 - (1 - output.EffectiveSpellSuppressionChance / 100) ^ (suppressRolls + 1)) * 100
1112+
else
1113+
output.EffectiveSpellSuppressionChance = (output.EffectiveSpellSuppressionChance / 100) ^ m_abs(suppressRolls) * output.EffectiveSpellSuppressionChance
10961114
end
10971115
end
10981116

src/Modules/CalcOffence.lua

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,8 +2826,19 @@ function calcs.offence(env, actor, activeSkill)
28262826
end
28272827
output.PreEffectiveCritChance = output.CritChance
28282828
local preLuckyCritChance = output.CritChance
2829+
local critRolls = 0
2830+
28292831
if env.mode_effective and skillModList:Flag(cfg, "CritChanceLucky") then
2830-
output.CritChance = (1 - (1 - output.CritChance / 100) ^ 2) * 100
2832+
critRolls = critRolls + 1
2833+
end
2834+
if skillModList:Flag(skillCfg, "ExtremeLuck") then
2835+
critRolls = critRolls * 2
2836+
end
2837+
if skillModList:Flag(skillCfg, "Unexciting") then
2838+
critRolls = 0
2839+
end
2840+
if critRolls ~= 0 then
2841+
output.CritChance = (1 - (1 - output.CritChance / 100) ^ (critRolls + 1)) * 100
28312842
end
28322843
local preHitCheckCritChance = output.CritChance
28332844
if env.mode_effective then
@@ -2852,9 +2863,9 @@ function calcs.offence(env, actor, activeSkill)
28522863
local overCap = preCapCritChance - 100
28532864
t_insert(breakdown.CritChance, s_format("Crit is overcapped by %.2f%% (%d%% increased Critical Strike Chance)", overCap, overCap / more / (baseCrit + base) * 100))
28542865
end
2855-
if env.mode_effective and skillModList:Flag(cfg, "CritChanceLucky") then
2866+
if env.mode_effective and critRolls ~= 0 then
28562867
t_insert(breakdown.CritChance, "Crit Chance is Lucky:")
2857-
t_insert(breakdown.CritChance, s_format("1 - (1 - %.4f) x (1 - %.4f)", preLuckyCritChance / 100, preLuckyCritChance / 100))
2868+
t_insert(breakdown.CritChance, s_format("1 - (1 - %.4f)^ %d", preLuckyCritChance / 100, critRolls + 1))
28582869
t_insert(breakdown.CritChance, s_format("= %.2f%%", preHitCheckCritChance))
28592870
end
28602871
if env.mode_effective and output.AccuracyHitChance < 100 then
@@ -3056,9 +3067,18 @@ function calcs.offence(env, actor, activeSkill)
30563067
if skillModList:Flag(skillCfg, "UnluckyHits") then
30573068
damageTypeLuckyChance = damageTypeLuckyChance - 1
30583069
end
3059-
damageTypeHitAvgNotLucky = (damageTypeHitMin / 2 + damageTypeHitMax / 2)
3060-
damageTypeHitAvgLucky = (damageTypeHitMin / 3 + 2 * damageTypeHitMax / 3)
3061-
damageTypeHitAvgUnlucky = (2 * damageTypeHitMin / 3 + damageTypeHitMax / 3)
3070+
local rolls = damageTypeLuckyChance
3071+
if skillModList:Flag(skillCfg, "ExtremeLuck") then
3072+
rolls = rolls * 2
3073+
end
3074+
if skillModList:Flag(skillCfg, "Unexciting") then
3075+
rolls = 0
3076+
end
3077+
output.DamageRolls = rolls
3078+
rolls = m_abs(rolls) + 2
3079+
damageTypeHitAvgNotLucky = (damageTypeHitMin / rolls + damageTypeHitMax / rolls)
3080+
damageTypeHitAvgLucky = (damageTypeHitMin / rolls + (rolls - 1) * damageTypeHitMax / rolls)
3081+
damageTypeHitAvgUnlucky = ((rolls - 1) * damageTypeHitMin / rolls + damageTypeHitMax / rolls)
30623082
if damageTypeLuckyChance >= 0 then
30633083
damageTypeHitAvg = damageTypeHitAvgNotLucky * (1 - damageTypeLuckyChance) + damageTypeHitAvgLucky * damageTypeLuckyChance
30643084
else
@@ -3360,18 +3380,19 @@ function calcs.offence(env, actor, activeSkill)
33603380
if breakdown then
33613381
if output.CritEffect ~= 1 then
33623382
breakdown.AverageHit = { }
3363-
if skillModList:Flag(skillCfg, "LuckyHits") and not skillModList:Flag(skillCfg, "UnluckyHits") then
3364-
t_insert(breakdown.AverageHit, s_format("(1/3) x %d + (2/3) x %d = %.1f ^8(average from non-crits)", totalHitMin, totalHitMax, totalHitAvg))
3383+
local rolls = m_abs(output.DamageRolls) + 2
3384+
if output.DamageRolls > 0 then
3385+
t_insert(breakdown.AverageHit, s_format("(1/%d) x %d + (%d/%d) x %d = %.1f ^8(average from non-crits)", rolls, totalHitMin, rolls - 1, rolls, totalHitMax, totalHitAvg))
33653386
end
3366-
if skillModList:Flag(skillCfg, "UnluckyHits") and not skillModList:Flag(skillCfg, "LuckyHits") then
3367-
t_insert(breakdown.AverageHit, s_format("(2/3) x %d + (1/3) x %d = %.1f ^8(average from non-crits)", totalHitMin, totalHitMax, totalHitAvg))
3387+
if output.DamageRolls < 0 then
3388+
t_insert(breakdown.AverageHit, s_format("(%d/%d) x %d + (1/%d) x %d = %.1f ^8(average from non-crits)", rolls - 1, rolls, totalHitMin, rolls, totalHitMax, totalHitAvg))
33683389
end
3369-
if (skillModList:Flag(skillCfg, "CritLucky") or skillModList:Flag(skillCfg, "LuckyHits")) and not skillModList:Flag(skillCfg, "UnluckyHits") then
3370-
t_insert(breakdown.AverageHit, s_format("(1/3) x %d + (2/3) x %d = %.1f ^8(average from crits)", totalCritMin, totalCritMax, totalCritAvg))
3390+
if output.DamageRolls > 0 or skillModList:Flag(skillCfg, "CritLucky") then
3391+
t_insert(breakdown.AverageHit, s_format("(1/%d) x %d + (%d/%d) x %d = %.1f ^8(average from crits)", rolls, totalCritMin, rolls - 1, rolls, totalCritMax, totalCritAvg))
33713392
t_insert(breakdown.AverageHit, "")
33723393
end
3373-
if skillModList:Flag(skillCfg, "UnluckyHits") and not (skillModList:Flag(skillCfg, "CritLucky") or skillModList:Flag(skillCfg, "LuckyHits")) then
3374-
t_insert(breakdown.AverageHit, s_format("(2/3) x %d + (1/3) x %d = %.1f ^8(average from crits)", totalCritMin, totalCritMax, totalCritAvg))
3394+
if output.DamageRolls < 0 and not skillModList:Flag(skillCfg, "CritLucky") then
3395+
t_insert(breakdown.AverageHit, s_format("(%d/%d) x %d + (1/%d) x %d = %.1f ^8(average from crits)", rolls - 1, rolls, totalCritMin, rolls, totalCritMax, totalCritAvg))
33753396
t_insert(breakdown.AverageHit, "")
33763397
end
33773398
t_insert(breakdown.AverageHit, s_format("%.1f x (1 - %.4f) ^8(damage from non-crits)", totalHitAvg, output.CritChance / 100))

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,7 @@ local specialModList = {
36893689
["y?o?u?r? ?chance to block is unlucky"] = { flag("BlockChanceIsUnlucky"), flag("ProjectileBlockChanceIsUnlucky"), flag("SpellBlockChanceIsUnlucky"), flag("SpellProjectileBlockChanceIsUnlucky") },
36903690
["y?o?u?r? ?chance to block spell damage is lucky"] = { flag("SpellBlockChanceIsLucky"), flag("SpellProjectileBlockChanceIsLucky") },
36913691
["y?o?u?r? ?chance to block spell damage is unlucky"] = { flag("SpellBlockChanceIsUnlucky"), flag("SpellProjectileBlockChanceIsUnlucky") },
3692+
["your lucky or unlucky effects use the best or worst from three rolls instead of two"] = { flag("ExtremeLuck")},
36923693
["chance to block attack or spell damage is lucky if you've blocked recently"] = {
36933694
flag("BlockChanceIsLucky", { type = "Condition", var = "BlockedRecently" }),
36943695
flag("ProjectileBlockChanceIsLucky", { type = "Condition", var = "BlockedRecently" }),

0 commit comments

Comments
 (0)