Skip to content

Commit

Permalink
CostHandler now just a table
Browse files Browse the repository at this point in the history
  • Loading branch information
coolmodi committed Nov 18, 2021
1 parent 07726b6 commit 07b4a1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
12 changes: 1 addition & 11 deletions core/CostHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@ local HEALING_WAVE = GetSpellInfo(332);
local LESSER_HEALING_WAVE = GetSpellInfo(8004);
local FLAME_SHOCK = GetSpellInfo(8053);

---@class CostHandler
local CostHandler = {};
CostHandler.__index = CostHandler;

--- Get an object used to calculate spell cost stuff
---@return CostHandler
function CostHandler:New()
local ch = {};
setmetatable(ch, CostHandler);
return ch;
end

--- Set vars for mana cost.
---@param calcedSpell CalcedSpell
Expand All @@ -29,7 +19,7 @@ end
---@param school number
---@param spellName string
---@param spellId number
function CostHandler:Mana(calcedSpell, spellBaseCost, effCastTime, school, spellName, spellId)
function CostHandler.Mana(calcedSpell, spellBaseCost, effCastTime, school, spellName, spellId)
local mps = stats.mp5.val / 5 + stats.manaRegAura;
calcedSpell.effectiveCost = calcedSpell.baseCost - math.min(5, effCastTime) * (stats.manaRegCasting + mps);
if effCastTime > 5 then
Expand Down
4 changes: 2 additions & 2 deletions core/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local currentState = 1;
local stats = _addon.stats;
local meleeCalc = _addon.MeleeCalc:New();
local magicCalc = _addon.MagicCalc:New();
local costHandler = _addon.CostHandler:New();
local costHandler = _addon.CostHandler;

-- If a seal is currently active this will be the spell that should be used for Judgement.
---@type number|nil
Expand Down Expand Up @@ -484,7 +484,7 @@ local function CalcSpell(spellId, calcedSpell, parentSpellData, parentEffCastTim
calcedSpell.effectiveCost = spellCost;

if costType == 0 then -- mana
costHandler:Mana(calcedSpell, spellRankInfo.baseCost, effCastTime, spellBaseInfo.school, spellName, spellId);
costHandler.Mana(calcedSpell, spellRankInfo.baseCost, effCastTime, spellBaseInfo.school, spellName, spellId);
elseif costType == 1 then -- rage
-- TODO: rage (on next melee, proc on crit etc.)
elseif costType == 3 then -- energy
Expand Down

0 comments on commit 07b4a1d

Please sign in to comment.