Quantcast

Remove "nextCast" from the parameters passed via ApplySpell().

Johnny C. Lam [01-01-15 - 07:37]
Remove "nextCast" from the parameters passed via ApplySpell().

If the value is needed, then it should be taken from the simulator via
state.nextCast, which is set in state:ApplySpell().
Filename
Aura.lua
ComboPoints.lua
Cooldown.lua
Eclipse.lua
Future.lua
Power.lua
Runes.lua
Stance.lua
Totem.lua
diff --git a/Aura.lua b/Aura.lua
index 4eabed3..d14253e 100644
--- a/Aura.lua
+++ b/Aura.lua
@@ -936,7 +936,7 @@ function OvaleAura:CleanState(state)
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvaleAura:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleAura:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleAura_ApplySpellAfterCast")
 	local si = OvaleData.spellInfo[spellId]
 	-- Apply the auras on the player.
@@ -947,7 +947,7 @@ function OvaleAura:ApplySpellAfterCast(state, spellId, targetGUID, startCast, en
 end

 -- Apply the effects of the spell on the target's state after it lands on the target.
-function OvaleAura:ApplySpellAfterHit(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleAura:ApplySpellAfterHit(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleAura_ApplySpellAfterHit")
 	local si = OvaleData.spellInfo[spellId]
 	-- Apply the auras on the target.
diff --git a/ComboPoints.lua b/ComboPoints.lua
index 7d9deec..516f4a6 100644
--- a/ComboPoints.lua
+++ b/ComboPoints.lua
@@ -413,7 +413,7 @@ function OvaleComboPoints:ResetState(state)
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvaleComboPoints:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleComboPoints:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleComboPoints_ApplySpellAfterCast")
 	local si = OvaleData.spellInfo[spellId]
 	if si and si.combo then
diff --git a/Cooldown.lua b/Cooldown.lua
index c51744b..1960787 100644
--- a/Cooldown.lua
+++ b/Cooldown.lua
@@ -228,7 +228,7 @@ function OvaleCooldown:CleanState(state)
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvaleCooldown:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleCooldown:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleCooldown_ApplySpellAfterCast")
 	local cd = state:GetCD(spellId)

diff --git a/Eclipse.lua b/Eclipse.lua
index 4f3e144..9ee5786 100644
--- a/Eclipse.lua
+++ b/Eclipse.lua
@@ -220,7 +220,7 @@ function OvaleEclipse:ResetState(state)
 end

 -- Apply the effects of the spell at the start of the spellcast.
-function OvaleEclipse:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleEclipse:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleEclipse_ApplySpellStartCast")
 	-- Channeled spells cost resources at the start of the channel.
 	if isChanneled then
@@ -230,7 +230,7 @@ function OvaleEclipse:ApplySpellStartCast(state, spellId, targetGUID, startCast,
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvaleEclipse:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleEclipse:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleEclipse_ApplySpellAfterCast")
 	-- Instant or cast-time spells cost resources at the end of the spellcast.
 	if not isChanneled then
diff --git a/Future.lua b/Future.lua
index 67a5281..d5c590c 100644
--- a/Future.lua
+++ b/Future.lua
@@ -676,7 +676,7 @@ function OvaleFuture:ApplyInFlightSpells(state)
 		local spellcast = self_activeSpellcast[index]
 		state:Log("now = %f, spellId = %d, endCast = %f", now, spellcast.spellId, spellcast.stop)
 		if now - spellcast.stop < 5 then
-			state:ApplySpell(spellcast.spellId, spellcast.target, spellcast.start, spellcast.stop, spellcast.stop, spellcast.channeled, spellcast)
+			state:ApplySpell(spellcast.spellId, spellcast.target, spellcast.start, spellcast.stop, spellcast.channeled, spellcast)
 		else
 			tremove(self_activeSpellcast, index)
 			self_pool:Release(spellcast)
@@ -845,7 +845,7 @@ function OvaleFuture:CleanState(state)
 end

 -- Apply the effects of the spell at the start of the spellcast.
-function OvaleFuture:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleFuture:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleFuture_ApplySpellStartCast")
 	local si = OvaleData.spellInfo[spellId]
 	if si then
@@ -890,18 +890,18 @@ end
 		targetGUID	The GUID of the target of the spellcast.
 		startCast	The time at the start of the spellcast.
 		endCast		The time at the end of the spellcast.
-		nextCast	The earliest time at which the next spell can be cast (nextCast >= endCast).
 		isChanneled	The spell is a channeled spell.
 		spellcast	(optional) Table of spellcast information, including a snapshot of player's stats.
 --]]
-statePrototype.ApplySpell = function(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+statePrototype.ApplySpell = function(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	OvaleFuture:StartProfiling("OvaleFuture_state_ApplySpell")
 	if spellId and targetGUID then
 		local target = OvaleGUID:GetUnitId(targetGUID)
 		local gcd = state:GetGCD(spellId, target)
+		local nextCast

 		-- Handle missing start/end/next cast times.
-		if not startCast or not endCast or not nextCast then
+		if not startCast or not endCast then
 			local castTime = OvaleSpellBook:GetCastTime(spellId) or 0
 			startCast = startCast or state.nextCast
 			endCast = endCast or (startCast + castTime)
@@ -951,17 +951,17 @@ statePrototype.ApplySpell = function(state, spellId, targetGUID, startCast, endC
 		--]]
 		-- If the spellcast has already started, then the effects have already occurred.
 		if startCast > now then
-			OvaleState:InvokeMethod("ApplySpellStartCast", state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+			OvaleState:InvokeMethod("ApplySpellStartCast", state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 		end
 		-- If the spellcast has already ended, then the effects have already occurred.
 		if endCast > now then
-			OvaleState:InvokeMethod("ApplySpellAfterCast", state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+			OvaleState:InvokeMethod("ApplySpellAfterCast", state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 		end
 		if not spellcast or not spellcast.success then
-			OvaleState:InvokeMethod("ApplySpellOnHit", state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+			OvaleState:InvokeMethod("ApplySpellOnHit", state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 		end
 		if not spellcast or not spellcast.success or spellcast.success == "hit" or spellcast.success == "critical" then
-			OvaleState:InvokeMethod("ApplySpellAfterHit", state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+			OvaleState:InvokeMethod("ApplySpellAfterHit", state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 		end
 	end
 	OvaleFuture:StopProfiling("OvaleFuture_state_ApplySpell")
diff --git a/Power.lua b/Power.lua
index 4f99d50..179c228 100644
--- a/Power.lua
+++ b/Power.lua
@@ -618,27 +618,27 @@ function OvalePower:CleanState(state)
 end

 -- Apply the effects of the spell at the start of the spellcast.
-function OvalePower:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvalePower:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvalePower_ApplySpellStartCast")
 	-- Channeled spells cost resources at the start of the channel.
 	if isChanneled then
 		if state.inCombat then
 			state.powerRate[self.powerType] = self.activeRegen
 		end
-		state:ApplyPowerCost(spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+		state:ApplyPowerCost(spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	end
 	self:StopProfiling("OvalePower_ApplySpellStartCast")
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvalePower:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvalePower:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvalePower_ApplySpellAfterCast")
 	-- Instant or cast-time spells cost resources at the end of the spellcast.
 	if not isChanneled then
 		if state.inCombat then
 			state.powerRate[self.powerType] = self.activeRegen
 		end
-		state:ApplyPowerCost(spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+		state:ApplyPowerCost(spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	end
 	self:StopProfiling("OvalePower_ApplySpellAfterCast")
 end
@@ -646,7 +646,7 @@ end

 --<state-methods>
 -- Update the state of the simulator for the power cost of the given spell.
-statePrototype.ApplyPowerCost = function(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+statePrototype.ApplyPowerCost = function(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	OvalePower:StartProfiling("OvalePower_state_ApplyPowerCost")
 	local target = OvaleGUID:GetUnitId(targetGUID)
 	local si = OvaleData.spellInfo[spellId]
@@ -669,7 +669,7 @@ statePrototype.ApplyPowerCost = function(state, spellId, targetGUID, startCast,
 				-- Add any power regenerated or consumed during the cast time of a non-channeled spell.
 				if not isChanneled then
 					local powerRate = state.powerRate[powerType]
-					local gain = powerRate * (nextCast - state.currentTime)
+					local gain = powerRate * (state.nextCast - state.currentTime)
 					power = power + gain
 				end
 				-- Clamp power to lower and upper limits.
diff --git a/Runes.lua b/Runes.lua
index f399ac9..6e8dc93 100644
--- a/Runes.lua
+++ b/Runes.lua
@@ -264,7 +264,7 @@ function OvaleRunes:CleanState(state)
 end

 -- Apply the effects of the spell at the start of the spellcast.
-function OvaleRunes:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleRunes:ApplySpellStartCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleRunes_ApplySpellStartCast")
 	-- Channeled spells cost resources at the start of the channel.
 	if isChanneled then
@@ -274,7 +274,7 @@ function OvaleRunes:ApplySpellStartCast(state, spellId, targetGUID, startCast, e
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvaleRunes:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleRunes:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleRunes_ApplySpellAfterCast")
 	-- Instant or cast-time spells cost resources at the end of the spellcast.
 	if not isChanneled then
diff --git a/Stance.lua b/Stance.lua
index d16c827..5f5c8f1 100644
--- a/Stance.lua
+++ b/Stance.lua
@@ -294,7 +294,7 @@ function OvaleStance:ResetState(state)
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvaleStance:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleStance:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleStance_ApplySpellAfterCast")
 	local target = OvaleGUID:GetUnitId(targetGUID)
 	local stance = state:GetSpellInfoProperty(spellId, "to_stance", target)
diff --git a/Totem.lua b/Totem.lua
index b620d22..a708518 100644
--- a/Totem.lua
+++ b/Totem.lua
@@ -144,7 +144,7 @@ function OvaleTotem:CleanState(state)
 end

 -- Apply the effects of the spell on the player's state, assuming the spellcast completes.
-function OvaleTotem:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, nextCast, isChanneled, spellcast)
+function OvaleTotem:ApplySpellAfterCast(state, spellId, targetGUID, startCast, endCast, isChanneled, spellcast)
 	self:StartProfiling("OvaleTotem_ApplySpellAfterCast")
 	if self_class == "SHAMAN" and spellId == TOTEMIC_RECALL then
 		-- Shaman's Totemic Recall destroys all totems.