From a3e869e4122dfe40113e3559e5ed276201f19661 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 27 Apr 2014 04:39:39 +0000 Subject: [PATCH] Another fix for buff conditions. Back out r1321 and partially re-implement r1252 by giving the results of those conditions a time span that starts when the buff starts and lasting to infinity. This fixes uses of buff conditions for buffs that are applied in the future, e.g., a spell applies a DoT at end of spellcast and something like: if target.DebuffRemains(dot) < 3 Spell(spell_that_applies_dot) git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1337 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- conditions/BuffAmount.lua | 4 ++-- conditions/BuffComboPoints.lua | 4 ++-- conditions/BuffDamageMultiplier.lua | 4 ++-- conditions/BuffDuration.lua | 4 ++-- conditions/BuffRemains.lua | 4 ++-- conditions/BuffSnapshot.lua | 8 ++++---- conditions/BuffStacks.lua | 4 ++-- conditions/TickTime.lua | 2 +- conditions/TicksRemain.lua | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/conditions/BuffAmount.lua b/conditions/BuffAmount.lua index 6ca4963..ba250ef 100644 --- a/conditions/BuffAmount.lua +++ b/conditions/BuffAmount.lua @@ -54,10 +54,10 @@ do statName = "value3" end local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending = aura.start, aura.ending local value = aura[statName] or 0 - return TestValue(0, math.huge, value, start, 0, comparator, limit) + return TestValue(start, math.huge, value, start, 0, comparator, limit) end return Compare(0, comparator, limit) end diff --git a/conditions/BuffComboPoints.lua b/conditions/BuffComboPoints.lua index b888be9..731f52d 100644 --- a/conditions/BuffComboPoints.lua +++ b/conditions/BuffComboPoints.lua @@ -37,10 +37,10 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending = aura.start, aura.ending local value = aura and aura.combo or 0 - return TestValue(0, math.huge, value, start, 0, comparator, limit) + return TestValue(start, math.huge, value, start, 0, comparator, limit) end return Compare(0, comparator, limit) end diff --git a/conditions/BuffDamageMultiplier.lua b/conditions/BuffDamageMultiplier.lua index e9c4af6..78f357e 100644 --- a/conditions/BuffDamageMultiplier.lua +++ b/conditions/BuffDamageMultiplier.lua @@ -37,12 +37,12 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending = aura.start, aura.ending local baseDamageMultiplier = aura.snapshot and aura.snapshot.baseDamageMultiplier or 1 local damageMultiplier = aura.damageMultiplier or 1 local value = baseDamageMultiplier * damageMultiplier - return TestValue(0, math.huge, value, start, 0, comparator, limit) + return TestValue(start, math.huge, value, start, 0, comparator, limit) end return Compare(1, comparator, limit) end diff --git a/conditions/BuffDuration.lua b/conditions/BuffDuration.lua index e867318..2149316 100644 --- a/conditions/BuffDuration.lua +++ b/conditions/BuffDuration.lua @@ -35,10 +35,10 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending = aura.start, aura.ending local value = ending - start - return TestValue(0, math.huge, value, start, 0, comparator, limit) + return TestValue(start, math.huge, value, start, 0, comparator, limit) end return Compare(0, comparator, limit) end diff --git a/conditions/BuffRemains.lua b/conditions/BuffRemains.lua index 048272d..406b4c3 100644 --- a/conditions/BuffRemains.lua +++ b/conditions/BuffRemains.lua @@ -41,9 +41,9 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending = aura.start, aura.ending - return TestValue(0, math.huge, ending - start, start, -1, comparator, limit) + return TestValue(start, math.huge, ending - start, start, -1, comparator, limit) end return Compare(0, comparator, limit) end diff --git a/conditions/BuffSnapshot.lua b/conditions/BuffSnapshot.lua index 83b9254..d81be30 100644 --- a/conditions/BuffSnapshot.lua +++ b/conditions/BuffSnapshot.lua @@ -23,10 +23,10 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start = aura.start local value = aura.snapshot and aura.snapshot[statName] or defaultValue - return TestValue(0, math.huge, value, start, 0, comparator, limit) + return TestValue(start, math.huge, value, start, 0, comparator, limit) end return Compare(defaultValue, comparator, limit) end @@ -36,13 +36,13 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending = aura.start, aura.ending local value = aura.snapshot and aura.snapshot[statName] or defaultValue if condition.unlimited ~= 1 and value > 100 then value = 100 end - return TestValue(0, math.huge, value, start, 0, comparator, limit) + return TestValue(start, math.huge, value, start, 0, comparator, limit) end return Compare(defaultValue, comparator, limit) end diff --git a/conditions/BuffStacks.lua b/conditions/BuffStacks.lua index 2449351..7c74b0b 100644 --- a/conditions/BuffStacks.lua +++ b/conditions/BuffStacks.lua @@ -43,10 +43,10 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending = aura.start, aura.ending local value = aura.stacks or 0 - return TestValue(0, math.huge, value, start, 0, comparator, limit) + return TestValue(start, math.huge, value, start, 0, comparator, limit) end return Compare(0, comparator, limit) end diff --git a/conditions/TickTime.lua b/conditions/TickTime.lua index 5bfd6be..5b09fe5 100644 --- a/conditions/TickTime.lua +++ b/conditions/TickTime.lua @@ -38,7 +38,7 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) and aura.tick then + if aura and aura.tick then local value = aura.tick return Compare(value, comparator, limit) end diff --git a/conditions/TicksRemain.lua b/conditions/TicksRemain.lua index e8750f3..2aace89 100644 --- a/conditions/TicksRemain.lua +++ b/conditions/TicksRemain.lua @@ -42,10 +42,10 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local target, filter, mine = ParseCondition(condition) local aura = state:GetAura(target, auraId, filter, mine) - if state:IsActiveAura(aura) then + if aura then local start, ending, tick = aura.start, aura.ending, aura.tick if tick and tick > 0 then - return TestValue(0, math.huge, 1, ending, -1/tick, comparator, limit) + return TestValue(start, math.huge, 1, ending, -1/tick, comparator, limit) end end return Compare(0, comparator, limit) -- 1.7.9.5