Skip to content

Commit

Permalink
Add new mana regen Stats and StatMod relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed Dec 12, 2024
1 parent 81f5605 commit 24b17b3
Show file tree
Hide file tree
Showing 8 changed files with 259 additions and 142 deletions.
123 changes: 87 additions & 36 deletions RatingBuster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2545,18 +2545,13 @@ do
local healingPower = statModContext("ADD_HEALING_MOD_INT")
self:ProcessStat(StatLogic.Stats.HealingPower, healingPower, infoTable, link, color, statModContext, false, db.profile.showHealingFromInt)

if db.profile.showMP5FromInt then
local effect = value * statModContext("ADD_MANA_REG_MOD_INT")
+ value * statModContext("ADD_NORMAL_MANA_REG_MOD_INT") * statModContext("MOD_NORMAL_MANA_REG") * math.min(statModContext("ADD_MANA_REG_MOD_NORMAL_MANA_REG"), 1)
+ value * statModContext("ADD_MANA_MOD_INT") * statModContext("MOD_MANA") * statModContext("ADD_MANA_REG_MOD_MANA") -- Replenishment
infoTable[StatLogic.Stats.ManaRegen] = infoTable[StatLogic.Stats.ManaRegen] + effect
end
if db.profile.showMP5NCFromInt then
local effect = value * statModContext("ADD_MANA_REG_MOD_INT")
+ value * statModContext("ADD_NORMAL_MANA_REG_MOD_INT") * statModContext("MOD_NORMAL_MANA_REG")
+ value * statModContext("ADD_MANA_MOD_INT") * statModContext("MOD_MANA") * statModContext("ADD_MANA_REG_MOD_MANA") -- Replenishment
infoTable[StatLogic.Stats.ManaRegenNotCasting] = infoTable[StatLogic.Stats.ManaRegenNotCasting] + effect
end
local genericManaRegen = value * statModContext("ADD_GENERIC_MANA_REGEN_MOD_INT")
-- TODO: Options key using wrong dest stat
self:ProcessStat(StatLogic.Stats.GenericManaRegen, genericManaRegen, infoTable, link, color, statModContext, false, db.profile.showManaRegenFromInt)

local normalManaRegen = value * statModContext("ADD_NORMAL_MANA_REGEN_MOD_INT")
-- TODO: Options key using wrong dest stat
self:ProcessStat(StatLogic.Stats.NormalManaRegen, normalManaRegen, infoTable, link, color, statModContext, false, db.profile.showManaRegenFromInt)

local rangedAttackPower = value * statModContext("ADD_RANGED_AP_MOD_INT")
self:ProcessStat(StatLogic.Stats.RangedAttackPower, rangedAttackPower, infoTable, link, color, statModContext, false, db.profile.showRAPFromInt)
Expand All @@ -2572,14 +2567,10 @@ do
if isBaseStat and mod ~= 1 and db.profile.showModifiedSpirit then
infoTable["Decimal"] = value
end
if db.profile.showMP5FromSpi then
local effect = value * statModContext("ADD_NORMAL_MANA_REG_MOD_SPI") * statModContext("MOD_NORMAL_MANA_REG") * math.min(statModContext("ADD_MANA_REG_MOD_NORMAL_MANA_REG"), 1)
infoTable[StatLogic.Stats.ManaRegen] = infoTable[StatLogic.Stats.ManaRegen] + effect
end
if db.profile.showMP5NCFromSpi then
local effect = value * statModContext("ADD_NORMAL_MANA_REG_MOD_SPI") * statModContext("MOD_NORMAL_MANA_REG")
infoTable[StatLogic.Stats.ManaRegenNotCasting] = infoTable[StatLogic.Stats.ManaRegenNotCasting] + effect
end

local normalManaRegen = value * statModContext("ADD_NORMAL_MANA_REGEN_MOD_SPI")
-- TODO: Options key using wrong dest stat
self:ProcessStat(StatLogic.Stats.NormalManaRegen, normalManaRegen, infoTable, link, color, statModContext, false, db.profile.showManaRegenFromSpi)

local healthRegenOutOfCombat = value * statModContext("ADD_NORMAL_HEALTH_REG_MOD_SPI")
self:ProcessStat(StatLogic.Stats.HealthRegenOutOfCombat, healthRegenOutOfCombat, infoTable, link, color, statModContext, false, db.profile.showHP5NCFromSpi)
Expand Down Expand Up @@ -2641,6 +2632,49 @@ do
local healingPower = value * statModContext("ADD_HEALING_MOD_MANA")
-- TODO: Options key using wrong source stat
self:ProcessStat(StatLogic.Stats.HealingPower, healingPower, infoTable, link, color, statModContext, false, db.profile.showHealingFromInt)

