Skip to content

Commit

Permalink
Add Cata Health Regen
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed May 7, 2024
1 parent 93f4e18 commit 12ff558
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 13 deletions.
52 changes: 39 additions & 13 deletions RatingBuster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -300,27 +300,36 @@ local options = {
args = {},
hidden = true,
},
health = {
type = 'group',
name = L[StatLogic.Stats.Health],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.Health]),
width = "full",
order = 8,
args = {},
hidden = true,
},
ap = {
type = 'group',
name = L[StatLogic.Stats.AttackPower],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.AttackPower]),
order = 8,
order = 9,
args = {},
hidden = true,
},
mastery = {
type = 'group',
name = L[StatLogic.Stats.MasteryRating],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.MasteryRating]),
order = 9,
order = 10,
args = {},
hidden = true,
},
weaponskill = {
type = 'group',
name = L[StatLogic.Stats.WeaponSkill],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.WeaponSkill]),
order = 10,
order = 11,
hidden = true,
--[[
hidden = function()
Expand All @@ -340,31 +349,31 @@ local options = {
type = 'group',
name = L[StatLogic.Stats.ExpertiseRating],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.ExpertiseRating]),
order = 11,
order = 12,
hidden = true,
args = {},
},
defense = {
type = 'group',
name = L[StatLogic.Stats.Defense],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.Defense]),
order = 12,
order = 13,
hidden = true,
args = {},
},
armor = {
type = 'group',
name = L[StatLogic.Stats.Armor],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.Armor]),
order = 13,
order = 14,
args = {},
hidden = true,
},
resilience = {
type = 'group',
name = L[StatLogic.Stats.ResilienceRating],
desc = L["Changes the display of %s"]:format(L[StatLogic.Stats.ResilienceRating]),
order = 14,
order = 15,
args = {},
hidden = true,
},
Expand Down Expand Up @@ -580,9 +589,6 @@ local options = {
name = L["Sum %s"]:format(L[StatLogic.Stats.HealthRegenOutOfCombat]),
desc = L["Health Regen when out of combat <- Spirit"],
order = 6,
hidden = function()
return addon.tocversion >= 40000
end,
},
sumStr = {
type = 'toggle',
Expand Down Expand Up @@ -1182,6 +1188,8 @@ local defaults = {
showMP5NCFromSpi = false,
showHP5NCFromSpi = false,

showHP5NCFromHealth = false,

showDefenseFromDefenseRating = false,
showDodgeReductionFromExpertise = false,
showParryReductionFromExpertise = false,
Expand Down Expand Up @@ -1554,7 +1562,13 @@ do
addStatModOption(add, "INT", sources)
end
elseif mod == "NORMAL_HEALTH_REG" then
mod = "SPI"
if GSM("ADD_NORMAL_HEALTH_REG_MOD_SPI") > 0 then
-- Vanilla through Wrath
mod = "SPI"
elseif GSM("ADD_NORMAL_HEALTH_REG_MOD_HEALTH") > 0 then
-- Cata onwards
mod = "HEALTH"
end
elseif mod == "MANA" then
mod = "INT"
end
Expand Down Expand Up @@ -2228,9 +2242,10 @@ do
-- Stamina --
-------------
value = value * GSM("MOD_STA")
local health = value * GSM("ADD_HEALTH_MOD_STA") * GSM("MOD_HEALTH")
self:ProcessStat(StatLogic.Stats.Health, health, infoTable)
if db.profile.showHealthFromSta then
local effect = value * GSM("ADD_HEALTH_MOD_STA") * GSM("MOD_HEALTH")
infoTable[StatLogic.Stats.Health] = infoTable[StatLogic.Stats.Health] + effect
infoTable[StatLogic.Stats.Health] = infoTable[StatLogic.Stats.Health] + health
end
if db.profile.showSpellDmgFromSta then
local effect = value * GSM("MOD_SPELL_DMG") * (GSM("ADD_SPELL_DMG_MOD_STA")
Expand Down Expand Up @@ -2335,6 +2350,15 @@ do
local effect = StatLogic:GetEffectFromRating(rating, StatLogic.Stats.SpellCritRating, playerLevel)
infoTable[StatLogic.Stats.SpellCrit] = infoTable[StatLogic.Stats.SpellCrit] + effect
end
elseif statID == StatLogic.Stats.Health and db.profile.showStats then
if db.profile.showHP5FromHealth then
local effect = value * GSM("ADD_NORMAL_HEALTH_REG_MOD_HEALTH") * GSM("MOD_NORMAL_HEALTH_REG") * GSM("ADD_HEALTH_REG_MOD_NORMAL_HEALTH_REG")
infoTable[StatLogic.Stats.HealthRegen] = infoTable[StatLogic.Stats.HealthRegen] + effect
end
if db.profile.showHP5NCFromHealth then
local effect = value * GSM("ADD_NORMAL_HEALTH_REG_MOD_HEALTH") * GSM("MOD_NORMAL_HEALTH_REG")
infoTable[StatLogic.Stats.HealthRegenOutOfCombat] = infoTable[StatLogic.Stats.HealthRegenOutOfCombat] + effect
end
elseif statID == StatLogic.Stats.Defense then
local blockChance = value * GSM("ADD_BLOCK_CHANCE_MOD_DEFENSE")
if db.profile.showBlockChanceFromDefense then
Expand Down Expand Up @@ -2616,6 +2640,7 @@ local summaryCalcData = {
func = function(sum)
return sum[StatLogic.Stats.HealthRegen]
+ sum[StatLogic.Stats.Spirit] * GSM("ADD_NORMAL_HEALTH_REG_MOD_SPI") * GSM("MOD_NORMAL_HEALTH_REG") * GSM("ADD_HEALTH_REG_MOD_NORMAL_HEALTH_REG")
+ summaryFunc[StatLogic.Stats.Health](sum) * GSM("ADD_NORMAL_HEALTH_REG_MOD_HEALTH") * GSM("MOD_NORMAL_HEALTH_REG") * GSM("ADD_HEALTH_REG_MOD_NORMAL_HEALTH_REG")
end,
},
-- Health Regen while Out of Combat - HEALTH_REG, SPI
Expand All @@ -2625,6 +2650,7 @@ local summaryCalcData = {
func = function(sum)
return sum[StatLogic.Stats.HealthRegen]
+ sum[StatLogic.Stats.Spirit] * GSM("ADD_NORMAL_HEALTH_REG_MOD_SPI") * GSM("MOD_NORMAL_HEALTH_REG")
+ summaryFunc[StatLogic.Stats.Health](sum) * GSM("ADD_NORMAL_HEALTH_REG_MOD_HEALTH") * GSM("MOD_NORMAL_HEALTH_REG")
end,
},
-- Mana Regen - MANA_REG, SPI, INT
Expand Down
49 changes: 49 additions & 0 deletions libs/StatLogic/Cata_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,23 @@ elseif addon.playerRace == "Orc" then
addon.WeaponRacials[Enum.ItemWeaponSubclass.Axe2H] = {StatLogic.Stats.Expertise, 3}
addon.WeaponRacials[Enum.ItemWeaponSubclass.Unarmed] = {StatLogic.Stats.Expertise, 3}
elseif addon.playerRace == "Troll" then
StatLogic.StatModTable["Troll"] = {
["MOD_NORMAL_HEALTH_REG"] = {
-- Troll: Regeneration - Racial
-- Health regeneration rate increased by 10%.
{
["value"] = 0.1,
},
},
["ADD_HEALTH_REG_MOD_NORMAL_HEALTH_REG"] = {
-- Troll: Regeneration - Racial
-- 10% of total Health regeneration may continue during combat.
{
["value"] = 0.1,
["spellid"] = 20555,
},
},
}
addon.WeaponRacials[Enum.ItemWeaponSubclass.Bows] = {StatLogic.Stats.RangedCrit, 1}
addon.WeaponRacials[Enum.ItemWeaponSubclass.Thrown] = {StatLogic.Stats.RangedCrit, 1}
end
Expand All @@ -2296,6 +2313,38 @@ StatLogic.StatModTable["ALL"] = {
})
},
},
["ADD_NORMAL_HEALTH_REG_MOD_HEALTH"] = {
{
-- Levels 1-19 are likely two piecewise linear sections,
-- with the intersection at roughly 15
["level"] = setmetatable({
0.6250,
0.5938,
0.5625,
0.5313,
0.5000,
0.4688,
0.4375,
0.4063,
0.3750,
0.3438,
0.3125,
0.2813,
0.2500,
0.2188,
0.1875,
0.1528,
0.1212,
0.0893,
0.0574,
}, {
-- Levels 20-85 are all 2.5% HP5 (1% HP2)
__index = function()
return 0.025
end
})
},
},
["ADD_MANA_MOD_INT"] = {
{
["value"] = 15,
Expand Down
4 changes: 4 additions & 0 deletions libs/StatLogic/StatLogic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ local addedInfoMods = {
add = "AP",
mod = "STR",
},
{
add = "NORMAL_HEALTH_REG",
mod = "HEALTH",
},
{
add = "NORMAL_HEALTH_REG",
mod = "SPI",
Expand Down

0 comments on commit 12ff558

Please sign in to comment.