Quantcast

Signed-off-by: BillLive <bill@live.com.au>

BillLive [01-25-16 - 00:11]
Signed-off-by: BillLive <bill@live.com.au>
Filename
Change_log.txt
modules/elemental.lua
modules/enhancement.lua
diff --git a/Change_log.txt b/Change_log.txt
index 32e8ad9..ac355aa 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,14 @@
+***V3.6.2.2
+* Updated:  Spell usability checks before recommending spells to support lower level shamans
+* Updated:  Elemental shaman 2nd prompt for Flameshock from 30% of duration to 9 Seconds
+* Fixed:  Elemental rotation when Flameshock on cooldown, Flameshock Debuff missing and Assended
+* Fixed:  Range check on Windstrike removed because it the Blizzard API doesnt return correct value
+
+
+***v3.6.2.1
+* Fixed: Calcuation of Elemental Fussion Charges (not factoring in Spell in Cast correctly)
+* Fixed: Calcuation of DOT refresh timer when toon does NOT have class trinket and has Unleash Fury talent
+
 ***v3.6.1
 * Updated: Elemental Shaman rotation changed to cater for Class trinket

diff --git a/modules/elemental.lua b/modules/elemental.lua
index d0ac513..1b1dd77 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -172,7 +172,8 @@ Elementarist.elemental = {
 				if 	Elementarist.inCombat == false then

 				-- Searing Totem
-				if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
+				if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
+					Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"])then
 					local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
 					if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift) then
 						return Elementarist.SpellList["Searing Totem"];
@@ -180,7 +181,8 @@ Elementarist.elemental = {
 				end

 				-- Opening Uleash flame  prior to combat
-				if (Elementarist:Count(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) == 0) then
+				if (Elementarist:Count(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) == 0) and
+					Elementarist:SpellAvailable(Elementarist.SpellList["Unleash Flame"]) then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Flame"])
 					if (d-timeshift <= 0) then
 						return Elementarist.SpellList["Unleash Flame"];
@@ -193,7 +195,8 @@ Elementarist.elemental = {
 		-- Priority 1
 		-- if Tier7 talent is Liquid Magma and fire totem has 10 sec or more, use it
 		if (LMTalent) and (not ElementaristDB.DisableLM) then
-			if (Elementarist:Count(Elementarist.SpellList["Liquid Magma"],spellInCast,exspell1,exspell2) == 0) then
+			if (Elementarist:Count(Elementarist.SpellList["Liquid Magma"],spellInCast,exspell1,exspell2) == 0) and
+				Elementarist:SpellAvailable(Elementarist.SpellList["Liquid Magma"])then
 				haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
 				if ((fireTotemName ~= "") and (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) >= timeshift + 15)) or
 					(Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) ~= 0) then
