Skip to content

Commit

Permalink
Fix DodgePerAgi at strange max levels
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed Dec 4, 2023
1 parent dbc8212 commit bef7962
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 43 deletions.
42 changes: 31 additions & 11 deletions libs/StatLogic/Cata_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,37 @@ addon.BaseDodge = {
["DRUID"] = 4.9510,
}

addon.DodgePerAgiMaxLevel = {
["WARRIOR"] = 0,
["PALADIN"] = 0,
["HUNTER"] = 0.0133266,
["ROGUE"] = 0.0240537,
["PRIEST"] = 0.0192366,
["DEATHKNIGHT"] = 0,
["SHAMAN"] = 0.0192366,
["MAGE"] = 0.0195253,
["WARLOCK"] = 0.0192366,
["DRUID"] = 0.0240458,
addon.DodgePerAgi = {
["WARRIOR"] = {
[85] = 0,
},
["PALADIN"] = {
[85] = 0,
},
["HUNTER"] = {
[85] = 0.0133266,
},
["ROGUE"] = {
[85] = 0.0240537,
},
["PRIEST"] = {
[85] = 0.0192366,
},
["DEATHKNIGHT"] = {
[85] = 0,
},
["SHAMAN"] = {
[85] = 0.0192366,
},
["MAGE"] = {
[85] = 0.0195253,
},
["WARLOCK"] = {
[85] = 0.0192366,
},
["DRUID"] = {
[85] = 0.0240458,
},
}

local BuffGroup = {
Expand Down
7 changes: 4 additions & 3 deletions libs/StatLogic/StatLogic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,8 @@ end
function StatLogic:GetDodgePerAgi()
local level = UnitLevel("player")
local class = addon.class
if level == GetMaxPlayerLevel() and addon.DodgePerAgiMaxLevel[class] then
return addon.DodgePerAgiMaxLevel[class], StatLogic.Stats.Dodge
if addon.DodgePerAgi[class][level] then
return addon.DodgePerAgi[class][level]
end
local _, agility = UnitStat("player", 2)
-- dodgeFromAgi is %
Expand All @@ -1506,7 +1506,8 @@ function StatLogic:GetDodgePerAgi()
- self:GetEffectFromRating(GetCombatRating(CR_DODGE), CR_DODGE, UnitLevel("player"))
- self:GetEffectFromDefense(GetTotalDefense("player"), UnitLevel("player"))
- self:GetTotalEquippedStat(StatLogic.Stats.Dodge)
return (dodgeFromAgi - addon.BaseDodge[addon.class]) / agility, StatLogic.Stats.Dodge
- addon.BaseDodge[addon.class]
return dodgeFromAgi / agility
end

--[[---------------------------------
Expand Down
2 changes: 1 addition & 1 deletion libs/StatLogic/TBC_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ addon.BaseDodge = {
}

-- TODO Gather data if TBC comes back
addon.DodgePerAgiMaxLevel = {}
addon.DodgePerAgi = {}

StatLogic.StatModTable = {}
if addon.class == "DRUID" then
Expand Down
38 changes: 28 additions & 10 deletions libs/StatLogic/Vanilla_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,34 @@ addon.BaseDodge = {
["DRUID"] = 0.9000,
}

addon.DodgePerAgiMaxLevel = {
["WARRIOR"] = 0.0500,
["PALADIN"] = 0.0506,
["HUNTER"] = 0.0377,
["ROGUE"] = 0.0690,
["PRIEST"] = 0.0500,
["SHAMAN"] = 0.0508,
["MAGE"] = 0.0514,
["WARLOCK"] = 0.0500,
["DRUID"] = 0.0500,
addon.DodgePerAgi = {
["WARRIOR"] = {
[60] = 0.0500,
},
["PALADIN"] = {
[60] = 0.0506,
},
["HUNTER"] = {
[60] = 0.0377,
},
["ROGUE"] = {
[60] = 0.0690,
},
["PRIEST"] = {
[60] = 0.0500,
},
["SHAMAN"] = {
[60] = 0.0508,
},
["MAGE"] = {
[60] = 0.0514,
},
["WARLOCK"] = {
[60] = 0.0500,
},
["DRUID"] = {
[60] = 0.0500,
},
}

local BuffGroup = {
Expand Down
53 changes: 35 additions & 18 deletions libs/StatLogic/Wrath_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,37 @@ addon.BaseDodge = {
["DRUID"] = 5.6097,
}

addon.DodgePerAgiMaxLevel = {
["WARRIOR"] = 0.0118,
["PALADIN"] = 0.0167,
["HUNTER"] = 0.0116,
["ROGUE"] = 0.0209,
["PRIEST"] = 0.0167,
["DEATHKNIGHT"] = 0.0118,
["SHAMAN"] = 0.0167,
["MAGE"] = 0.017,
["WARLOCK"] = 0.0167,
["DRUID"] = 0.0209,
addon.DodgePerAgi = {
["WARRIOR"] = {
[80] = 0.0118,
},
["PALADIN"] = {
[80] = 0.0167,
},
["HUNTER"] = {
[80] = 0.0116,
},
["ROGUE"] = {
[80] = 0.0209,
},
["PRIEST"] = {
[80] = 0.0167,
},
["DEATHKNIGHT"] = {
[80] = 0.0118,
},
["SHAMAN"] = {
[80] = 0.0167,
},
["MAGE"] = {
[80] = 0.017,
},
["WARLOCK"] = {
[80] = 0.0167,
},
["DRUID"] = {
[80] = 0.0209,
},
}

addon.bonusArmorItemEquipLoc = {
Expand Down Expand Up @@ -3172,7 +3192,6 @@ Arguments:
None
Returns:
; dodge : number - Dodge percentage per agility
; statid : Stat - StatLogic.Stats.Dodge
Notes:
* Formula by Whitetooth (hotdogee [at] gmail [dot] com)
* Calculates the dodge percentage per agility for your current class and level.
Expand Down Expand Up @@ -3203,7 +3222,7 @@ Notes:
# c=(D'-D_b)(D_r+C_d*k)-C_d*D_r
** Dodge/Agi=(-b-(b^2-4ac)^0.5)/(2a)
Example:
local dodge, statid = StatLogic:GetDodgePerAgi()
local dodge = StatLogic:GetDodgePerAgi()
-----------------------------------]]

local ModAgiClasses = {
Expand All @@ -3215,10 +3234,8 @@ local ModAgiClasses = {
function StatLogic:GetDodgePerAgi()
local level = UnitLevel("player")
local class = addon.class
if level == GetMaxPlayerLevel() and addon.DodgePerAgiMaxLevel[class] then

return addon.DodgePerAgiMaxLevel[class], StatLogic.Stats.Dodge

if addon.DodgePerAgi[class][level] then
return addon.DodgePerAgi[class][level]
end
-- Collect data
local D_dr = GetDodgeChance()
Expand Down Expand Up @@ -3253,7 +3270,7 @@ function StatLogic:GetDodgePerAgi()
dodgePerAgi = -c / b
end
--return dodgePerAgi
return floor(dodgePerAgi*10000+0.5)/10000, StatLogic.Stats.Dodge
return floor(dodgePerAgi*10000+0.5)/10000
end

--[[---------------------------------
Expand Down

0 comments on commit bef7962

Please sign in to comment.