Quantcast

Fix SimC translation of some "react" buffs to use BuffStacks().

Johnny C. Lam [06-01-14 - 05:30]
Fix SimC translation of some "react" buffs to use BuffStacks().

Most usage of "buff.name.react" is interpreted as
"BuffPresent(name_buff)", but there are some cases where it really wants
"BuffStacks(name_buff)".  Fix the few cases where this happens.

This fixes ticket 375 by @only1yzerman that noted a problem with using up
Maelstrom Weapon stacks on enhancement shamans.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1508 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleSimulationCraft.lua
scripts/ovale_shaman.lua
scripts/simulationcraft_shaman_enhancement_t16h.lua
scripts/simulationcraft_warlock_demonology_t16h.lua
diff --git a/OvaleSimulationCraft.lua b/OvaleSimulationCraft.lua
index 89e3ef7..9b9b4ff 100644
--- a/OvaleSimulationCraft.lua
+++ b/OvaleSimulationCraft.lua
@@ -811,6 +811,10 @@ do
 				tinsert(simc.symbols, "lightning_shield_buff")
 				return "BuffStacks(lightning_shield_buff)"
 			end,
+		["^buff%.maelstrom_weapon%.react$"] = function(simc, action)
+				tinsert(simc.symbols, "maelstrom_weapon_buff")
+				return "BuffStacks(maelstrom_weapon_buff)"
+			end,
 		["^pet%.greater_fire_elemental%.active$"] = "TotemPresent(fire totem=fire_elemental_totem)",
 		["^pet%.primal_fire_elemental%.active$"] = "TotemPresent(fire totem=fire_elemental_totem)",
 		-- Warlock
@@ -822,6 +826,10 @@ do
 				tinsert(simc.symbols, "havoc_debuff")
 				return "DebuffStacksOnAny(havoc_debuff)"
 			end,
+		["^buff%.molten_core%.react$"] = function(simc, action)
+				tinsert(simc.symbols, "molten_core_buff")
+				return "BuffStacks(molten_core_buff)"
+			end,
 		["^debuff%.magic_vulnerability%.down$"] = "target.DebuffExpires(magic_vulnerability any=1)",
 		["^debuff%.magic_vulnerability%.up$"] = "target.DebuffPresent(magic_vulnerability any=1)",
 	}
diff --git a/scripts/ovale_shaman.lua b/scripts/ovale_shaman.lua
index 25a45cf..a5a9dde 100644
--- a/scripts/ovale_shaman.lua
+++ b/scripts/ovale_shaman.lua
@@ -225,9 +225,9 @@ AddFunction EnhancementAoeActions
 	#lava_lash,if=dot.flame_shock.ticking
 	if target.DebuffPresent(flame_shock_debuff) Spell(lava_lash)
 	#elemental_blast,if=talent.elemental_blast.enabled&buff.maelstrom_weapon.react>=1