local genericManaRegen = value * statModContext("ADD_GENERIC_MANA_REGEN_MOD_MANA")
-- TODO: Options key using wrong dest AND source stats
self:ProcessStat(StatLogic.Stats.GenericManaRegen, genericManaRegen, infoTable, link, color, statModContext, false, db.profile.showManaRegenFromInt)
elseif stat == StatLogic.Stats.NormalManaRegen then
local mod = statModContext("MOD_NORMAL_MANA_REGEN")
value = value * mod

local manaRegen = value * math.min(statModContext("ADD_MANA_REGEN_MOD_NORMAL_MANA_REGEN"), 1)
-- TODO: Options key using wrong source stat
self:ProcessStat(StatLogic.Stats.ManaRegen, manaRegen, infoTable, link, color, statModContext, false, show and db.profile.showManaRegenFromManaRegen)

local manaRegenNotCasting = value * statModContext("ADD_MANA_REGEN_NOT_CASTING_MOD_NORMAL_MANA_REGEN")
-- TODO: Options key using wrong source stat
self:ProcessStat(StatLogic.Stats.ManaRegenNotCasting, manaRegenNotCasting, infoTable, link, color, statModContext, false, show and db.profile.showManaRegenNotCastingFromManaRegen)

local manaRegenOutOfCombat = value * statModContext("ADD_MANA_REGEN_OUT_OF_COMBAT_MOD_NORMAL_MANA_REGEN")
-- TODO: Options key using wrong source stat
self:ProcessStat(StatLogic.Stats.ManaRegenOutOfCombat, manaRegenOutOfCombat, infoTable, link, color, statModContext, false, show and db.profile.showManaRegenOutOfCombatFromManaRegen)
elseif stat == StatLogic.Stats.GenericManaRegen then
local manaRegen = value * statModContext("ADD_MANA_REGEN_MOD_GENERIC_MANA_REGEN")
-- TODO: Options key using wrong source stat
self:ProcessStat(StatLogic.Stats.ManaRegen, manaRegen, infoTable, link, color, statModContext, false, show and db.profile.showManaRegenFromManaRegen)

local manaRegenNotCasting = value * statModContext("ADD_MANA_REGEN_NOT_CASTING_MOD_GENERIC_MANA_REGEN")
-- TODO: Options key using wrong source stat
self:ProcessStat(StatLogic.Stats.ManaRegenNotCasting, manaRegenNotCasting, infoTable, link, color, statModContext, false, show and db.profile.showManaRegenNotCastingFromManaRegen)

