Quantcast

Differentiate between some conditions when tracing state.

Johnny C. Lam [12-12-14 - 21:37]
Differentiate between some conditions when tracing state.
Filename
BestAction.lua
SpellBook.lua
diff --git a/BestAction.lua b/BestAction.lua
index 396740a..3ee6c07 100644
--- a/BestAction.lua
+++ b/BestAction.lua
@@ -253,8 +253,14 @@ local function GetActionSpellInfo(element, state, target)
 					if seconds > 0 then
 						local atTime = state.currentTime + seconds
 						if atTime > actionCooldownStart + actionCooldownDuration then
-							state:Log("Delaying spell ID '%s' for primary resource.", spellId)
-							actionCooldownDuration = atTime - actionCooldownStart
+							if actionCooldownDuration > 0 then
+								local extend = atTime - (actionCooldownStart + actionCooldownDuration)
+								actionCooldownDuration = actionCooldownDuration + extend
+								state:Log("Extending cooldown of spell ID '%s' for primary resource by %fs.", spellId, extend)
+							else
+								actionCooldownStart = atTime
+								state:Log("Delaying spell ID '%s' for primary resource by %fs.", spellId, seconds)
+							end
 						end
 					end
 				end
diff --git a/SpellBook.lua b/SpellBook.lua
index 25220eb..babebd4 100644
--- a/SpellBook.lua
+++ b/SpellBook.lua
@@ -516,7 +516,11 @@ statePrototype.IsUsableSpell = function(state, spellId, target)
 				if OvalePower.PRIMARY_POWER[requirement] then
 					noMana = true
 				end
-				state:Log("Spell ID '%s' failed requirements.", spellId)
+				if noMana then
+					state:Log("Spell ID '%s' does not have enough %s.", spellId, requirement)
+				else
+					state:Log("Spell ID '%s' failed '%s' requirements.", spellId, requirement)
+				end
 			end
 		end
 	else