Skip to content

Commit

Permalink
Fix low-level regen in vanilla
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed Nov 29, 2023
1 parent ea29015 commit d11164c
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 71 deletions.
41 changes: 28 additions & 13 deletions libs/StatLogic/Cata_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ StatLogic.GenericStatMap[StatLogic.GenericStats.CR_HASTE] = {
}

-- Extracted from the client at GameTables/RegenMPPerSpt.txt via wow.tools.local
addon.BaseManaRegenPerSpi = {
local BaseManaRegenPerSpi = {
0.062937, 0.056900, 0.051488, 0.046267, 0.041637, 0.037784, 0.034309, 0.031172, 0.028158, 0.025460,
0.022654, 0.019904, 0.017817, 0.015771, 0.014008, 0.013650, 0.013175, 0.012832, 0.012475, 0.012073,
0.011840, 0.011494, 0.011292, 0.010990, 0.010761, 0.010546, 0.010321, 0.010151, 0.009949, 0.009740,
Expand All @@ -59,6 +59,21 @@ addon.BaseManaRegenPerSpi = {
0.003345, 0.003345, 0.003345, 0.003345, 0.003345,
}

local NormalManaRegenPerSpi = function()
local level = UnitLevel("player")
local _, int = UnitStat("player", 4)
local _, spi = UnitStat("player", 5)
return (0.001 / spi + BaseManaRegenPerSpi[level] * (int ^ 0.5)) * 5
end

local NormalManaRegenPerInt = function()
local level = UnitLevel("player")
local _, int = UnitStat("player", 4)
local _, spi = UnitStat("player", 5)
-- Derivative of regen with respect to int
return (spi * BaseManaRegenPerSpi[level] / (2 * (int ^ 0.5))) * 5
end

-- Extracted from gtChanceToMeleeCrit.db2 or from gametables/chancetomeleecrit.txt
addon.CritPerAgi = {
["WARRIOR"] = {
Expand Down Expand Up @@ -328,12 +343,12 @@ if addon.class == "DRUID" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
-- Druid: Nurturing Instinct (Rank 2) - 2,14
Expand Down Expand Up @@ -816,12 +831,12 @@ elseif addon.class == "MAGE" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
-- Mage: Wizardry - Passive: 89744
Expand Down Expand Up @@ -884,12 +899,12 @@ elseif addon.class == "PALADIN" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
-- Healers: Meditation
Expand Down Expand Up @@ -1022,12 +1037,12 @@ elseif addon.class == "PRIEST" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_MANA_REG_MOD_NORMAL_MANA_REG"] = {
Expand Down Expand Up @@ -1214,12 +1229,12 @@ elseif addon.class == "SHAMAN" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
-- Druid: Elemental Precision - Rank 3/3 - 1,7
Expand Down Expand Up @@ -1313,12 +1328,12 @@ elseif addon.class == "WARLOCK" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
-- Warlock: Metamorphosis - Buff: 47241
Expand Down
21 changes: 0 additions & 21 deletions libs/StatLogic/StatLogic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1656,27 +1656,6 @@ function StatLogic:GetSpellCritFromInt(int, class, level)
return int * StatLogic:GetSpellCritPerInt(class, level), StatLogic.Stats.SpellCrit
end

if ({
[WOW_PROJECT_BURNING_CRUSADE_CLASSIC] = true,
[WOW_PROJECT_WRATH_CLASSIC] = true,
-- TODO: [WOW_PROJECT_CATA_CLASSIC] = true,
})[WOW_PROJECT_ID] then
addon.NormalManaRegenPerSpi = function()
local level = UnitLevel("player")
local _, int = UnitStat("player", 4)
local _, spi = UnitStat("player", 5)
return (0.001 / spi + addon.BaseManaRegenPerSpi[level] * (int ^ 0.5)) * 5
end

addon.NormalManaRegenPerInt = function()
local level = UnitLevel("player")
local _, int = UnitStat("player", 4)
local _, spi = UnitStat("player", 5)
-- Derivative of regen with respect to int
return (spi * addon.BaseManaRegenPerSpi[level] / (2 * (int ^ 0.5))) * 5
end
end

----------------------------------
-- Stat Summary Ignore Settings --
----------------------------------
Expand Down
45 changes: 30 additions & 15 deletions libs/StatLogic/TBC_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ StatLogic.GenericStatMap[StatLogic.GenericStats.CR_HASTE] = {
}

-- Numbers reverse engineered by Whitetooth@Cenarius(US) (hotdogee [at] gmail [dot] com)
addon.BaseManaRegenPerSpi = {
local BaseManaRegenPerSpi = {
0.034965, 0.034191, 0.033465, 0.032526, 0.031661, 0.031076, 0.030523, 0.029994, 0.029307, 0.028661,
0.027584, 0.026215, 0.025381, 0.024300, 0.023345, 0.022748, 0.021958, 0.021386, 0.020790, 0.020121,
0.019733, 0.019155, 0.018819, 0.018316, 0.017936, 0.017576, 0.017201, 0.016919, 0.016581, 0.016233,
Expand All @@ -51,6 +51,21 @@ addon.BaseManaRegenPerSpi = {
0.010700, 0.010522, 0.010290, 0.010119, 0.009968, 0.009808, 0.009651, 0.009553, 0.009445, 0.009327,
}

local NormalManaRegenPerSpi = function()
local level = UnitLevel("player")
local _, int = UnitStat("player", 4)
local _, spi = UnitStat("player", 5)
return (0.001 / spi + BaseManaRegenPerSpi[level] * (int ^ 0.5)) * 5
end

local NormalManaRegenPerInt = function()
local level = UnitLevel("player")
local _, int = UnitStat("player", 4)
local _, spi = UnitStat("player", 5)
-- Derivative of regen with respect to int
return (spi * BaseManaRegenPerSpi[level] / (2 * (int ^ 0.5))) * 5
end

-- Numbers reverse engineered by Whitetooth@Cenarius(US) (hotdogee [at] gmail [dot] com)
addon.CritPerAgi = {
["WARRIOR"] = {
Expand Down Expand Up @@ -237,12 +252,12 @@ if addon.class == "DRUID" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -503,12 +518,12 @@ elseif addon.class == "HUNTER" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -680,12 +695,12 @@ elseif addon.class == "MAGE" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -752,12 +767,12 @@ elseif addon.class == "PALADIN" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -861,12 +876,12 @@ elseif addon.class == "PRIEST" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -1094,12 +1109,12 @@ elseif addon.class == "SHAMAN" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -1216,12 +1231,12 @@ elseif addon.class == "WARLOCK" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["regen"] = addon.NormalManaRegenPerSpi,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
{
["regen"] = addon.NormalManaRegenPerInt,
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down
55 changes: 48 additions & 7 deletions libs/StatLogic/Vanilla_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,47 @@ local StatLogic = LibStub:GetLibrary(addonName)

addon.RatingBase = {}

-- Extracted from the client at GameTables/OCTRegenMP.txt via wow.tools.local
local OCTRegenMP = {
["PALADIN"] = 0.25,
["HUNTER"] = 0.25,
["PRIEST"] = 0.25,
["SHAMAN"] = 0.25,
["MAGE"] = 0.25,
["WARLOCK"] = 0.25,
["DRUID"] = 0.25,
}

-- Extracted from the client at GameTables/RegenMPPerSpt.txt via wow.tools.local
local RegenMPPerSpt = {
["PALADIN"] = 0.100,
["HUNTER"] = 0.100,
["PRIEST"] = 0.125,
["SHAMAN"] = 0.100,
["MAGE"] = 0.125,
["WARLOCK"] = 0.100,
["DRUID"] = 0.100,
}

-- Y-intercepts from commonly cited regen formulas
local RegenMPBase = {
["PALADIN"] = 15.0,
["HUNTER"] = 15.0,
["PRIEST"] = 12.5,
["SHAMAN"] = 17.0,
["MAGE"] = 12.5,
["WARLOCK"] = 15.0,
["DRUID"] = 15.0,
}

local NormalManaRegenPerSpi = function()
local _, spi = UnitStat("player", 5)
local low = OCTRegenMP[addon.class]
local high = RegenMPPerSpt[addon.class]
local base = RegenMPBase[addon.class]
return 5 * (spi > base / (low - high) and high or low)
end

addon.BaseMeleeCrit = {
["WARRIOR"] = 0.0000,
["PALADIN"] = 1.7000,
Expand Down Expand Up @@ -130,7 +171,7 @@ if addon.class == "DRUID" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["value"] = 0.5625,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -282,7 +323,7 @@ elseif addon.class == "HUNTER" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["value"] = 0.5,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -412,7 +453,7 @@ elseif addon.class == "MAGE" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["value"] = 0.625,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -493,7 +534,7 @@ elseif addon.class == "PALADIN" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["value"] = 0.5,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -572,7 +613,7 @@ elseif addon.class == "PRIEST" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["value"] = 0.625,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -731,7 +772,7 @@ elseif addon.class == "SHAMAN" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["value"] = 0.5,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down Expand Up @@ -839,7 +880,7 @@ elseif addon.class == "WARLOCK" then
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
{
["value"] = 0.5,
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_HEALTH_REG_MOD_SPI"] = {
Expand Down
Loading

0 comments on commit d11164c

Please sign in to comment.