From 0e8712177e7ff072d7ae5ffba5f9857e3dd27c0e Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Fri, 15 Nov 2013 19:55:40 +0000 Subject: [PATCH] Fix target used in "targetlifenocd" computation for spell cooldowns. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1163 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleCooldown.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OvaleCooldown.lua b/OvaleCooldown.lua index f5b8093..15a52e9 100644 --- a/OvaleCooldown.lua +++ b/OvaleCooldown.lua @@ -14,6 +14,7 @@ Ovale.OvaleCooldown = OvaleCooldown -- local OvaleData = Ovale.OvaleData +local OvaleGUID = Ovale.OvaleGUID local OvalePaperDoll = Ovale.OvalePaperDoll local OvaleStance = Ovale.OvaleStance local OvaleState = Ovale.OvaleState @@ -135,8 +136,9 @@ function OvaleCooldown:ApplySpellOnPlayer(state, spellId, startCast, endCast, ne -- There is no cooldown if the target's health percent is below what's specified -- with the "targetlifenocd" parameter. - if si.targetlifenocd then - local healthPercent = API_UnitHealth("target") / API_UnitHealthMax("target") * 100 + local target = OvaleGUID:GetUnitId(targetGUID) + if target and si.targetlifenocd then + local healthPercent = API_UnitHealth(target) / API_UnitHealthMax(target) * 100 if healthPercent < si.targetlifenocd then cd.duration = 0 end -- 1.7.9.5