Quantcast

Various fixes in Enchancement module

Taracque [10-19-15 - 13:24]
Various fixes in Enchancement module
Filename
Change_log.txt
Elementarist.lua
Elementarist.toc
modules/enhancement.lua
diff --git a/Change_log.txt b/Change_log.txt
index e07b3e1..675695a 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,6 @@
+***v3.5.1
+* Fixed: Various fixes in Enchancement module
+
 ***v3.5.0
 * Fixed: Augmentation Rune detection in Enhancement module

diff --git a/Elementarist.lua b/Elementarist.lua
index dda4fee..0494b27 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -8,7 +8,7 @@ Elementarist = {Locals = {}}

 local L = Elementarist.Locals

-Elementarist.versionNumber = '3.4.9';
+Elementarist.versionNumber = '3.5.1';
 Elementarist.enabled = true;
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
diff --git a/Elementarist.toc b/Elementarist.toc
index 571eda6..ebd316a 100755
--- a/Elementarist.toc
+++ b/Elementarist.toc
@@ -2,7 +2,7 @@
 ## Title: Elementarist
 ## Notes: Elemental shaman spell rotation helper
 ## Author: Taracque, Felmosórongy of Arathor
-## Version: 3.5.0
+## Version: 3.5.1
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies:
diff --git a/modules/enhancement.lua b/modules/enhancement.lua
index 15d9358..f22cec5 100755
--- a/modules/enhancement.lua
+++ b/modules/enhancement.lua
@@ -171,22 +171,25 @@ Elementarist.enhancement = {

 		----Priority 4	---- Load Windstrike and Stormstrike data
 		SSCharges, maxSSCharges, cdSSStart, cdSSLength  = GetSpellCharges(Elementarist.SpellList["Stormstrike"]);
-		if (SSCharges<maxSSCharges) and (((cdSSStart + cdSSLength)- currentTime) - timeshift <= 0) then
-			SSCharges = SSCharges + 1;
-		end
-		SSCharges = SSCharges - Elementarist:Count(Elementarist.SpellList["Stormstrike"],spellInCast,exspell1,exspell2);
-		SSCharges = SSCharges - Elementarist:Count(Elementarist.SpellList["Windstrike"],spellInCast,exspell1,exspell2);
+		if (SSCharges) then
+			if (SSCharges<maxSSCharges) and (((cdSSStart + cdSSLength)- currentTime) - timeshift <= 0) then
+				SSCharges = SSCharges + 1;
+			end
+			SSCharges = SSCharges - Elementarist:Count(Elementarist.SpellList["Stormstrike"],spellInCast,exspell1,exspell2);
+			SSCharges = SSCharges - Elementarist:Count(Elementarist.SpellList["Windstrike"],spellInCast,exspell1,exspell2);

-		--------- Windstrike (requires assendance) at max charges of SS/WS
-		if ascendance then
-			if (
-					(  SSCharges >= 1) and (not EETalent) or
-					( (SSCharges >= 2) )
-		    ) then
-				return Elementarist.SpellList["Windstrike"]
+			--------- Windstrike (requires assendance) at max charges of SS/WS
+			if ascendance and (IsSpellInRange(Elementarist.SpellList["Windstrike"], "target") == 1) then
+				if (
+						(  SSCharges >= 1) and (not EETalent) or
+						( (SSCharges >= 2) )
+				) then
+					return Elementarist.SpellList["Windstrike"]
+				end
 			end
 		end

+
 		----Priority 5	-- Cast Lightning Bolt  with 5 Maelstrom Weapon stacks (8 with 4 set)
 		if (
 				(  (MWcount >= 5)  and ( not ( Elementarist.hasT18_4pcs)) ) or
@@ -201,7 +204,7 @@ Elementarist.enhancement = {
 		end

 		----Priority 6	-- stormstrike at max charges of SS/WS
-		if (not ascendance) then
+		if (not ascendance) and (SSCharges) and (IsSpellInRange(Elementarist.SpellList["Stormstrike"], "target") == 1) then
 			if ( 	(  SSCharges >= 1) and (not EETalent) or
 				( (SSCharges >= 2) )

@@ -218,11 +221,13 @@ Elementarist.enhancement = {
 		LLCharges = LLCharges - Elementarist:Count(Elementarist.SpellList["Lava Lash"],spellInCast, exspell1, exspell2);

 		-----Lava Lash at max charges of LL
-		if (
-			(  LLCharges >= 1) and (not EETalent) or
-			( (LLCharges >= 2) )
-		) then
-			return Elementarist.SpellList["Lava Lash"]
+		if (IsSpellInRange(Elementarist.SpellList["Lava Lash"], "target") == 1) then
+			if (
+				( (LLCharges >= 1) and (not EETalent) ) or
+				( (LLCharges >= 2) )
+			) then
+				return Elementarist.SpellList["Lava Lash"]
+			end
 		end

 		----Priority 8	-- Flame shock if <9 sec remaining and Unleash Flame is up
@@ -248,13 +253,13 @@ Elementarist.enhancement = {
 		-- Priority 9 : Unleash Elements
 		if (Elementarist:Count(Elementarist.SpellList["Unleash Elements"],spellInCast,exspell1,exspell2) == 0) then
 			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Elements"])
-			if ((d - timeshift) <= 0) then
+			if (d) and ((d - timeshift) <= 0) then
 				return Elementarist.SpellList["Unleash Elements"]
 			end
 		end

 		-- Priority 10	: Windstrike (requires assendance) at 1 charges of SS/WS with EETalent
-		if ascendance then
+		if ascendance and SSCharges and (IsSpellInRange(Elementarist.SpellList["Windstrike"], "target") == 1) then
 			if ( (SSCharges >= 1) and (EETalent) ) then
 				return Elementarist.SpellList["Windstrike"]
 			end
@@ -294,7 +299,7 @@ Elementarist.enhancement = {
 		end

 		-- Priority 13 : Lava Lash at 1 charge with Echo of the elements
-		if ((  LLCharges >= 1) and EETalent) then
+		if ((  LLCharges >= 1) and EETalent) and (IsSpellInRange(Elementarist.SpellList["Lava Lash"], "target") == 1) then
 			return Elementarist.SpellList["Lava Lash"]
 		end

@@ -302,6 +307,7 @@ Elementarist.enhancement = {
 		-- Priority 14 : Frost Shock if not using Elemental Fusion or if more than 16 seconds remaining on Flame Shock debuff
 		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Frost Shock"])
 		if (
+			d and
 			((d - timeshift) <= 0) and
 			(Elementarist:Count(Elementarist.SpellList["Frost Shock"],exspell1,exspell2) == 0) and
 			(Elementarist:Count(Elementarist.SpellList["Flame Shock"],exspell1,exspell2) == 0)
@@ -333,7 +339,7 @@ Elementarist.enhancement = {
 		end

 		-- Priority 17 : storm strike if using Echo of Elements
-		if (not ascendance) then
+		if (not ascendance) and (SSCharges) and (IsSpellInRange(Elementarist.SpellList["Stormstrike"], "target") == 1) then
 			if ((SSCharges >= 1) and EETalent ) then
 				return Elementarist.SpellList["Stormstrike"]
 			end