Quantcast

Rename SpellInfo parameter "canStopChannelling" to "channel".

Johnny C. Lam [04-27-14 - 04:40]
Rename SpellInfo parameter "canStopChannelling" to "channel".

Also remove unnecessary duration=N and tick=N parameters from channeled
spells as they have no meaning there.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1340 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleBestAction.lua
scripts/leafkiller_druid.lua
scripts/ovale_druid_spells.lua
scripts/ovale_monk_spells.lua
scripts/ovale_priest_spells.lua
diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua
index 8461715..8dcd6b8 100644
--- a/OvaleBestAction.lua
+++ b/OvaleBestAction.lua
@@ -124,34 +124,38 @@ local function ComputeAction(element, state)

 	-- If the action is available before the end of the current spellcast, then wait until we can first cast the action.
 	if start < state.nextCast then
-		local si = state.currentSpellId and OvaleData.spellInfo[state.currentSpellId]
-		if not (si and si.canStopChannelling) then
-			-- not a channelled spell, or a channelled spell that cannot be interrupted
-			start = state.nextCast
-		else
-			-- This is a channelled spell that can be interrupted, so wait till the next tick.
-			-- "canStopChannelling=N" means that there are N total ticks in the channelled spell.
-			local numTicks, scaling
-			if si.haste == "spell" then
-				scaling = state:GetSpellHasteMultiplier()
-			elseif si.haste == "melee" then
-				scaling = state:GetMeleeHasteMultiplier()
-			else
-				scaling = 1
-			end
-			numTicks = floor(si.canStopChannelling * scaling + 0.5)
-			local tick = (state.nextCast - state.startCast) / numTicks
-			local tickTime = state.startCast + tick
-			Ovale:Logf("%s start=%f", spellId, start)
-			for i = 1, numTicks do
-				if start <= tickTime then
-					start = tickTime
-					break
+		-- Default to starting at next available cast time.
+		local newStart = state.nextCast
+		-- If we are currently channeling a spellcast, then see if it is interruptible.
+		-- If we are allowed to interrupt it, then start after the next tick of the channel.
+		if state.isChanneling then
+			local spellId = state.currentSpellId
+			local si = spellId and OvaleData.spellInfo[spellId]
+			if si then
+				-- "channel=N" means that the channel has N total ticks and can be interrupted.
+				local channel = si.channel or si.canStopChannelling
+				if channel then
+					local hasteMultiplier = 1
+					if si.haste == "spell" then
+						hasteMultiplier = state:GetSpellHasteMultiplier()
+					elseif si.haste == "melee" then
+						hasteMultiplier = state:GetMeleeHasteMultiplier()
+					end
+					local numTicks = floor(channel * hasteMultiplier + 0.5)
+					local tick = (state.nextCast - state.startCast) / numTicks
+					local tickTime = state.startCast
+					for i = 1, numTicks do
+						tickTime = tickTime + tick
+						if start <= tickTime then
+							break
+						end
+					end
+					newStart = tickTime
+					Ovale:Logf("%s start=%f, numTicks=%d, tick=%f, tickTime=%f", spellId, newStart, numTicks, tick, tickTime)
 				end
-				tickTime = tickTime + tick
 			end
-			Ovale:Logf("%s start=%f, numTicks=%d, tick=%f, tickTime=%f", spellId, start, numTicks, tick, tickTime)
 		end
+		start = newStart
 	end
 	Ovale:Logf("Action %s can start at %f", action, start)
 	timeSpan[1], timeSpan[2] = start, math.huge
diff --git a/scripts/leafkiller_druid.lua b/scripts/leafkiller_druid.lua
index 26c06bb..56fb76a 100644
--- a/scripts/leafkiller_druid.lua
+++ b/scripts/leafkiller_druid.lua
@@ -104,7 +104,7 @@ Define(SYMBIOSIS 110309)
 	SpellAddBuff(SYMBIOSIS SYMBIOSIS=1)
 Define(WRATH 5176)
 Define(HURRICANE 16914)
-  SpellInfo(HURRICANE duration=10 tick=1 haste=spell canStopChannelling=9 )
+  SpellInfo(HURRICANE haste=spell channel=9 )

 # Shared buffs
 Define(DREAM_OF_CENARIUS 145152)
diff --git a/scripts/ovale_druid_spells.lua b/scripts/ovale_druid_spells.lua
index 1152578..da98ccb 100644
--- a/scripts/ovale_druid_spells.lua
+++ b/scripts/ovale_druid_spells.lua
@@ -78,7 +78,7 @@ Define(heart_of_the_wild 108292)
 	SpellInfo(heart_of_the_wild cd=360)
 Define(heart_of_the_wild_talent 16)
 Define(hurricane 16914)
