Quantcast

Translate "cooldown.spell.remains=0" as "not SpellCooldown(spell) > 0".

Johnny C. Lam [05-15-14 - 23:18]
Translate "cooldown.spell.remains=0" as "not SpellCooldown(spell) > 0".

This avoids an equality comparison, which allows for a time span to be
computed for the condition.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1449 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleSimulationCraft.lua
scripts/ovale_mage.lua
scripts/ovale_shaman.lua
diff --git a/OvaleSimulationCraft.lua b/OvaleSimulationCraft.lua
index 43ceceb..5ef3ca9 100644
--- a/OvaleSimulationCraft.lua
+++ b/OvaleSimulationCraft.lua
@@ -537,7 +537,7 @@ do
 					if needAnd then
 						tinsert(scriptLine, "and")
 					end
-					tinsert(scriptLine, format("Spell(%s)", scriptLine.sync))
+					tinsert(scriptLine, format("not SpellCooldown(%s) > 0", scriptLine.sync))
 					needAnd = true
 				end
 				if scriptLine.weapon then
@@ -738,7 +738,6 @@ do
 				return "DebuffStacks(arcane_charge_debuff)"
 			end,
 		["^buff%.rune_of_power%.remains$"] = "RuneOfPowerRemains()",
-		["^cooldown%.icy_veins%.remains$"] = "IcyVeinsCooldownRemains()",
 		-- Monk
 		["^dot%.zen_sphere%.ticking$"] = function(simc, action)
 				tinsert(simc.symbols, "zen_sphere_buff")
@@ -1220,12 +1219,41 @@ do
 					if name then
 						name = self:Name(name)
 						tinsert(self.symbols, name)
+						local remains = false
 						for pattern, result in pairs(COOLDOWN_PROPERTY) do
 							if strmatch(property, pattern) then
 								translated = (type(result) == "function") and result(self, name) or result
 								break
 							end
 						end
+						-- XXX
+						if strmatch(token, "^cooldown%.icy_veins%.remains$") then
+							translated = "IcyVeinsCooldownRemains()"
+							remains = true
+						end
+						if strmatch(property, "^remains$") then
+							remains = true
+						end
+						if remains then
+							tokenType, token = tokenIterator()
+							if tokenType then
+								if token == "=" then
+									translated = format("not %s >", translated)
+								else
+									local nextTranslated
+									for pattern, result in pairs(TRANSLATED_TOKEN) do
+										if strmatch(token, pattern) then
+											nextTranslated = (type(result) == "function") and result(self, token) or result
+											break
+										end
+									end
+									if not nextTranslated then
+										nextTranslated = format("FIXME_%s", token)
+									end
+									translated = format("%s %s", translated, nextTranslated)
+								end
+							end
+						end
 					end
 				end
 				if not translated then
diff --git a/scripts/ovale_mage.lua b/scripts/ovale_mage.lua
index 7d986ae..008c332 100644
--- a/scripts/ovale_mage.lua
+++ b/scripts/ovale_mage.lua
@@ -104,11 +104,11 @@ AddFunction ArcaneDefaultShortCdActions
 	#rune_of_power,if=buff.rune_of_power.remains<cast_time
 	if TalentPoints(rune_of_power_talent) and RuneOfPowerRemains() < CastTime(rune_of_power) Spell(rune_of_power)
 	#rune_of_power,if=cooldown.arcane_power.remains=0&buff.rune_of_power.remains<buff.arcane_power.duration
-	if TalentPoints(rune_of_power_talent) and Spell(arcane_power) and RuneOfPowerRemains() < SpellData(arcane_power_buff duration) Spell(rune_of_power)
+	if TalentPoints(rune_of_power_talent) and not SpellCooldown(arcane_power) > 0 and RuneOfPowerRemains() < SpellData(arcane_power_buff duration) Spell(rune_of_power)
 	#evocation,if=buff.invokers_energy.down
 	if TalentPoints(invocation_talent) and BuffExpires(invokers_energy_buff) Spell(evocation)
 	#evocation,if=cooldown.arcane_power.remains=0&buff.invokers_energy.remains<buff.arcane_power.duration
-	if TalentPoints(invocation_talent) and Spell(arcane_power) and BuffRemains(invokers_energy_buff) < SpellData(arcane_power_buff duration) Spell(evocation)
+	if TalentPoints(invocation_talent) and not SpellCooldown(arcane_power) > 0 and BuffRemains(invokers_energy_buff) < SpellData(arcane_power_buff duration) Spell(evocation)
 	#evocation,if=mana.pct<50,interrupt_if=mana.pct>95&buff.invokers_energy.remains>10
 	if not TalentPoints(rune_of_power_talent) and ManaPercent() < 50 Spell(evocation)
 }
