Skip to content

Commit 79c8734

Browse files
authored
Add support for Now and Again (#604)
* add support for Now and Again * refactor improve condition check for cooldownMode
1 parent 74529a4 commit 79c8734

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

src/Data/ModCache.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2929,7 +2929,7 @@ c["Skills gain a Base Life Cost equal to 50% of Base Mana Cost"]={{[1]={flags=0,
29292929
c["Skills gain a Base Life Cost equal to Base Mana Cost"]={{[1]={flags=0,keywordFlags=0,name="ManaCostAsLifeCost",type="BASE",value=100}},nil}
29302930
c["Skills have +1 to Limit"]={{}," Limit "}
29312931
c["Skills have -2 seconds to Cooldown"]={{}," seconds to Cooldown "}
2932-
c["Skills have 33% chance to not consume a Cooldown when used"]={{}," to not consume a Cooldown when used "}
2932+
c["Skills have 33% chance to not consume a Cooldown when used"]={{[1]={[1]={skillType=101,type="SkillType"},flags=0,keywordFlags=0,name="CooldownChanceNotConsume",type="BASE",value=0.33}},nil}
29332933
c["Skills have a 125% longer Perfect Timing window"]={{[1]={flags=0,keywordFlags=0,name="PerfectTiming",type="INC",value=125}},nil}
29342934
c["Skills have a 150% longer Perfect Timing window"]={{[1]={flags=0,keywordFlags=0,name="PerfectTiming",type="INC",value=150}},nil}
29352935
c["Skills reserve 50% less Spirit"]={nil,"Skills reserve 50% less Spirit "}

src/Modules/CalcOffence.lua

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,16 @@ end
278278
function calcSkillCooldown(skillModList, skillCfg, skillData)
279279
local cooldownOverride = skillModList:Override(skillCfg, "CooldownRecovery")
280280
local addedCooldown = skillModList:Sum("BASE", skillCfg, "CooldownRecovery")
281+
local noCooldownChance = skillModList:Sum("BASE", skillCfg, "CooldownChanceNotConsume")
281282
local cooldown = cooldownOverride or ((skillData.cooldown or 0) + addedCooldown) / m_max(0, calcLib.mod(skillModList, skillCfg, "CooldownRecovery"))
282283
-- If a skill can store extra uses and has a cooldown, it doesn't round the cooldown value to server ticks
283284
local rounded = false
284285
if (skillData.storedUses and skillData.storedUses > 1) or (skillData.VaalStoredUses and skillData.VaalStoredUses > 1) or skillModList:Sum("BASE", skillCfg, "AdditionalCooldownUses") > 0 then
285-
return cooldown, rounded
286+
return cooldown, rounded, nil, noCooldownChance
286287
else
287288
cooldown = m_ceil(cooldown * data.misc.ServerTickRate) / data.misc.ServerTickRate
288289
rounded = true
289-
return cooldown, rounded, addedCooldown
290+
return cooldown, rounded, addedCooldown, noCooldownChance
290291
end
291292
end
292293

@@ -1256,13 +1257,30 @@ function calcs.offence(env, actor, activeSkill)
12561257
breakdown.TrapTriggerRadius = breakdown.area(data.misc.TrapTriggerRadiusBase, areaMod, output.TrapTriggerRadius, incAreaBreakpoint, moreAreaBreakpoint, redAreaBreakpoint, lessAreaBreakpoint)
12571258
end
12581259
elseif skillData.cooldown or skillModList:Sum("BASE", skillCfg, "CooldownRecovery") ~= 0 then
1259-
local cooldown, rounded, addedCooldown = calcSkillCooldown(skillModList, skillCfg, skillData)
1260+
local cooldownMode = env.configInput.cooldownMode or "BASE"
1261+
local cooldown, rounded, addedCooldown, noCooldownChance = calcSkillCooldown(skillModList, skillCfg, skillData)
1262+
local effectiveCooldownMultiplier = 1 - noCooldownChance
1263+
local effectiveCooldown = cooldown * effectiveCooldownMultiplier
1264+
12601265
output.Cooldown = cooldown
1266+
output.EffectiveCooldown = cooldown
1267+
12611268
if breakdown then
12621269
breakdown.Cooldown = {
12631270
s_format("%.2fs ^8(base)", skillData.cooldown or 0 + addedCooldown),
12641271
s_format("/ %.2f ^8(increased/reduced cooldown recovery)", 1 + skillModList:Sum("INC", skillCfg, "CooldownRecovery") / 100),
12651272
}
1273+
1274+
if cooldownMode == "AVERAGE" and noCooldownChance > 0 then
1275+
output.EffectiveCooldown = effectiveCooldown
1276+
breakdown.EffectiveCooldown = {
1277+
s_format("Effective Cooldown:"),
1278+
unpack(breakdown.Cooldown),
1279+
}
1280+
t_insert(breakdown.EffectiveCooldown, s_format("* %.2f ^8(effect of %d%% chance to not consume cooldown)", effectiveCooldownMultiplier, noCooldownChance * 100))
1281+
t_insert(breakdown.EffectiveCooldown, s_format("= %.3fs", output.EffectiveCooldown))
1282+
end
1283+
12661284
if rounded then
12671285
t_insert(breakdown.Cooldown, s_format("rounded up to nearest server tick"))
12681286
end

src/Modules/CalcSections.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,10 @@ return {
630630
{ breakdown = "QuantityMultiplier" },
631631
{ modName = { "QuantityMultiplier" }, cfg = "skill" },
632632
}, },
633-
{ label = "Skill Cooldown", haveOutput = "Cooldown", { format = "{3:output:Cooldown}s",
633+
{ label = "Skill Cooldown", haveOutput = "Cooldown", { format = "{3:output:EffectiveCooldown}s",
634634
{ breakdown = "Cooldown" },
635-
{ modName = "CooldownRecovery", cfg = "skill" },
635+
{ breakdown = "EffectiveCooldown" },
636+
{ modName = {"CooldownRecovery", "CooldownChanceNotConsume"}, cfg = "skill" },
636637
}, },
637638
{ label = "Stored Uses", haveOutput = "StoredUses", { format = "{output:StoredUses}",
638639
{ breakdown = "StoredUses" },

src/Modules/ConfigOptions.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ local configSettings = {
153153
modList:NewMod("Condition:MinionsCreatedRecently", "FLAG", true, "Config")
154154
end },
155155
{ var = "ailmentMode", type = "list", label = "Ailment calculation mode:", tooltip = "Controls how the base damage for applying Ailments is calculated:\n\tAverage: damage is based on the average application, including both crits and non-crits\n\tCrits Only: damage is based solely on Ailments inflicted with crits", list = {{val="AVERAGE",label="Average"},{val="CRIT",label="Crits Only"}} },
156+
{ var = "cooldownMode", type = "list", label = "Cooldown calculation mode:", tooltip = "Controls how the cooldown for skills is calculated:\n\tBase: The cooldown is calculated with normal behavior.\n\tAverage: The cooldown is adjusted to reflect the average time between uses, factoring in effects such as a chance to not consume a cooldown.", list = {{val="BASE",label="Base"},{val="AVERAGE",label="Average"}} },
156157
{ var = "physMode", type = "list", label = "Random element mode:", ifFlag = "randomPhys", tooltip = "Controls how modifiers which choose a random element will function.\n\tAverage: Modifiers will grant one third of their value to ^xB97123Fire^7, ^x3F6DB3Cold^7, and ^xADAA47Lightning ^7simultaneously\n\t^xB97123Fire ^7/ ^x3F6DB3Cold ^7/ ^xADAA47Lightning^7: Modifiers will grant their full value as the specified element\nIf a modifier chooses between just two elements, the full value can only be given as those two elements.", list = {{val="AVERAGE",label="Average"},{val="FIRE",label="^xB97123Fire"},{val="COLD",label="^x3F6DB3Cold"},{val="LIGHTNING",label="^xADAA47Lightning"}} },
157158
{ var = "lifeRegenMode", type = "list", label = "^xE05030Life ^7regen calculation mode:", ifCond = { "LifeRegenBurstAvg", "LifeRegenBurstFull" }, tooltip = "Controls how ^xE05030life ^7regeneration is calculated:\n\tMinimum: does not include burst regen\n\tAverage: includes burst regen, averaged based on uptime\n\tBurst: includes full burst regen", list = {{val="MIN",label="Minimum"},{val="AVERAGE",label="Average"},{val="FULL",label="Burst"}}, apply = function(val, modList, enemyModList)
158159
if val == "AVERAGE" then

src/Modules/ModParser.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,6 +2850,10 @@ local specialModList = {
28502850
["effect and duration of flames of chayula on you is doubled"] = function() return {
28512851
mod("Multiplier:FlameEffect", "BASE", 1),
28522852
} end,
2853+
-- Chronomancer
2854+
["skills have (%d+)%% chance to not consume a cooldown when used"] = function(num) return {
2855+
mod("CooldownChanceNotConsume", "BASE", num / 100, { type = "SkillType", skillType = SkillType.Cooldown })
2856+
} end,
28532857
-- Item local modifiers
28542858
["has no sockets"] = { flag("NoSockets") },
28552859
["reflects your other ring"] = {

0 commit comments

Comments
 (0)