Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split calc defence and only run ehp calcs on first pass of full dps #5773

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Modules/CalcDefence.lua
Expand Up @@ -230,7 +230,7 @@ function calcs.reducePoolsByDamage(poolTable, damageTable, actor)
}
end

-- Performs all defensive calculations
-- Performs all ingame and related defensive calculations
function calcs.defence(env, actor)
local modDB = actor.modDB
local enemyDB = actor.enemy.modDB
Expand Down Expand Up @@ -1132,6 +1132,16 @@ function calcs.defence(env, actor)
for _, ailment in ipairs(data.ailmentTypeList) do
output["Self"..ailment.."Effect"] = calcLib.mod(modDB, nil, "Self"..ailment.."Effect") * (modDB:Flag(nil, "Condition:"..ailment.."edSelf") and calcLib.mod(modDB, nil, "Enemy"..ailment.."Effect") or calcLib.mod(enemyDB, nil, "Enemy"..ailment.."Effect")) * 100
end
end

-- Performs all extra defensive calculations ( eg EHP, maxHit )
function calcs.buildDefenceEstimations(env, actor)
local modDB = actor.modDB
local enemyDB = actor.enemy.modDB
local output = actor.output
local breakdown = actor.breakdown

local condList = modDB.conditions

--Enemy damage input and modifications
do
Expand Down
12 changes: 10 additions & 2 deletions src/Modules/CalcPerform.lua
Expand Up @@ -1169,10 +1169,12 @@ end
-- 8. Processes buffs and debuffs
-- 9. Processes charges and misc buffs (doActorMisc)
-- 10. Calculates defence and offence stats (calcs.defence, calcs.offence)
function calcs.perform(env, avoidCache)
function calcs.perform(env, avoidCache, fullDPSSkipEHP)
local avoidCache = avoidCache or false
local modDB = env.modDB
local enemyDB = env.enemyDB

local fullDPSSkipEHP = fullDPSSkipEHP or false

-- Merge keystone modifiers
env.keystonesAdded = { }
Expand Down Expand Up @@ -2720,7 +2722,7 @@ function calcs.perform(env, avoidCache)

-- Make a copy of this skill so we can add new modifiers to the copy affected by Mirage Archers
local newSkill, newEnv = calcs.copyActiveSkill(env, calcMode, usedSkill)

-- Add new modifiers to new skill (which already has all the old skill's modifiers)
newSkill.skillModList:NewMod("Damage", "MORE", moreDamage, "Mirage Archer", env.player.mainSkill.ModFlags, env.player.mainSkill.KeywordFlags)
newSkill.skillModList:NewMod("Speed", "MORE", moreAttackSpeed, "Mirage Archer", env.player.mainSkill.ModFlags, env.player.mainSkill.KeywordFlags)
Expand Down Expand Up @@ -3420,10 +3422,16 @@ function calcs.perform(env, avoidCache)

-- Defence/offence calculations
calcs.defence(env, env.player)
if not fullDPSSkipEHP then
calcs.buildDefenceEstimations(env, env.player)
end
calcs.offence(env, env.player, env.player.mainSkill)

if env.minion then
calcs.defence(env, env.minion)
if not fullDPSSkipEHP then -- main.build.calcsTab.input.showMinion and -- should be disabled unless "calcsTab.input.showMinion" is true
calcs.buildDefenceEstimations(env, env.minion)
end
calcs.offence(env, env.minion, env.minion.mainSkill)
end

Expand Down
4 changes: 2 additions & 2 deletions src/Modules/Calcs.lua
Expand Up @@ -203,9 +203,9 @@ function calcs.calcFullDPS(build, mode, override, specEnv)
GlobalCache.numActiveSkillInFullDPS = 0
for _, activeSkill in ipairs(fullEnv.player.activeSkillList) do
if activeSkill.socketGroup and activeSkill.socketGroup.includeInFullDPS and not isExcludedFromFullDps(activeSkill) then
GlobalCache.numActiveSkillInFullDPS = GlobalCache.numActiveSkillInFullDPS + 1
local activeSkillCount, enabled = getActiveSkillCount(activeSkill)
if enabled then
GlobalCache.numActiveSkillInFullDPS = GlobalCache.numActiveSkillInFullDPS + 1
local cachedData = getCachedData(activeSkill, mode)
if cachedData and next(override) == nil and not GlobalCache.noCache then
usedEnv = cachedData.Env
Expand All @@ -217,7 +217,7 @@ function calcs.calcFullDPS(build, mode, override, specEnv)
GlobalCache.noCache = nil
end
fullEnv.player.mainSkill = activeSkill
calcs.perform(fullEnv, true)
calcs.perform(fullEnv, true, (GlobalCache.numActiveSkillInFullDPS ~= 1))
usedEnv = fullEnv
GlobalCache.noCache = forceCache
end
Expand Down