From 8126858a3cb87744fe01952caa0e910476eb0860 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Fri, 28 Sep 2012 00:59:19 +0000 Subject: [PATCH] Cache the player's current mastery (specialization) and stance. Use the cached stance information instead of calling the WoW function GetShapeshiftForm(). Correctly set the energy regeneration for Brewmaster Monks in Stance of the Sturdy Ox (increased by 10%). All monks in Stance of the Fierce Tiger will generate one extra Chi per Jab Expel Harm. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@577 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleAura.lua | 27 +++++++++++++++++++++++++++ OvaleBestAction.lua | 2 +- OvaleCondition.lua | 2 +- OvaleState.lua | 23 ++++++++++++++++++++--- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/OvaleAura.lua b/OvaleAura.lua index f1d781c..0c28f0d 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -14,6 +14,8 @@ OvaleAura = LibStub("AceAddon-3.0"):NewAddon("OvaleAura", "AceEvent-3.0") -- OvaleAura.aura = {} +OvaleAura.mastery = nil +OvaleAura.stance = 0 OvaleAura.serial = 0 OvaleAura.spellHaste = 1 OvaleAura.meleeHaste = 1 @@ -28,11 +30,23 @@ local baseDamageMultiplier = 1 -- function OvaleAura:OnEnable() self.playerGUID = UnitGUID("player") + self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + self:RegisterEvent("PLAYER_ENTERING_WORLD") + self:RegisterEvent("UPDATE_SHAPESHIFT_FORM") + self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS") end function OvaleAura:OnDisable() + self:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + self:UnregisterEvent("PLAYER_ENTERING_WORLD") + self:UnregisterEvent("UPDATE_SHAPESHIFT_FORM") + self:UnregisterEvent("UPDATE_SHAPESHIFT_FORMS") +end + +function OvaleAura:ACTIVE_TALENT_GROUP_CHANGED(event) + self.mastery = GetSpecialization() end function OvaleAura:COMBAT_LOG_EVENT_UNFILTERED(event, ...) @@ -64,6 +78,19 @@ function OvaleAura:COMBAT_LOG_EVENT_UNFILTERED(event, ...) end end +function OvaleAura:PLAYER_ENTERING_WORLD(event) + self.mastery = GetSpecialization() + self.stance = GetShapeshiftForm() +end + +function OvaleAura:UPDATE_SHAPESHIFT_FORM(event) + self.stance = GetShapeshiftForm() +end + +function OvaleAura:UPDATE_SHAPESHIFT_FORMS(event) + self.stance = GetShapeshiftForm() +end + function OvaleAura:AddAura(unitGUID, spellId, unitCaster, icon, count, debuffType, duration, expirationTime, isStealable, name) local auraList = self.aura[unitGUID] diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua index 8d3d9a1..cbef0ab 100644 --- a/OvaleBestAction.lua +++ b/OvaleBestAction.lua @@ -100,7 +100,7 @@ function OvaleBestAction:GetActionInfo(element) local si = OvaleData:GetSpellInfo(spellId) if si then - if si.stance and si.stance > 0 and GetShapeshiftForm()~=si.stance then + if si.stance and si.stance > 0 and OvaleAura.stance ~= si.stance then return nil end diff --git a/OvaleCondition.lua b/OvaleCondition.lua index 6f10d86..cf8669e 100644 --- a/OvaleCondition.lua +++ b/OvaleCondition.lua @@ -2176,7 +2176,7 @@ OvaleCondition.conditions= -- unless Stance(1) Spell(bear_form) stance = function(condition) - if (GetShapeshiftForm() == condition[1]) then + if (OvaleAura.stance == condition[1]) then return 0 else return nil diff --git a/OvaleState.lua b/OvaleState.lua index 2968f38..9a44677 100644 --- a/OvaleState.lua +++ b/OvaleState.lua @@ -59,8 +59,14 @@ function OvaleState:UpdatePowerRates() end self.powerRate.energy = 10 * OvaleAura.meleeHaste - - if OvaleState:GetAura("player", 13750, true) then + + -- Stance of the Sturdy Ox (brewmaster monk) + if OvaleData.className == "MONK" and OvaleAura.mastery == 1 and OvaleAura.stance == 1 then + self.powerRate.energy = self.powerRate.energy * 1.1 + end + + -- Adrenaline Rush (rogue) + if OvaleData.className == "ROGUE" and OvaleState:GetAura("player", 13750, true) then self.powerRate.energy = self.powerRate.energy * 2 end @@ -164,6 +170,16 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd, end if newSpellInfo then + -- Monks in Stance of the Fierce Tiger generate one extra Chi per Jab and Expel Harm. + if OvaleData.className == "MONK" then + if OvaleAura.stance == 2 or (OvaleAura.mastery ~= 2 and OvaleAura.stance == 1) then + if spellId == 100780 or spellId == 115072 then + self.state.chi = self.state.chi + 1 + end + end + end + + -- Update power state, except for eclipse, combo, and runes. for k,v in pairs(OvaleData.power) do -- eclipse cost is on hit if newSpellInfo[k] and k ~= "eclipse" then @@ -185,7 +201,7 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd, end end end - + --Points de combo if newSpellInfo.combo then if newSpellInfo.combo == 0 then @@ -204,6 +220,7 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd, self.state.combo = 5 end end + --Runes if newSpellInfo.frost then self:AddRune(startCast, 3, newSpellInfo.frost) -- 1.7.9.5