@@ -142,7 +142,7 @@ AddFunction ArcaneDefaultCdActions
 		#jade_serpent_potion,if=buff.alter_time.down&(buff.arcane_power.up|target.time_to_die<50)
 		if BuffExpires(alter_time_buff) and { BuffPresent(arcane_power_buff) or target.TimeToDie() < 50 } UsePotionIntellect()
 		#use_item,slot=hands,sync=alter_time_activate,if=buff.alter_time.down
-		if Spell(alter_time_activate) and BuffExpires(alter_time_buff) UseItemActions()
+		if not SpellCooldown(alter_time_activate) > 0 and BuffExpires(alter_time_buff) UseItemActions()
 		#alter_time,if=buff.alter_time.down&buff.arcane_power.up
 		if BuffExpires(alter_time_buff) and BuffPresent(arcane_power_buff) Spell(alter_time)
 		#use_item,slot=hands,if=(cooldown.alter_time_activate.remains>45|target.time_to_die<25)&buff.rune_of_power.remains>20
@@ -246,7 +246,7 @@ AddFunction FireDefaultActions
 	#conjure_mana_gem,if=mana_gem_charges<3&target.debuff.invulnerable.react
 	if ItemCharges(mana_gem) < 3 and target.InCombat(no) ConjureManaGem()
 	#presence_of_mind,sync=alter_time_activate,if=buff.alter_time.down
-	if TalentPoints(presence_of_mind_talent) and Spell(alter_time_activate) and BuffExpires(alter_time_buff) Spell(presence_of_mind)
+	if TalentPoints(presence_of_mind_talent) and not SpellCooldown(alter_time_activate) > 0 and BuffExpires(alter_time_buff) Spell(presence_of_mind)
 	#presence_of_mind,if=cooldown.alter_time_activate.remains>60|target.time_to_die<5
 	if TalentPoints(presence_of_mind_talent) and { SpellCooldown(alter_time_activate) > 60 or target.TimeToDie() < 5 } Spell(presence_of_mind)
 	#pyroblast,if=buff.pyroblast.react|buff.presence_of_mind.up
@@ -271,7 +271,7 @@ AddFunction FireDefaultAoeActions
 	#conjure_mana_gem,if=mana_gem_charges<3&target.debuff.invulnerable.react
 	if ItemCharges(mana_gem) < 3 and target.InCombat(no) ConjureManaGem()
 	#presence_of_mind,sync=alter_time_activate,if=buff.alter_time.down
-	if TalentPoints(presence_of_mind_talent) and Spell(alter_time_activate) and BuffExpires(alter_time_buff) Spell(presence_of_mind)
+	if TalentPoints(presence_of_mind_talent) and not SpellCooldown(alter_time_activate) > 0 and BuffExpires(alter_time_buff) Spell(presence_of_mind)
 	#presence_of_mind,if=cooldown.alter_time_activate.remains>60|target.time_to_die<5
 	if TalentPoints(presence_of_mind_talent) and { SpellCooldown(alter_time_activate) > 60 or target.TimeToDie() < 5 } Spell(presence_of_mind)
 	#flamestrike,if=active_enemies>=5
@@ -295,11 +295,11 @@ AddFunction FireDefaultShortCdActions
 	#rune_of_power,if=buff.rune_of_power.remains<cast_time&buff.alter_time.down
 	if TalentPoints(rune_of_power_talent) and RuneOfPowerRemains() < CastTime(rune_of_power) and BuffExpires(alter_time_buff) Spell(rune_of_power)
 	#rune_of_power,if=cooldown.alter_time_activate.remains=0&buff.rune_of_power.remains<6
-	if TalentPoints(rune_of_power_talent) and Spell(alter_time_activate) and RuneOfPowerRemains() < 6 Spell(rune_of_power)
+	if TalentPoints(rune_of_power_talent) and not SpellCooldown(alter_time_activate) > 0 and RuneOfPowerRemains() < 6 Spell(rune_of_power)
 	#evocation,if=buff.rune_of_power.remains<cast_time&buff.alter_time.down
 	if TalentPoints(invocation_talent) and BuffRemains(invokers_energy_buff) < CastTime(rune_of_power) and BuffExpires(alter_time_buff) Spell(evocation)
 	#evocation,if=cooldown.alter_time_activate.remains=0&buff.rune_of_power.remains<6
