Quantcast

Unholy priority completed, Necrotic Plague, Unholy Blight etc talents handled correctly

Taracque [12-09-14 - 18:16]
Unholy priority completed, Necrotic Plague, Unholy Blight etc talents handled correctly
Filename
DKCrutch.lua
diff --git a/DKCrutch.lua b/DKCrutch.lua
index 2662199..15f3095 100755
--- a/DKCrutch.lua
+++ b/DKCrutch.lua
@@ -1000,7 +1000,14 @@ end
 function DKCrutch:AdviseUnholyAbility()
 	-- spell advisor
 	local spell = "";
-	local obcd,cd, enabled;
+	local cd, enabled;
+
+	-- get spell cooldowns
+	local obcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Outbreak"])
+	local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death Coil"]);
+	local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"])
+	local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"])
+	local fscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Festering Strike"])

 	-- raise dead if has no pet and raise dead is not on cd
 	cd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Raise Dead"])
@@ -1008,10 +1015,9 @@ function DKCrutch:AdviseUnholyAbility()
 		return "Raise Dead"
 	end

-	obcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Outbreak"])
-	local ffName, _, _, _, _, _, ffExpiration, ffUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Frost Fever"], "player")
-	local bpName, _, _, _, _, _, bpExpiration, bpUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Blood Plague"], "player")
-	local npName, _, _, _, _, _, npExpiration, npUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Necrotic Plague"], "player")
+	local ffName, _, _, _, _, _, ffExpiration = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Frost Fever"], "player");
+	local bpName, _, _, _, _, _, bpExpiration = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Blood Plague"], "player");
+	local npName, _, _, _, _, _, npExpiration = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Necrotic Plague"], "player");
 	if (not ffExpiration) then
 		ffExpiration = 0;
 	end
@@ -1032,7 +1038,7 @@ function DKCrutch:AdviseUnholyAbility()
 		end
 		-- or if diseases will expire in 2 sec on target
 		if ((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) ) or	-- necrotic plague
-			((ffExpiration - GetTime() < 2) and (bpExpiration - GetTime() < 2) )
+			((DKCrutch.tier7talent ~= 21207) and (ffExpiration - GetTime() < 2) and (bpExpiration - GetTime() < 2) )
 		then
 			if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then
 				return "Plague Leech";
@@ -1067,14 +1073,12 @@ function DKCrutch:AdviseUnholyAbility()
 	end

 	-- Death Coil if runic power>90
-	local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death Coil"]);
 	if (dccd) and (dccd <= 1) and (UnitPower("player", 6) > 90)	then
 		return "Death Coil";
 	end

 	-- Defile if available
 	if (DKCrutch.tier7talent == 21208) then
-		local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"])
 		if (ddcd) and (ddcd <= 1) then
 			return "Death and Decay"
 		end
@@ -1092,7 +1096,7 @@ function DKCrutch:AdviseUnholyAbility()
 		if (cd) and (cd<=0) and (
 			((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) )
 			or
-			(ffExpiration - GetTime()<3) or (bpExpiration - GetTime()<3)
+			((DKCrutch.tier7talent ~= 21207) and (ffExpiration - GetTime()<3) or (bpExpiration - GetTime()<3) )
 		) then
 			return "Unholy Blight"
 		end
@@ -1103,7 +1107,7 @@ function DKCrutch:AdviseUnholyAbility()
 		if (
 			((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) )
 			or
-			(ffExpiration - GetTime() <2) or ( (bpExpiration - GetTime()) < 2)
+			((DKCrutch.tier7talent ~= 21207) and ((ffExpiration - GetTime() <2) or ( (bpExpiration - GetTime()) < 2)) )
 		) then
 			return "Outbreak"
 		end
@@ -1115,7 +1119,7 @@ function DKCrutch:AdviseUnholyAbility()
 		if (
 			((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) )
 			or
-			(ffExpiration - GetTime() <2) or ( (bpExpiration - GetTime()) < 2)
+			((DKCrutch.tier7talent ~= 21207) and ((ffExpiration - GetTime() <2) or ( (bpExpiration - GetTime()) < 2)))
 		) then
 			return "Plague Strike"
 		end
