Skip to content

Commit

Permalink
Convert Armor from Agi and Block from Str to StatMods
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed Dec 23, 2023
1 parent 997fa42 commit 163fdaa
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 167 deletions.
32 changes: 11 additions & 21 deletions RatingBuster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,7 @@ local options = {
desc = L["Changes the display of Strength"],
width = "full",
order = 3,
args = {
showBlockValueFromStr = {
type = 'toggle',
name = L["Show Block Value"],
desc = L["Show Block Value from Strength"],
width = "full",
},
},
args = {},
},
agi = {
type = 'group',
Expand All @@ -323,12 +316,6 @@ local options = {
desc = L["Show Dodge chance from Agility"],
width = "full",
},
showArmorFromAgi = {
type = 'toggle',
name = L["Show Armor"],
desc = L["Show Armor from Agility"],
width = "full",
},
},
},
sta = {
Expand Down Expand Up @@ -1413,6 +1400,11 @@ do
-- but we show it to the user as the converted stat
add = add:gsub("_RATING", "")

-- We want to show the user Armor, regardless of where it comes from
if add == "BONUS_ARMOR" then
add = "ARMOR"
end

if mod == "NORMAL_MANA_REG" then
mod = "SPI"
if GSM("ADD_NORMAL_MANA_REG_MOD_INT") > 0 then
Expand Down Expand Up @@ -2088,7 +2080,7 @@ do
end
end
if profileDB.showBlockValueFromStr then
local effect = value * StatLogic:GetBlockValuePerStr(class)
local effect = value * GSM("ADD_BLOCK_VALUE_MOD_STR")
if floor(abs(effect) * 10 + 0.5) > 0 then
tinsert(infoTable, (L["$value Block"]:gsub("$value", ("%+.1f"):format(effect))))
end
Expand Down Expand Up @@ -2304,7 +2296,7 @@ do
end
end
if profileDB.showArmorFromInt then
local effect = value * GSM("ADD_ARMOR_MOD_INT")
local effect = value * GSM("ADD_BONUS_ARMOR_MOD_INT")
if floor(abs(effect) + 0.5) > 0 then
tinsert(infoTable, (L["$value Armor"]:gsub("$value", ("%+.0f"):format(effect))))
end
Expand Down Expand Up @@ -2537,8 +2529,6 @@ local armorTypes = {
}

-- Interface_<Expansion>/FrameXML/PaperDollFrame.lua Compatibility
if not ARMOR_PER_AGILITY then ARMOR_PER_AGILITY = 2 end
if not BLOCK_PER_STRENGTH then BLOCK_PER_STRENGTH = 0.05 end
if not DODGE_PARRY_BLOCK_PERCENT_PER_DEFENSE then DODGE_PARRY_BLOCK_PERCENT_PER_DEFENSE = 0.04 end

local summaryCalcData = {
Expand Down Expand Up @@ -3031,8 +3021,8 @@ local summaryCalcData = {
func = function(sum)
return GSM("MOD_ARMOR") * sum["ARMOR"]
+ sum["ARMOR_BONUS"]
+ sum[StatLogic.Stats.Agility] * ARMOR_PER_AGILITY
+ sum[StatLogic.Stats.Intellect] * GSM("ADD_ARMOR_MOD_INT")
+ sum[StatLogic.Stats.Agility] * GSM("ADD_BONUS_ARMOR_MOD_AGI")
+ sum[StatLogic.Stats.Intellect] * GSM("ADD_BONUS_ARMOR_MOD_INT")
end,
},
-- Dodge Chance Before DR - DODGE, DODGE_RATING, DEFENSE, AGI
Expand Down Expand Up @@ -3140,7 +3130,7 @@ local summaryCalcData = {
return GetBlockChance() > 0 and (
GSM("MOD_BLOCK_VALUE") * (
sum["BLOCK_VALUE"]
+ sum[StatLogic.Stats.Strength] * StatLogic:GetBlockValuePerStr(class)
+ sum[StatLogic.Stats.Strength] * GSM("ADD_BLOCK_VALUE_MOD_STR")
)
) or 0
end,
Expand Down
25 changes: 5 additions & 20 deletions libs/StatLogic/Cata_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,11 @@ StatLogic.StatModTable["ALL"] = {
["value"] = 15,
},
},
["ADD_BONUS_ARMOR_MOD_AGI"] = {
{
["value"] = ARMOR_PER_AGILITY,
},
},
["ADD_MANA_REG_MOD_MANA"] = {
-- Replenishment - Buff
-- 4.0.1: Replenishes 1% of maximum mana per 10 sec.
Expand Down Expand Up @@ -1566,26 +1571,6 @@ StatLogic.StatModTable["ALL"] = {
["group"] = addon.BuffGroup.SpellPower,
},
},
["MOD_BLOCK_VALUE"] = {
-- MetaGem: Eternal Earthsiege Diamond - Meta: 41396
-- 4.0.1: +1% Shield Block Value
{
["value"] = 0.01,
["meta"] = 41396,
},
-- MetaGem: Eternal Earthstorm Diamond - Meta: 35501
-- 4.0.1: +1% Shield Block Value
{
["value"] = 0.01,
["meta"] = 35501,
},
-- MetaGem: Eternal Shadowspirit Diamond - Meta: 52293
-- 4.0.1: +5% Shield Block Value
{
["value"] = 0.05,
["meta"] = 52293,
},
},
["MOD_ARMOR"] = {
-- MetaGem: Austere Earthsiege Diamond - Meta: 41380
-- 4.0.1: 2% Increased Armor Value from Items
Expand Down
79 changes: 9 additions & 70 deletions libs/StatLogic/StatLogic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,15 @@ local addedInfoMods = {
mod = "STA",
},
{
add = "ARMOR",
add = "BLOCK_VALUE",
mod = "STR",
},
{
add = "BONUS_ARMOR",
mod = "AGI",
},
{
add = "BONUS_ARMOR",
mod = "INT",
},
{
Expand Down Expand Up @@ -1347,75 +1355,6 @@ function StatLogic:GetEffectFromRating(rating, id, level)
end
end

--[[---------------------------------
{ :GetBlockValuePerStr([class])
-------------------------------------
-- Description
Gets the block value per strength for any class.
-- Args
[class] - (defaults: PlayerClass)
string - english class name
number - class id
-- Returns
[blockValue]
number - block value per strength
[statid]
string - "BLOCK_VALUE"
-- Remarks
Player level does not effect block value per strength.
-- Examples
StatLogic:GetBlockValuePerStr()
StatLogic:GetBlockValuePerStr("WARRIOR")
}
-----------------------------------]]

local BlockClasses = {
["WARRIOR"] = true,
["PALADIN"] = true,
["SHAMAN"] = true,
}

function StatLogic:GetBlockValuePerStr(class)
assert(type(class)=="string" or type(class)=="number", "Expected string or number as arg #1 to GetBlockValuePerStr, got "..type(class))
class = self:ValidateClass(class)
local blockValue = BlockClasses[class] and BLOCK_PER_STRENGTH or 0
return blockValue, "BLOCK_VALUE"
end

--[[---------------------------------
{ :GetBlockValueFromStr(str, [class])
-------------------------------------
-- Description
Calculates the block value from strength for any class.
-- Args
str
number - strength
[class] - (defaults: PlayerClass)
string - english class name
number - class id
-- Returns
[blockValue]
number - block value
[statid]
string - "BLOCK_VALUE"
-- Remarks
Player level does not effect block value per strength.
-- Examples
StatLogic:GetBlockValueFromStr(1) -- GetBlockValuePerStr
StatLogic:GetBlockValueFromStr(10)
StatLogic:GetBlockValueFromStr(10, "WARRIOR")
}
-----------------------------------]]

function StatLogic:GetBlockValueFromStr(str, class)
assert(type(str)=="number", "Expected number as arg #1 to GetBlockValueFromStr, got "..type(str))
assert(type(class)=="string" or type(class)=="number", "Expected string or number as arg #2 to GetBlockValueFromStr, got "..type(class))
class = self:ValidateClass(class)
local blockValue = BlockClasses[class] and BLOCK_PER_STRENGTH or 0
-- Calculate
return str * blockValue, "BLOCK_VALUE"
end

--[[---------------------------------
{ :GetBaseDodge([class])
-------------------------------------
Expand Down
22 changes: 21 additions & 1 deletion libs/StatLogic/TBC_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ elseif addon.class == "MAGE" then
-- Mage: Arcane Fortitude - 1,9
-- Increases your armor by an amount equal to 50% of your Intellect.
-- 2.4.0 Increases your armor by an amount equal to 100% of your Intellect.
["ADD_ARMOR_MOD_INT"] = {
["ADD_BONUS_ARMOR_MOD_INT"] = {
{
["tab"] = 1,
["num"] = 9,
Expand Down Expand Up @@ -800,6 +800,11 @@ elseif addon.class == "PALADIN" then
["value"] = 0.125 * 5,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = BLOCK_PER_STRENGTH,
},
},
-- Paladin: Holy Guidance (Rank 5) - 1,19
-- Increases your spell damage and healing by 7%/14%/21%/28%/35% of your total Intellect.
["ADD_SPELL_DMG_MOD_INT"] = {
Expand Down Expand Up @@ -1142,6 +1147,11 @@ elseif addon.class == "SHAMAN" then
["value"] = 0.071429 * 5,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = BLOCK_PER_STRENGTH,
},
},
-- Shaman: Mental Quickness (Rank 3) - 2,15
-- Reduces the mana cost of your instant cast spells by 2%/4%/6% and increases your spell damage and healing equal to 10%/20%/30% of your attack power.
["ADD_SPELL_DMG_MOD_AP"] = {
Expand Down Expand Up @@ -1398,6 +1408,11 @@ elseif addon.class == "WARRIOR" then
["value"] = 0.5 * 5,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = BLOCK_PER_STRENGTH,
},
},
-- Warrior: Improved Berserker Stance (Rank 5) - 2,20 - Stance
-- Increases attack power by 2%/4%/6%/8%/10% while in Berserker Stance.
["MOD_AP"] = {
Expand Down Expand Up @@ -1527,6 +1542,11 @@ StatLogic.StatModTable["ALL"] = {
["value"] = 15,
},
},
["ADD_BONUS_ARMOR_MOD_AGI"] = {
{
["value"] = ARMOR_PER_AGILITY,
},
},
["MOD_ARMOR"] = {
-- Paladin: Lay on Hands (Rank 1/2) - Buff
-- Armor increased by 15%/30%.
Expand Down
22 changes: 21 additions & 1 deletion libs/StatLogic/Vanilla_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ elseif addon.class == "MAGE" then
},
-- Mage: Arcane Fortitude - 1,9
-- Increases your armor by an amount equal to 50% of your Intellect.
["ADD_ARMOR_MOD_INT"] = {
["ADD_BONUS_ARMOR_MOD_INT"] = {
{
["tab"] = 1,
["num"] = 9,
Expand Down Expand Up @@ -575,6 +575,11 @@ elseif addon.class == "PALADIN" then
["value"] = 0.125 * 5,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = 0.05,
},
},
["ADD_MELEE_CRIT"] = {
-- Conviction
{
Expand Down Expand Up @@ -813,6 +818,11 @@ elseif addon.class == "SHAMAN" then
["value"] = 0.071429 * 5,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = 0.05,
},
},
-- Shaman: Anticipation (Rank 5) - 2,9
-- Increases your chance to dodge by an additional 1%/2%/3%/4%/5%.
["ADD_DODGE"] = {
Expand Down Expand Up @@ -1035,6 +1045,11 @@ elseif addon.class == "WARRIOR" then
["value"] = 0.5 * 5,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = 0.05,
},
},
["MOD_ARMOR"] = {
-- Warrior: Toughness (Rank 5) - 3,4
-- Increases your armor value from items by 2%/4%/6%/8%/10%.
Expand Down Expand Up @@ -1163,6 +1178,11 @@ StatLogic.StatModTable["ALL"] = {
["value"] = 15,
},
},
["ADD_BONUS_ARMOR_MOD_AGI"] = {
{
["value"] = 2,
},
},
["MOD_ARMOR"] = {
-- Paladin: Lay on Hands (Rank 1/2) - Buff
-- Armor increased by 15%/30%.
Expand Down
22 changes: 21 additions & 1 deletion libs/StatLogic/Wrath_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ elseif addon.class == "MAGE" then
},
-- Mage: Arcane Fortitude - 1,4
-- Increases your armor by an amount equal to 50%/100%/150% of your Intellect.
["ADD_ARMOR_MOD_INT"] = {
["ADD_BONUS_ARMOR_MOD_INT"] = {
{
["tab"] = 1,
["num"] = 4,
Expand Down Expand Up @@ -1996,6 +1996,11 @@ elseif addon.class == "PALADIN" then
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = BLOCK_PER_STRENGTH,
},
},
-- Paladin: Sheath of Light (Rank 3) - 3,24
-- Increases your spell power by an amount equal to 10%/20%/30% of your attack power
-- 3.1.0: 3,24
Expand Down Expand Up @@ -2419,6 +2424,11 @@ elseif addon.class == "SHAMAN" then
["regen"] = NormalManaRegenPerInt,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = BLOCK_PER_STRENGTH,
},
},
-- Shaman: Mental Dexterity (Rank 3) - 2,15
-- Increases your Attack Power by 33%/66%/100% of your Intellect.
["ADD_AP_MOD_INT"] = {
Expand Down Expand Up @@ -2717,6 +2727,11 @@ elseif addon.class == "WARRIOR" then
["value"] = 1,
},
},
["ADD_BLOCK_VALUE_MOD_STR"] = {
{
["value"] = BLOCK_PER_STRENGTH,
},
},
-- Warrior: Armored to the Teeth (Rank 3) - 2,1
-- Increases your attack power by 1/2/3 for every 108 armor value you have.
["ADD_AP_MOD_ARMOR"] = {
Expand Down Expand Up @@ -2879,6 +2894,11 @@ StatLogic.StatModTable["ALL"] = {
["regen"] = NormalHealthRegenPerSpi,
},
},
["ADD_BONUS_ARMOR_MOD_AGI"] = {
{
["value"] = ARMOR_PER_AGILITY,
},
},
-- ICC: Chill of the Throne
-- Chance to dodge reduced by 20%.
["ADD_DODGE"] = {
Expand Down
Loading

0 comments on commit 163fdaa

Please sign in to comment.