-	if TalentPoints(elemental_blast_talent) and BuffPresent(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
+	if TalentPoints(elemental_blast_talent) and BuffStacks(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
 	#chain_lightning,if=active_enemies>=2&buff.maelstrom_weapon.react>=3
-	if Enemies() >= 2 and BuffPresent(maelstrom_weapon_buff) >= 3 Spell(chain_lightning)
+	if Enemies() >= 2 and BuffStacks(maelstrom_weapon_buff) >= 3 Spell(chain_lightning)
 	#unleash_elements
 	Spell(unleash_elements)
 	#flame_shock,cycle_targets=1,if=!ticking
@@ -237,7 +237,7 @@ AddFunction EnhancementAoeActions
 	#fire_nova,if=active_flame_shock>=3
 	if DebuffCountOnAny(flame_shock_debuff) >= 3 Spell(fire_nova)
 	#chain_lightning,if=active_enemies>=2&buff.maelstrom_weapon.react>=1
-	if Enemies() >= 2 and BuffPresent(maelstrom_weapon_buff) >= 1 Spell(chain_lightning)
+	if Enemies() >= 2 and BuffStacks(maelstrom_weapon_buff) >= 1 Spell(chain_lightning)
 	#stormstrike
 	Spell(stormstrike)
 	#earth_shock,if=active_enemies<4
@@ -257,9 +257,9 @@ AddFunction EnhancementSingleActions
 	#unleash_elements,if=(talent.unleashed_fury.enabled|set_bonus.tier16_2pc_melee=1)
 	if { TalentPoints(unleashed_fury_talent) or ArmorSetBonus(T16_melee 2) == 1 } Spell(unleash_elements)
 	#elemental_blast,if=talent.elemental_blast.enabled&buff.maelstrom_weapon.react>=1
-	if TalentPoints(elemental_blast_talent) and BuffPresent(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
+	if TalentPoints(elemental_blast_talent) and BuffStacks(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
 	#lightning_bolt,if=buff.maelstrom_weapon.react=5
-	if BuffPresent(maelstrom_weapon_buff) == 5 Spell(lightning_bolt)
+	if BuffStacks(maelstrom_weapon_buff) == 5 Spell(lightning_bolt)
 	#stormblast
 	Spell(stormblast)
 	#stormstrike
@@ -269,7 +269,7 @@ AddFunction EnhancementSingleActions
 	#lava_lash
 	Spell(lava_lash)
 	#lightning_bolt,if=set_bonus.tier15_2pc_melee=1&buff.maelstrom_weapon.react>=4&!buff.ascendance.up
-	if ArmorSetBonus(T15_melee 2) == 1 and BuffPresent(maelstrom_weapon_buff) >= 4 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
+	if ArmorSetBonus(T15_melee 2) == 1 and BuffStacks(maelstrom_weapon_buff) >= 4 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
 	#flame_shock,if=(buff.unleash_flame.up&(dot.flame_shock.remains<10|action.flame_shock.tick_damage>dot.flame_shock.tick_dmg))|!ticking
 	if { BuffPresent(unleash_flame_buff) and { target.DebuffRemains(flame_shock_debuff) < 10 or Damage(flame_shock) > target.LastEstimatedDamage(flame_shock_debuff) } } or not target.DebuffPresent(flame_shock_debuff) Spell(flame_shock)
 	#unleash_elements
@@ -277,21 +277,21 @@ AddFunction EnhancementSingleActions
 	#frost_shock,if=glyph.frost_shock.enabled&set_bonus.tier14_4pc_melee=0
 	if Glyph(glyph_of_frost_shock) and ArmorSetBonus(T14_melee 4) == 0 Spell(frost_shock)
 	#lightning_bolt,if=buff.maelstrom_weapon.react>=3&!buff.ascendance.up
-	if BuffPresent(maelstrom_weapon_buff) >= 3 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
+	if BuffStacks(maelstrom_weapon_buff) >= 3 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
 	#lightning_bolt,if=buff.ancestral_swiftness.up
 	if BuffPresent(ancestral_swiftness_buff) or Spell(ancestral_swiftness) Spell(lightning_bolt)
 	#earth_shock,if=(!glyph.frost_shock.enabled|set_bonus.tier14_4pc_melee=1)
 	if { not Glyph(glyph_of_frost_shock) or ArmorSetBonus(T14_melee 4) == 1 } Spell(earth_shock)
 	#lightning_bolt,if=buff.maelstrom_weapon.react>1&!buff.ascendance.up
-	if BuffPresent(maelstrom_weapon_buff) > 1 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
+	if BuffStacks(maelstrom_weapon_buff) > 1 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
 }

 AddFunction EnhancementSingleCdActions
 {
 	unless not TotemPresent(fire)
 		or { { TalentPoints(unleashed_fury_talent) or ArmorSetBonus(T16_melee 2) == 1 } and Spell(unleash_elements) }
-		or { TalentPoints(elemental_blast_talent) and BuffPresent(maelstrom_weapon_buff) >= 1 and Spell(elemental_blast) }
-		or BuffPresent(maelstrom_weapon_buff) == 5
+		or { TalentPoints(elemental_blast_talent) and BuffStacks(maelstrom_weapon_buff) >= 1 and Spell(elemental_blast) }
+		or BuffStacks(maelstrom_weapon_buff) == 5
 	{
 		#feral_spirit,if=set_bonus.tier15_4pc_melee=1
 		if ArmorSetBonus(T15_melee 4) == 1 Spell(feral_spirit)
@@ -300,14 +300,14 @@ AddFunction EnhancementSingleCdActions
 			or Spell(stormstrike)
 			or { BuffPresent(unleash_flame_buff) and not target.DebuffPresent(flame_shock_debuff) and Spell(flame_shock) }
 			or Spell(lava_lash)
-			or { ArmorSetBonus(T15_melee 2) == 1 and BuffPresent(maelstrom_weapon_buff) >= 4 and not BuffPresent(ascendance_melee_buff) }
+			or { ArmorSetBonus(T15_melee 2) == 1 and BuffStacks(maelstrom_weapon_buff) >= 4 and not BuffPresent(ascendance_melee_buff) }
 			or { { BuffPresent(unleash_flame_buff) and { target.DebuffRemains(flame_shock_debuff) < 10 or Damage(flame_shock) > target.LastEstimatedDamage(flame_shock_debuff) } } or not target.DebuffPresent(flame_shock_debuff) or Spell(flame_shock) }
 			or Spell(unleash_elements)
 			or { Glyph(glyph_of_frost_shock) and ArmorSetBonus(T14_melee 4) == 0 and Spell(frost_shock) }
-			or { BuffPresent(maelstrom_weapon_buff) >= 3 and not BuffPresent(ascendance_melee_buff) }
+			or { BuffStacks(maelstrom_weapon_buff) >= 3 and not BuffPresent(ascendance_melee_buff) }
 		{
 			#ancestral_swiftness,if=talent.ancestral_swiftness.enabled&buff.maelstrom_weapon.react<2
-			if TalentPoints(ancestral_swiftness_talent) and BuffPresent(maelstrom_weapon_buff) < 2 Spell(ancestral_swiftness)
+			if TalentPoints(ancestral_swiftness_talent) and BuffStacks(maelstrom_weapon_buff) < 2 Spell(ancestral_swiftness)

 			unless BuffPresent(ancestral_swiftness_buff)
 				or { { not Glyph(glyph_of_frost_shock) or ArmorSetBonus(T14_melee 4) == 1 } and Spell(earth_shock) }
diff --git a/scripts/simulationcraft_shaman_enhancement_t16h.lua b/scripts/simulationcraft_shaman_enhancement_t16h.lua
index 6ea67b4..f10bd6d 100644
--- a/scripts/simulationcraft_shaman_enhancement_t16h.lua
+++ b/scripts/simulationcraft_shaman_enhancement_t16h.lua
@@ -28,9 +28,9 @@ AddFunction EnhancementAoeActions
 	#lava_lash,if=dot.flame_shock.ticking
 	if target.DebuffPresent(flame_shock_debuff) Spell(lava_lash)
 	#elemental_blast,if=talent.elemental_blast.enabled&buff.maelstrom_weapon.react>=1
-	if TalentPoints(elemental_blast_talent) and BuffPresent(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
+	if TalentPoints(elemental_blast_talent) and BuffStacks(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
 	#chain_lightning,if=active_enemies>=2&buff.maelstrom_weapon.react>=3
-	if Enemies() >= 2 and BuffPresent(maelstrom_weapon_buff) >= 3 Spell(chain_lightning)
+	if Enemies() >= 2 and BuffStacks(maelstrom_weapon_buff) >= 3 Spell(chain_lightning)
 	#unleash_elements
 	Spell(unleash_elements)
 	#flame_shock,cycle_targets=1,if=!ticking
@@ -40,7 +40,7 @@ AddFunction EnhancementAoeActions
 	#fire_nova,if=active_flame_shock>=3
 	if DebuffCountOnAny(flame_shock_debuff) >= 3 Spell(fire_nova)
 	#chain_lightning,if=active_enemies>=2&buff.maelstrom_weapon.react>=1
-	if Enemies() >= 2 and BuffPresent(maelstrom_weapon_buff) >= 1 Spell(chain_lightning)
+	if Enemies() >= 2 and BuffStacks(maelstrom_weapon_buff) >= 1 Spell(chain_lightning)
 	#stormstrike
 	Spell(stormstrike)
 	#earth_shock,if=active_enemies<4
@@ -62,9 +62,9 @@ AddFunction EnhancementSingleActions
 	#unleash_elements,if=(talent.unleashed_fury.enabled|set_bonus.tier16_2pc_melee=1)
 	if { TalentPoints(unleashed_fury_talent) or ArmorSetBonus(T16_melee 2) == 1 } Spell(unleash_elements)
 	#elemental_blast,if=talent.elemental_blast.enabled&buff.maelstrom_weapon.react>=1
-	if TalentPoints(elemental_blast_talent) and BuffPresent(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
+	if TalentPoints(elemental_blast_talent) and BuffStacks(maelstrom_weapon_buff) >= 1 Spell(elemental_blast)
 	#lightning_bolt,if=buff.maelstrom_weapon.react=5
-	if BuffPresent(maelstrom_weapon_buff) == 5 Spell(lightning_bolt)
+	if BuffStacks(maelstrom_weapon_buff) == 5 Spell(lightning_bolt)
 	#feral_spirit,if=set_bonus.tier15_4pc_melee=1
 	if ArmorSetBonus(T15_melee 4) == 1 Spell(feral_spirit)
 	#stormblast
@@ -76,7 +76,7 @@ AddFunction EnhancementSingleActions
 	#lava_lash
 	Spell(lava_lash)
 	#lightning_bolt,if=set_bonus.tier15_2pc_melee=1&buff.maelstrom_weapon.react>=4&!buff.ascendance.up
-	if ArmorSetBonus(T15_melee 2) == 1 and BuffPresent(maelstrom_weapon_buff) >= 4 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
+	if ArmorSetBonus(T15_melee 2) == 1 and BuffStacks(maelstrom_weapon_buff) >= 4 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
 	#flame_shock,if=(buff.unleash_flame.up&(dot.flame_shock.remains<10|action.flame_shock.tick_damage>dot.flame_shock.tick_dmg))|!ticking
 	if { BuffPresent(unleash_flame_buff) and { target.DebuffRemains(flame_shock_debuff) < 10 or target.Damage(flame_shock_debuff) > target.LastEstimatedDamage(flame_shock_debuff) } } or not target.DebuffPresent(flame_shock_debuff) Spell(flame_shock)
 	#unleash_elements
@@ -84,9 +84,9 @@ AddFunction EnhancementSingleActions
 	#frost_shock,if=glyph.frost_shock.enabled&set_bonus.tier14_4pc_melee=0
 	if Glyph(glyph_of_frost_shock) and ArmorSetBonus(T14_melee 4) == 0 Spell(frost_shock)
 	#lightning_bolt,if=buff.maelstrom_weapon.react>=3&!buff.ascendance.up
-	if BuffPresent(maelstrom_weapon_buff) >= 3 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
+	if BuffStacks(maelstrom_weapon_buff) >= 3 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
 	#ancestral_swiftness,if=talent.ancestral_swiftness.enabled&buff.maelstrom_weapon.react<2
-	if TalentPoints(ancestral_swiftness_talent) and BuffPresent(maelstrom_weapon_buff) < 2 Spell(ancestral_swiftness)
+	if TalentPoints(ancestral_swiftness_talent) and BuffStacks(maelstrom_weapon_buff) < 2 Spell(ancestral_swiftness)
 	#lightning_bolt,if=buff.ancestral_swiftness.up
 	if BuffPresent(ancestral_swiftness_buff) Spell(lightning_bolt)
 	#earth_shock,if=(!glyph.frost_shock.enabled|set_bonus.tier14_4pc_melee=1)
@@ -98,7 +98,7 @@ AddFunction EnhancementSingleActions
 	#spiritwalkers_grace,moving=1
 	if Speed() > 0 Spell(spiritwalkers_grace)
 	#lightning_bolt,if=buff.maelstrom_weapon.react>1&!buff.ascendance.up
-	if BuffPresent(maelstrom_weapon_buff) > 1 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
+	if BuffStacks(maelstrom_weapon_buff) > 1 and not BuffPresent(ascendance_melee_buff) Spell(lightning_bolt)
 }

 AddFunction EnhancementDefaultActions
diff --git a/scripts/simulationcraft_warlock_demonology_t16h.lua b/scripts/simulationcraft_warlock_demonology_t16h.lua
index ba7c637..76cf53f 100644
--- a/scripts/simulationcraft_warlock_demonology_t16h.lua
+++ b/scripts/simulationcraft_warlock_demonology_t16h.lua
@@ -68,7 +68,7 @@ AddFunction DemonologyDefaultActions
 	#cancel_metamorphosis,if=buff.metamorphosis.up&buff.dark_soul.down&demonic_fury<=650&target.time_to_die>30&(cooldown.metamorphosis.remains<4|demonic_fury<=300)&!(action.hand_of_guldan.in_flight&dot.shadowflame.remains)
 	if BuffPresent(metamorphosis_buff) and BuffExpires(dark_soul_knowledge_buff) and DemonicFury() <= 650 and target.TimeToDie() > 30 and { SpellCooldown(metamorphosis) < 4 or DemonicFury() <= 300 } and not { InFlightToTarget(hand_of_guldan) and target.DebuffRemains(shadowflame_debuff) } Spell(cancel_metamorphosis)
 	#soul_fire,if=buff.metamorphosis.up&buff.molten_core.react&(buff.dark_soul.remains<action.shadow_bolt.cast_time|buff.dark_soul.remains>cast_time)
-	if BuffPresent(metamorphosis_buff) and BuffPresent(molten_core_buff) and { BuffRemains(dark_soul_knowledge_buff) < CastTime(shadow_bolt) or BuffRemains(dark_soul_knowledge_buff) > CastTime(soul_fire) } Spell(soul_fire)
+	if BuffPresent(metamorphosis_buff) and BuffStacks(molten_core_buff) and { BuffRemains(dark_soul_knowledge_buff) < CastTime(shadow_bolt) or BuffRemains(dark_soul_knowledge_buff) > CastTime(soul_fire) } Spell(soul_fire)
 	#touch_of_chaos,if=buff.metamorphosis.up
 	if BuffPresent(metamorphosis_buff) Spell(touch_of_chaos)
 	#metamorphosis,if=(buff.dark_soul.up&buff.dark_soul.remains<demonic_fury%32)|demonic_fury>=950|demonic_fury%32>target.time_to_die|(action.hand_of_guldan.in_flight&dot.shadowflame.remains)
@@ -80,7 +80,7 @@ AddFunction DemonologyDefaultActions
 	#hand_of_guldan,if=!in_flight&dot.shadowflame.remains<travel_time+action.shadow_bolt.cast_time&(charges=2|dot.shadowflame.remains>travel_time|(charges=1&recharge_time<4))
 	if not InFlightToTarget(hand_of_guldan) and target.DebuffRemains(shadowflame_debuff) < 0.5 + CastTime(shadow_bolt) and { Charges(hand_of_guldan) == 2 or target.DebuffRemains(shadowflame_debuff) > 0.5 or { Charges(hand_of_guldan) == 1 and SpellChargeCooldown(hand_of_guldan) < 4 } } Spell(hand_of_guldan)
 	#soul_fire,if=buff.molten_core.react&(buff.dark_soul.remains<action.shadow_bolt.cast_time|buff.dark_soul.remains>cast_time)&(buff.molten_core.react>9|target.health.pct<=28)
-	if BuffPresent(molten_core_buff) and { BuffRemains(dark_soul_knowledge_buff) < CastTime(shadow_bolt) or BuffRemains(dark_soul_knowledge_buff) > CastTime(soul_fire) } and { BuffPresent(molten_core_buff) > 9 or target.HealthPercent() <= 28 } Spell(soul_fire)
+	if BuffStacks(molten_core_buff) and { BuffRemains(dark_soul_knowledge_buff) < CastTime(shadow_bolt) or BuffRemains(dark_soul_knowledge_buff) > CastTime(soul_fire) } and { BuffStacks(molten_core_buff) > 9 or target.HealthPercent() <= 28 } Spell(soul_fire)
 	#life_tap,if=mana.pct<60
 	if ManaPercent() < 60 Spell(life_tap)
 	#shadow_bolt