-	if TalentPoints(invocation_talent) and Spell(alter_time_activate) and BuffRemains(invokers_energy_buff) < 6 Spell(evocation)
+	if TalentPoints(invocation_talent) and not Spell(alter_time_activate) > 0 and BuffRemains(invokers_energy_buff) < 6 Spell(evocation)
 	#evocation,if=buff.alter_time.down&mana.pct<20,interrupt_if=mana.pct>95
 	if not TalentPoints(rune_of_power_talent) and not TalentPoints(invocation_talent) and BuffExpires(alter_time_buff) and ManaPercent() < 20 Spell(evocation)
 	#combustion,if=target.time_to_die<22
@@ -336,11 +336,11 @@ AddFunction FireDefaultCdActions
 			#blood_fury,if=buff.alter_time.down&(cooldown.alter_time_activate.remains>30|target.time_to_die<18)
 			if BuffExpires(alter_time_buff) and { SpellCooldown(alter_time_activate) > 30 or target.TimeToDie() < 18 } Spell(blood_fury)
 			#berserking,sync=alter_time_activate,if=buff.alter_time.down
-			if Spell(alter_time_activate) and BuffExpires(alter_time_buff) Spell(berserking)
+			if not SpellCooldown(alter_time_activate) > 0 and BuffExpires(alter_time_buff) Spell(berserking)
 			#jade_serpent_potion,sync=alter_time_activate,if=buff.alter_time.down
-			if Spell(alter_time_activate) and BuffExpires(alter_time_buff) UsePotionIntellect()
+			if not SpellCooldown(alter_time_activate) > 0 and BuffExpires(alter_time_buff) UsePotionIntellect()
 			#use_item,slot=hands,sync=alter_time_activate
-			if Spell(alter_time_activate) UseItemActions()
+			if not SpellCooldown(alter_time_activate) > 0 UseItemActions()
 			#alter_time,if=time_to_bloodlust>180&buff.alter_time.down&buff.pyroblast.react
 			if TimeToBloodlust() > 180 and BuffExpires(alter_time_buff) and BuffPresent(pyroblast_buff) Spell(alter_time)
 			#use_item,slot=hands,if=cooldown.alter_time_activate.remains>40|target.time_to_die<12
@@ -447,13 +447,13 @@ AddFunction FrostDefaultActions
 	#frost_bomb,if=!ticking&target.time_to_die>tick_time*3
 	if TalentPoints(frost_bomb_talent) and not target.DebuffPresent(frost_bomb_debuff) and target.TimeToDie() > target.TickTime(frost_bomb_debuff) * 3 Spell(frost_bomb)
 	#frostfire_bolt,if=buff.brain_freeze.react&cooldown.icy_veins.remains>2
-	if BuffPresent(brain_freeze_buff) and { IcyVeins() or IcyVeinsCooldownRemains() > 2 } Spell(frostfire_bolt)
+	if BuffPresent(brain_freeze_buff) and { not IcyVeinsCooldownRemains() > 0 or IcyVeinsCooldownRemains() > 2 } Spell(frostfire_bolt)
 	#ice_lance,if=buff.frozen_thoughts.react&buff.fingers_of_frost.up
 	if ArmorSetBonus(T16_caster 2) == 1 and BuffPresent(frozen_thoughts_buff) and BuffPresent(fingers_of_frost_buff) Spell(ice_lance)
 	#ice_lance,if=buff.fingers_of_frost.up&(buff.fingers_of_frost.remains<2|(buff.fingers_of_frost.stack>1&cooldown.icy_veins.remains>2))
-	if ArmorSetBonus(T16_caster 2) == 1 and BuffPresent(fingers_of_frost_buff) and { BuffRemains(fingers_of_frost_buff) < 2 or { BuffStacks(fingers_of_frost_buff) > 1 and { IcyVeins() or IcyVeinsCooldownRemains() > 2 } } } Spell(ice_lance)
+	if ArmorSetBonus(T16_caster 2) == 1 and BuffPresent(fingers_of_frost_buff) and { BuffRemains(fingers_of_frost_buff) < 2 or { BuffStacks(fingers_of_frost_buff) > 1 and { not IcyVeinsCooldownRemains() > 0 or IcyVeinsCooldownRemains() > 2 } } } Spell(ice_lance)
 	#ice_lance,if=buff.fingers_of_frost.react&cooldown.icy_veins.remains>2
