- added Distance condition
Sidoine De Wispelaere [03-04-11 - 20:35]
- added Distance condition
- added maxHealth and MaxHealth conditions
- fixed BuffGain condition
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@357 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/Condition.lua b/Condition.lua
index 67b7b8e..1217f0c 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -1,5 +1,5 @@
local LBCT = LibStub("LibBabble-CreatureType-3.0"):GetLookupTable()
-
+local LRC = LibStub("LibRangeCheck-2.0", true)
local runes = {}
local runesCD = {}
@@ -376,8 +376,8 @@ Ovale.conditions=
-- 2 : time since the buff gain
BuffGain = function(condition)
local spellId = condition[1]
- if (spell) then
- if (not Ovale.buff[spellId]) then
+ if spellId then
+ if not Ovale.buff[spellId] then
return 0
end
local timeGain = Ovale.buff[spellId].gain
@@ -528,6 +528,28 @@ Ovale.conditions=
local timeBefore = avecHate(condition[2], condition.haste)
return start, addTime(ending, -timeBefore)
end,
+ Distance = function(condition)
+ if LRC then
+ local target = getTarget(condition.target)
+ local minRange, maxRange = LRC:GetRange(target)
+ if maxRange == nil or minRange == nil then
+ return nil
+ end
+ if condition[1] == "more" then
+ if condition[2]~=nil and maxRange>condition[2] then
+ return 0
+ else
+ return nil
+ end
+ else
+ if condition[2]~=nil and minRange<condition[2] then
+ return 0
+ else
+ return nil
+ end
+ end
+ end
+ end,
--Compare to eclipse power. <0 lunar, >0 solar
Eclipse = function(condition)
return compare(Ovale.state.eclipse, condition[1], condition[2])
@@ -689,6 +711,13 @@ Ovale.conditions=
local conversion = 100/UnitPowerMax("player")
return value * conversion, t, rate * conversion
end,
+ MaxHealth = function(condition)
+ local target = getTarget(condition.target)
+ return compare(UnitMaxHealth(target), condition[1], condition[2])
+ end,
+ maxHealth = function(condition)
+ return UnitMaxHealth(getTarget(condition.target))
+ end,
OtherDebuffExpires = function(condition)
Ovale:EnableOtherDebuffs()
local otherDebuff = Ovale.otherDebuffs[condition[1]]
diff --git a/Ovale.toc b/Ovale.toc
index 129ba28..8bc7d64 100644
--- a/Ovale.toc
+++ b/Ovale.toc
@@ -4,7 +4,7 @@
## Notes-frFR: Affiche l'icône du prochain sort à lancer
## Author: Sidoine
## Version: 4.0.24
-## OptionalDeps: Ace3, ButtonFacade, Recount, Skada, LibBabble-CreatureType-3.0
+## OptionalDeps: Ace3, ButtonFacade, Recount, Skada, LibBabble-CreatureType-3.0, LibRangeCheck-2.0
## SavedVariables: OvaleDB
## SavedVariablesPerCharacter: OvaleDBPC
## X-Category: Combat