@@ -1128,22 +1132,19 @@ function DKCrutch:AdviseUnholyAbility()
 			return "Breath of Sindragosa";
 		end
 		-- If Breath of Sindragosa active focus on RP generation
-		local msName, _, _, _, _, _, msExpiration, msUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Mark of Sindragosa"], "player");
+		local msName, _, _, _, _, _, msExpiration = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Mark of Sindragosa"], "player");
 		if (msName) and (msExpiration - GetTime() > 0) then
 			if (UnitPower("player", 6) < 88) then
-				local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"])
 				if (ddcd) and (ddcd <= 1) then
 					return "Death and Decay";
 				end
 			end
 			if (UnitPower("player", 6) < 77) then
-				local fscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Festering Strike"])
 				if (fscd) and (fscd <= 1) then
 					return "Festering Strike";
 				end
 			end
 			if (UnitPower("player", 6) < 88) then
-				local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"])
 				if (sscd) and (sscd <= 1) then
 					return "Scourge Strike";
 				end
@@ -1169,15 +1170,12 @@ function DKCrutch:AdviseUnholyAbility()
 		end
 		-- start generate runic power for Breath of Sindragosa
 		if (bscd < 7) and (UnitPower("player", 6) < 88) then
-			local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"])
 			if (ddcd) and (ddcd <= 1) then
 				return "Death and Decay"
 			end
-			local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"])
 			if (sscd) and (sscd <= 1) then
 				return "Scourge Strike";
 			end
-			local fscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Festering Strike"])
 			if (fscd) and (fscd <= 1) then
 				return "Festering Strike";
 			end
@@ -1186,7 +1184,6 @@ function DKCrutch:AdviseUnholyAbility()

 	-- Death and Decay if 2 unholy runes are up
 	if (DKCrutch.SpellList["Death and Decay"]) and (DKCrutch.runesUp[2] >= 2) then
-		local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"])
 		if (ddcd) and (ddcd <= 1) then
 			return "Death and Decay";
 		end
@@ -1194,7 +1191,6 @@ function DKCrutch:AdviseUnholyAbility()

 	-- Scourge Strike if 2 unholy runes are up
 	if (DKCrutch.SpellList["Scourge Strike"]) and (DKCrutch.runesUp[2] >= 2) then
-		local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"])
 		if (sscd) and (sscd <= 1) then
 			return "Scourge Strike";
 		end
@@ -1221,7 +1217,7 @@ function DKCrutch:AdviseUnholyAbility()
 	end

 	-- Unholy blight and debuffs are expiring
-	if (DKCrutch.SpellList["Unholy Blight"]) then
+	if (DKCrutch.tier1talent == 19217) and (DKCrutch.SpellList["Unholy Blight"]) then
 		cd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Unholy Blight"])
 		if (cd) and (cd<=0) and (ffExpiration<3) or (bpExpiration<3) then
 			return "Unholy Blight"
@@ -1229,12 +1225,10 @@ function DKCrutch:AdviseUnholyAbility()
 	end

 	-- Death and Decay if available and AoE
-	local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"])
 	if (ddcd) and (ddcd <= 1) and (DKCrutch.person["foeCount"]>1) then
 		return "Death and Decay"
 	else
 		-- Scourge strike if death runes are up, or unholy runes are up
-		local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"])
 		if (sscd) and (sscd <= 1) and (DKCrutch.runesUp[4] > 0) or (DKCrutch.runesUp[2] > 0) then
 			return "Scourge Strike"
 		end
@@ -1248,7 +1242,6 @@ function DKCrutch:AdviseUnholyAbility()
 		end
 	else
  	-- Festering Strike if (blood=2 or frost=2)
-		local fscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Festering Strike"])
 		if (fscd) and (fscd <= 1) and ( (DKCrutch.runesUp[1] > 0) or (DKCrutch.runesUp[3] > 0) ) then
 			return "Festering Strike"
 		end