Quantcast

Use the correct spell cost when determining usability of a spell.

Johnny C. Lam [04-12-14 - 16:20]
Use the correct spell cost when determining usability of a spell.

The cost defined in SpellInfo may be adjusted downward based on other
parameters, and we should use the adjusted value, not the raw value, when
checking whether the spell is able to be cast or not.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1292 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleBestAction.lua
diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua
index 91985d9..888425a 100644
--- a/OvaleBestAction.lua
+++ b/OvaleBestAction.lua
@@ -749,10 +749,13 @@ function OvaleBestAction:GetActionInfo(element, state)
 				end
 			end
 			for _, powerType in pairs(OvalePower.SECONDARY_POWER) do
-				if si[powerType] and si[powerType] > state[powerType] then
-					-- Spell requires "secondary" resources, e.g., chi, focus, rage, etc.,
-					-- that the player does not have enough of.
-					return nil
+				if si[powerType] then
+					local cost = state:PowerCost(spellId, powerType)
+					if cost > state[powerType] then
+						-- Spell requires "secondary" resources, e.g., chi, focus, rage, etc.,
+						-- that the player does not have enough of.
+						return nil
+					end
 				end
 			end
 			if actionCooldownStart and actionCooldownDuration then