From 71b5141be9ec29c01118771637d8ee1402021e22 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 15 May 2014 23:18:15 +0000 Subject: [PATCH] Rename RuneCount() to Rune() and reimplement RuneCount() to just count. Rune() will return fractional numbers to indicate how far along a rune is to regenerating. RuneCount() will always return a whole number for the actual count of active runes of the given type. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1447 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- conditions/RuneCount.lua | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/conditions/RuneCount.lua b/conditions/RuneCount.lua index d0c63da..ceafdde 100644 --- a/conditions/RuneCount.lua +++ b/conditions/RuneCount.lua @@ -1,7 +1,7 @@ --[[-------------------------------------------------------------------- Ovale Spell Priority Copyright (C) 2012, 2013 Sidoine - Copyright (C) 2012, 2013 Johnny C. Lam + Copyright (C) 2012, 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 @@ -33,6 +33,7 @@ do -- Valid values: unset, 0, 1 -- @return The number of runes. -- @return A boolean value for the result of the comparison. + -- @see Rune -- @usage -- if RuneCount(unholy) ==2 or RuneCount(frost) ==2 or RuneCount(death) ==2 -- Spell(obliterate) @@ -43,6 +44,37 @@ do local count, startCooldown, endCooldown = state:RuneCount(name, deathCondition) if startCooldown < math.huge then + local start, ending = startCooldown, endCooldown + return TestValue(start, ending, count, start, 0, comparator, limit) + end + return Compare(count, comparator, limit) + end + + --- Get the current number of active and regenerating (fractional) runes of the given type for death knights. + -- @name Rune + -- @paramsig number or boolean + -- @param type The type of rune. + -- Valid values: blood, frost, unholy, death + -- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more. + -- @param number Optional. The number to compare against. + -- @param death Sets how death runes are used to fulfill the rune count requirements. + -- If not set, then only death runes of the proper rune type are used. + -- If set with "death=0", then no death runes are used. + -- If set with "death=1", then death runes of any rune type are used. + -- Default is unset. + -- Valid values: unset, 0, 1 + -- @return The number of runes. + -- @return A boolean value for the result of the comparison. + -- @see RuneCount + -- @usage + -- if Rune(blood) > 1 Spell(blood_tap) + + local function Rune(condition) + local name, comparator, limit = condition[1], condition[2], condition[3] + local deathCondition = condition.death + + local count, startCooldown, endCooldown = state:RuneCount(name, deathCondition) + if startCooldown < math.huge then local origin = startCooldown local rate = 1 / (endCooldown - startCooldown) local start, ending = startCooldown, math.huge @@ -51,5 +83,6 @@ do return Compare(count, comparator, limit) end + OvaleCondition:RegisterCondition("rune", false, Rune) OvaleCondition:RegisterCondition("runecount", false, RuneCount) end -- 1.7.9.5