local manaRegenOutOfCombat = value * statModContext("ADD_MANA_REGEN_OUT_OF_COMBAT_MOD_GENERIC_MANA_REGEN")
-- TODO: Options key using wrong source stat
self:ProcessStat(StatLogic.Stats.ManaRegenOutOfCombat, manaRegenOutOfCombat, infoTable, link, color, statModContext, false, show and db.profile.showManaRegenOutOfCombatFromManaRegen)
elseif stat == StatLogic.Stats.ManaRegen then
if show then
infoTable[stat] = infoTable[stat] + value
end
elseif stat == StatLogic.Stats.ManaRegenNotCasting then
if show then
infoTable[stat] = infoTable[stat] + value
end
elseif stat == StatLogic.Stats.ManaRegenOutOfCombat then
if show then
infoTable[stat] = infoTable[stat] + value
end
elseif stat == StatLogic.Stats.SpellCrit then
if show then
infoTable[stat] = infoTable[stat] + value
Expand Down Expand Up @@ -3072,30 +3106,47 @@ local summaryCalcData = {
+ summaryFunc[StatLogic.Stats.Health](sum, statModContext) * statModContext("ADD_NORMAL_HEALTH_REG_MOD_HEALTH") * statModContext("MOD_NORMAL_HEALTH_REG")
end,
},
-- Mana Regen - MANA_REG, SPI, INT
{
option = "sumMP5",
option = "sumGenericManaRegen",
stat = StatLogic.Stats.GenericManaRegen,
func = function(sum, statModContext)
return sum[StatLogic.Stats.GenericManaRegen]
+ sum[StatLogic.Stats.Intellect] * statModContext("ADD_GENERIC_MANA_REGEN_MOD_INT")
+ summaryFunc[StatLogic.Stats.Mana](sum, statModContext) * statModContext("ADD_GENERIC_MANA_REGEN_MOD_MANA")
end,
},
{
option = "sumNormalManaRegen",
stat = StatLogic.Stats.NormalManaRegen,
func = function(sum, statModContext)
return statModContext("MOD_NORMAL_MANA_REGEN") * (
sum[StatLogic.Stats.Intellect] * statModContext("ADD_NORMAL_MANA_REGEN_MOD_INT")
+ sum[StatLogic.Stats.Spirit] * statModContext("ADD_NORMAL_MANA_REGEN_MOD_SPI")
)
end,
},
{
option = "sumManaRegen",
stat = StatLogic.Stats.ManaRegen,
func = function(sum, statModContext)
return sum[StatLogic.Stats.ManaRegen]
+ sum[StatLogic.Stats.Intellect] * statModContext("ADD_MANA_REG_MOD_INT")
+ math.min(statModContext("ADD_MANA_REG_MOD_NORMAL_MANA_REG"), 1) * statModContext("MOD_NORMAL_MANA_REG") * (
sum[StatLogic.Stats.Intellect] * statModContext("ADD_NORMAL_MANA_REG_MOD_INT")
+ sum[StatLogic.Stats.Spirit] * statModContext("ADD_NORMAL_MANA_REG_MOD_SPI")
) + summaryFunc[StatLogic.Stats.Mana](sum, statModContext) * statModContext("ADD_MANA_REG_MOD_MANA")
return summaryFunc[StatLogic.Stats.GenericManaRegen](sum, statModContext) * statModContext("ADD_MANA_REGEN_MOD_GENERIC_MANA_REGEN")
+ summaryFunc[StatLogic.Stats.NormalManaRegen](sum, statModContext) * math.min(statModContext("ADD_MANA_REGEN_MOD_NORMAL_MANA_REGEN"), 1)
end,
},
-- Mana Regen while Not casting - MANA_REG, SPI, INT
{
option = "sumMP5NC",
option = "sumManaRegenNotCasting",
stat = StatLogic.Stats.ManaRegenNotCasting,
func = function(sum, statModContext)
return sum[StatLogic.Stats.ManaRegen]
+ sum[StatLogic.Stats.Intellect] * statModContext("ADD_MANA_REG_MOD_INT")
+ statModContext("MOD_NORMAL_MANA_REG") * (
sum[StatLogic.Stats.Intellect] * statModContext("ADD_NORMAL_MANA_REG_MOD_INT")
+ sum[StatLogic.Stats.Spirit] * statModContext("ADD_NORMAL_MANA_REG_MOD_SPI")
) + summaryFunc[StatLogic.Stats.Mana](sum, statModContext) * statModContext("ADD_MANA_REG_MOD_MANA")
return summaryFunc[StatLogic.Stats.GenericManaRegen](sum, statModContext) * statModContext("ADD_MANA_REGEN_NOT_CASTING_MOD_GENERIC_MANA_REGEN")
+ summaryFunc[StatLogic.Stats.NormalManaRegen](sum, statModContext) * statModContext("ADD_MANA_REGEN_NOT_CASTING_MOD_NORMAL_MANA_REGEN")
end,
},
{
option = "sumManaRegenOutOfCombat",
stat = StatLogic.Stats.ManaRegenOutOfCombat,
func = function(sum, statModContext)
return summaryFunc[StatLogic.Stats.GenericManaRegen](sum, statModContext) * statModContext("ADD_MANA_REGEN_OUT_OF_COMBAT_MOD_GENERIC_MANA_REGEN")
+ summaryFunc[StatLogic.Stats.NormalManaRegen](sum, statModContext) * statModContext("ADD_MANA_REGEN_OUT_OF_COMBAT_MOD_NORMAL_MANA_REGEN")
end,
},
---------------------
Expand Down
50 changes: 31 additions & 19 deletions libs/StatLogic/Cata_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -959,12 +959,12 @@ if addon.class == "DRUID" then
["value"] = 1,
},
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
["ADD_NORMAL_MANA_REGEN_MOD_SPI"] = {
{
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
["ADD_NORMAL_MANA_REGEN_MOD_INT"] = {
{
["regen"] = NormalManaRegenPerInt,
},
Expand All @@ -979,7 +979,7 @@ if addon.class == "DRUID" then
},
},
},
["ADD_MANA_REG_MOD_NORMAL_MANA_REG"] = {
["ADD_MANA_REGEN_MOD_NORMAL_MANA_REGEN"] = {
-- Passive: Meditation
{
["value"] = 0.50,
Expand Down Expand Up @@ -1486,12 +1486,12 @@ elseif addon.class == "MAGE" then
["value"] = 3.4575,
},
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
["ADD_NORMAL_MANA_REGEN_MOD_SPI"] = {
{
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
["ADD_NORMAL_MANA_REGEN_MOD_INT"] = {
{
["regen"] = NormalManaRegenPerInt,
},
Expand Down Expand Up @@ -1527,7 +1527,7 @@ elseif addon.class == "MAGE" then
["aura"] = 83098, -- ["Improved Mana Gem"],
},
},
["ADD_MANA_REG_MOD_MANA"] = {
["ADD_GENERIC_MANA_REGEN_MOD_MANA"] = {
-- Buff: Mage Armor
{
["value"] = 0.03,
Expand Down Expand Up @@ -1605,17 +1605,17 @@ elseif addon.class == "PALADIN" then
["value"] = 5.0000,
},
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
["ADD_NORMAL_MANA_REGEN_MOD_SPI"] = {
{
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
["ADD_NORMAL_MANA_REGEN_MOD_INT"] = {
{
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_MANA_REG_MOD_NORMAL_MANA_REG"] = {
["ADD_MANA_REGEN_MOD_NORMAL_MANA_REGEN"] = {
-- Passive: Meditation
{
["value"] = 0.50,
Expand Down Expand Up @@ -1776,17 +1776,17 @@ elseif addon.class == "PRIEST" then
["value"] = 3.1830,
},
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
["ADD_NORMAL_MANA_REGEN_MOD_SPI"] = {
{
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
["ADD_NORMAL_MANA_REGEN_MOD_INT"] = {
{
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_MANA_REG_MOD_NORMAL_MANA_REG"] = {
["ADD_MANA_REGEN_MOD_NORMAL_MANA_REGEN"] = {
-- Passive: Meditation (Discipline)
{
["value"] = 0.5,
Expand All @@ -1808,7 +1808,7 @@ elseif addon.class == "PRIEST" then
},
},
},
["ADD_MANA_REG_MOD_MANA"] = {
["ADD_GENERIC_MANA_REGEN_MOD_MANA"] = {
-- Talent: Dispersion
{
["tab"] = 3,
Expand Down Expand Up @@ -2030,12 +2030,12 @@ elseif addon.class == "SHAMAN" then
["value"] = 1.6750,
},
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
["ADD_NORMAL_MANA_REGEN_MOD_SPI"] = {
{
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
["ADD_NORMAL_MANA_REGEN_MOD_INT"] = {
{
["regen"] = NormalManaRegenPerInt,
},
Expand All @@ -2050,7 +2050,7 @@ elseif addon.class == "SHAMAN" then
},
},
},
["ADD_MANA_REG_MOD_NORMAL_MANA_REG"] = {
["ADD_MANA_REGEN_MOD_NORMAL_MANA_REGEN"] = {
-- Passive: Meditation
{
["value"] = 0.50,
Expand Down Expand Up @@ -2170,12 +2170,12 @@ elseif addon.class == "WARLOCK" then
["value"] = 2.0350,
},
},
["ADD_NORMAL_MANA_REG_MOD_SPI"] = {
["ADD_NORMAL_MANA_REGEN_MOD_SPI"] = {
{
["regen"] = NormalManaRegenPerSpi,
},
},
["ADD_NORMAL_MANA_REG_MOD_INT"] = {
["ADD_NORMAL_MANA_REGEN_MOD_INT"] = {
{
["regen"] = NormalManaRegenPerInt,
},
Expand Down Expand Up @@ -2475,14 +2475,26 @@ StatLogic.StatModTable["ALL"] = {
["value"] = 15,
},
},
["ADD_MANA_REG_MOD_MANA"] = {
["ADD_GENERIC_MANA_REGEN_MOD_MANA"] = {
-- Replenishment - Buff
-- 4.0.1: Replenishes 1% of maximum mana per 10 sec.
{
["value"] = 0.005,
["aura"] = 57669,
},
},
["ADD_MANA_REGEN_OUT_OF_COMBAT_MOD_NORMAL_MANA_REGEN"] = {
-- Base
{
["value"] = 1.0,
},
},
["ADD_MANA_REGEN_OUT_OF_COMBAT_MOD_GENERIC_MANA_REGEN"] = {
-- Base
{
["value"] = 1.0,
},
},
["MOD_SPELL_DMG"] = {
-- Warlock: Demonic Pact - Buff: 53646
-- 4.0.1: Spell Power increased by 10%.
Expand Down
5 changes: 5 additions & 0 deletions libs/StatLogic/Global_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ StatLogic.StatModTable["GLOBAL"] = {
["level"] = addon.CritPerAgi[addon.class]
}
},
["ADD_MANA_REGEN_MOD_GENERIC_MANA_REGEN"] = {
{
["value"] = 1,
}
},
["ADD_SPELL_CRIT_MOD_INT"] = {
{
["level"] = conversionFallback(addon.SpellCritPerInt[addon.class], StatLogic.GetSpellCritPerInt),
Expand Down
Loading

0 comments on commit 24b17b3

Please sign in to comment.