From deb9d47783e5d5e370ae3132373f9a7d156a56e8 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Mon, 5 May 2014 18:02:54 +0000 Subject: [PATCH] Rename BuffCount() condition to BuffCountOnAny(). This name makes it more explicit that the check is across all targets instead of one target. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1376 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleSimulationCraft.lua | 2 +- conditions/BuffCount.lua | 51 -------------------------------------- conditions/BuffCountOnAny.lua | 55 +++++++++++++++++++++++++++++++++++++++++ conditions/files.xml | 2 +- scripts/ovale_druid.lua | 12 ++++----- scripts/ovale_monk.lua | 8 +++--- scripts/ovale_paladin.lua | 10 ++++---- scripts/ovale_shaman.lua | 10 ++++---- 8 files changed, 77 insertions(+), 73 deletions(-) delete mode 100644 conditions/BuffCount.lua create mode 100644 conditions/BuffCountOnAny.lua diff --git a/OvaleSimulationCraft.lua b/OvaleSimulationCraft.lua index 632b5ad..bcded24 100644 --- a/OvaleSimulationCraft.lua +++ b/OvaleSimulationCraft.lua @@ -705,7 +705,7 @@ do -- Shaman ["^active_flame_shock$"] = function(simc, action) tinsert(simc.symbols, "flame_shock_debuff") - return "DebuffCount(flame_shock_debuff)" + return "DebuffCountOnAny(flame_shock_debuff)" end, ["^buff%.lightning_shield%.max_stack$"] = "7", ["^buff%.lightning_shield%.react$"] = function(simc, action) diff --git a/conditions/BuffCount.lua b/conditions/BuffCount.lua deleted file mode 100644 index 7a22dc8..0000000 --- a/conditions/BuffCount.lua +++ /dev/null @@ -1,51 +0,0 @@ ---[[-------------------------------------------------------------------- - Ovale Spell Priority - Copyright (C) 2013, 2014 Johnny C. Lam - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License in the LICENSE - file accompanying this program. ---]]-------------------------------------------------------------------- - -local _, Ovale = ... - -do - local OvaleCondition = Ovale.OvaleCondition - local OvaleState = Ovale.OvaleState - - local Compare = OvaleCondition.Compare - local ParseCondition = OvaleCondition.ParseCondition - local TestValue = OvaleCondition.TestValue - local state = OvaleState.state - - --- Get the total count of the given aura across all targets. - -- @name BuffCount - -- @paramsig number or boolean - -- @param id The spell ID of the aura or the name of a spell list. - -- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more. - -- @param number Optional. The number to compare against. - -- @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. - -- @return The total aura count. - -- @return A boolean value for the result of the comparison. - -- @see DebuffCount - - local function BuffCount(condition) - local auraId, comparator, limit = condition[1], condition[2], condition[3] - local _, filter, mine = ParseCondition(condition) - - local count, startChangeCount, endingChangeCount, startFirst, endingLast = state:AuraCount(auraId, filter, mine) - Ovale:Logf("BuffCount(%d) is %s, %s, %s, %s, %s", auraId, count, startChangeCount, endingChangeCount, startFirst, endingLast) - if count > 0 and startChangeCount < math.huge then - local origin = startChangeCount - local rate = -1 / (endingChangeCount - startChangeCount) - local start, ending = startFirst, endingLast - return TestValue(start, ending, count, origin, rate, comparator, limit) - end - return Compare(count, comparator, limit) - end - - OvaleCondition:RegisterCondition("buffcount", false, BuffCount) - OvaleCondition:RegisterCondition("debuffcount", false, BuffCount) -end diff --git a/conditions/BuffCountOnAny.lua b/conditions/BuffCountOnAny.lua new file mode 100644 index 0000000..16d464a --- /dev/null +++ b/conditions/BuffCountOnAny.lua @@ -0,0 +1,55 @@ +--[[-------------------------------------------------------------------- + Ovale Spell Priority + Copyright (C) 2013, 2014 Johnny C. Lam + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License in the LICENSE + file accompanying this program. +--]]-------------------------------------------------------------------- + +local _, Ovale = ... + +do + local OvaleCondition = Ovale.OvaleCondition + local OvaleState = Ovale.OvaleState + + local Compare = OvaleCondition.Compare + local ParseCondition = OvaleCondition.ParseCondition + local TestValue = OvaleCondition.TestValue + local state = OvaleState.state + + --- Get the total count of the given aura across all targets. + -- @name BuffCountOnAny + -- @paramsig number or boolean + -- @param id The spell ID of the aura or the name of a spell list. + -- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more. + -- @param number Optional. The number to compare against. + -- @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. + -- @return The total aura count. + -- @return A boolean value for the result of the comparison. + -- @see DebuffCountOnAny + + local function BuffCountOnAny(condition) + local auraId, comparator, limit = condition[1], condition[2], condition[3] + local _, filter, mine = ParseCondition(condition) + + local count, startChangeCount, endingChangeCount, startFirst, endingLast = state:AuraCount(auraId, filter, mine) + Ovale:Logf("BuffCount(%d) is %s, %s, %s, %s, %s", auraId, count, startChangeCount, endingChangeCount, startFirst, endingLast) + if count > 0 and startChangeCount < math.huge then + local origin = startChangeCount + local rate = -1 / (endingChangeCount - startChangeCount) + local start, ending = startFirst, endingLast + return TestValue(start, ending, count, origin, rate, comparator, limit) + end + return Compare(count, comparator, limit) + end + + OvaleCondition:RegisterCondition("buffcountonany", false, BuffCountOnAny) + OvaleCondition:RegisterCondition("debuffcountonany", false, BuffCountOnAny) + + -- Deprecated. + OvaleCondition:RegisterCondition("buffcount", false, BuffCountOnAny) + OvaleCondition:RegisterCondition("debuffcount", false, BuffCountOnAny) +end diff --git a/conditions/files.xml b/conditions/files.xml index 81491ee..707c545 100644 --- a/conditions/files.xml +++ b/conditions/files.xml @@ -4,7 +4,7 @@