Quantcast

Only check across player-applied auras when checking auras on all targets.

Johnny C. Lam [03-23-13 - 21:38]
Only check across player-applied auras when checking auras on all targets.

OvaleAura only accurately tracks every aura applied by the player.  For
auras applied by anyone else, OvaleAura only saves the one with the latest
expiration time.  Rename the GetAuraOnAnyTarget methods to
GetMyAuraOnAnyTarget in both OvaleAura and OvaleState.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@820 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleAura.lua
OvaleCondition.lua
OvaleState.lua
diff --git a/OvaleAura.lua b/OvaleAura.lua
index cf0f5d0..8ef0443 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -343,29 +343,24 @@ function OvaleAura:GetStealable(unitId)
 	return start, ending
 end

--- Look for the aura on any target.
+-- Look for my aura on any target.
 -- Returns the earliest start time, the latest ending time, and the number of auras seen.
-function OvaleAura:GetAuraOnAnyTarget(spellId, filter, mine, excludingGUID)
+function OvaleAura:GetMyAuraOnAnyTarget(spellId, filter, excludingGUID)
 	local start, ending
 	local count = 0
-
-	local aura
 	for guid, auraTable in pairs(self_aura) do
 		if guid ~= excludingGUID then
 			for auraFilter, auraList in pairs(auraTable) do
 				if not filter or auraFilter == filter then
 					if auraList[spellId] then
-						for whose, aura in pairs(auraList[spellId]) do
-							if not mine or (mine and whose == "mine") then
-								if aura.start and (not start or aura.start < start) then
-									start = aura.start
-								end
-								if aura.ending and (not ending or aura.ending > ending) then
-									ending = aura.ending
-								end
-								count = count + 1
-							end
+						local aura = auraList[spellId].mine
+						if aura.start and (not start or aura.start < start) then
+							start = aura.start
+						end
+						if aura.ending and (not ending or aura.ending > ending) then
+							ending = aura.ending
 						end
+						count = count + 1
 					end
 				end
 			end
@@ -378,9 +373,8 @@ function OvaleAura:GetDamageMultiplier(spellId)
 	-- Calculate the base damage multiplier for all spells.
 	local damageMultiplier = 1
 	local playerGUID = OvaleGUID:GetGUID("player")
-	local count
 	for auraSpellId, multiplier in pairs(OvaleData.selfDamageBuff) do
-		count = select(3, self:GetAuraByGUID(playerGUID, auraSpellId, filter, nil, "player"))
+		local count = select(3, self:GetAuraByGUID(playerGUID, auraSpellId, filter, nil, "player"))
 		if count and count > 0 then
 			-- Try to account for a stacking aura.
 			multiplier = 1 + (multiplier - 1) * count
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index e0cf56f..a0c3658 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -220,11 +220,11 @@ local function addOrSubTime(time1, operator, duration)
 	end
 end

-local function getOtherAura(spellId, filter, mine, excludingUnit)
+local function getOtherAura(spellId, filter, excludingUnit)
 	if excludingUnit then
 		excludingUnit = OvaleGUID:GetGUID(excludingUnit)
 	end
-	return OvaleState:GetAuraOnAnyTarget(spellId, filter, mine, excludingUnit)
+	return OvaleState:GetMyAuraOnAnyTarget(spellId, filter, excludingUnit)
 end

 local function GetRuneCount(type, death)
@@ -540,7 +540,7 @@ OvaleCondition.conditions.attackpower = function(condition)
 	return compare(OvalePaperDoll.attackPower, condition[1], condition[2])
 end

---- Get the total count of the given aura across all targets.
+--- Get the total count of the given aura applied by the player across all targets.
 -- @name BuffCount
 -- @paramsig number
 -- @param id The aura spell ID.
@@ -548,7 +548,7 @@ end
 -- @see DebuffCount

 OvaleCondition.conditions.buffcount = function(condition)
-	local start, ending, count = getOtherAura(condition[1], getFilter(condition), getMine(condition))
+	local start, ending, count = getOtherAura(condition[1], getFilter(condition))
 	return start, ending, count, 0, 0
 end
 OvaleCondition.conditions.debuffcount = OvaleCondition.conditions.buffcount
@@ -2017,15 +2017,12 @@ OvaleCondition.conditions.nexttick = function(condition)
 	return nil
 end

---- Test if an aura is expired, or will expire after a given number of seconds, on every unit other than the current target.
+--- Test if an aura applied by the player is expired, or will expire after a given number of seconds, on every unit other than the current target.
 -- @name OtherDebuffExpires
 -- @paramsig boolean
 -- @param id The spell ID of the aura or the name of a spell list.
 -- @param seconds Optional. The maximum number of seconds before the aura should expire.
 --     Defaults to 0 (zero).
--- @param any Optional. Sets by whom the aura was applied. If the aura can be applied by anyone, then set any=1.
---     Defaults to any=0.
---     Valid values: 0, 1.
 -- @param haste Optional. Sets whether "seconds" should be lengthened or shortened due to spell haste.
 --     Defaults to haste=none.
 --     Valid values: spell, none.
