Quantcast

Added various improvements in rotation, and aoe spells

Taracque [03-10-15 - 16:47]
Added various improvements in rotation, and aoe spells
Filename
modules/elemental.lua
diff --git a/modules/elemental.lua b/modules/elemental.lua
index 3f76887..d69942d 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -158,7 +158,7 @@ Elementarist.elemental = {
 							doFS = true
 						end
 					end
-					if (doFS) and ((fsExpiration - GetTime() - timeshift) < 9) then
+					if (doFS) and ((fsExpiration - GetTime() - timeshift) < 2 * Elementarist.lastBaseGCD) then
 						return Elementarist.SpellList["Flame Shock"]
 					end
 				end
@@ -213,7 +213,7 @@ Elementarist.elemental = {
 			end
 		end

-		-- Earth shock if Lightning Shield count >=17 and not on cd, and FS debuff remaining > FS cooldown, or FS debuff remaining between FS and FS cd + 2sec and LS count>=13
+		-- Earth shock if Lightning Shield count >=17 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
 		if ( (exspell1 ~= Elementarist.SpellList["Earth Shock"]) and (exspell2 ~= Elementarist.SpellList["Earth Shock"]) and (exspell1 ~= Elementarist.SpellList["Flame Shock"]) and (exspell2 ~= Elementarist.SpellList["Flame Shock"]) ) then
 			if ( (fsExpiration - GetTime() - timeshift) > Elementarist.lastShockCD ) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"])
@@ -221,7 +221,8 @@ Elementarist.elemental = {
 				if (
 					( (d) and ((d-timeshift) <= 0) and (lscount) ) and (	-- Earth Shock is available, and has lightning shield
 						(lscount>=17) or 														-- Lightning shield has 17 charge
-						( (lscount>=13) and ( (fsExpiration - GetTime() - timeshift) < Elementarist.lastShockCD + 2 ) )	-- or, has 13 or more charges but FS expiration within 2 secs to FS CD
+						( (lscount>=13) and ( (fsExpiration - GetTime() - timeshift) < Elementarist.lastShockCD + 2 ) ) or	-- or, has 13 or more charges but FS expiration within 2 secs to FS CD
+						( (lscount>=12) and Elementarist.hasT17_4pcs) -- or has T17 4pcs bonus, and 12 or more charges on LS
 					)
 				) then
 					return Elementarist.SpellList["Earth Shock"]
@@ -229,6 +230,25 @@ Elementarist.elemental = {
 			end
 		end

+		-- Searing Totem
+		if (
+			(exspell1 ~= Elementarist.SpellList["Searing Totem"]) and
+			(exspell2 ~= Elementarist.SpellList["Searing Totem"]) and
+			(Elementarist.SpellList["Searing Totem"] ~= spellInCast)
+		) then
+			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
+			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift) then
+ 				return Elementarist.SpellList["Searing Totem"];
+		   end
+		end
+
+		-- refresh FS
+		if 	(exspell1 ~= Elementarist.SpellList["Flame Shock"]) and (exspell2 ~= Elementarist.SpellList["Flame Shock"]) then
+			if (doFS) and ((fsExpiration - GetTime() - timeshift) < 9) then
+				return Elementarist.SpellList["Flame Shock"]
+			end
+		end
+
 		-- otherwise lightning bolt
 		if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 then
 			return Elementarist.SpellList["Lightning Bolt"]
@@ -250,20 +270,36 @@ Elementarist.elemental = {
 		-- Blood Fury orc racial

 		local d, e
-		local name, expirationTime, _, name2, exp2
+		local name, expirationTime, _, name2, expirationTime2, name3, expirationTime3

 		-- Alchemy Flask of Enhancement
-		if ((GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) or (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0)) and (Elementarist.playerLevel<=90) then
-			name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of the Warm Sun"]);
+		if	(
+			((GetItemCount(Elementarist.CustomIDs["Whispering Crystal Item"]) ~= 0) and (Elementarist.playerLevel >= 90)  ) or
+			((GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0)and (Elementarist.playerLevel >= 85)  ) or
+			((GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0)  and (Elementarist.playerLevel <= 91)  )
+		) then
+			name = Elementarist:hasBuff("player", Elementarist.SpellList["Greater Draenic Intellect Flask"]);
+			if (name == nil) then
+				name = Elementarist:hasBuff("player", Elementarist.SpellList["Draenic Intellect Flask"]);
+			end
+			if (name == nil) then
+				name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of the Warm Sun"]);
+			end
 			if (name == nil) then
 				name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of the Draconic Mind"]);
 			end
 			if (name == nil) then
-				name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Crystal of Insanity"], false, Elementarist.CustomIDs["Crystal of Insanity Spell"]);
-				name2, _, _, _, _, _, exp2 = Elementarist:hasBuff("player", Elementarist.SpellList["Alchemist's Flask"], false, Elementarist.CustomIDs["Alchemist's Flask Spell"]);
+				name,  _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Whispers of Insanity"], false, Elementarist.CustomIDs["Whispers of Insanity Spell"]);
+				name2, _, _, _, _, _, expirationTime2 = Elementarist:hasBuff("player", Elementarist.SpellList["Crystal of Insanity"], false, Elementarist.CustomIDs["Crystal of Insanity Spell"]);
+				name3, _, _, _, _, _, expirationTime3 = Elementarist:hasBuff("player", Elementarist.SpellList["Alchemist's Flask"], false, Elementarist.CustomIDs["Alchemist's Flask Spell"]);

-				if ((name == nil) and (name2 == nil)) or (((name ~= nil) and (expirationTime<2)) or ((name2 ~= nil) and (exp2<2))) then
-					if (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0) then
+				if ((name == nil) and (name2 == nil) and (name3 == nil)) or (((name ~= nil) and (expirationTime<2)) or ((name2 ~= nil) and (expirationTime2<2)) or ((name3 ~= nil) and (expirationTime3<2))) then
+					if (GetItemCount(Elementarist.CustomIDs["Whispering Crystal Item"]) ~= 0) then
+						local itemCooldown = Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Whispering Crystal Item"]);
+						if ((name == nil) or (expirationTime < 2)) and (itemCooldown < 1) then
+							return nil,GetItemIcon(Elementarist.CustomIDs["Whispering Crystal Item"])
+						end
+					elseif (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0) then
 						local itemCooldown = Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Crystal of Insanity Item"]);
 						if ((name == nil) or (expirationTime < 2)) and (itemCooldown < 1) then
 							return nil,GetItemIcon(Elementarist.CustomIDs["Crystal of Insanity Item"])
@@ -286,6 +322,17 @@ Elementarist.elemental = {
 			end
 		end

+		-- Storm Elemental Totem
+		if (Elementarist.tier7Talent == Elementarist.CustomIDs["Storm Elemental Talent"]) then
+			if Elementarist:SpellAvailable(Elementarist.SpellList["Storm Elemental Totem"]) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Storm Elemental Totem"])
+				if d <= 0.5 then
+					return Elementarist.SpellList["Storm Elemental Totem"]
+				end
+			end
+		end
+
+--[[
 		-- Searing Totem
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"]) then
 			local haveFireTotem,fireTotemName,_,_ = GetTotemInfo(1)
@@ -294,6 +341,7 @@ Elementarist.elemental = {
 				return Elementarist.SpellList["Searing Totem"]
 			end
 		end
+--]]

 		-- Healing Stream Totem
 		if (ElementaristDB.ShowHealingStream) and (Elementarist:SpellAvailable(Elementarist.SpellList["Healing Stream Totem"])) then
@@ -347,6 +395,49 @@ Elementarist.elemental = {
 		-- interruptions, purge, and AoE on target
 		local d

+		---- Earthquake with Enhanced chain lightning buff
+		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
+		if (d) and (d<0.5) then
+			eclBuff, _, _, _, _, _, eclExp = Elementarist:hasBuff("player",Elementarist.SpellList["EnhancedChainLightningBuff"]);
+			if (eclBuff) then
+				return Elementarist.SpellList["Earthquake"]
+			end
+		end
+
+		if (Elementarist.person["foeCount"]>2) then
+			----  Lava beam if available
+			if Elementarist:SpellAvailable(Elementarist.SpellList["Lava Beam"]) then
+				if IsSpellInRange(Elementarist.SpellList["Lava Beam"], "target") == 1 then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Lava Beam"])
+					return Elementarist.SpellList["Lava Beam"]
+				end
+			end
+
+			---- Earth shock if Lightning Shield count >=17 and not on cd
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"])
+			if (d) and (d<0.5) then
+				local _, _, _, lscount = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"])
+				if (lscount>=17) then
+					return Elementarist.SpellList["Earth Shock"]
+				end
+			end
+
+			----  When Earthquake available get Enhanced chain lightning buff
+			if (not eclBuff) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
+				if (d) and (d<0.5 + Elementarist.lastBaseGCD) then
+					if Elementarist:SpellAvailable(Elementarist.SpellList["Chain Lightning"]) then
+						return Elementarist.SpellList["Chain Lightning"]
+					end
+				end
+			end
+
+			---- Chain Lightning as filler
+			if Elementarist:SpellAvailable(Elementarist.SpellList["Chain Lightning"]) then
+				return Elementarist.SpellList["Chain Lightning"]
+			end
+		end
+
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Wind Shear"]) then
 			if IsSpellInRange(Elementarist.SpellList["Wind Shear"], "target") == 1 then
 				local _, status, threatpct, _, _ = UnitDetailedThreatSituation("player", "target")
@@ -377,44 +468,6 @@ Elementarist.elemental = {
 				end
 			end
 		end
-
-		-- Lava Beam if there are multiple targets, (count in a dirty way from combat log, not to accurate!!!)
-		if Elementarist:SpellAvailable(Elementarist.SpellList["Lava Beam"]) then
-			if (Elementarist.person["foeCount"]>2) then
-				if IsSpellInRange(Elementarist.SpellList["Lava Beam"], "target") == 1 then
-					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Lava Beam"])
-					if (d) and (d<0.5) then
-						return Elementarist.SpellList["Lava Beam"]
-					end
-				end
-			end
-		end
-
-		-- EQ if not in rotataion and has 3 or more targets
-		if (not ElementaristDB.EnableEQ) then
-			if ((Elementarist.iLvl>=550) and (Elementarist.person["foeCount"]>1)) or (Elementarist.person["foeCount"]>2) then
-				if (exspell1 ~= Elementarist.SpellList["Earthquake"]) and (exspell2 ~= Elementarist.SpellList["Earthquake"]) and ((Elementarist.SpellList["Earthquake"]) ~= spellInCast) then
-					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
-					if (d) and (d<0.5) then
-						return Elementarist.SpellList["Earthquake"]
-					end
-				end
-			end
-		end
-
-		-- CL if there are multiple targets, (count in a dirty way from combat log, not to accurate!!!)
-		if (exspell1 ~= Elementarist.SpellList["Chain Lightning"]) and (exspell2 ~= Elementarist.SpellList["Chain Lightning"]) then
-			if (Elementarist.person["foeCount"]>2) then
-				if IsSpellInRange(Elementarist.SpellList["Chain Lightning"], "target") == 1 then
-					if ((Elementarist.SpellList["Chain Lightning"]) ~= spellInCast) then
-						d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Chain Lightning"])
-						if (d) and (d<0.5) then
-							return Elementarist.SpellList["Chain Lightning"]
-						end
-					end
-				end
-			end
-		end

 		return ""
 	end;