Quantcast

Rename BuffCount() condition to BuffCountOnAny().

Johnny C. Lam [05-05-14 - 18:02]
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
Filename
OvaleSimulationCraft.lua
conditions/BuffCount.lua
conditions/BuffCountOnAny.lua
conditions/files.xml
scripts/ovale_druid.lua
scripts/ovale_monk.lua
scripts/ovale_paladin.lua
scripts/ovale_shaman.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 @@
 	<Script file="ArmorSetParts.lua" />
 	<Script file="BuffAmount.lua" />
 	<Script file="BuffComboPoints.lua" />
-	<Script file="BuffCount.lua" />
+	<Script file="BuffCountOnAny.lua" />
 	<Script file="BuffDamageMultiplier.lua" />
 	<Script file="BuffDuration.lua" />
 	<Script file="BuffExpires.lua" />
diff --git a/scripts/ovale_druid.lua b/scripts/ovale_druid.lua
index 10d0dcc..9f6480a 100644
--- a/scripts/ovale_druid.lua
+++ b/scripts/ovale_druid.lua
@@ -778,18 +778,18 @@ AddFunction RestorationMainActions
 	# Maintain 100% uptime on Harmony mastery buff.
 	if BuffRemains(harmony_buff) < 3
 	{
-		if BuffCount(rejuvenation_buff) > 0 or BuffCount(regrowth_buff) > 0 Swiftmend()
+		if BuffCountOnAny(rejuvenation_buff) > 0 or BuffCountOnAny(regrowth_buff) > 0 Swiftmend()
 		Spell(nourish)
 	}

 	# Keep one Lifebloom stack up on the raid.
-	if not BuffCount(lifebloom_buff) > 0 Spell(lifebloom)
+	if not BuffCountOnAny(lifebloom_buff) > 0 Spell(lifebloom)

-	if BuffCount(rejuvenation_buff) > 0 or BuffCount(regrowth_buff) > 0 Swiftmend()
+	if BuffCountOnAny(rejuvenation_buff) > 0 or BuffCountOnAny(regrowth_buff) > 0 Swiftmend()
 	if TalentPoints(cenarion_ward_talent) Spell(cenarion_ward)

 	# Keep up 5 Rejuvenation HoTs on the raid.
-	if BuffCount(rejuvenation_buff) < 5 Spell(rejuvenation)
+	if BuffCountOnAny(rejuvenation_buff) < 5 Spell(rejuvenation)

 	# Filler.
 	Spell(nourish)
@@ -806,13 +806,13 @@ AddFunction RestorationAoeActions

 	Spell(wild_growth)
 	if not Glyph(glyph_of_efflorescence) Swiftmend()
-	if BuffCount(rejuvenation_buff) >= 3 Spell(genesis)
+	if BuffCountOnAny(rejuvenation_buff) >= 3 Spell(genesis)
 	Spell(rejuvenation)
 }

 AddFunction RestorationShortCdActions
 {
-	if BuffCount(rejuvenation_buff) >= 5 Spell(genesis)
+	if BuffCountOnAny(rejuvenation_buff) >= 5 Spell(genesis)
 	if WildMushroomCount() > 0 Spell(wild_mushroom_bloom)
 }

diff --git a/scripts/ovale_monk.lua b/scripts/ovale_monk.lua
index b912352..9b1fc0c 100644
--- a/scripts/ovale_monk.lua
+++ b/scripts/ovale_monk.lua
@@ -231,7 +231,7 @@ AddFunction MistweaverAoeActions
 	#rushing_jade_wind,if=talent.rushing_jade_wind.enabled
 	if TalentPoints(rushing_jade_wind_talent) Spell(rushing_jade_wind)
 	#zen_sphere,cycle_targets=1,if=talent.zen_sphere.enabled&!dot.zen_sphere.ticking
