From 5ba531d179da53aa26c8e8d78da83165b2f72784 Mon Sep 17 00:00:00 2001 From: Nostrademous Date: Sun, 28 Mar 2021 10:22:00 -0400 Subject: [PATCH] fixed up conditional code --- Modules/CalcPerform.lua | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Modules/CalcPerform.lua b/Modules/CalcPerform.lua index 38857936..e4a55343 100644 --- a/Modules/CalcPerform.lua +++ b/Modules/CalcPerform.lua @@ -28,18 +28,12 @@ local function findTriggerSkill(env, skill, source, triggerRate, reqManaCost) if GlobalCache.cachedData["CACHE"][uuid] then -- Below code sets the trigger skill to highest APS skill it finds that meets all conditions - if not source and GlobalCache.cachedData["CACHE"][uuid].Speed then - if reqManaCost and GlobalCache.cachedData["CACHE"][uuid].ManaCost and GlobalCache.cachedData["CACHE"][uuid].ManaCost >= reqManaCost then - return skill, GlobalCache.cachedData["CACHE"][uuid].Speed - elseif not reqManaCost then - return skill, GlobalCache.cachedData["CACHE"][uuid].Speed - end - elseif GlobalCache.cachedData["CACHE"][uuid].Speed and GlobalCache.cachedData["CACHE"][uuid].Speed > triggerRate then - if reqManaCost and GlobalCache.cachedData["CACHE"][uuid].ManaCost and GlobalCache.cachedData["CACHE"][uuid].ManaCost >= reqManaCost then - return skill, GlobalCache.cachedData["CACHE"][uuid].Speed - elseif not reqManaCost then - return skill, GlobalCache.cachedData["CACHE"][uuid].Speed - end + local cachedSpeed = GlobalCache.cachedData["CACHE"][uuid].Speed + local cachedManaCost = GlobalCache.cachedData["CACHE"][uuid].ManaCost + + if ((not source and cachedSpeed) or (cachedSpeed and cachedSpeed > triggerRate)) and + ((reqManaCost and cachedManaCost and cachedManaCost >= reqManaCost) or not reqManaCost) then + return skill, GlobalCache.cachedData["CACHE"][uuid].Speed end end return source, triggerRate