Quantcast

Updated Elemental to use Zero Count

BillLive [01-31-16 - 00:18]
Updated Elemental to use Zero Count
Changed default value for maxizeFS to false
Signed-off-by: BillLive <bill@live.com.au>
Filename
Elementarist.lua
modules/elemental.lua
diff --git a/Elementarist.lua b/Elementarist.lua
index c5251a5..2b01ab4 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -364,7 +364,7 @@ function Elementarist:InitSettings()
 	if ElementaristDB.DebugMode == nil then ElementaristDB.DebugMode = false end
 	if ElementaristDB.trackAuraBuffs == nil then ElementaristDB.trackAuraBuffs = true end
 	if ElementaristDB.DpsTxtDisabled == nil then ElementaristDB.DpsTxtDisabled = false end
-	if ElementaristDB.maximizeFS == nil then ElementaristDB.maximizeFS = true end
+	if ElementaristDB.maximizeFS == nil then ElementaristDB.maximizeFS = false end
 	if ElementaristDB.doFSThreshold == nil then ElementaristDB.doFSThreshold = 12 end
 	if ElementaristDB.disableLM == nil then ElementaristDB.disableLM = false end
 	if ElementaristDB.showHealingStream == nil then ElementaristDB.showHealingStream = false end
diff --git a/modules/elemental.lua b/modules/elemental.lua
index a779608..a83de2b 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -211,7 +211,7 @@ Elementarist.elemental = {
 				if 	Elementarist.inCombat == false then

 				-- Searing Totem
-				if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
+				if (Elementarist:ZeroCount(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) ) 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
@@ -220,7 +220,7 @@ Elementarist.elemental = {
 				end

 				-- Opening Uleash flame  prior to combat
-				if (Elementarist:Count(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) == 0) and
+				if (Elementarist:ZeroCount(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) ) and
 					Elementarist:SpellAvailable(Elementarist.SpellList["Unleash Flame"]) then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Flame"])
 					if (d-timeshift <= 0) then
@@ -234,17 +234,16 @@ 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) and
-				Elementarist:SpellAvailable(Elementarist.SpellList["Liquid Magma"])then
+			if (Elementarist:ZeroCount(Elementarist.SpellList["Liquid Magma"],spellInCast,exspell1,exspell2) ) 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
+					(Elementarist:ZeroCount(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) ~= 0) then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Liquid Magma"])
 					if (d-timeshift <= 0) then
 						return Elementarist.SpellList["Liquid Magma"]
 					end
 				else
-					if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
+					if (Elementarist:ZeroCount(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) ) and
 						Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"])and
 						((fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift))
 					then
@@ -257,9 +256,8 @@ 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 and
-			Elementarist:SpellAvailable(Elementarist.SpellList["Earth Shock"])) then
+		if (Elementarist:ZeroCount(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2)  and
+			Elementarist:ZeroCount(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2)) 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"]
@@ -269,9 +267,8 @@ Elementarist.elemental = {
 		-- Priority 3
 		-- 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 and
-			Elementarist:SpellAvailable(Elementarist.SpellList["Flame Shock"])) then
+		if (Elementarist:ZeroCount(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2)  and
+			Elementarist:ZeroCount(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2))  then
 			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
 			if ((d - timeshift) <= 0) then
 				if (efCount==2) and (ufCount==1)then
@@ -304,9 +301,8 @@ Elementarist.elemental = {
 		-- 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)
 		-- Only allow this if we are not boosting Flameshock priority
-		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"]) and
+		if (Elementarist:ZeroCount(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2)  and
+			Elementarist:ZeroCount(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2)) and
 			not (doFS) then
 			if ( (fsExpiration - GetTime() - timeshift) > Elementarist.lastShockCD ) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"])
@@ -325,9 +321,8 @@ 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) and
-			Elementarist:SpellAvailable(Elementarist.SpellList["Flame Shock"]) then
+		if 	(Elementarist:ZeroCount(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) ) and
+			(Elementarist:ZeroCount(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) ) then
 			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
 			if ((d - timeshift) <= 0) then
 				if ((fsExpiration - GetTime() - timeshift) < (9) ) then
@@ -347,9 +342,8 @@ Elementarist.elemental = {
 		-- 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) and
-				Elementarist:SpellAvailable(Elementarist.SpellList["Elemental Blast"])	) then
+			if ((Elementarist:ZeroCount(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) ) and
+				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1) ) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
 				if ((d - timeshift) <= 0) then
 					return Elementarist.SpellList["Elemental Blast"]
@@ -362,8 +356,7 @@ Elementarist.elemental = {
 		-- Unleash_flame,if=talent.unleashed_fury.enabled&!buff.ascendance.up|(talent.elemental_fusion.enabled&buff.elemental_fusion.stack=2&(dot.flame_shock.remains)<(dot.flame_shock.duration*(0.3+t18_class_trinket*(0.48+talent.unleashed_fury.enabled*0.22)))&cooldown.flame_shock.remains<gcd)
 		if ((UFTalent) and not (doFS))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) and
-				Elementarist:SpellAvailable(Elementarist.SpellList["Unleash Flame"])then
+			if (Elementarist:ZeroCount(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) ) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Flame"])
 				if (d-timeshift <= 0) then
 					return Elementarist.SpellList["Unleash Flame"];
@@ -373,8 +366,7 @@ Elementarist.elemental = {

 		-- Priority 9
 		-- Searing Totem
-		if  (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) and
-			Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"]) then
+		if  (Elementarist:ZeroCount(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) ) then
 			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
 			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift) then
 				return Elementarist.SpellList["Searing Totem"];
@@ -389,7 +381,7 @@ Elementarist.elemental = {
 				if (eqCharges<maxEqCharges) and (((cdStart + cdLength)- GetTime()) - timeshift <= 0) then
 					eqCharges = eqCharges + 1;
 				end
-				eqCharges = eqCharges - Elementarist:Count(Elementarist.SpellList["Earthquake"],spellInCast,exspell1,exspell2);
+				eqCharges = eqCharges - Elementarist:ZeroCount(Elementarist.SpellList["Earthquake"],spellInCast,exspell1,exspell2);
 				eclBuff, _, _, _, _, _, eclExp = Elementarist:hasBuff("player",Elementarist.SpellList["Enhanced Chain Lightning"]);
 						if (eqCharges > 0) and (eclBuff) then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
@@ -619,8 +611,8 @@ Elementarist.elemental = {
 				if (d) and (d<0.5) then
 					local _, _, _, lscount = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"])
 					if (lscount) then
-						lscount= lscount + (Elementarist:Count(Elementarist.SpellList["Lightning Bolt"],spellInCast,exspell1,exspell2));
-						lscount= lscount + (Elementarist:Count(Elementarist.SpellList["Lava Burst"],spellInCast,exspell1,exspell2));
+						lscount= lscount + (Elementarist:ZeroCount(Elementarist.SpellList["Lightning Bolt"],spellInCast,exspell1,exspell2));
+						lscount= lscount + (Elementarist:ZeroCount(Elementarist.SpellList["Lava Burst"],spellInCast,exspell1,exspell2));
 					else
 						lscount=0;
 					end