-	SpellInfo(hurricane canStopChannelling=10 duration=10 haste=spell tick=1)
+	SpellInfo(hurricane channel=10 haste=spell)
 Define(incarnation 106731)
 	SpellInfo(incarnation cd=180)
 Define(incarnation_talent 11)
@@ -234,7 +234,7 @@ Define(tigers_fury 5217)
 Define(tigers_fury_buff 5217)
 	SpellInfo(tigers_fury duration=6)
 Define(tranquility 740)
-	SpellInfo(tranquility canStopChannelling=4 cd=480 duration=8 haste=spell tick=2)
+	SpellInfo(tranquility channel=4 cd=480 haste=spell)
 	SpellInfo(tranquility cd=180 if_spell=malfurions_gift)
 Define(typhoon 132469)
 	SpellInfo(typhoon cd=30)
diff --git a/scripts/ovale_monk_spells.lua b/scripts/ovale_monk_spells.lua
index 1a923e9..1619e3c 100644
--- a/scripts/ovale_monk_spells.lua
+++ b/scripts/ovale_monk_spells.lua
@@ -33,7 +33,7 @@ Define(combo_breaker_bok_buff 116768)
 Define(combo_breaker_tp_buff 118864)
 	SpellInfo(combo_breaker_tp_buff duration=15)
 Define(crackling_jade_lightning 117952)
-	SpellInfo(crackling_jade_lightning canStopChannelling=6 duration=6 tick=1)
+	SpellInfo(crackling_jade_lightning channel=6)
 	SpellAddBuff(crackling_jade_lightning power_strikes_buff=0 talent=power_strikes_talent)
 Define(dampen_harm 122278)
 	SpellInfo(dampen_harm cd=90)
@@ -62,7 +62,7 @@ Define(expel_harm_glyphed 147489)
 	SpellInfo(expel_harm_glyphed chi=-2 if_stance=monk_stance_of_the_fierce_tiger)
 	SpellAddBuff(expel_harm_glyphed power_strikes_buff=0 talent=power_strikes_talent)
 Define(fists_of_fury 113656)
-	SpellInfo(fists_of_fury canStopChannelling=4 cd=25 chi=3 tick=1)
+	SpellInfo(fists_of_fury channel=4 cd=25 chi=3)
 	SpellInfo(fists_of_fury addcd=-5 itemset=T14_melee itemcount=2)
 	SpellInfo(fists_of_fury buff_chi=focus_of_xuen_buff buff_chi_amount=-1)
 Define(focus_of_xuen_buff 145024)
@@ -102,7 +102,7 @@ Define(legacy_of_the_white_tiger 116781)
 Define(light_stagger_debuff 124275)
 	SpellInfo(light_stagger_debuff duration=10 tick=1)
 Define(mana_tea 115294)
-	SpellInfo(mana_tea canStopChannelling=6 duration=3 tick=0.5 texture=inv_misc_herb_jadetealeaf)
+	SpellInfo(mana_tea channel=6 texture=inv_misc_herb_jadetealeaf)
 Define(mana_tea_buff 115867)
 	SpellInfo(mana_tea_buff duration=120)
 Define(mana_tea_glyphed 123761)
diff --git a/scripts/ovale_priest_spells.lua b/scripts/ovale_priest_spells.lua
index 02bad71..94fd600 100644
--- a/scripts/ovale_priest_spells.lua
+++ b/scripts/ovale_priest_spells.lua
@@ -44,9 +44,9 @@ Define(mind_blast 8092)
 	SpellInfo(mind_blast cd=8 shadoworbs=-1)
 	SpellAddBuff(mind_blast divine_insight_shadow_buff=0 talent=divine_insight_talent)
 Define(mind_flay 15407)
-	SpellInfo(mind_flay canStopChannelling=3 duration=3 haste=spell tick=1)
+	SpellInfo(mind_flay channel=3 haste=spell)
 Define(mind_sear 48045)
-	SpellInfo(mind_sear canStopChannelling=5 duration=5 haste=spell tick=1)
+	SpellInfo(mind_sear channel=5 haste=spell)
 Define(mind_spike 73510)
 	SpellAddBuff(mind_spike surge_of_darkness_buff=0 mastery=shadow talent=from_darkness_comes_light_talent)
 Define(mindbender 123040)