@@ -203,6 +206,7 @@ Elementarist.elemental = {
 					end
 				else
 					if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
+						Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"])and
 						((fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift))
 					then
 						return Elementarist.SpellList["Searing Totem"];
@@ -214,7 +218,9 @@ Elementarist.elemental = {
 		-- Priority 2
 		-- Earth shock if Lightning Shield count >=20
 		-- earth_shock,if=buff.lightning_shield.react=buff.lightning_shield.max_stack
-		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
+		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and
+			Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0 and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Earth Shock"])) then
 			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"])
 			if ( (d) and ((d-timeshift) <= 0) and (lscount) and (lscount>=20)) then
 				return Elementarist.SpellList["Earth Shock"]
@@ -225,7 +231,9 @@ Elementarist.elemental = {
 		-- Flame shock if 2 stacks Elemental Fussion and Unleashed Flame buff active
 		-- flame_shock,cycle_targets=1,if=(talent.elemental_fusion.enabled&buff.elemental_fusion.stack=2&buff.unleash_flame.up&dot.flame_shock.remains<(dot.flame_shock.duration*(0.3+t18_class_trinket*(0.48+talent.unleashed_fury.enabled*0.22))))

-		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
+		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and
+			Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0 and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Flame Shock"])) then
 			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
 			if ((d - timeshift) <= 0) then
 				if (efCount>=2) then
@@ -244,7 +252,9 @@ Elementarist.elemental = {
 		-- lava_burst,if=dot.flame_shock.remains>cast_time


-		if ( (lvbCharges > 0) or((ascendanceExp-GetTime()-timeshift) > 0)  )then
+		if ( (lvbCharges > 0) or((ascendanceExp-GetTime()-timeshift) > 0)  ) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Lava Burst"])
+		then
 			if (IsSpellInRange(Elementarist.SpellList["Flame Shock"], "target") == 1) and
 			(
 				((fsExpiration~=0) and ((fsExpiration-GetTime()-timeshift) > LvBct)) or
@@ -260,7 +270,9 @@ Elementarist.elemental = {
 		-- Priority 5
 		-- Earth shock if Lightning Shield count >=15 and not on cd, and FS debuff remaining > FS cooldown, or FS debuff remaining between FS and FS cd + 2sec and LS count>=13, or has T17 4pcs and LS Count >= 12
 		-- Earth_shock,if=(set_bonus.tier17_4pc&buff.lightning_shield.react>=12&!buff.lava_surge.up)|(!set_bonus.tier17_4pc&buff.lightning_shield.react>15)
-		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
+		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and
+			Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0)and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Earth Shock"]) then
 			if ( (fsExpiration - GetTime() - timeshift) > Elementarist.lastShockCD ) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"])
 				if (
@@ -278,25 +290,32 @@ Elementarist.elemental = {
 		-- Priority 6
 		-- Flameshock if not present or at less than 30% duration
 		-- lame_shock,cycle_targets=1,if=dot.flame_shock.remains<=(dot.flame_shock.duration*0.3)
-		if 	(Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0) and (Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
+		if 	(Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0) and
+			(Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Flame Shock"]) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
 			if ((d - timeshift) <= 0) then
-				if ((fsExpiration - GetTime() - timeshift) < (fsDuration * 0.3) ) then
+				if ((fsExpiration - GetTime() - timeshift) < (9) ) then
 					Elementarist:Debug(GetTime()..' Priority 6: EFCount=', efCount)
 					return Elementarist.SpellList["Flame Shock"]
 				end
 			end
 		end

+		-- Priority 6b
+		-- Lava Burst if Ascendance but not able to flame shock..you should never get here!!.. Flameshock before you Assend!
+		if ( (ascendanceExp-GetTime()-timeshift) > 0)  and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Lava Burst"])then
+			return Elementarist.SpellList["Lava Burst"]
+		end

 		-- Priority 7
 		-- if Tier6 talent is Elemental Blast use it
 		-- elemental_blast
 		if (EBTalent) then
-			if (
-				(Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
-				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
-			) then
+			if ((Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
+				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1) and
+				Elementarist:SpellAvailable(Elementarist.SpellList["Elemental Blast"])	) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
 				if ((d - timeshift) <= 0) then
 					return Elementarist.SpellList["Elemental Blast"]
@@ -306,7 +325,8 @@ Elementarist.elemental = {

 		-- Priority 8
 		-- Searing Totem
-		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
+		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"]) then
 			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
 			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift) then
 				return Elementarist.SpellList["Searing Totem"];
@@ -320,7 +340,8 @@ Elementarist.elemental = {

 		if (UFTalent)  or
 		   (efCount==2 and ( (fsExpiration - currentTime - timeshift) < (fsDuration * fsRefreshPercentage )  and (fsExpiration - currentTime - timeshift) > Elementarist.lastShockCD)    ) then
-			if (Elementarist:Count(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) == 0) then
+			if (Elementarist:Count(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) == 0) and
+				Elementarist:SpellAvailable(Elementarist.SpellList["Unleash Flame"])then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Flame"])
 				if (d-timeshift <= 0) then
 					return Elementarist.SpellList["Unleash Flame"];
@@ -331,7 +352,7 @@ Elementarist.elemental = {

 		-- Priority 9b (optional)
 		-- if item level >575 and Earthquake is enabled
-		if (ElementaristDB.EnableEQ) then
+		if (ElementaristDB.EnableEQ) and Elementarist:SpellAvailable(Elementarist.SpellList["Earthquake"])then
 			if (Elementarist.iLvl>=575) or (Elementarist.person["foeCount"]>1) then
 				local eqCharges, maxEqCharges, cdStart, cdLength  = GetSpellCharges(Elementarist.SpellList["Earthquake"]);
 				if (eqCharges<maxEqCharges) and (((cdStart + cdLength)- GetTime()) - timeshift <= 0) then
@@ -348,18 +369,13 @@ Elementarist.elemental = {
 			end
 		end

-
 		-- Priority 10
 		-- otherwise lightning bolt
-		if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 then
+		if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Lightning Bolt"])then
 			return Elementarist.SpellList["Lightning Bolt"]
 		end
-
-		-- if nothing works, try flameshock again
-		if flameshockavail then
-			return Elementarist.SpellList["Flame Shock"]
-		end
-
+
 		return ""
 	end;
 	MiscSpell = function(self)
diff --git a/modules/enhancement.lua b/modules/enhancement.lua
index 3a00aa5..808820b 100755
--- a/modules/enhancement.lua
+++ b/modules/enhancement.lua
@@ -58,22 +58,15 @@ Elementarist.enhancement = {

 		EETalent = (Elementarist.tier4Talent == 19273)
 		EBTalent = (Elementarist.tier6Talent == 19267)
-		Elementarist.exspell1=exspell1

 		 _, _, _, MWcount = Elementarist:hasBuff("player",Elementarist.SpellList["Maelstrom Weapon"])
-		if (MWcount == nil) then
-			MWcount = 0
-		end
+		if (MWcount == nil) then MWcount = 0 end

 		 _, _, _, EFcount = Elementarist:hasBuff("player",Elementarist.SpellList["Elemental Fusion"])
-		if (EFcount == nil) then
-			EFcount = 0
-		end
+		if (EFcount == nil) then EFcount = 0 end

 		ascendance, _, _, _, _, _, ascendanceExp = Elementarist:hasBuff("player", Elementarist.SpellList["AscendanceEnhancementBuff"])
-		if (ascendance == nil) then
-			ascendanceExp = 0
-		end
+		if (ascendance == nil) then ascendanceExp = 0 end

 		if (exspell1) then
 			if (exspell2) then
@@ -91,22 +84,14 @@ Elementarist.enhancement = {

 		-- check Shock CD
 		s, d = GetSpellCooldown(Elementarist.SpellList["Flame Shock"])
-		if (d) and (d>0) and (s == 0) then
-			Elementarist.lastShockCD = d
-		end
+		if (d) and (d>0) and (s == 0) then 	Elementarist.lastShockCD = d end
 		s, d = GetSpellCooldown(Elementarist.SpellList["Frost Shock"])
-		if (d) and (d>0) and (s == 0) then
-			Elementarist.lastShockCD = d
-		end
+		if (d) and (d>0) and (s == 0) then 	Elementarist.lastShockCD = d end

 		-- if target is dead, return ""
-		if (UnitHealth("target")<=0) then
-			return ""
-		end
+		if (UnitHealth("target")<=0) then return "" end

-		if (not timeshift) then
-			timeshift = 0
-		end
+		if (not timeshift) then timeshift = 0 end

 		-- check current spell
 		spellInCast, _, _, _, sICstartTime, sICendTime = UnitCastingInfo("player")
@@ -132,20 +117,20 @@ Elementarist.enhancement = {
 		--------------------------- start of priority list ----------------

 		----Priority 1 ---  Searing Totem if no fire totem or fire totem about to expire
-		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
+		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"])then
 			haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
 			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - currentTime ) -timeshift <= 0) then
-				Elementarist:Debug(functionname,  "Priority1",1)
  				return Elementarist.SpellList["Searing Totem"];
 			end
 		end

 		----Priority 2 ---  -- if Tier6 talent is Unleashed Fury then use Unleash Elements
 		if (EFTalent) then
-			if (Elementaris:Count(Elementarist.SpellList["Unleash Elements"],spellInCast,exspell1,exspell2) == 0) then
+			if (Elementaris:Count(Elementarist.SpellList["Unleash Elements"],spellInCast,exspell1,exspell2) == 0) and
+				Elementarist:SpellAvailable(Elementarist.SpellList["Unleash Elements"]) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Elements"])
 				if (d-timeshift <= 0) then
-					Elementarist:Debug(functionname, "Priority2",1)
 					return Elementarist.SpellList["Unleash Elements"];
 				end
 			end
@@ -153,14 +138,10 @@ Elementarist.enhancement = {

 		----Priority 3	-- if Tier6 talent is Elemental Blast use it with 5 Maelstrom Weapon stacks (8 with 4 set)
 		if EBTalent then
-			if  (
-					(  (not Elementarist.hasT18_4pcs) and (MWcount >= 5)) or
-					(  (Elementarist.hasT18_4pcs) and (MWcount >= 8))
-			)  then
-				if (
-					(Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
-					(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
-				) then
+			if  ( (  (not Elementarist.hasT18_4pcs) and (MWcount >= 5))  or ( (Elementarist.hasT18_4pcs) and (MWcount >= 8)) )  then
+				if ( Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
+					(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1) and
+					Elementarist:SpellAvailable(Elementarist.SpellList["Elemental Blast"]) 	then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
 					if ((d - timeshift) <= 0) then
 						return Elementarist.SpellList["Elemental Blast"]
@@ -179,11 +160,9 @@ Elementarist.enhancement = {
 			SSCharges = SSCharges - Elementarist:Count(Elementarist.SpellList["Windstrike"],spellInCast,exspell1,exspell2);

 			--------- 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
+			if ascendance then
+				if (( (SSCharges >= 1) and (not EETalent) ) or
+					(SSCharges >= 2) ) then
 					return Elementarist.SpellList["Windstrike"]
 				end
 			end
@@ -191,20 +170,19 @@ Elementarist.enhancement = {


 		----Priority 5	-- Cast Lightning Bolt  with 5 Maelstrom Weapon stacks (8 with 4 set)
-		if (
-			( (MWcount >= 5) and ( not Elementarist.hasT18_4pcs) ) or
-			( (MWcount >= 8) )
-		) then
-			if (
-					(IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1) and
-					(Elementarist:Count(Elementarist.SpellList["Lightning Bolt"],exspell1,exspell2) == 0)
-			) then
+		if ( ( (MWcount >= 5) and ( not Elementarist.hasT18_4pcs) ) or
+			(MWcount >= 8)	) then
+			if ((IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1) and
+				(Elementarist:Count(Elementarist.SpellList["Lightning Bolt"],exspell1,exspell2) == 0) and
+				Elementarist:SpellAvailable(Elementarist.SpellList["Lightning Bolt"]) ) then
 				return Elementarist.SpellList["Lightning Bolt"]
 			end
 		end

 		----Priority 6	-- stormstrike at max charges of SS/WS
-		if (not ascendance) and (SSCharges) and (IsSpellInRange(Elementarist.SpellList["Lava Lash"], "target") == 1) then
+		-- note:  Stormstrikeo has 100 yrd range and does not return IsSpellInRange correctly so no checking of range
+		if (not ascendance) and (SSCharges) and (IsSpellInRange(Elementarist.SpellList["Lava Lash"], "target") == 1) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Stormstrike"]) then
 			if (
 				( ( SSCharges >= 1) and (not EETalent) ) or
 				( SSCharges >= 2 )
@@ -221,7 +199,8 @@ Elementarist.enhancement = {
 		LLCharges = LLCharges - Elementarist:Count(Elementarist.SpellList["Lava Lash"],spellInCast, exspell1, exspell2);

 		-----Lava Lash at max charges of LL
-		if (IsSpellInRange(Elementarist.SpellList["Lava Lash"], "target") == 1) then
+		if (IsSpellInRange(Elementarist.SpellList["Lava Lash"], "target") == 1) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Lava Lash"]) then
 			if (
 				( (LLCharges >= 1) and (not EETalent) ) or
 				( (LLCharges >= 2) )
@@ -237,7 +216,8 @@ Elementarist.enhancement = {
 		end
 		if (Elementarist:hasBuff("player",Elementarist.SpellList["Unleash Flame"])) and
 			(Elementarist:Count(Elementarist.SpellList["Frost Shock"],exspell1,exspell2) == 0) and
-			(Elementarist:Count(Elementarist.SpellList["Flame Shock"],exspell1,exspell2) == 0) then
+			(Elementarist:Count(Elementarist.SpellList["Flame Shock"],exspell1,exspell2) == 0) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Flame Shock"]) then
 			if IsSpellInRange(Elementarist.SpellList["Flame Shock"], "target") == 1 then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
 				if (
@@ -251,26 +231,26 @@ Elementarist.enhancement = {
 		end

 		-- Priority 9 : Unleash Elements
-		if (Elementarist:Count(Elementarist.SpellList["Unleash Elements"],spellInCast,exspell1,exspell2) == 0) then
+		if (Elementarist:Count(Elementarist.SpellList["Unleash Elements"],spellInCast,exspell1,exspell2) == 0) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Unleash Elements"]) then
 			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Elements"])
 			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 and SSCharges and (IsSpellInRange(Elementarist.SpellList["Windstrike"], "target") == 1) then
+		-- Priority 10	: Windstrike (requires assendance) at 1 charges of SS/WS with EETalent
+		-- note:  Stormstrikeo has 100 yrd range and does not return IsSpellInRange correctly so no checking of range
+		if ascendance and SSCharges then
 			if ( (SSCharges >= 1) and (EETalent) ) then
 				return Elementarist.SpellList["Windstrike"]
 			end
 		end

 		-- Priority 11 : check Elemental Blast is available first
-		if EBTalent then
-			if 	(
-				(Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
-				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
-			) then
+		if EBTalent and Elementarist:SpellAvailable(Elementarist.SpellList["Elemental Blast"])  then
+			if 	((Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
+				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1) ) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
 				-- Elemental Blast (Tier 6 Talent) with Anscestral Swiftness buff
 				if ((d - timeshift) <= 0) then
@@ -289,40 +269,38 @@ Elementarist.enhancement = {
 		end

 		-- Priority 12 : lightning bolt near max count or with Ancesteral swiftness (only if not using T18 4 set)
-		if ( not  Elementarist.hasT18_4pcs) then
-			if (
-				((MWcount >=3 ) and (not ascendance)) or
-				Elementarist:hasBuff("player", Elementarist.SpellList["Ancestral Swiftness"])
-			) then
+		if ( not  Elementarist.hasT18_4pcs) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Lightning Bolt"]) then
+			if ( ((MWcount >=3 ) and (not ascendance)) or Elementarist:hasBuff("player", Elementarist.SpellList["Ancestral Swiftness"]) ) then
 				return Elementarist.SpellList["Lightning Bolt"]
 			end
 		end

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


 		-- 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
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Frost Shock"]) then
+			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)
-		) then
-			if (EFTalent and ((fsExpiration - currentTime - timeshift) < 16)) or (not EFTalent) then
-				return Elementarist.SpellList["Frost Shock"]
+			(Elementarist:Count(Elementarist.SpellList["Flame Shock"],exspell1,exspell2) == 0) ) then
+				if (EFTalent and ((fsExpiration - currentTime - timeshift) < 16)) or (not EFTalent) then
+					return Elementarist.SpellList["Frost Shock"]
+				end
 			end
 		end

 		-- Priority 15 : Elemental Blast if T18 4 piece and 2 or more Maelstom Weapon
-		if EBTalent and Elementarist.hasT18_4pcs and (MWcount >=2) then
-			if 	(
-				(Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
-				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
-	    	) then
+		if EBTalent and Elementarist.hasT18_4pcs and (MWcount >=2) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Elemental Blast"]) then
+			if 	( (Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
+				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
 				if ((d - timeshift) <= 0) then
   					if Elementarist:hasBuff("player", Elementarist.SpellList["Ancestral Swiftness"]) then
@@ -334,28 +312,30 @@ Elementarist.enhancement = {
 		end

 		-- Priority 16
-		if ( EETalent and (not Elementarist.hasT18_4pcs) and (MWcount >=2) ) then
-			return Elementarist.SpellList["Lightning Bolt"]
+		if ( EETalent and (not Elementarist.hasT18_4pcs) and (MWcount >=2) ) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Lighnting Bolt"]) then
+			return Elementarist.SpellList["Lightning Bolt"]
 		end

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

 		-- Priority 18 : Lighnting bolt at low charges of Maelstrom weapon
-		if (
-			(Elementarist.hasT18_4pcs and (MWcount >=3)) or (MWcount >= 1)
-		) then
+		if ( (Elementarist.hasT18_4pcs and (MWcount >=3)) or (MWcount >= 1) ) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Lighnting Bolt"]) then
 			if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 then
 				return Elementarist.SpellList["Lightning Bolt"]
 			end
 		end

 		-- Priority 19 : Searing Totem if less than 20 seconds until it expires
-		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
+		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
+			Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"]) then
 			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - currentTime ) -timeshift <= 20) then
  				return Elementarist.SpellList["Searing Totem"];
 			end