Skip to content

Commit

Permalink
Account for weapon skill in crit conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed Jul 27, 2023
1 parent 120263f commit 25a91e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
5 changes: 4 additions & 1 deletion RatingBuster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1511,11 +1511,14 @@ do
end
end

-- Ignore Stat Mods that mostly exist for Tank Points
-- Ignore Stat Mods that are only used for Diminishing Returns
-- and agi/int conversion rates
local ignoredStatMods = {
["MOD_DMG_TAKEN"] = true,
["ADD_DODGE"] = true,
["ADD_HIT_TAKEN"] = true,
["ADD_MELEE_CRIT"] = true,
["ADD_SPELL_CRIT"] = true,
}
local function GenerateAuraOptions()
for modType, modList in pairs(StatLogic.StatModTable) do
Expand Down
22 changes: 17 additions & 5 deletions libs/StatLogic/StatLogic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ local function GetTotalDefense(unit)
return base + modifier
end

local function GetTotalWeaponSkill(unit)
local base, modifier = UnitAttackBothHands(unit);
return base + modifier
end

--============--
-- Base Stats --
Expand Down Expand Up @@ -1562,14 +1566,21 @@ end
function StatLogic:GetEffectFromDefense(defense, attackerLevel)
self:argCheck(defense, 2, "nil", "number")
self:argCheck(attackerLevel, 3, "nil", "number")
if not defense then
local base, add = UnitDefense("player")
defense = base + add
end
defense = defense or GetTotalDefense("player")
if not attackerLevel then
attackerLevel = UnitLevel("player")
end
return (defense - attackerLevel * 5) * 0.04
return (defense - attackerLevel * 5) * DODGE_PARRY_BLOCK_PERCENT_PER_DEFENSE
end

function StatLogic:GetCritChanceFromWeaponSkill(skill, targetLevel)
self:argCheck(skill, 2, "nil", "number")
self:argCheck(targetLevel, 3, "nil", "number")
skill = skill or GetTotalWeaponSkill("player")
if not targetLevel then
targetLevel = UnitLevel("player")
end
return (skill - targetLevel * 5) * 0.04
end

function StatLogic:RatingExists(id)
Expand Down Expand Up @@ -2048,6 +2059,7 @@ function StatLogic:GetCritPerAgi(class, level)
local _, agility = UnitStat("player", 2)
local critFromAgi = GetCritChance()
- self:GetStatMod("ADD_MELEE_CRIT")
- self:GetCritChanceFromWeaponSkill()
- self:GetTotalEquippedStat(StatLogic.Stats.MeleeCrit)
return (critFromAgi - addon.BaseMeleeCrit[class]) / agility
end
Expand Down

0 comments on commit 25a91e6

Please sign in to comment.