@@ -2036,21 +2033,18 @@ end
 --     Spell(thunder_clap)

 OvaleCondition.conditions.otherdebuffexpires = function(condition)
-	local start, ending = getOtherAura(condition[1], getFilter(condition), getMine(condition), "target")
+	local start, ending = getOtherAura(condition[1], getFilter(condition), "target")
 	local timeBefore = avecHate(condition[2], condition.haste)
 	return addTime(ending, -timeBefore)
 end
 OvaleCondition.conditions.otherbuffexpires = OvaleCondition.conditions.otherdebuffexpires

---- Test if an aura is present, or if the remaining time on the aura is more than the given number of seconds, on at least one unit other than the current target.
+--- Test if an aura applied by the player is present, or if the remaining time on the aura is more than the given number of seconds, on at least one unit other than the current target.
 -- @name OtherDebuffPresent
 -- @paramsig boolean
 -- @param id The spell ID of the aura or the name of a spell list.
 -- @param seconds Optional. The mininum number of seconds before the aura should expire.
 --     Defaults to 0 (zero).
--- @param any Optional. Sets by whom the aura was applied. If the aura can be applied by anyone, then set any=1.
---     Defaults to any=0.
---     Valid values: 0, 1.
 -- @param haste Optional. Sets whether "seconds" should be lengthened or shortened due to spell haste.
 --     Defaults to haste=none.
 --     Valid values: spell, none.
@@ -2061,21 +2055,16 @@ OvaleCondition.conditions.otherbuffexpires = OvaleCondition.conditions.otherdebu
 --     Spell(devouring_plague)

 OvaleCondition.conditions.otherdebuffpresent = function(condition)
-	local start, ending = getOtherAura(condition[1], getFilter(condition), getMine(condition), "target")
+	local start, ending = getOtherAura(condition[1], getFilter(condition), "target")
 	local timeBefore = avecHate(condition[2], condition.haste)
 	return start, addTime(ending, -timeBefore)
 end
 OvaleCondition.conditions.otherbuffpresent = OvaleCondition.conditions.otherdebuffpresent

-	-- Get the maximum aura remaining duration on any target
-	-- return: number
---- Get the remaining time in seconds on an aura across every unit other than the current target.
+--- Get the remaining time in seconds on an aura applied by the player across every unit other than the current target.
 -- @name OtherDebuffRemains
 -- @paramsig number
 -- @param id The spell ID of the aura or the name of a spell list.
--- @param any Optional. Sets by whom the aura was applied. If the aura can be applied by anyone, then set any=1.
---     Defaults to any=0.
---     Valid values: 0, 1.
 -- @param target Optional. Sets the target to check. The target may also be given as a prefix to the condition.
 --     Defaults to target=player.
 --     Valid values: player, target, focus, pet.
@@ -2086,7 +2075,7 @@ OvaleCondition.conditions.otherbuffpresent = OvaleCondition.conditions.otherdebu
 --     Spell(devouring_plague)

 OvaleCondition.conditions.otherdebuffremains = function(condition)
-	local start, ending = getOtherAura(condition[1], getFilter(condition), getMine(condition), "target")
+	local start, ending = getOtherAura(condition[1], getFilter(condition), "target")
 	if ending then
 		return start, ending, ending - start, start, -1
 	else
diff --git a/OvaleState.lua b/OvaleState.lua
index 2452108..efbd5fd 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -567,24 +567,23 @@ function OvaleState:GetAura(target, spellId, filter, mine)
 	return self:GetAuraByGUID(OvaleGUID:GetGUID(target), spellId, filter, mine, target)
 end

-function OvaleState:GetAuraOnAnyTarget(spellId, filter, mine, excludingGUID)
-	local start, ending, count = OvaleAura:GetAuraOnAnyTarget(spellId, filter, mine, excludingGUID)
-	if mine then
-		local aura
-		for guid, auraTable in pairs(self.aura) do
-			if guid ~= excludingGUID then
-				for auraFilter, auraList in pairs(auraTable) do
-					if not filter or auraFilter == filter then
-						aura = auraList[spellId]
-						if aura and aura.serial == self.serial then
-							if aura.start and (not start or aura.start < start) then
-								start = aura.start
-							end
-							if aura.ending and (not ending or aura.ending > ending) then
-								ending = aura.ending
-							end
-							count = count + 1
+-- Look for my aura on any target.
+-- Returns the earliest start time, the latest ending time, and the number of auras seen.
+function OvaleState:GetMyAuraOnAnyTarget(spellId, filter, excludingGUID)
+	local start, ending, count = OvaleAura:GetMyAuraOnAnyTarget(spellId, filter, excludingGUID)
+	for guid, auraTable in pairs(self.aura) do
+		if guid ~= excludingGUID then
+			for auraFilter, auraList in pairs(auraTable) do
+				if not filter or auraFilter == filter then
+					local aura = auraList[spellId]
+					if aura and aura.serial == self.serial then
+						if aura.start and (not start or aura.start < start) then
+							start = aura.start
+						end
+						if aura.ending and (not ending or aura.ending > ending) then
+							ending = aura.ending
 						end
+						count = count + 1
 					end
 				end
 			end