Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ stds.ecs = {
"GetUICameraInfo",
"GetUITextureKitInfo",
"GetUnitHealthModifier",
"GetUnitManaRegenRateFromSpirit",
"GetUnitMaxHealthModifier",
"GetUnitPowerModifier",
"GetUnitSpeed",
Expand Down Expand Up @@ -2767,6 +2768,7 @@ stds.ecs = {
"WOW_PROJECT_WRATH_CLASSIC",
"-----------------------------------------------------> Enums",
"LE_EXPANSION_BURNING_CRUSADE",
"LE_UNIT_STAT_SPIRIT",
"-----------------------------------------------------> GlobalStrings",
"CLOSE",
"DEFENSE",
Expand Down
40 changes: 40 additions & 0 deletions Modules/Data/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,46 @@ Data.Aura = {
[25894] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 1
[25918] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 2
},
PowerRegenPercentModifier = {
[Enum.PowerType.Energy] = {
[13750] = 1, -- Adrenaline Rush
[58427] = 0.3, -- Overkill
[66203] = -1, -- Steam Blast
[69470] = -1, -- Heat Drain
[70385] = -1, -- Abomination Vehicle Power Drain
[72242] = -1, -- Zero Power
[1231381] = 0.26, -- Feral Dedication
},
[Enum.PowerType.Mana] = {
[5419] = (ECS.IsTBC and -0.11 or nil), -- Travel Form (Passive)
[5421] = (ECS.IsTBC and -0.11 or nil), -- Aquatic Form (Passive)
[12051] = (ECS.IsClassic and 15 or nil), -- Evocation
[18371] = (ECS.IsClassic and 0.5 or nil), -- Soul Siphon
[24705] = (ECS.IsClassic and 0.25 or nil), -- Invocation of the Wickerman
[27747] = -1, -- Steam Tank Passive
[29166] = ((not ECS.IsWotlk) and 4 or nil), -- Innervate
[33948] = (ECS.IsTBC and -0.11 or nil), -- Flight Form (Passive)
[34754] = (ECS.IsWotlk and 0.16 or nil), -- Holy Concentration
[40121] = (ECS.IsTBC and -0.11 or nil), -- Swift Flight Form (Passive)
[42514] = 1, -- Arcane Surge
[49307] = 1, -- Full Mana Regen
[51623] = 5, -- Sholazar Guardian Heartbeat
[63724] = 0.32, -- Holy Concentration
[63725] = 0.5, -- Holy Concentration
[456195] = 4, -- Innervate
[468466] = 1, -- Unmaking the Simulacrum
},
[Enum.PowerType.RuneBlood] = {
[50469] = -0.5, -- Rhythm of the Fallen
[50779] = 1, -- Blood Rune Mastery
},
[Enum.PowerType.RuneFrost] = {
[50469] = -0.5, -- Rhythm of the Fallen
},
[Enum.PowerType.RuneUnholy] = {
[50469] = -0.5, -- Rhythm of the Fallen
},
},
SpellCrit = {
[24907] = ((not ECS.IsClassic) and 5 or nil), -- Moonkin Aura
[29177] = 6, -- Elemental Devastation Rank 2
Expand Down
67 changes: 40 additions & 27 deletions Modules/Data/MP5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,48 +74,61 @@ function _MP5:GetMP5ValueOnItems()
return mp5
end

local lastManaReg = 0

---@return number
function Data:GetMP5FromSpirit()
local base, _ = GetManaRegen() -- Returns mana reg per 1 second (including talent and buff modifiers)
if base < 1 then
base = lastManaReg
local regen
if ECS.IsClassic then
-- GetUnitManaRegenRateFromSpirit uses TBC formula in classic
local _, spirit, _, _ = UnitStat("player", LE_UNIT_STAT_SPIRIT)
if spirit < 50 then
regen = 0.25 * spirit
else
if classId == Data.PRIEST or classId == Data.MAGE then
regen = (12.5 + spirit/4)/2
elseif classId == Data.DRUID and (not DataUtils:IsShapeshifted()) then
regen = (15 + spirit/4.5)/2
else
regen = (15 + spirit/5)/2
end
end
else
regen = GetUnitManaRegenRateFromSpirit("player")
end
lastManaReg = base

return DataUtils:Round(base * 5, 2)
return DataUtils:Round(regen * 5, 1)
end

-- Get mana regen while casting
---@return number
function Data:GetMP5WhileCasting()
local _, casting = GetManaRegen() -- Returns mana reg per 1 second (including talent and buff modifiers)
if casting < 0.1 then
casting = 0
-- Returns mana reg per 1 second (including talent and buff casting modifiers)
local _, casting = GetManaRegen()
local modifier, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
-- castingModifier = min(1,castingModifier + _MP5:GetTalentModifier() + Data:GetSetBonusModifierMP5()) -- capped at 100%
casting = casting * 5
if ECS.IsClassic then
-- in classic GetManaRegen doesn't account for mp5 from items nor buffs
casting = casting + Data:GetMP5FromItems() + mp5BuffBonus
end

local castingModifier, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
castingModifier = min(1,castingModifier + _MP5:GetTalentModifier() + Data:GetSetBonusModifierMP5()) -- capped at 100%
local mp5Items = Data:GetMP5FromItems()
casting = (casting * 5) + mp5Items + mp5BuffBonus * castingModifier + periodicMana

return DataUtils:Round(casting, 2)
casting = casting * modifier + mp5BuffBonus + periodicMana
return DataUtils:Round(casting, 1)
end

---@return number
function Data:GetMP5OutsideCasting()
local mp5FromSpirit = Data:GetMP5FromSpirit()
local _, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
local mp5FromItems = Data:GetMP5FromItems()

local totalMP5 = mp5FromSpirit + mp5FromItems + mp5BuffBonus + periodicMana
return DataUtils:Round(totalMP5, 2)
local base, _ = GetManaRegen()
local modifier, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
local totalMP5 = base * 5
if ECS.IsClassic then
-- in classic GetManaRegen doesn't account for mp5 from items nor buffs
totalMP5 = totalMP5 + Data:GetMP5FromItems() + mp5BuffBonus
end
totalMP5 = totalMP5 * modifier + periodicMana
return DataUtils:Round(totalMP5, 1)
end

---@return number, number, number
function Data:GetMP5FromBuffs()
local mod = 0
local mod = 1
local bonus = 0
local periodic = 0
local maxmana = UnitPowerMax("player", Enum.PowerType.Mana)
Expand All @@ -127,7 +140,7 @@ function Data:GetMP5FromBuffs()
bonus = bonus + (Data.Aura.MP5[aura.spellId] or 0)
bonus = bonus + (Data.Aura.PercentageMp5[aura.spellId] or 0) * maxmana
periodic = periodic + (Data.Aura.PeriodicallyGiveMana[aura.spellId] or 0)
mod = mod + (Data.Aura.AllowCastingManaRegeneration[aura.spellId] or 0) -- assuming buffs stacking, to be investigated
mod = mod + (Data.Aura.PowerRegenPercentModifier[Enum.PowerType.Mana][aura.spellId] or 0)
if Data.Aura.IsLightningShield[aura.spellId] and Data:IsSetBonusActive(Data.setNames.THE_EARTHSHATTERER, 8) then
bonus = bonus + 15 -- 15 MP5 from Shaman T3 8 piece bonus when Lightning Shield is active
end
Expand All @@ -153,7 +166,7 @@ function Data:GetMP5FromBuffs()
end
i = i + 1
until (not aura)
return min(mod,1), bonus, periodic
return max(mod,0), bonus, periodic
end

---@return number
Expand Down
Loading