From f89ffb3d93c71048a0eadc81e866a2e8c0125486 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 10 Nov 2013 00:32:27 +0000 Subject: [PATCH] Remove legacy code from refactoring OvaleState. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1155 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleBestAction.lua | 11 +++---- OvaleState.lua | 54 ++++------------------------------- conditions/BuffDamageMultiplier.lua | 3 +- conditions/BuffDuration.lua | 3 +- conditions/BuffExpires.lua | 6 ++-- conditions/BuffGain.lua | 3 +- conditions/BuffRemains.lua | 3 +- conditions/BuffSnapshot.lua | 6 ++-- conditions/BuffStacks.lua | 3 +- conditions/CanCast.lua | 5 ++-- conditions/ComboPoints.lua | 3 +- conditions/Counter.lua | 3 +- conditions/Damage.lua | 5 ++-- conditions/DamageMultiplier.lua | 3 +- conditions/Eclipse.lua | 3 +- conditions/EnergyRegen.lua | 3 +- conditions/FocusRegen.lua | 3 +- conditions/IsFeared.lua | 3 +- conditions/IsIncapacitated.lua | 3 +- conditions/IsRooted.lua | 3 +- conditions/IsStunned.lua | 3 +- conditions/ManaPercent.lua | 3 +- conditions/NextTick.lua | 3 +- conditions/Power.lua | 3 +- conditions/RuneCount.lua | 3 +- conditions/SpellCooldown.lua | 5 ++-- conditions/StaggerRemains.lua | 7 +++-- conditions/TickTime.lua | 3 +- conditions/Ticks.lua | 5 ++-- conditions/TicksAdded.lua | 3 +- conditions/TicksRemain.lua | 3 +- conditions/TimeToMaxEnergy.lua | 5 ++-- conditions/TimeToPowerFor.lua | 5 ++-- 33 files changed, 85 insertions(+), 95 deletions(-) diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua index c900aa5..755901c 100644 --- a/OvaleBestAction.lua +++ b/OvaleBestAction.lua @@ -711,6 +711,7 @@ function OvaleBestAction:GetActionInfo(element) return nil end + local state = OvaleState.state local target = element.params.target or OvaleCondition.defaultTarget local action local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration, @@ -726,7 +727,7 @@ function OvaleBestAction:GetActionInfo(element) actionTexture = actionTexture or API_GetSpellTexture(spellId) actionInRange = API_IsSpellInRange(OvaleSpellBook:GetSpellName(spellId), target) - actionCooldownStart, actionCooldownDuration, actionEnable = OvaleState.state:GetSpellCooldown(spellId) + actionCooldownStart, actionCooldownDuration, actionEnable = state:GetSpellCooldown(spellId) -- Verify that the spell may be cast given restrictions specified in SpellInfo(). local si = OvaleData.spellInfo[spellId] @@ -737,13 +738,13 @@ function OvaleBestAction:GetActionInfo(element) end if si.combo == 0 then local minCombo = si.minCombo or 1 - if OvaleState.state.combo < minCombo then + if state.combo < minCombo then -- Spell is a combo point finisher, but player has too few combo points on the target. return nil end end for _, powerType in pairs(OvalePower.SECONDARY_POWER) do - if si[powerType] and si[powerType] > OvaleState.state[powerType] then + if si[powerType] and si[powerType] > state[powerType] then -- Spell requires "secondary" resources, e.g., chi, focus, rage, etc., -- that the player does not have enough of. return nil @@ -811,8 +812,8 @@ function OvaleBestAction:GetActionInfo(element) actionIsCurrent = API_IsCurrentAction(action) end - local cd = OvaleState:GetCD(spellId) - if cd and cd.toggle then + local cd = state:GetCD(spellId) + if cd and cd.toggled then actionIsCurrent = 1 end diff --git a/OvaleState.lua b/OvaleState.lua index 711b377..85eb824 100644 --- a/OvaleState.lua +++ b/OvaleState.lua @@ -49,8 +49,6 @@ local STARFALL = 48505 -- -- The state in the current frame OvaleState.state = {} --- Legacy table for transition. -OvaleState.powerRate = nil -- The spell being cast OvaleState.currentSpellId = nil OvaleState.now = nil @@ -126,9 +124,6 @@ function OvaleState:InitializeState() self.state.rune[i] = {} end - -- Legacy fields - self.powerRate = self.state.powerRate - self_stateIsInitialized = true end @@ -241,8 +236,8 @@ function OvaleState:ApplySpellCost(spellId, startCast, endCast) end -- Euphoria: While not in an Eclipse state, your spells generate double the normal amount of Solar or Lunar energy. if OvaleSpellBook:IsKnownSpell(81062) - and not self:GetAura("player", LUNAR_ECLIPSE, "HELPFUL", true) - and not self:GetAura("player", SOLAR_ECLIPSE, "HELPFUL", true) then + and not self.state:GetAura("player", LUNAR_ECLIPSE, "HELPFUL", true) + and not self.state:GetAura("player", SOLAR_ECLIPSE, "HELPFUL", true) then energy = energy * 2 end -- Only adjust Eclipse energy if the spell moves the Eclipse bar in the right direction. @@ -254,7 +249,7 @@ function OvaleState:ApplySpellCost(spellId, startCast, endCast) self.state.eclipse = -100 self.state:AddEclipse(endCast, LUNAR_ECLIPSE) -- Reaching Lunar Eclipse resets the cooldown of Starfall. - local cd = self:GetCD(STARFALL) + local cd = self.state:GetCD(STARFALL) if cd then cd.start = 0 cd.duration = 0 @@ -284,11 +279,11 @@ end -- Returns 1 if moving toward Solar or -1 if moving toward Lunar. function OvaleState:GetEclipseDir() - local stacks = select(3, self:GetAura("player", SOLAR_ECLIPSE, "HELPFUL", true)) + local stacks = select(3, self.state:GetAura("player", SOLAR_ECLIPSE, "HELPFUL", true)) if stacks and stacks > 0 then return -1 else - stacks = select(3, self:GetAura("player", LUNAR_ECLIPSE, "HELPFUL", true)) + stacks = select(3, self.state:GetAura("player", LUNAR_ECLIPSE, "HELPFUL", true)) if stacks and stacks > 0 then return 1 elseif self.state.eclipse < 0 then @@ -365,43 +360,4 @@ function OvaleState:GetRunesCooldown(blood, frost, unholy, death, nodeath) end return maxCD end - ---[[------------------------------ - Legacy methods for transition. ---]]------------------------------ -function OvaleState:GetCounterValue(id) - return self.state:GetCounterValue(id) -end - -function OvaleState:GetCD(spellId) - return self.state:GetCD(spellId) -end - -function OvaleState:GetComputedSpellCD(spellId) - return self.state:GetSpellCooldown(spellId) -end - -function OvaleState:GetAuraByGUID(guid, spellId, filter, mine, unitId, auraFound) - return self.state:GetAuraByGUID(guid, spellId, filter, mine, unitId, auraFound) -end - -function OvaleState:GetAura(unitId, spellId, filter, mine, auraFound) - return self.state:GetAura(unitId, spellId, filter, mine, auraFound) -end - -function OvaleState:GetAuraOnAnyTarget(spellId, filter, mine, excludingGUID) - return self.state:GetAuraOnAnyTarget(spellId, filter, mine, excludingGUID) -end - -function OvaleState:NewAura(guid, spellId, filter) - return self.state:NewAura(guid, spellId, filter) -end - -function OvaleState:GetDamageMultiplier(spellId) - return self.state:GetDamageMultiplier(spellId) -end - -function OvaleState:GetDuration(auraSpellId) - return self.state:GetDuration(auraSpellId) -end -- diff --git a/conditions/BuffDamageMultiplier.lua b/conditions/BuffDamageMultiplier.lua index cde1dac..ad2b1b8 100644 --- a/conditions/BuffDamageMultiplier.lua +++ b/conditions/BuffDamageMultiplier.lua @@ -36,8 +36,9 @@ do local function BuffDamageMultiplier(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound.comboPoints = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local baseDamageMultiplier = auraFound.baseDamageMultiplier or 1 local damageMultiplier = auraFound.damageMultiplier or 1 local value = baseDamageMultiplier * damageMultiplier diff --git a/conditions/BuffDuration.lua b/conditions/BuffDuration.lua index aee0b10..0d79627 100644 --- a/conditions/BuffDuration.lua +++ b/conditions/BuffDuration.lua @@ -32,7 +32,8 @@ do local function BuffDuration(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) - local start, ending = OvaleState:GetAura(target, auraId, filter, mine) + local state = OvaleState.state + local start, ending = state:GetAura(target, auraId, filter, mine) start = start or 0 ending = ending or math.huge value = ending - start diff --git a/conditions/BuffExpires.lua b/conditions/BuffExpires.lua index 20cc381..4531dab 100644 --- a/conditions/BuffExpires.lua +++ b/conditions/BuffExpires.lua @@ -59,7 +59,8 @@ do local function BuffExpires(condition) local auraId, seconds = condition[1], condition[2] local target, filter, mine = ParseCondition(condition) - local start, ending = OvaleState:GetAura(target, auraId, filter, mine) + local state = OvaleState.state + local start, ending = state:GetAura(target, auraId, filter, mine) if not start or not ending then return 0, math.huge end @@ -100,7 +101,8 @@ do local function BuffPresent(condition) local auraId, seconds = condition[1], condition[2] local target, filter, mine = ParseCondition(condition) - local start, ending = OvaleState:GetAura(target, auraId, filter, mine) + local state = OvaleState.state + local start, ending = state:GetAura(target, auraId, filter, mine) if not start or not ending then return nil end diff --git a/conditions/BuffGain.lua b/conditions/BuffGain.lua index 18e151e..68c3e8f 100644 --- a/conditions/BuffGain.lua +++ b/conditions/BuffGain.lua @@ -36,8 +36,9 @@ do local function BuffGain(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound.gain = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local gain = auraFound.gain or 0 if true then Ovale:Error("not implemented") diff --git a/conditions/BuffRemains.lua b/conditions/BuffRemains.lua index 0ff47ef..d458299 100644 --- a/conditions/BuffRemains.lua +++ b/conditions/BuffRemains.lua @@ -39,7 +39,8 @@ do local function BuffRemains(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) - local start, ending = OvaleState:GetAura(target, auraId, filter, mine) + local state = OvaleState.state + local start, ending = state:GetAura(target, auraId, filter, mine) if not start or not ending then return Compare(0, comparator, limit) else diff --git a/conditions/BuffSnapshot.lua b/conditions/BuffSnapshot.lua index adbd754..a09b1ce 100644 --- a/conditions/BuffSnapshot.lua +++ b/conditions/BuffSnapshot.lua @@ -22,8 +22,9 @@ do local function BuffSnapshot(statName, defaultValue, condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound[statName] = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local value = auraFound[statName] value = value and value or defaultValue return TestValue(start, ending, value, start, 0, comparator, limit) @@ -33,8 +34,9 @@ do local function BuffSnapshotCritChance(statName, defaultValue, condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound[statName] = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local value = auraFound[statName] value = value and value or defaultValue if condition.unlimited ~= 1 and value > 100 then diff --git a/conditions/BuffStacks.lua b/conditions/BuffStacks.lua index 06aad2b..f2c96d3 100644 --- a/conditions/BuffStacks.lua +++ b/conditions/BuffStacks.lua @@ -40,7 +40,8 @@ do local function BuffStacks(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) - local start, ending, stacks = OvaleState:GetAura(target, auraId, filter, mine) + local state = OvaleState.state + local start, ending, stacks = state:GetAura(target, auraId, filter, mine) stacks = stacks or 0 return TestValue(start, ending, stacks, start, 0, comparator, limit) end diff --git a/conditions/CanCast.lua b/conditions/CanCast.lua index 461ca94..07d18aa 100644 --- a/conditions/CanCast.lua +++ b/conditions/CanCast.lua @@ -22,8 +22,9 @@ do local function CanCast(condition) local spellId = condition[1] - local actionCooldownStart, actionCooldownDuration = OvaleState:GetComputedSpellCD(spellId) - return actionCooldownStart + actionCooldownDuration, math.huge + local state = OvaleState.state + local start, duration = state:GetSpellCooldown(spellId) + return start + duration, math.huge end OvaleCondition:RegisterCondition("cancast", true, CanCast) diff --git a/conditions/ComboPoints.lua b/conditions/ComboPoints.lua index 559ffeb..956dbd5 100644 --- a/conditions/ComboPoints.lua +++ b/conditions/ComboPoints.lua @@ -29,7 +29,8 @@ do local function ComboPoints(condition) local comparator, limit = condition[1], condition[2] - local value = OvaleState.state.combo + local state = OvaleState.state + local value = state.combo return Compare(value, comparator, limit) end diff --git a/conditions/Counter.lua b/conditions/Counter.lua index b507cdc..c2a9a2d 100644 --- a/conditions/Counter.lua +++ b/conditions/Counter.lua @@ -26,7 +26,8 @@ do local function Counter(condition) local counter, comparator, limit = condition[1], condition[2], condition[3] - local value = OvaleState:GetCounterValue(counter) + local state = OvaleState.state + local value = state:GetCounterValue(counter) return Compare(value, comparator, limit) end diff --git a/conditions/Damage.lua b/conditions/Damage.lua index a45c37f..9613ad6 100644 --- a/conditions/Damage.lua +++ b/conditions/Damage.lua @@ -19,14 +19,15 @@ do -- Return the non-critical-strike damage of a spell, given the player's current stats. local function GetDamage(spellId) + local state = OvaleState.state -- TODO: Use target's debuffs in this calculation. local ap = OvalePaperDoll.stat.attackPower or 0 local sp = OvalePaperDoll.stat.spellBonusDamage or 0 local mh = OvalePaperDoll.stat.mainHandWeaponDamage or 0 local oh = OvalePaperDoll.stat.offHandWeaponDamage or 0 local bdm = OvalePaperDoll.stat.baseDamageMultiplier or 1 - local dm = OvaleState:GetDamageMultiplier(spellId) or 1 - local combo = OvaleState.state.combo or 0 + local dm = state:GetDamageMultiplier(spellId) or 1 + local combo = state.combo or 0 return OvaleData:GetDamage(spellId, ap, sp, mh, oh, combo) * bdm * dm end diff --git a/conditions/DamageMultiplier.lua b/conditions/DamageMultiplier.lua index 2778334..7a1ad37 100644 --- a/conditions/DamageMultiplier.lua +++ b/conditions/DamageMultiplier.lua @@ -32,8 +32,9 @@ do local function DamageMultiplier(condition) local spellId, comparator, limit = condition[1], condition[2], condition[3] + local state = OvaleState.state local bdm = OvalePaperDoll.stat.baseDamageMultiplier - local dm = OvaleState:GetDamageMultiplier(spellId) + local dm = state:GetDamageMultiplier(spellId) local value = bdm * dm return Compare(value, comparator, limit) end diff --git a/conditions/Eclipse.lua b/conditions/Eclipse.lua index ed0a9b3..209b326 100644 --- a/conditions/Eclipse.lua +++ b/conditions/Eclipse.lua @@ -31,7 +31,8 @@ do local function Eclipse(condition) local comparator, limit = condition[1], condition[2] - local value = OvaleState.state.eclipse + local state = OvaleState.state + local value = state.eclipse return Compare(value, comparator, limit) end diff --git a/conditions/EnergyRegen.lua b/conditions/EnergyRegen.lua index 70bb7bd..a82bf27 100644 --- a/conditions/EnergyRegen.lua +++ b/conditions/EnergyRegen.lua @@ -27,7 +27,8 @@ do local function EnergyRegen(condition) local comparator, limit = condition[1], condition[2] - local value = OvaleState.powerRate.energy + local state = OvaleState.state + local value = state.powerRate.energy return Compare(value, comparator, limit) end diff --git a/conditions/FocusRegen.lua b/conditions/FocusRegen.lua index 7fd4318..4f05fd5 100644 --- a/conditions/FocusRegen.lua +++ b/conditions/FocusRegen.lua @@ -28,7 +28,8 @@ do local function FocusRegen(condition) local comparator, limit = condition[1], condition[2] - local value = OvaleState.powerRate.focus + local state = OvaleState.state + local value = state.powerRate.focus return Compare(value, comparator, limit) end diff --git a/conditions/IsFeared.lua b/conditions/IsFeared.lua index 6371c4e..d18752d 100644 --- a/conditions/IsFeared.lua +++ b/conditions/IsFeared.lua @@ -28,7 +28,8 @@ do local function IsFeared(condition) local yesno = condition[1] - local boolean = not API_HasFullControl() and OvaleState:GetAura("player", "fear", "HARMFUL") + local state = OvaleState.state + local boolean = not API_HasFullControl() and state:GetAura("player", "fear", "HARMFUL") return TestBoolean(boolean, yesno) end diff --git a/conditions/IsIncapacitated.lua b/conditions/IsIncapacitated.lua index 33d9cda..f4d2e81 100644 --- a/conditions/IsIncapacitated.lua +++ b/conditions/IsIncapacitated.lua @@ -28,7 +28,8 @@ do local function IsIncapacitated(condition) local yesno = condition[1] - local boolean = not API_HasFullControl() and OvaleState:GetAura("player", "incapacitate", "HARMFUL") + local state = OvaleState.state + local boolean = not API_HasFullControl() and state:GetAura("player", "incapacitate", "HARMFUL") return TestBoolean(boolean, yesno) end diff --git a/conditions/IsRooted.lua b/conditions/IsRooted.lua index 11ce741..9e3b60b 100644 --- a/conditions/IsRooted.lua +++ b/conditions/IsRooted.lua @@ -27,7 +27,8 @@ do local function IsRooted(condition) local yesno = condition[1] - local boolean = OvaleState:GetAura("player", "root", "HARMFUL") + local state = OvaleState.state + local boolean = state:GetAura("player", "root", "HARMFUL") return TestBoolean(boolean, yesno) end diff --git a/conditions/IsStunned.lua b/conditions/IsStunned.lua index db64263..08bef3d 100644 --- a/conditions/IsStunned.lua +++ b/conditions/IsStunned.lua @@ -28,7 +28,8 @@ do local function IsStunned(condition) local yesno = condition[1] - local boolean = not API_HasFullControl() and OvaleState:GetAura("player", "stun", "HARMFUL") + local state = OvaleState.state + local boolean = not API_HasFullControl() and state:GetAura("player", "stun", "HARMFUL") return TestBoolean(boolean, yesno) end diff --git a/conditions/ManaPercent.lua b/conditions/ManaPercent.lua index 13a774d..4979931 100644 --- a/conditions/ManaPercent.lua +++ b/conditions/ManaPercent.lua @@ -37,11 +37,12 @@ do local function ManaPercent(condition) local comparator, limit = condition[1], condition[2] local target = ParseCondition(condition) + local state = OvaleState.state if target == "player" then local powerMax = OvalePower.maxPower.mana or 0 if powerMax > 0 then local conversion = 100 / powerMax - local value, origin, rate = OvaleState.state.mana * conversion, OvaleState.currentTime, OvaleState.powerRate.mana * conversion + local value, origin, rate = state.mana * conversion, OvaleState.currentTime, state.powerRate.mana * conversion local start, ending = OvaleState.currentTime, math.huge return TestValue(start, ending, value, origin, rate, comparator, limit) end diff --git a/conditions/NextTick.lua b/conditions/NextTick.lua index 091faca..6bb28d0 100644 --- a/conditions/NextTick.lua +++ b/conditions/NextTick.lua @@ -37,8 +37,9 @@ do local function NextTick(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound.tick = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local tick = auraFound.tick if ending and ending < math.huge and tick then while ending - tick > OvaleState.currentTime do diff --git a/conditions/Power.lua b/conditions/Power.lua index 38d80ce..aab2a61 100644 --- a/conditions/Power.lua +++ b/conditions/Power.lua @@ -38,8 +38,9 @@ do local function Power(powerType, condition) local comparator, limit = condition[1], condition[2] local target = ParseCondition(condition) + local state = OvaleState.state if target == "player" then - local value, origin, rate = OvaleState.state[powerType], OvaleState.currentTime, OvaleState.powerRate[powerType] + local value, origin, rate = state[powerType], OvaleState.currentTime, state.powerRate[powerType] local start, ending = OvaleState.currentTime, math.huge return TestValue(start, ending, value, origin, rate, comparator, limit) else diff --git a/conditions/RuneCount.lua b/conditions/RuneCount.lua index ddabf64..6f53e4e 100644 --- a/conditions/RuneCount.lua +++ b/conditions/RuneCount.lua @@ -42,12 +42,13 @@ do local function RuneCount(condition) local runeType, comparator, limit = condition[1], condition[2], condition[3] local death = condition.death + local state = OvaleState.state runeType = RUNE_TYPE[runeType] -- Loop through the rune state and count the number of runes that match the given rune type. local value, origin, rate = 0, nil, nil for i = 1, 6 do - local rune = OvaleState.state.rune[i] + local rune = state.rune[i] if rune and (rune.type == runeType or (rune.type == 4 and death == 1)) then if rune.cd > OvaleState.currentTime then -- Rune matches but is on cooldown. diff --git a/conditions/SpellCooldown.lua b/conditions/SpellCooldown.lua index bbb7a59..fd7a50b 100644 --- a/conditions/SpellCooldown.lua +++ b/conditions/SpellCooldown.lua @@ -34,9 +34,10 @@ do local function SpellCooldown(condition) local spellId, comparator, limit = condition[1], condition[2], condition[3] + local state = OvaleState.state local start, duration if type(spellId) == "string" then - local sharedCd = OvaleState.state.cd[spellId] + local sharedCd = state.cd[spellId] if not sharedCd then return nil end @@ -44,7 +45,7 @@ do elseif not OvaleSpellBook:IsKnownSpell(spellId) then return nil else - start, duration = OvaleState:GetComputedSpellCD(spellId) + start, duration = state:GetSpellCooldown(spellId) end if start > 0 and duration > 0 then return TestValue(start, start + duration, duration, start, -1, comparator, limit) diff --git a/conditions/StaggerRemains.lua b/conditions/StaggerRemains.lua index bdc1a6f..24bd3ed 100644 --- a/conditions/StaggerRemains.lua +++ b/conditions/StaggerRemains.lua @@ -38,13 +38,14 @@ do local function StaggerRemains(condition) local comparator, limit = condition[1], condition[2] local target = ParseCondition(condition) + local state = OvaleState.state local start, ending, stacks - start, ending, stacks = OvaleState:GetAura(target, HEAVY_STAGGER, "HARMFUL") + start, ending, stacks = state:GetAura(target, HEAVY_STAGGER, "HARMFUL") if not stacks or stacks == 0 then - start, ending, stacks = OvaleState:GetAura(target, MODERATE_STAGGER, "HARMFUL") + start, ending, stacks = state:GetAura(target, MODERATE_STAGGER, "HARMFUL") end if not stacks or stacks == 0 then - start, ending, stacks = OvaleState:GetAura(target, LIGHT_STAGGER, "HARMFUL") + start, ending, stacks = state:GetAura(target, LIGHT_STAGGER, "HARMFUL") end if start and ending then local stagger = API_UnitStagger(target) diff --git a/conditions/TickTime.lua b/conditions/TickTime.lua index 7712748..93d539d 100644 --- a/conditions/TickTime.lua +++ b/conditions/TickTime.lua @@ -39,8 +39,9 @@ do local function TickTime(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound.tick = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local value = auraFound.tick value = value and value or OvaleAura:GetTickLength(auraId) if value then diff --git a/conditions/Ticks.lua b/conditions/Ticks.lua index 1d3dcdb..ca0740e 100644 --- a/conditions/Ticks.lua +++ b/conditions/Ticks.lua @@ -33,8 +33,9 @@ do local function Ticks(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound.tick = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local tick = auraFound.tick local duration, numTicks if start then @@ -44,7 +45,7 @@ do numTicks = floor(duration / tick + 0.5) end else - duration, tick, numTicks = OvaleState:GetDuration(auraId) + duration, tick, numTicks = state:GetDuration(auraId) end if numTicks then return Compare(numTicks, comparator, limit) diff --git a/conditions/TicksAdded.lua b/conditions/TicksAdded.lua index 200538a..fa4c4b4 100644 --- a/conditions/TicksAdded.lua +++ b/conditions/TicksAdded.lua @@ -32,8 +32,9 @@ do local function TicksAdded(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound.tick = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local tick = auraFound.tick return TestValue(start, ending, 0, start, 0, comparator, limit) end diff --git a/conditions/TicksRemain.lua b/conditions/TicksRemain.lua index 7c0e2e8..e15bb42 100644 --- a/conditions/TicksRemain.lua +++ b/conditions/TicksRemain.lua @@ -42,8 +42,9 @@ do local function TicksRemain(condition) local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) + local state = OvaleState.state auraFound.tick = nil - local start, ending = OvaleState:GetAura(target, auraId, filter, mine, auraFound) + local start, ending = state:GetAura(target, auraId, filter, mine, auraFound) local tick = auraFound.tick if ending and tick and tick > 0 then return TestValue(start, ending, 1, ending, -1/tick, comparator, limit) diff --git a/conditions/TimeToMaxEnergy.lua b/conditions/TimeToMaxEnergy.lua index 4c21548..c8c8618 100644 --- a/conditions/TimeToMaxEnergy.lua +++ b/conditions/TimeToMaxEnergy.lua @@ -31,8 +31,9 @@ do local function TimeToMaxEnergy(condition) local comparator, limit = condition[1], condition[2] local maxEnergy = OvalePower.maxPower.energy or 0 - local energy = OvaleState.state.energy or 0 - local energyRegen = OvaleState.powerRate.energy or 10 + local state = OvaleState.state + local energy = state.energy or 0 + local energyRegen = state.powerRate.energy or 10 local t = (maxEnergy - energy) / energyRegen if t > 0 then return TestValue(0, OvaleState.currentTime + t, t, OvaleState.currentTime, -1, comparator, limit) diff --git a/conditions/TimeToPowerFor.lua b/conditions/TimeToPowerFor.lua index 2a0c517..b35120f 100644 --- a/conditions/TimeToPowerFor.lua +++ b/conditions/TimeToPowerFor.lua @@ -33,8 +33,9 @@ do local spellId, comparator, limit = condition[1], condition[2], condition[3] local cost, _, powerToken = select(4, API_GetSpellInfo(spellId)) local powerType = OvalePower.POWER_TYPE[powerToken] - local currentPower = OvaleState.state[powerType] - local powerRate = OvaleState.powerRate[powerType] + local state = OvaleState.state + local currentPower = state[powerType] + local powerRate = state.powerRate[powerType] cost = cost or 0 if currentPower < cost then if powerRate > 0 then -- 1.7.9.5