diff --git a/modules/energytick.lua b/modules/energytick.lua index a1273629..c86ec9e8 100644 --- a/modules/energytick.lua +++ b/modules/energytick.lua @@ -1,3 +1,20 @@ +local function getAdjustedTickTimer() + local adjustedEnergyTick = 2 + if UnitClass("player") == "Rogue" then + local _, _, _, _, currRank = GetTalentInfo(2, 16) + local bladeRushRank = currRank or 0 + + if bladeRushRank > 0 then + local agility = UnitStat("player", 2) -- 2 is agility stat index + local reductionPerAgi = 0.0006 * bladeRushRank -- 0.0006 for rank 1, 0.0012 for rank 2 + local totalReduction = agility * reductionPerAgi + adjustedEnergyTick = adjustedEnergyTick - totalReduction + end + end + + return adjustedEnergyTick +end + pfUI:RegisterModule("energytick", "vanilla:tbc", function() if not pfUI.uf or not pfUI.uf.player then return @@ -43,18 +60,6 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function() end -- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent) - local adjustedEnergyTick = 2 - if UnitClass("player") == "Rogue" then - local _, _, _, _, currRank = GetTalentInfo(2, 16) - local bladeRushRank = currRank or 0 - - if bladeRushRank > 0 then - local agility = UnitStat("player", 2) -- 2 is agility stat index - local reductionPerAgi = 0.0006 * bladeRushRank -- 0.0006 for rank 1, 0.0012 for rank 2 - local totalReduction = agility * reductionPerAgi - adjustedEnergyTick = adjustedEnergyTick - totalReduction - end - end if this.mode == "MANA" and diff < 0 then this.target = 5 @@ -64,9 +69,9 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function() else this.badtick = diff end - elseif this.mode == "ENERGY" and diff > 0 then + elseif this.mode == "ENERGY" and diff >= 0 then if not this.ignoreNextGain then - this.target = adjustedEnergyTick + this.target = getAdjustedTickTimer() end this.ignoreNextGain = false end @@ -93,7 +98,7 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function() this.current = GetTime() - this.start if this.current > this.max then - this.start, this.max, this.current = GetTime(), 2, 0 + this.start, this.max, this.current = GetTime(), getAdjustedTickTimer(), 0 end local pos = (C.unitframes.player.pwidth ~= "-1" and C.unitframes.player.pwidth or C.unitframes.player.width)