-	if TalentPoints(zen_sphere_talent) and BuffCount(zen_sphere_buff) < 1 Spell(zen_sphere)
+	if TalentPoints(zen_sphere_talent) and BuffCountOnAny(zen_sphere_buff) < 1 Spell(zen_sphere)
 	#chi_burst,if=talent.chi_burst.enabled
 	if TalentPoints(chi_burst_talent) Spell(chi_burst)
 	#tiger_palm,if=buff.muscle_memory.up&!buff.tiger_power.up
@@ -263,7 +263,7 @@ AddFunction MistweaverSingleTargetActions
 	#chi_wave,if=talent.chi_wave.enabled
 	if TalentPoints(chi_wave_talent) Spell(chi_wave)
 	#zen_sphere,cycle_targets=1,if=talent.zen_sphere.enabled&!dot.zen_sphere.ticking
-	if TalentPoints(zen_sphere_talent) and BuffCount(zen_sphere_buff) < 1 Spell(zen_sphere)
+	if TalentPoints(zen_sphere_talent) and BuffCountOnAny(zen_sphere_buff) < 1 Spell(zen_sphere)
 	#jab
 	if Glyph(glyph_of_targeted_expulsion) Spell(expel_harm_glyphed)
 	if Glyph(glyph_of_targeted_expulsion no) Spell(expel_harm)
@@ -298,7 +298,7 @@ AddIcon mastery=mistweaver size=small checkboxon=opt_icons_right

 AddIcon mastery=mistweaver size=small checkboxon=opt_icons_left
 {
-	if BuffCount(renewing_mist_buff) > 5 Spell(thunder_focus_tea)
+	if BuffCountOnAny(renewing_mist_buff) > 5 Spell(thunder_focus_tea)
 	Spell(revival)
 }

@@ -313,7 +313,7 @@ AddIcon mastery=mistweaver help=shortcd
 	}
 	Spell(renewing_mist)
 	if TalentPoints(chi_burst_talent) Spell(chi_burst)
-	if TalentPoints(zen_sphere_talent) and BuffCount(zen_sphere_buff) < 1 Spell(zen_sphere)
+	if TalentPoints(zen_sphere_talent) and BuffCountOnAny(zen_sphere_buff) < 1 Spell(zen_sphere)
 }

 AddIcon mastery=mistweaver help=main