-	if ArmorSetBonus(T16_caster 2) == 0 and BuffPresent(fingers_of_frost_buff) and { IcyVeins() or IcyVeinsCooldownRemains() > 2 } Spell(ice_lance)
+	if ArmorSetBonus(T16_caster 2) == 0 and BuffPresent(fingers_of_frost_buff) and { not IcyVeinsCooldownRemains() > 0 or IcyVeinsCooldownRemains() > 2 } Spell(ice_lance)
 	#frostbolt
 	Spell(frostbolt)
 }
@@ -463,11 +463,11 @@ AddFunction FrostDefaultShortCdActions
 	#rune_of_power,if=buff.rune_of_power.remains<cast_time&buff.alter_time.down
 	if TalentPoints(rune_of_power_talent) and RuneOfPowerRemains() < CastTime(rune_of_power) and BuffExpires(alter_time_buff) Spell(rune_of_power)
 	#rune_of_power,if=cooldown.icy_veins.remains=0&buff.rune_of_power.remains<20
-	if TalentPoints(rune_of_power_talent) and IcyVeins() and RuneOfPowerRemains() < 20 Spell(rune_of_power)
+	if TalentPoints(rune_of_power_talent) and not IcyVeinsCooldownRemains() > 0 and RuneOfPowerRemains() < 20 Spell(rune_of_power)
 	#evocation,if=buff.invokers_energy.remains<cast_time&buff.alter_time.down
 	if TalentPoints(invocation_talent) and BuffRemains(invokers_energy_buff) < CastTime(evocation) and BuffExpires(alter_time_buff) Spell(evocation)
 	#evocation,if=cooldown.icy_veins.remains=0&buff.invokers_energy.remains<20
-	if TalentPoints(invocation_talent) and IcyVeins() and BuffRemains(invokers_energy_buff) < 20 Spell(evocation)
+	if TalentPoints(invocation_talent) and not IcyVeinsCooldownRemains() > 0 and BuffRemains(invokers_energy_buff) < 20 Spell(evocation)
 	#evocation,if=mana.pct<50,interrupt_if=mana.pct>95
 	if not TalentPoints(rune_of_power_talent) and not TalentPoints(invocation_talent) and ManaPercent() < 50 Spell(evocation)
 	#frozen_orb
@@ -481,9 +481,9 @@ AddFunction FrostDefaultCdActions
 	UseRacialInterruptActions()

 	unless { TalentPoints(rune_of_power_talent) and RuneOfPowerRemains() < CastTime(rune_of_power) and BuffExpires(alter_time_buff) }
-		or { TalentPoints(rune_of_power_talent) and IcyVeins() and RuneOfPowerRemains() < 20 }
+		or { TalentPoints(rune_of_power_talent) and not IcyVeinsCooldownRemains() > 0 and RuneOfPowerRemains() < 20 }
 		or { TalentPoints(invocation_talent) and BuffRemains(invokers_energy_buff) < CastTime(evocation) and BuffExpires(alter_time_buff) }
