From 57c640ff20dce98d08ed973ec47c935a651cb5e2 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sat, 23 Mar 2013 21:39:17 +0000 Subject: [PATCH] Code consistency: rename a variable to match coding conventions. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@824 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleState.lua | 102 ++++++++++++++++++++++++++------------------------------ 1 file changed, 48 insertions(+), 54 deletions(-) diff --git a/OvaleState.lua b/OvaleState.lua index 013e8fd..9a54db4 100644 --- a/OvaleState.lua +++ b/OvaleState.lua @@ -51,8 +51,6 @@ for i=1,6 do end --The spell being cast OvaleState.currentSpellId = nil ---Allows to debug auras -OvaleState.traceAura = false OvaleState.maintenant = nil OvaleState.currentTime = nil OvaleState.attenteFinCast = nil @@ -204,7 +202,7 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ return end - local newSpellInfo = OvaleData.spellInfo[spellId] + local si = OvaleData.spellInfo[spellId] self.lastSpellId = spellId --On enregistre les infos sur le sort en cours @@ -226,14 +224,14 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ --Effet du sort au moment du début du cast --(donc si cast déjà commencé, on n'en tient pas compte) if startCast >= self.maintenant then - if newSpellInfo then - if newSpellInfo.inccounter then - local id = newSpellInfo.inccounter + if si then + if si.inccounter then + local id = si.inccounter self.state.counter[id] = self:GetCounterValue(id) + 1 end - if newSpellInfo.resetcounter then - self.state.counter[newSpellInfo.resetcounter] = 0 + if si.resetcounter then + self.state.counter[si.resetcounter] = 0 end end end @@ -244,25 +242,25 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ --Mana local _, _, _, cost, _, powerType = API_GetSpellInfo(spellId) local power = OvaleData.powerType[powerType] - if cost and power and (not newSpellInfo or not newSpellInfo[power]) then + if cost and power and (not si or not si[power]) then self.state[power] = self.state[power] - cost end - if newSpellInfo then + if si then -- 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 - if newSpellInfo[k] == 0 then + if si[k] and k ~= "eclipse" then + if si[k] == 0 then self.state[k] = 0 else - self.state[k] = self.state[k] - newSpellInfo[k] + self.state[k] = self.state[k] - si[k] end -- Add extra resource generated by presence of a buff. local buffParam = "buff_" .. tostring(k) local buffAmoumtParam = buffParam .. "_amount" - if newSpellInfo[k] < 0 and newSpellInfo[buffParam] and self:GetAura("player", newSpellInfo[buffParam], nil, true) then - local buffAmount = newSpellInfo[buffAmountParam] or 1 + if si[k] < 0 and si[buffParam] and self:GetAura("player", si[buffParam], nil, true) then + local buffAmount = si[buffAmountParam] or 1 self.state[k] = self.state[k] + buffAmount end if self.state[k] < v.mini then @@ -280,21 +278,21 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ end -- Combo points - if newSpellInfo.combo then - if newSpellInfo.combo == 0 then + if si.combo then + if si.combo == 0 then self.state.combo = 0 - elseif newSpellInfo.combo > 0 then - self.state.combo = self.state.combo + newSpellInfo.combo + elseif si.combo > 0 then + self.state.combo = self.state.combo + si.combo -- Add extra combo points generated by presence of a buff. - if newSpellInfo.buff_combo and self:GetAura("player", newSpellInfo.buff_combo, nil, true) then - local buffAmount = newSpellInfo.buff_combo_amount or 1 + if si.buff_combo and self:GetAura("player", si.buff_combo, nil, true) then + local buffAmount = si.buff_combo_amount or 1 self.state.combo = self.state.combo + buffAmount end if self.state.combo > MAX_COMBO_POINTS then self.state.combo = MAX_COMBO_POINTS end - else -- newSpellInfo.combo < 0 - self.state.combo = self.state.combo + newSpellInfo.combo + else -- si.combo < 0 + self.state.combo = self.state.combo + si.combo if self.state.combo < 0 then self.state.combo = 0 end @@ -302,62 +300,58 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ end --Runes - if newSpellInfo.frost then - self:AddRune(startCast, 3, newSpellInfo.frost) + if si.frost then + self:AddRune(startCast, 3, si.frost) end - if newSpellInfo.death then - self:AddRune(startCast, 4, newSpellInfo.death) + if si.death then + self:AddRune(startCast, 4, si.death) end - if newSpellInfo.blood then - self:AddRune(startCast, 1, newSpellInfo.blood) + if si.blood then + self:AddRune(startCast, 1, si.blood) end - if newSpellInfo.unholy then - self:AddRune(startCast, 2, newSpellInfo.unholy) + if si.unholy then + self:AddRune(startCast, 2, si.unholy) end end end -- Effets du sort au moment où il atteint sa cible - if newSpellInfo then + if si then -- Cooldown du sort local cd = self:GetCD(spellId) if cd then cd.start = startCast - cd.duration = newSpellInfo.cd + cd.duration = si.cd --Pas de cooldown if nocd then cd.duration = 0 - end - --On vérifie si le buff "buffnocd" est présent, auquel cas le CD du sort n'est pas déclenché - if newSpellInfo.buffnocd and not nocd then - local buffStart, buffEnding, buffStacks = self:GetAura("player", newSpellInfo.buffnocd, nil, true) - if self.traceAura then + else + --On vérifie si le buff "buffnocd" est présent, auquel cas le CD du sort n'est pas déclenché + if si.buffnocd then + local buffStart, buffEnding, buffStacks = self:GetAura("player", si.buffnocd) if buffStart then Ovale:Print("buffnocd stacks = "..tostring(buffStacks).." start="..tostring(buffStart).." ending = "..tostring(buffEnding)) Ovale:Print("startCast = "..startCast) - else - Ovale:Print("buffnocd not present") end - self.traceAura = false - end - if buffStacks and buffStacks > 0 and buffStart and buffStart <= startCast and (not buffEnding or buffEnding > startCast) then - cd.duration = 0 + if buffStacks and buffStacks > 0 and buffStart and buffStart <= startCast and (not buffEnding or buffEnding > startCast) then + cd.duration = 0 + end end - end - if newSpellInfo.targetlifenocd and not nocd then - --TODO - if API_UnitHealth("target") / API_UnitHealthMax("target") * 100 < newSpellInfo.targetlifenocd then - cd.duration = 0 + if si.targetlifenocd then + --TODO + if API_UnitHealth("target") / API_UnitHealthMax("target") * 100 < si.targetlifenocd then + cd.duration = 0 + end end end cd.enable = 1 - if newSpellInfo.toggle then + if si.toggle then cd.toggled = 1 end end - if newSpellInfo.eclipse then - self.state.eclipse = self.state.eclipse + newSpellInfo.eclipse + if si.eclipse then + self.state.eclipse = self.state.eclipse + si.eclipse if self.state.eclipse < -100 then self.state.eclipse = -100 self:AddEclipse(endCast, 48518) @@ -379,8 +373,8 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ --Auras causés par le sort - if newSpellInfo.aura then - for target, targetInfo in pairs(newSpellInfo.aura) do + if si.aura then + for target, targetInfo in pairs(si.aura) do if not (target == "player" and endCast <= self.maintenant) then -- If the spell has already finished casting, then player auras match the game -- state already, so no need to account for traveling spells. Update auras -- 1.7.9.5