diff --git a/scripts/ovale_paladin.lua b/scripts/ovale_paladin.lua
index f1d6781..3807ec1 100644
--- a/scripts/ovale_paladin.lua
+++ b/scripts/ovale_paladin.lua
@@ -23,8 +23,8 @@ AddCheckBox(opt_icons_right "Right icons")

 AddFunction HolySingleTargetActions
 {
-	if BuffCount(beacon_of_light_buff) == 0 Spell(beacon_of_light)
-	if TalentPoints(sacred_shield_talent) and BuffCount(sacred_shield_holy_buff) == 0 Spell(sacred_shield_holy)
+	if BuffCountOnAny(beacon_of_light_buff) == 0 Spell(beacon_of_light)
+	if TalentPoints(sacred_shield_talent) and BuffCountOnAny(sacred_shield_holy_buff) == 0 Spell(sacred_shield_holy)
 	if HolyPower() == MaxHolyPower()
 	{
 		if TalentPoints(eternal_flame_talent) Spell(eternal_flame)
@@ -37,8 +37,8 @@ AddFunction HolySingleTargetActions

 AddFunction HolyAoeActions
 {
-	if BuffCount(beacon_of_light_buff) == 0 Spell(beacon_of_light)
-	if TalentPoints(sacred_shield_talent) and BuffCount(sacred_shield_holy_buff) == 0 Spell(sacred_shield_holy)
+	if BuffCountOnAny(beacon_of_light_buff) == 0 Spell(beacon_of_light)
+	if TalentPoints(sacred_shield_talent) and BuffCountOnAny(sacred_shield_holy_buff) == 0 Spell(sacred_shield_holy)
 	if HolyPower() == MaxHolyPower()
 	{
 		if TalentPoints(eternal_flame_talent) Spell(eternal_flame)
@@ -51,7 +51,7 @@ AddFunction HolyAoeActions

 AddFunction HolySelflessHealerAoeActions()
 {
-	if BuffCount(beacon_of_light_buff) == 0 Spell(beacon_of_light)
+	if BuffCountOnAny(beacon_of_light_buff) == 0 Spell(beacon_of_light)
 	if HolyPower() == MaxHolyPower() Spell(light_of_dawn)
 	if target.IsFriend(no) and target.InRange(judgment) Spell(judgment)
 	if BuffPresent(selfless_healer_buff) Spell(holy_radiance)
diff --git a/scripts/ovale_shaman.lua b/scripts/ovale_shaman.lua
index 1fa0ff6..e42b85e 100644
--- a/scripts/ovale_shaman.lua
+++ b/scripts/ovale_shaman.lua
@@ -215,9 +215,9 @@ AddIcon mastery=elemental size=small checkboxon=opt_icons_right
 AddFunction EnhancementAoeActions
 {
 	#fire_nova,if=active_flame_shock>=4
-	if DebuffCount(flame_shock_debuff) >= 4 Spell(fire_nova)
+	if DebuffCountOnAny(flame_shock_debuff) >= 4 Spell(fire_nova)
 	#wait,sec=cooldown.fire_nova.remains,if=active_flame_shock>=4&cooldown.fire_nova.remains<0.67
-	if DebuffCount(flame_shock_debuff) >= 4 and SpellCooldown(fire_nova) < 0.67 wait Spell(fire_nova)
+	if DebuffCountOnAny(flame_shock_debuff) >= 4 and SpellCooldown(fire_nova) < 0.67 wait Spell(fire_nova)
 	#magma_totem,if=active_enemies>5&!totem.fire.active
 	if Enemies() > 5 and not TotemPresent(fire) Spell(magma_totem)
 	#searing_totem,if=active_enemies<=5&!totem.fire.active
@@ -235,7 +235,7 @@ AddFunction EnhancementAoeActions
 	#stormblast
 	Spell(stormblast)
 	#fire_nova,if=active_flame_shock>=3
-	if DebuffCount(flame_shock_debuff) >= 3 Spell(fire_nova)
+	if DebuffCountOnAny(flame_shock_debuff) >= 3 Spell(fire_nova)
 	#chain_lightning,if=active_enemies>=2&buff.maelstrom_weapon.react>=1
 	if Enemies() >= 2 and BuffPresent(maelstrom_weapon_buff) >= 1 Spell(chain_lightning)
 	#stormstrike
@@ -247,7 +247,7 @@ AddFunction EnhancementAoeActions
 	#earth_elemental_totem,if=!active&cooldown.fire_elemental_totem.remains>=50
 	if not TotemPresent(earth totem=earth_elemental_totem) and SpellCooldown(fire_elemental_totem) >= 50 Spell(earth_elemental_totem)
 	#fire_nova,if=active_flame_shock>=1
-	if DebuffCount(flame_shock_debuff) >= 1 Spell(fire_nova)
+	if DebuffCountOnAny(flame_shock_debuff) >= 1 Spell(fire_nova)
 }

 AddFunction EnhancementSingleActions
@@ -455,7 +455,7 @@ AddFunction RestorationMainActions
 {
 	if WeaponEnchantExpires(mainhand) Spell(earthliving_weapon)
 	if BuffExpires(water_shield_buff) Spell(water_shield)
-	if BuffCount(earth_shield_buff) == 0 Spell(earth_shield)
+	if BuffCountOnAny(earth_shield_buff) == 0 Spell(earth_shield)
 	if CheckBoxOn(opt_totemic_recall)
 	{
 		# Suggest Totemic Recall to regain mana from Healing Stream Totem, but only if it won't