-		or { TalentPoints(invocation_talent) and IcyVeins() and BuffRemains(invokers_energy_buff) < 20 }
+		or { TalentPoints(invocation_talent) and not IcyVeinsCooldownRemains() > 0 and BuffRemains(invokers_energy_buff) < 20 }
 		or { not TalentPoints(rune_of_power_talent) and not TalentPoints(invocation_talent) and ManaPercent() < 50 and Spell(evocation) }
 	{
 		#mirror_image
@@ -499,7 +499,7 @@ AddFunction FrostDefaultCdActions
 		#presence_of_mind,if=buff.icy_veins.up|cooldown.icy_veins.remains>15|target.time_to_die<15
 		if BuffPresent(icy_veins_buff) or IcyVeinsCooldownRemains() > 15 or target.TimeToDie() < 15 Spell(presence_of_mind)
 		#use_item,slot=hands,sync=alter_time_activate,if=buff.alter_time.down
-		if Spell(alter_time_activate) and BuffExpires(alter_time_buff) UseItemActions()
+		if not SpellCooldown(alter_time_activate) > 0 and BuffExpires(alter_time_buff) UseItemActions()
 		#alter_time,if=buff.alter_time.down&buff.icy_veins.up
 		if BuffExpires(alter_time_buff) and BuffPresent(icy_veins_buff) Spell(alter_time)
 		#use_item,slot=hands,if=(cooldown.alter_time_activate.remains>45&buff.rune_of_power.remains>20)|target.time_to_die<25" )
diff --git a/scripts/ovale_shaman.lua b/scripts/ovale_shaman.lua
index 031c99a..9323b8f 100644
--- a/scripts/ovale_shaman.lua
+++ b/scripts/ovale_shaman.lua
@@ -105,7 +105,7 @@ AddFunction ElementalDefaultCdActions
 		#jade_serpent_potion,if=time>60&(pet.primal_fire_elemental.active|pet.greater_fire_elemental.active|target.time_to_die<=60)
 		if TimeInCombat() > 60 and { TotemPresent(fire totem=fire_elemental_totem) or TotemPresent(fire totem=fire_elemental_totem) or target.TimeToDie() <= 60 } UsePotionIntellect()
 		#berserking,if=!buff.bloodlust.up&!buff.elemental_mastery.up&(set_bonus.tier15_4pc_caster=1|(buff.ascendance.cooldown_remains=0&(dot.flame_shock.remains>buff.ascendance.duration|level<87)))
-		if not BuffPresent(burst_haste any=1) and not BuffPresent(elemental_mastery_buff) and { ArmorSetBonus(T15_caster 4) == 1 or { SpellCooldown(ascendance_caster) == 0 and { target.DebuffRemains(flame_shock_debuff) > SpellData(ascendance_caster_buff duration) or Level() < 87 } } } Spell(berserking)
+		if not BuffPresent(burst_haste any=1) and not BuffPresent(elemental_mastery_buff) and { ArmorSetBonus(T15_caster 4) == 1 or { not SpellCooldown(ascendance_caster) > 0 and { target.DebuffRemains(flame_shock_debuff) > SpellData(ascendance_caster_buff duration) or Level() < 87 } } } Spell(berserking)
 		#blood_fury,if=buff.bloodlust.up|buff.ascendance.up|((cooldown.ascendance.remains>10|level<87)&cooldown.fire_elemental_totem.remains>10)
 		if BuffPresent(burst_haste any=1) or BuffPresent(ascendance_caster_buff) or { { SpellCooldown(ascendance_caster) > 10 or Level() < 87 } and SpellCooldown(fire_elemental_totem) > 10 } Spell(blood_fury)
 		#elemental_mastery,if=talent.elemental_mastery.enabled&(time>15&((!buff.bloodlust.up&time<120)|(!buff.berserking.up&!buff.bloodlust.up&buff.ascendance.up)|(time>=200&(cooldown.ascendance.remains>30|level<87))))
@@ -346,9 +346,9 @@ AddFunction EnhancementDefaultCdActions
 		#blood_fury
 		UseRacialActions()
 		#elemental_mastery,if=talent.elemental_mastery.enabled&(talent.primal_elementalist.enabled&glyph.fire_elemental_totem.enabled&(cooldown.fire_elemental_totem.remains=0|cooldown.fire_elemental_totem.remains>=80))
-		if TalentPoints(elemental_mastery_talent) and { TalentPoints(primal_elementalist_talent) and Glyph(glyph_of_fire_elemental_totem) and { SpellCooldown(fire_elemental_totem) == 0 or SpellCooldown(fire_elemental_totem) >= 80 } } Spell(elemental_mastery)
+		if TalentPoints(elemental_mastery_talent) and { TalentPoints(primal_elementalist_talent) and Glyph(glyph_of_fire_elemental_totem) and { not SpellCooldown(fire_elemental_totem) > 0 or SpellCooldown(fire_elemental_totem) >= 80 } } Spell(elemental_mastery)
 		#elemental_mastery,if=talent.elemental_mastery.enabled&(talent.primal_elementalist.enabled&!glyph.fire_elemental_totem.enabled&(cooldown.fire_elemental_totem.remains=0|cooldown.fire_elemental_totem.remains>=50))
-		if TalentPoints(elemental_mastery_talent) and { TalentPoints(primal_elementalist_talent) and not Glyph(glyph_of_fire_elemental_totem) and { SpellCooldown(fire_elemental_totem) == 0 or SpellCooldown(fire_elemental_totem) >= 50 } } Spell(elemental_mastery)
+		if TalentPoints(elemental_mastery_talent) and { TalentPoints(primal_elementalist_talent) and not Glyph(glyph_of_fire_elemental_totem) and { not SpellCooldown(fire_elemental_totem) > 0 or SpellCooldown(fire_elemental_totem) >= 50 } } Spell(elemental_mastery)
 		#elemental_mastery,if=talent.elemental_mastery.enabled&!talent.primal_elementalist.enabled
 		if TalentPoints(elemental_mastery_talent) and not TalentPoints(primal_elementalist_talent) Spell(elemental_mastery)
 		#fire_elemental_totem,if=!active