Quantcast

New Ovale scripts for 5.4.7 based on SimC profiles.

Johnny C. Lam [04-21-14 - 05:03]
New Ovale scripts for 5.4.7 based on SimC profiles.

Separate common parts into "#include"-style scripts and have the main
scripts just be the logic.

Add new default scripts for druids, hunters, monks, paladins and shamans.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1315 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Ovale.toc
class/DeathKnight.lua
class/Druid.lua
class/Hunter.lua
class/Mage.lua
class/Monk.lua
class/Paladin.lua
class/Priest.lua
class/Rogue.lua
class/Shaman.lua
class/Warlock.lua
class/Warrior.lua
class/files.xml
scripts/files.xml
scripts/ovale_druid.lua
scripts/ovale_druid_spells.lua
scripts/ovale_hunter.lua
scripts/ovale_hunter_spells.lua
scripts/ovale_items.lua
scripts/ovale_monk.lua
scripts/ovale_monk_spells.lua
scripts/ovale_paladin.lua
scripts/ovale_paladin_spells.lua
scripts/ovale_racials.lua
scripts/ovale_shaman.lua
scripts/ovale_shaman_spells.lua
diff --git a/Ovale.toc b/Ovale.toc
index f84e154..9c5e9a8 100644
--- a/Ovale.toc
+++ b/Ovale.toc
@@ -65,5 +65,5 @@ OvaleSkada.lua
 OvaleSpellDamage.lua
 OvaleSteadyFocus.lua
 OvaleSwing.lua
-class\files.xml
 conditions\files.xml
+scripts\files.xml
diff --git a/class/DeathKnight.lua b/class/DeathKnight.lua
deleted file mode 100644
index 725720b..0000000
--- a/class/DeathKnight.lua
+++ /dev/null
@@ -1,196 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Frost, Unholy"
-	local code = [[
-Define(army_of_the_dead 42650)
-  SpellInfo(army_of_the_dead duration=4 frost=1 blood=1 unholy=1 runicpower=-300 cd=600 )
-  SpellAddBuff(army_of_the_dead army_of_the_dead=1)
-Define(blood_charge 114851)
-  SpellInfo(blood_charge duration=25 )
-  SpellAddBuff(blood_charge blood_charge=1)
-Define(blood_fury 20572)
-  SpellInfo(blood_fury duration=15 cd=120 )
-  SpellAddBuff(blood_fury blood_fury=1)
-Define(blood_plague 55078)
-  SpellInfo(blood_plague duration=30 tick=3 )
-  SpellAddTargetDebuff(blood_plague blood_plague=1)
-Define(blood_tap 45529)
-Define(dark_transformation 63560)
-  SpellInfo(dark_transformation duration=30 unholy=1 runicpower=-100 )
-  SpellAddBuff(dark_transformation dark_transformation=1)
-Define(death_and_decay 43265)
-  SpellInfo(death_and_decay duration=10 unholy=1 runicpower=-100 cd=30 )
-  SpellAddBuff(death_and_decay death_and_decay=1)
-Define(death_coil 47541)
-  SpellInfo(death_coil runicpower=400 )
-Define(empower_rune_weapon 47568)
-  SpellInfo(empower_rune_weapon runicpower=-250 cd=300 )
-Define(festering_strike 85948)
-  SpellInfo(festering_strike frost=1 blood=1 runicpower=-200 )
-Define(frost_fever 55095)
-  SpellInfo(frost_fever duration=30 tick=3 )
-  SpellAddTargetDebuff(frost_fever frost_fever=1)
-Define(frost_presence 48266)
-  SpellAddBuff(frost_presence frost_presence=1)
-Define(frost_strike 49143)
-  SpellInfo(frost_strike runicpower=350 )
-Define(golems_strength 79634)
-  SpellInfo(golems_strength duration=25 cd=1 )
-  SpellAddBuff(golems_strength golems_strength=1)
-Define(horn_of_winter 57330)
-  SpellInfo(horn_of_winter duration=300 runicpower=-100 cd=20 )
-  SpellAddBuff(horn_of_winter horn_of_winter=1)
-Define(howling_blast 49184)
-  SpellInfo(howling_blast frost=1 runicpower=-100 )
-Define(killing_machine 51128)
-Define(mogu_power_potion_aura 105706)
-  SpellInfo(mogu_power_potion_aura duration=25 cd=1 )
-  SpellAddBuff(mogu_power_potion_aura mogu_power_potion_aura=1)
-Define(obliterate 49020)
-  SpellInfo(obliterate frost=1 unholy=1 runicpower=-200 )
-Define(outbreak 77575)
-  SpellInfo(outbreak runicpower=0 cd=60 )
-Define(pillar_of_frost 51271)
-  SpellInfo(pillar_of_frost duration=20 frost=1 runicpower=-100 cd=60 )
-  SpellAddBuff(pillar_of_frost pillar_of_frost=1)
-Define(plague_leech 123693)
-  SpellInfo(plague_leech cd=25 )
-Define(plague_strike 45462)
-  SpellInfo(plague_strike unholy=1 runicpower=-100 )
-Define(raise_dead 46584)
-  SpellInfo(raise_dead cd=120 )
-  SpellAddBuff(raise_dead raise_dead=1)
-Define(rime 59057)
-Define(runic_corruption 51460)
-  SpellInfo(runic_corruption duration=3 )
-  SpellAddBuff(runic_corruption runic_corruption=1)
-Define(scourge_strike 55090)
-  SpellInfo(scourge_strike unholy=1 runicpower=-100 )
-Define(shadow_infusion 49572)
-Define(soul_reaper 114866)
-  SpellInfo(soul_reaper duration=5 blood=1 runicpower=-100 cd=6 )
-  SpellAddBuff(soul_reaper soul_reaper=1)
-Define(sudden_doom 49530)
-Define(summon_gargoyle 49206)
-  SpellInfo(summon_gargoyle duration=40 cd=180 )
-  SpellAddBuff(summon_gargoyle summon_gargoyle=1)
-Define(unholy_blight 115989)
-  SpellInfo(unholy_blight duration=10 cd=90 )
-  SpellAddBuff(unholy_blight unholy_blight=1)
-Define(unholy_frenzy 49016)
-  SpellInfo(unholy_frenzy duration=30 cd=180 )
-  SpellAddBuff(unholy_frenzy unholy_frenzy=1)
-Define(unholy_presence 48265)
-  SpellAddBuff(unholy_presence unholy_presence=1)
-Define(blood_tap_talent 13)
-Define(plague_leech_talent 2)
-Define(runic_corruption_talent 15)
-Define(runic_empowerment_talent 14)
-Define(unholy_blight_talent 3)
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		unless Stance(2) Spell(frost_presence)
-		Spell(horn_of_winter)
-	}
-	if BuffStacks(killing_machine) or RunicPower() >88 Spell(frost_strike)
-	if TalentPoints(plague_leech_talent) and {target.DebuffRemains(blood_plague) <3 or target.DebuffRemains(frost_fever) <3 or SpellCooldown(outbreak) <1 } Spell(plague_leech)
-	if target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 Spell(outbreak)
-	if target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 Spell(soul_reaper)
-	if not target.DebuffPresent(frost_fever) Spell(howling_blast)
-	if not target.DebuffPresent(blood_plague) Spell(plague_strike)
-	if BuffStacks(rime) Spell(howling_blast)
-	if RunicPower() >76 Spell(frost_strike)
-	if RuneCount(unholy) >1 Spell(obliterate)
-	if RuneCount(death) >1 or RuneCount(frost) >1 Spell(howling_blast)
-	Spell(horn_of_winter)
-	if RuneCount(unholy) >0 Spell(obliterate)
-	Spell(howling_blast)
-	if TalentPoints(runic_empowerment_talent) and {RuneCount(frost) ==0 or RuneCount(blood) ==0 } Spell(frost_strike)
-	if TalentPoints(runic_corruption_talent) and BuffExpires(runic_corruption) Spell(frost_strike)
-	Spell(death_and_decay)
-	if RunicPower() >=40 Spell(frost_strike)
-}
-AddIcon mastery=2 help=offgcd
-{
-	if not InCombat()
-	{
-		Spell(pillar_of_frost)
-	}
-	Spell(pillar_of_frost)
-	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge) >10 and {RunicPower() >76 or {RunicPower() >=20 and BuffStacks(killing_machine) } } Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and {target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 and SpellCooldown(soul_reaper) ==0 } Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and {target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } >35 or BuffStacks(blood_charge) >=8 } Spell(blood_tap)
-}
-AddIcon mastery=2 help=cd
-{
-	if not InCombat()
-	{
-		Spell(army_of_the_dead)
-		Spell(blood_fury)
-		Spell(raise_dead)
-	}
-	if target.DeadIn() <=60 and {BuffPresent(mogu_power_potion_aura) or BuffPresent(golems_strength) } Spell(empower_rune_weapon)
-	if BuffPresent(pillar_of_frost)  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	Spell(blood_fury)
-	Spell(raise_dead)
-	if TalentPoints(unholy_blight_talent) and {target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 } Spell(unholy_blight)
-	Spell(empower_rune_weapon)
-}
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		unless Stance(3) Spell(unholy_presence)
-		Spell(horn_of_winter)
-	}
-	if AttackPower() >{LastSpellAttackPower(blood_plague) +5000 } and TimeInCombat() >15 and not {SpellCooldown(unholy_blight) >49 } Spell(outbreak)
-	if AttackPower() >{LastSpellAttackPower(blood_plague) +5000 } and TimeInCombat() >15 and not {SpellCooldown(unholy_blight) >49 } Spell(plague_strike)
-	if target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 Spell(outbreak)
-	if target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 Spell(soul_reaper)
-	if not target.DebuffPresent(blood_plague) or not target.DebuffPresent(frost_fever) Spell(plague_strike)
-	Spell(dark_transformation)
-	if RunicPower() >90 Spell(death_coil)
-	if RuneCount(unholy) ==2 Spell(death_and_decay)
-	if RuneCount(unholy) ==2 Spell(scourge_strike)
-	if RuneCount(blood) ==2 and RuneCount(frost) ==2 Spell(festering_strike)
-	Spell(death_and_decay)
-	if BuffStacks(sudden_doom) or {BuffExpires(dark_transformation) and RuneCount(unholy) <=1 } Spell(death_coil)
-	Spell(scourge_strike)
-	if TalentPoints(plague_leech_talent) and SpellCooldown(outbreak) <1 Spell(plague_leech)
-	Spell(festering_strike)
-	Spell(horn_of_winter)
-	if BuffExpires(dark_transformation) or {SpellCooldown(summon_gargoyle) >8 and BuffRemains(dark_transformation) >8 } Spell(death_coil)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge) >10 and RunicPower() >=32 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and {target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 and SpellCooldown(soul_reaper) ==0 } Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and BuffStacks(shadow_infusion) ==5 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and RuneCount(unholy) ==2 and SpellCooldown(death_and_decay) ==0 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and SpellCooldown(death_and_decay) ==0 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge) >=8 Spell(blood_tap)
-}
-AddIcon mastery=3 help=cd
-{
-	if not InCombat()
-	{
-		Spell(army_of_the_dead)
-		Spell(blood_fury)
-		Spell(raise_dead)
-	}
-	if TimeInCombat() >=2 Spell(blood_fury)
-	if TimeInCombat() >=4 Spell(unholy_frenzy)
-	if TimeInCombat() >=4  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if TalentPoints(unholy_blight_talent) and {target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 } Spell(unholy_blight)
-	Spell(summon_gargoyle)
-	Spell(empower_rune_weapon)
-}
-]]
-
-	OvaleScripts:RegisterScript("DEATHKNIGHT", name, desc, code)
-end
diff --git a/class/Druid.lua b/class/Druid.lua
deleted file mode 100644
index 93b9cc5..0000000
--- a/class/Druid.lua
+++ /dev/null
@@ -1,282 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Balance, Feral"
-	local code = [[
-Define(berserk 50334)
-  SpellInfo(berserk duration=10 cd=180 )
-  SpellAddBuff(berserk berserk=1)
-Define(berserking 26297)
-  SpellInfo(berserking duration=10 cd=180 )
-  SpellAddBuff(berserking berserking=1)
-Define(cat_form 768)
-  SpellAddBuff(cat_form cat_form=1)
-Define(celestial_alignment 112071)
-  SpellInfo(celestial_alignment duration=15 cd=180 )
-  SpellAddBuff(celestial_alignment celestial_alignment=1)
-Define(chosen_of_elune 122114)
-Define(dream_of_cenarius_damage 108381)
-  SpellInfo(dream_of_cenarius_damage duration=30 )
-  SpellAddBuff(dream_of_cenarius_damage dream_of_cenarius_damage=1)
-Define(faerie_fire 770)
-  SpellInfo(faerie_fire duration=300 )
-  SpellAddBuff(faerie_fire faerie_fire=1)
-  AddCheckBox(faerie_fire_check SpellName(faerie_fire))
-Define(ferocious_bite 22568)
-  SpellInfo(ferocious_bite combo=0 energy=25 )
-Define(healing_touch 5185)
-Define(hurricane 16914)
-  SpellInfo(hurricane duration=10 )
-  SpellAddBuff(hurricane hurricane=1)
-Define(incarnation 106731)
-  SpellInfo(incarnation duration=30 cd=180 )
-Define(lunar_eclipse 48518)
-  SpellAddBuff(lunar_eclipse lunar_eclipse=1)
-Define(mangle 33876)
-  SpellInfo(mangle energy=35 )
-Define(mark_of_the_wild 1126)
-  SpellInfo(mark_of_the_wild duration=3600 )
-  SpellAddBuff(mark_of_the_wild mark_of_the_wild=1)
-Define(moonfire 8921)
-  SpellInfo(moonfire duration=14 tick=2 haste=spell )
-  SpellAddTargetDebuff(moonfire moonfire=1)
-Define(moonkin_form 24858)
-  SpellAddBuff(moonkin_form moonkin_form=1)
-Define(natures_grace 16886)
-  SpellInfo(natures_grace duration=15 )
-  SpellAddBuff(natures_grace natures_grace=1)
-Define(natures_swiftness 132158)
-  SpellInfo(natures_swiftness cd=60 )
-  SpellAddBuff(natures_swiftness natures_swiftness=1)
-Define(natures_vigil 124974)
-  SpellInfo(natures_vigil duration=30 cd=90 )
-  SpellAddBuff(natures_vigil natures_vigil=1)
-Define(omen_of_clarity 16864)
-  SpellAddBuff(omen_of_clarity omen_of_clarity=1)
-Define(predatory_swiftness 16974)
-Define(rake 1822)
-  SpellInfo(rake duration=15 energy=35 tick=3 combo=1 )
-  SpellAddTargetDebuff(rake rake=1)
-Define(rip 1079)
-  SpellInfo(rip duration=16 combo=0 energy=30 tick=2 )
-  SpellAddTargetDebuff(rip rip=1)
-Define(savage_roar 52610)
-  SpellInfo(savage_roar duration=12 combo=0 energy=25 )
-  SpellAddBuff(savage_roar savage_roar=1)
-Define(shooting_stars 93399)
-Define(shred 5221)
-  SpellInfo(shred energy=40 combo=1 )
-Define(skull_bash_cat 80965)
-  SpellInfo(skull_bash_cat cd=15 )
-Define(solar_eclipse 48517)
-  SpellAddBuff(solar_eclipse solar_eclipse=1)
-Define(starfall 48505)
-  SpellInfo(starfall duration=10 cd=90 )
-  SpellAddBuff(starfall starfall=1)
-Define(starfire 2912)
-Define(starsurge 78674)
-  SpellInfo(starsurge cd=15 )
-Define(sunfire 93402)
-  SpellInfo(sunfire duration=14 tick=2 haste=spell )
-  SpellAddTargetDebuff(sunfire sunfire=1)
-Define(thrash 106832)
-Define(thrash 77758)
-  SpellInfo(thrash duration=16 tick=2 cd=6 )
-  SpellAddTargetDebuff(thrash thrash=1)
-Define(tigers_fury 5217)
-  SpellInfo(tigers_fury duration=6 energy=-60 cd=30 )
-  SpellAddBuff(tigers_fury tigers_fury=1)
-Define(treants 106737)
-  SpellInfo(treants duration=15 cd=60 )
-Define(virmens_bite 105697)
-  SpellInfo(virmens_bite duration=25 cd=1 )
-  SpellAddBuff(virmens_bite virmens_bite=1)
-Define(weakened_armor 113746)
-  SpellInfo(weakened_armor duration=30 )
-  SpellAddBuff(weakened_armor weakened_armor=1)
-Define(wild_mushroom 88747)
-  SpellInfo(wild_mushroom duration=300 )
-Define(wild_mushroom_detonate 78777)
-Define(wrath 5176)
-Define(dream_of_cenarius_talent 17)
-Define(force_of_nature_talent 12)
-Define(incarnation_talent 11)
-Define(natures_swiftness_talent 4)
-Define(natures_vigil_talent 18)
-AddIcon mastery=1 help=main
-{
-	if not InCombat()
-	{
-		if not BuffPresent(str_agi_int any=1) Spell(mark_of_the_wild)
-		if not BuffPresent(dream_of_cenarius_damage) and TalentPoints(dream_of_cenarius_talent) Spell(healing_touch)
-		unless Stance(5) Spell(moonkin_form)
-	}
-	if TalentPoints(force_of_nature_talent) Spell(treants)
-	if TalentPoints(dream_of_cenarius_talent) and not BuffPresent(dream_of_cenarius_damage) and ManaPercent() >25 Spell(healing_touch)
-	if BuffStacks(shooting_stars) and {True() or not BuffPresent(solar_eclipse) } Spell(starsurge)
-	if BuffPresent(lunar_eclipse) and {target.DebuffRemains(moonfire) <{BuffRemains(natures_grace) -2 +2 *ArmorSetParts(T14 more 4) } } Spell(moonfire)
-	if BuffPresent(solar_eclipse) and {target.DebuffRemains(sunfire) <{BuffRemains(natures_grace) -2 +2 *ArmorSetParts(T14 more 4) } } Spell(sunfire)
-	if {target.DebuffRemains(moonfire) <{BuffRemains(natures_grace) -2 +2 *ArmorSetParts(T14 more 4) } } Spell(moonfire)
-	if {target.DebuffRemains(sunfire) <{BuffRemains(natures_grace) -2 +2 *ArmorSetParts(T14 more 4) } } Spell(sunfire)
-	if BuffPresent(lunar_eclipse) and target.TicksRemain(moonfire) <2 Spell(moonfire)
-	if BuffPresent(solar_eclipse) and target.TicksRemain(sunfire) <2 Spell(sunfire)
-	if SpellCooldown(starsurge) Spell(starsurge)
-	if BuffPresent(celestial_alignment) and CastTime(starfire) <BuffRemains(celestial_alignment) Spell(starfire)
-	if BuffPresent(celestial_alignment) and CastTime(wrath) <BuffRemains(celestial_alignment) Spell(wrath)
-	if EclipseDir() ==1 or {EclipseDir() ==0 and Eclipse() >0 } Spell(starfire)
-	if EclipseDir() ==0-1 or {EclipseDir() ==0 and Eclipse() <=0 } Spell(wrath)
-}
-AddIcon mastery=1 help=offgcd
-{
-	if BuffStacks(wild_mushroom) >0 and BuffPresent(solar_eclipse) Spell(wild_mushroom_detonate)
-	if TalentPoints(natures_swiftness_talent) and TalentPoints(dream_of_cenarius_talent) Spell(natures_swiftness)
-}
-AddIcon mastery=1 help=moving
-{
-	if target.TicksRemain(moonfire) <2 Spell(moonfire)
-	if target.TicksRemain(sunfire) <2 Spell(sunfire)
-	if BuffStacks(wild_mushroom) <0 Spell(wild_mushroom)
-	if BuffStacks(shooting_stars) Spell(starsurge)
-	if BuffPresent(lunar_eclipse) Spell(moonfire)
-	Spell(sunfire)
-}
-AddIcon mastery=1 help=aoe
-{
-	if BuffPresent(solar_eclipse) and BuffPresent(natures_grace) Spell(hurricane)
-	if BuffPresent(solar_eclipse) and ManaPercent() >25 Spell(hurricane)
-	if BuffPresent(solar_eclipse) and ManaPercent() >25 Spell(hurricane)
-}
-AddIcon mastery=1 help=cd
-{
-	if not BuffPresent(starfall) Spell(starfall)
-	if BuffPresent(celestial_alignment) Spell(berserking)
-	if BuffPresent(celestial_alignment) or SpellCooldown(celestial_alignment) >30  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if TalentPoints(incarnation_talent) and {BuffPresent(lunar_eclipse) or BuffPresent(solar_eclipse) } Spell(incarnation)
-	if {not BuffPresent(lunar_eclipse) and not BuffPresent(solar_eclipse) } and {BuffPresent(chosen_of_elune) or not TalentPoints(incarnation_talent) or SpellCooldown(incarnation) >10 } Spell(celestial_alignment)
-	if TalentPoints(natures_vigil_talent) Spell(natures_vigil)
-}
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		if not BuffPresent(str_agi_int any=1) Spell(mark_of_the_wild)
-		if not BuffPresent(dream_of_cenarius_damage) and TalentPoints(dream_of_cenarius_talent) Spell(healing_touch)
-		unless Stance(3) Spell(cat_form)
-		Spell(savage_roar)
-	}
-	if target.IsInterruptible() Spell(skull_bash_cat)
-	if BuffPresent(predatory_swiftness) and BuffRemains(predatory_swiftness) <=1.5 and BuffExpires(dream_of_cenarius_damage) Spell(healing_touch)
-	if BuffExpires(savage_roar) Spell(savage_roar)
-	if target.DebuffStacks(weakened_armor any=1) <3 if CheckBoxOn(faerie_fire_check) Spell(faerie_fire)
-	if BuffPresent(predatory_swiftness) and ComboPoints() >=4 and BuffStacks(dream_of_cenarius_damage) <2 Spell(healing_touch)
-	if BuffPresent(natures_swiftness) Spell(healing_touch)
-	if ComboPoints() >=1 and target.DebuffPresent(rip) and target.DebuffRemains(rip) <=3 and target.HealthPercent() <=25 Spell(ferocious_bite)
-	if {target.DeadIn() <=4 and ComboPoints() >=5 } or {target.DeadIn() <=1 and ComboPoints() >=3 } Spell(ferocious_bite)
-	if BuffRemains(savage_roar) <=3 and ComboPoints() >0 and target.HealthPercent() <25 Spell(savage_roar)
-	if ComboPoints() >=5 and BuffPresent(virmens_bite) and BuffPresent(dream_of_cenarius_damage) and target.HealthPercent() <=25 and target.DeadIn() >30 Spell(rip)
-	if ComboPoints() >=5 and target.DebuffPresent(rip) and target.HealthPercent() <=25 Spell(ferocious_bite)
-	if ComboPoints() >=5 and target.DeadIn() >=6 and target.DebuffRemains(rip) <2 and BuffPresent(dream_of_cenarius_damage) Spell(rip)
-	if ComboPoints() >=5 and target.DeadIn() >=6 and target.DebuffRemains(rip) <2 and {BuffPresent(berserk) or target.DebuffRemains(rip) +1.9 <=SpellCooldown(tigers_fury) } Spell(rip)
-	if BuffRemains(savage_roar) <=3 and ComboPoints() >0 and BuffRemains(savage_roar) +2 >target.DebuffRemains(rip) Spell(savage_roar)
-	if BuffRemains(savage_roar) <=6 and ComboPoints() >=5 and BuffRemains(savage_roar) +2 <=target.DebuffRemains(rip) Spell(savage_roar)
-	if ComboPoints() >=5 and target.DebuffRemains(rip) >6 Spell(ferocious_bite)
-	if target.DebuffRemains(rake) <9 and BuffPresent(dream_of_cenarius_damage) Spell(rake)
-	if target.DebuffRemains(rake) <3 Spell(rake)
-	if BuffStacks(omen_of_clarity)
-	{
-		if BuffStacks(omen_of_clarity) Spell(shred)
-		if BuffPresent(berserk) Spell(shred)
-		if {{ComboPoints() <5 and target.DebuffRemains(rip) <3.0 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 } } Spell(mangle)
-		Spell(shred)
-	}
-	if {ComboPoints() <5 and target.DebuffRemains(rip) <3 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 }
-	{
-		if BuffStacks(omen_of_clarity) Spell(shred)
-		if BuffPresent(berserk) Spell(shred)
-		if {{ComboPoints() <5 and target.DebuffRemains(rip) <3.0 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 } } Spell(mangle)
-		Spell(shred)
-	}
-	if BuffRemains(predatory_swiftness) >1
-	{
-		if BuffStacks(omen_of_clarity) Spell(shred)
-		if BuffPresent(berserk) Spell(shred)
-		if {{ComboPoints() <5 and target.DebuffRemains(rip) <3.0 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 } } Spell(mangle)
-		Spell(shred)
-	}
-	if target.DeadIn() <=8.5
-	{
-		if BuffStacks(omen_of_clarity) Spell(shred)
-		if BuffPresent(berserk) Spell(shred)
-		if {{ComboPoints() <5 and target.DebuffRemains(rip) <3.0 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 } } Spell(mangle)
-		Spell(shred)
-	}
-	if BuffPresent(tigers_fury) or BuffPresent(berserk)
-	{
-		if BuffStacks(omen_of_clarity) Spell(shred)
-		if BuffPresent(berserk) Spell(shred)
-		if {{ComboPoints() <5 and target.DebuffRemains(rip) <3.0 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 } } Spell(mangle)
-		Spell(shred)
-	}
-	if SpellCooldown(tigers_fury) <=3
-	{
-		if BuffStacks(omen_of_clarity) Spell(shred)
-		if BuffPresent(berserk) Spell(shred)
-		if {{ComboPoints() <5 and target.DebuffRemains(rip) <3.0 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 } } Spell(mangle)
-		Spell(shred)
-	}
-	if TimeToMaxEnergy() <=1
-	{
-		if BuffStacks(omen_of_clarity) Spell(shred)
-		if BuffPresent(berserk) Spell(shred)
-		if {{ComboPoints() <5 and target.DebuffRemains(rip) <3.0 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 } } Spell(mangle)
-		Spell(shred)
-	}
-}
-AddIcon mastery=2 help=offgcd
-{
-	if {Energy() <=35 and not BuffStacks(omen_of_clarity) } Spell(tigers_fury)
-	if target.DeadIn() >=6 and BuffStacks(omen_of_clarity) and target.DebuffRemains(thrash) <3 Spell(thrash)
-	if BuffExpires(dream_of_cenarius_damage) and BuffExpires(predatory_swiftness) and ComboPoints() >=5 and target.HealthPercent() <=25 Spell(natures_swiftness)
-	if BuffExpires(dream_of_cenarius_damage) and BuffExpires(predatory_swiftness) and ComboPoints() >=5 and target.DebuffRemains(rip) <3 and {BuffPresent(berserk) or target.DebuffRemains(rip) +1.9 <=SpellCooldown(tigers_fury) } Spell(natures_swiftness)
-	if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and {target.DebuffRemains(rip) >=4 or BuffPresent(berserk) } Spell(thrash)
-	if BuffStacks(omen_of_clarity)
-	{
-		if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and ComboPoints() >=5 Spell(thrash)
-	}
-	if {ComboPoints() <5 and target.DebuffRemains(rip) <3 } or {ComboPoints() ==0 and BuffRemains(savage_roar) <2 }
-	{
-		if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and ComboPoints() >=5 Spell(thrash)
-	}
-	if BuffRemains(predatory_swiftness) >1
-	{
-		if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and ComboPoints() >=5 Spell(thrash)
-	}
-	if target.DeadIn() <=8.5
-	{
-		if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and ComboPoints() >=5 Spell(thrash)
-	}
-	if BuffPresent(tigers_fury) or BuffPresent(berserk)
-	{
-		if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and ComboPoints() >=5 Spell(thrash)
-	}
-	if SpellCooldown(tigers_fury) <=3
-	{
-		if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and ComboPoints() >=5 Spell(thrash)
-	}
-	if TimeToMaxEnergy() <=1
-	{
-		if target.DebuffRemains(thrash) <3 and target.DeadIn() >=6 and ComboPoints() >=5 Spell(thrash)
-	}
-}
-AddIcon mastery=2 help=cd
-{
-	Spell(berserking)
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if BuffPresent(tigers_fury) or {target.DeadIn() <18 and SpellCooldown(tigers_fury) >6 } Spell(berserk)
-}
-]]
-
-	OvaleScripts:RegisterScript("DRUID", name, desc, code)
-end
diff --git a/class/Hunter.lua b/class/Hunter.lua
deleted file mode 100644
index 373968b..0000000
--- a/class/Hunter.lua
+++ /dev/null
@@ -1,245 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Beast Mastery, Marksmanship, Survival"
-	local code = [[
-Define(a_murder_of_crows 131900)
-Define(aimed_shot 19434)
-  SpellInfo(aimed_shot focus=50 )
-Define(arcane_shot 3044)
-  SpellInfo(arcane_shot focus=20 )
-Define(aspect_of_the_hawk 13165)
-  SpellInfo(aspect_of_the_hawk cd=1 )
-  SpellAddBuff(aspect_of_the_hawk aspect_of_the_hawk=1)
-Define(barrage 120360)
-  SpellInfo(barrage duration=3 focus=30 cd=30 )
-Define(beast_within 34692)
-Define(bestial_wrath 19574)
-  SpellInfo(bestial_wrath duration=10 cd=60 )
-  SpellAddBuff(bestial_wrath bestial_wrath=1)
-Define(black_arrow 3674)
-  SpellInfo(black_arrow duration=20 focus=35 tick=2 cd=30 )
-  SpellAddTargetDebuff(black_arrow black_arrow=1)
-Define(blood_fury 20572)
-  SpellInfo(blood_fury duration=15 cd=120 )
-  SpellAddBuff(blood_fury blood_fury=1)
-Define(call_pet_1 883)
-Define(chimera_shot 53209)
-  SpellInfo(chimera_shot focus=45 cd=9 )
-Define(cobra_shot 77767)
-  SpellInfo(cobra_shot focus=-14 )
-Define(dire_beast 120679)
-  SpellInfo(dire_beast duration=15 cd=30 )
-Define(explosive_shot 53301)
-  SpellInfo(explosive_shot duration=2 focus=25 tick=1 cd=6 )
-  SpellAddTargetDebuff(explosive_shot explosive_shot=1)
-Define(explosive_trap 13812)
-  SpellInfo(explosive_trap duration=20 )
-  SpellAddTargetDebuff(explosive_trap explosive_trap=1)
-Define(fervor 82726)
-  SpellInfo(fervor duration=10 focus=-50 cd=30 )
-  SpellAddBuff(fervor fervor=1)
-Define(focus_fire 82692)
-  SpellInfo(focus_fire duration=20 )
-  SpellAddBuff(focus_fire focus_fire=1)
-Define(glaive_toss 120761)
-  SpellInfo(glaive_toss duration=3 )
-  SpellAddBuff(glaive_toss glaive_toss=1)
-Define(hunters_mark 1130)
-  SpellInfo(hunters_mark duration=300 )
-  SpellAddTargetDebuff(hunters_mark hunters_mark=1)
-Define(kill_command 34026)
-  SpellInfo(kill_command focus=40 cd=6 )
-  SpellAddBuff(kill_command kill_command=1)
-Define(kill_shot 53351)
-  SpellInfo(kill_shot cd=10 )
-Define(lock_and_load 56343)
-Define(lynx_rush 120699)
-  SpellInfo(lynx_rush duration=15 tick=3 )
-  SpellAddTargetDebuff(lynx_rush lynx_rush=1)
-Define(master_marksman_fire 82926)
-  SpellInfo(master_marksman_fire duration=10 )
-  SpellAddBuff(master_marksman_fire master_marksman_fire=1)
-Define(multi_shot 2643)
-  SpellInfo(multi_shot focus=40 )
-Define(pet_frenzy 19615)
-  SpellInfo(pet_frenzy duration=30 )
-  SpellAddBuff(pet_frenzy pet_frenzy=1)
-Define(powershot 109259)
-  SpellInfo(powershot focus=20 cd=60 )
-Define(rapid_fire 3045)
-  SpellInfo(rapid_fire duration=15 cd=180 )
-  SpellAddBuff(rapid_fire rapid_fire=1)
-Define(readiness 23989)
-  SpellInfo(readiness cd=300 )
-Define(serpent_sting 1978)
-  SpellInfo(serpent_sting focus=25 )
-  SpellAddTargetDebuff(serpent_sting serpent_sting_aura=1)
-Define(serpent_sting_aura 118253)
-  SpellInfo(serpent_sting_aura duration=15 tick=3 )
-  SpellAddTargetDebuff(serpent_sting_aura serpent_sting_aura=1)
-Define(stampede 57386)
-  SpellInfo(stampede duration=30 cd=15 )
-  SpellAddBuff(stampede stampede=1)
-Define(steady_focus 53224)
-Define(steady_shot 56641)
-  SpellInfo(steady_shot focus=-14 )
-Define(thrill_of_the_hunt 34720)
-  SpellInfo(thrill_of_the_hunt duration=15 )
-  SpellAddBuff(thrill_of_the_hunt thrill_of_the_hunt=1)
-AddIcon mastery=1 help=main
-{
-	if not InCombat()
-	{
-		if target.DeadIn() >=21 and not target.DebuffPresent(ranged_vulnerability any=1) Spell(hunters_mark)
-		unless pet.Present() Spell(call_pet_1)
-	}
-	if BuffStacks(pet_frenzy any=1)>4 Spell(focus_fire)
-	if not target.DebuffPresent(serpent_sting_aura) Spell(serpent_sting)
-	if target.HealthPercent(less 20) Spell(kill_shot)
-	Spell(kill_command)
-	if SpellUsable(dire_beast) and Focus() <=90 Spell(dire_beast)
-	if SpellUsable(barrage) Spell(barrage)
-	if SpellUsable(powershot) Spell(powershot)
-	if BuffStacks(thrill_of_the_hunt) Spell(arcane_shot)
-	if not target.DebuffPresent(focus_fire) and not BuffPresent(beast_within) if BuffStacks(pet_frenzy any=1)>4 Spell(focus_fire)
-	if target.DebuffRemains(serpent_sting_aura) <6 Spell(cobra_shot)
-	if Focus() >=61 or BuffPresent(beast_within) Spell(arcane_shot)
-	Spell(cobra_shot)
-}
-AddIcon mastery=1 help=offgcd
-{
-	if not InCombat()
-	{
-		unless Stance(1) Spell(aspect_of_the_hawk)
-	}
-	unless Stance(1) Spell(aspect_of_the_hawk)
-	if SpellUsable(fervor) and not target.DebuffPresent(fervor) and Focus() <=65 Spell(fervor)
-	if Focus() >60 and not BuffPresent(beast_within) Spell(bestial_wrath)
-	if BuffPresent(rapid_fire) or BuffStacks(bloodlust any=1) or target.DeadIn() <=25 Spell(stampede)
-	if SpellUsable(a_murder_of_crows) and not target.DebuffPresent(a_murder_of_crows) Spell(a_murder_of_crows)
-	if SpellUsable(glaive_toss) Spell(glaive_toss)
-	if SpellUsable(lynx_rush) and not target.DebuffPresent(lynx_rush) Spell(lynx_rush)
-}
-AddIcon mastery=1 help=aoe
-{
-	Spell(explosive_trap)
-	Spell(multi_shot)
-	Spell(cobra_shot)
-}
-AddIcon mastery=1 help=cd
-{
-	Spell(blood_fury)
-	if not BuffPresent(rapid_fire) Spell(rapid_fire)
-	if BuffPresent(rapid_fire) Spell(readiness)
-}
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		if target.DeadIn() >=21 and not target.DebuffPresent(ranged_vulnerability any=1) Spell(hunters_mark)
-		unless pet.Present() Spell(call_pet_1)
-	}
-	if SpellUsable(powershot) Spell(powershot)
-	if SpellUsable(dire_beast) Spell(dire_beast)
-	if target.HealthPercent() >80
-	{
-		if not target.DebuffPresent(serpent_sting_aura) Spell(serpent_sting)
-		Spell(chimera_shot)
-		if PreviousSpell(steady_shot) and BuffRemains(steady_focus) <6 Spell(steady_shot)
-		Spell(aimed_shot)
-		Spell(steady_shot)
-	}
-	if SpellUsable(barrage) Spell(barrage)
-	if PreviousSpell(steady_shot) and BuffRemains(steady_focus) <=5 Spell(steady_shot)
-	if not target.DebuffPresent(serpent_sting_aura) Spell(serpent_sting)
-	Spell(chimera_shot)
-	if BuffRemains(steady_focus) <{CastTime(steady_shot) +1 } and not InFlightToTarget(steady_shot) Spell(steady_shot)
-	if target.HealthPercent(less 20) Spell(kill_shot)
-	if BuffStacks(master_marksman_fire) Spell(aimed_shot)
-	if BuffStacks(thrill_of_the_hunt) Spell(arcane_shot)
-	if BuffPresent(rapid_fire) or BuffStacks(bloodlust any=1) Spell(aimed_shot)
-	if Focus() >=60 or {Focus() >=43 and {SpellCooldown(chimera_shot) >=CastTime(steady_shot) } } and {not BuffPresent(rapid_fire) and not BuffStacks(bloodlust any=1) } Spell(arcane_shot)
-	Spell(steady_shot)
-}
-AddIcon mastery=2 help=offgcd
-{
-	if not InCombat()
-	{
-		unless Stance(1) Spell(aspect_of_the_hawk)
-	}
-	unless Stance(1) Spell(aspect_of_the_hawk)
-	if SpellUsable(lynx_rush) and not target.DebuffPresent(lynx_rush) Spell(lynx_rush)
-	if SpellUsable(fervor) and Focus() <=50 Spell(fervor)
-	if BuffPresent(rapid_fire) or BuffStacks(bloodlust any=1) or target.DeadIn() <=25 Spell(stampede)
-	if SpellUsable(a_murder_of_crows) and not target.DebuffPresent(a_murder_of_crows) Spell(a_murder_of_crows)
-	if SpellUsable(glaive_toss) Spell(glaive_toss)
-}
-AddIcon mastery=2 help=aoe
-{
-	Spell(explosive_trap)
-	Spell(multi_shot)
-	Spell(steady_shot)
-}
-AddIcon mastery=2 help=cd
-{
-	Spell(blood_fury)
-	if not BuffPresent(rapid_fire) Spell(rapid_fire)
-	if target.HealthPercent() >80
-	{
-		Spell(readiness)
-	}
-	Spell(readiness)
-}
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		if target.DeadIn() >=21 and not target.DebuffPresent(ranged_vulnerability any=1) Spell(hunters_mark)
-		unless pet.Present() Spell(call_pet_1)
-	}
-	if BuffStacks(lock_and_load) Spell(explosive_shot)
-	if SpellUsable(powershot) Spell(powershot)
-	if SpellUsable(barrage) Spell(barrage)
-	if not target.DebuffPresent(serpent_sting_aura) and target.DeadIn() >=10 Spell(serpent_sting)
-	if SpellCooldown(explosive_shot) Spell(explosive_shot)
-	if target.HealthPercent(less 20) Spell(kill_shot)
-	if not target.DebuffPresent(black_arrow) and target.DeadIn() >=8 Spell(black_arrow)
-	if BuffStacks(thrill_of_the_hunt) and target.DebuffRemains(serpent_sting_aura) <2 Spell(multi_shot)
-	if BuffStacks(thrill_of_the_hunt) Spell(arcane_shot)
-	if SpellUsable(dire_beast) Spell(dire_beast)
-	if target.DebuffRemains(serpent_sting_aura) <6 Spell(cobra_shot)
-	if Focus() >=67 Spell(arcane_shot)
-	Spell(cobra_shot)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if not InCombat()
-	{
-		unless Stance(1) Spell(aspect_of_the_hawk)
-	}
-	unless Stance(1) Spell(aspect_of_the_hawk)
-	if SpellUsable(a_murder_of_crows) and not target.DebuffPresent(a_murder_of_crows) Spell(a_murder_of_crows)
-	if SpellUsable(lynx_rush) and not target.DebuffPresent(lynx_rush) Spell(lynx_rush)
-	if SpellUsable(glaive_toss) Spell(glaive_toss)
-	if BuffPresent(rapid_fire) or BuffStacks(bloodlust any=1) or target.DeadIn() <=25 Spell(stampede)
-	if SpellUsable(fervor) and Focus() <=50 Spell(fervor)
-}
-AddIcon mastery=3 help=aoe
-{
-	Spell(explosive_trap)
-	Spell(multi_shot)
-	Spell(cobra_shot)
-}
-AddIcon mastery=3 help=cd
-{
-	Spell(blood_fury)
-	if not BuffPresent(rapid_fire) Spell(rapid_fire)
-	if BuffPresent(rapid_fire) Spell(readiness)
-}
-]]
-
-	OvaleScripts:RegisterScript("HUNTER", name, desc, code)
-end
diff --git a/class/Mage.lua b/class/Mage.lua
deleted file mode 100644
index a77e946..0000000
--- a/class/Mage.lua
+++ /dev/null
@@ -1,237 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Arcane, Fire, Frost"
-	local code = [[
-Define(alter_time 110909)
-  SpellInfo(alter_time duration=6 )
-  SpellAddBuff(alter_time alter_time=1)
-Define(alter_time_activate 108978)
-  SpellInfo(alter_time_activate duration=10 cd=180 )
-Define(arcane_barrage 44425)
-  SpellInfo(arcane_barrage cd=3 )
-Define(arcane_blast 30451)
-Define(arcane_brilliance 1459)
-  SpellInfo(arcane_brilliance duration=3600 )
-  SpellAddBuff(arcane_brilliance arcane_brilliance=1)
-Define(arcane_charge 36032)
-  SpellInfo(arcane_charge duration=10 )
-  SpellAddBuff(arcane_charge arcane_charge=1)
-Define(arcane_missiles 5143)
-  SpellInfo(arcane_missiles duration=2 )
-Define(arcane_missiles_aura 79683)
-  SpellInfo(arcane_missiles_aura duration=20 )
-  SpellAddBuff(arcane_missiles_aura arcane_missiles_aura=1)
-Define(arcane_power 12042)
-  SpellInfo(arcane_power duration=15 cd=90 )
-  SpellAddBuff(arcane_power arcane_power=1)
-Define(berserking 26297)
-  SpellInfo(berserking duration=10 cd=180 )
-  SpellAddBuff(berserking berserking=1)
-Define(brain_freeze 44549)
-Define(combustion 11129)
-  SpellInfo(combustion cd=45 )
-Define(conjure_mana_gem 759)
-Define(counterspell 2139)
-  SpellInfo(counterspell duration=6 cd=24 )
-Define(fingers_of_frost_aura 44544)
-  SpellInfo(fingers_of_frost_aura duration=15 )
-  SpellAddBuff(fingers_of_frost_aura fingers_of_frost_aura=1)
-Define(fire_blast 2136)
-  SpellInfo(fire_blast cd=8 )
-Define(fireball 133)
-  SpellInfo(fireball base=1561 bonussp=1.5)
-Define(frost_armor 7302)
-  SpellAddBuff(frost_armor frost_armor=1)
-Define(frost_bomb 113092)
-  SpellInfo(frost_bomb duration=2 )
-  SpellAddBuff(frost_bomb frost_bomb=1)
-Define(frostbolt 116)
-  SpellInfo(frostbolt duration=15 )
-  SpellAddBuff(frostbolt frostbolt=1)
-Define(frostfire_bolt 44614)
-  SpellInfo(frostfire_bolt duration=8 )
-  SpellAddBuff(frostfire_bolt frostfire_bolt=1)
-Define(frozen_orb 84714)
-  SpellInfo(frozen_orb duration=10 cd=60 )
-Define(heating_up 48107)
-  SpellInfo(heating_up duration=10 )
-  SpellAddBuff(heating_up heating_up=1)
-Define(ice_lance 30455)
-Define(icy_veins 12472)
-  SpellInfo(icy_veins duration=20 cd=180 )
-  SpellAddBuff(icy_veins icy_veins=1)
-Define(ignite 12654)
-  SpellInfo(ignite duration=4 tick=2 )
-  SpellAddTargetDebuff(ignite ignite=1)
-Define(inferno_blast 108853)
-  SpellInfo(inferno_blast cd=8 )
-  SpellInfo(inferno_blast base=624.5 bonussp=0.6)
-Define(living_bomb 44457)
-  SpellInfo(living_bomb duration=12 tick=3 haste=spell )
-  SpellAddTargetDebuff(living_bomb living_bomb=1)
-Define(mage_armor 6117)
-  SpellAddBuff(mage_armor mage_armor=1)
-Define(mana_gem 56597)
-Define(mirror_image 55342)
-  SpellInfo(mirror_image duration=30 cd=180 )
-  SpellAddBuff(mirror_image mirror_image=1)
-Define(molten_armor 30482)
-  SpellAddBuff(molten_armor molten_armor=1)
-Define(presence_of_mind 12043)
-  SpellInfo(presence_of_mind cd=90 )
-  SpellAddBuff(presence_of_mind presence_of_mind=1)
-Define(pyroblast 11366)
-  SpellInfo(pyroblast duration=18 tick=3 haste=spell )
-  SpellInfo(pyroblast base=2061 bonussp=1.98)
-  SpellAddTargetDebuff(pyroblast pyroblast=1)
-Define(pyroblast_aura 48108)
-  SpellInfo(pyroblast_aura duration=15 )
-  SpellAddBuff(pyroblast_aura pyroblast_aura=1)
-Define(rune_of_power 116011)
-  SpellInfo(rune_of_power duration=60 )
-Define(rune_of_power_aura 116014)
-Define(scorch 2948)
-Define(time_warp 35346)
-  SpellInfo(time_warp duration=6 cd=15 )
-  SpellAddBuff(time_warp time_warp=1)
-Define(water_elemental 63859)
-AddIcon mastery=1 help=main
-{
-	if not InCombat()
-	{
-		if BuffExpires(spell_power_multiplier any=1) or BuffExpires(critical_strike any=1) Spell(arcane_brilliance)
-		if BuffExpires(mage_armor) Spell(mage_armor)
-		Spell(rune_of_power)
-	}
-	if ItemCharges(36799) <3 and False() Spell(conjure_mana_gem)
-	if BuffRemains(rune_of_power_aura) <CastTime(rune_of_power) Spell(rune_of_power)
-	if SpellCooldown(arcane_power) ==0 and BuffRemains(rune_of_power_aura) <BuffDuration(arcane_power) Spell(rune_of_power)
-	if BuffPresent(alter_time) and BuffRemains(alter_time) <2 Spell(arcane_barrage)
-	if BuffPresent(alter_time) Spell(arcane_missiles)
-	if BuffPresent(alter_time) Spell(arcane_blast)
-	if {BuffStacks(arcane_missiles_aura) ==2 and SpellCooldown(arcane_power) >0 } or {BuffStacks(arcane_charge) >=4 and SpellCooldown(arcane_power) >8 } Spell(arcane_missiles)
-	if {not target.DebuffPresent(living_bomb) or target.DebuffRemains(living_bomb) <TickTime(living_bomb) } and target.DeadIn() >TickTime(living_bomb) *3 Spell(living_bomb)
-	if BuffStacks(arcane_charge) >=4 and ManaPercent() <95 Spell(arcane_barrage)
-	Spell(arcane_blast)
-}
-AddIcon mastery=1 help=offgcd
-{
-	if target.IsInterruptible() if target.IsInterruptible() Spell(counterspell)
-	cancel.Spell(alter_time)
-	if target.HealthPercent() <25 or TimeInCombat() >5 Spell(time_warp)
-	if ManaPercent() <80 and BuffExpires(alter_time) Spell(mana_gem)
-	if BuffExpires(alter_time) and BuffPresent(arcane_power) Spell(alter_time)
-}
-AddIcon mastery=1 help=moving
-{
-	Spell(arcane_barrage)
-	Spell(fire_blast)
-	Spell(ice_lance)
-}
-AddIcon mastery=1 help=cd
-{
-	if not InCombat()
-	{
-		Spell(mirror_image)
-	}
-	Spell(mirror_image)
-	if {BuffRemains(rune_of_power) >=BuffDuration(arcane_power) and BuffStacks(arcane_missiles_aura) ==2 and BuffStacks(arcane_charge) >2 } or target.DeadIn() <BuffDuration(arcane_power) +5 Spell(arcane_power)
-	if BuffExpires(alter_time) and {BuffPresent(arcane_power) or target.DeadIn() <18 } Spell(berserking)
-	if BuffExpires(alter_time)  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if {SpellCooldown(alter_time_activate) >45 or target.DeadIn() <25 } and BuffRemains(rune_of_power) >20  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-}
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		if BuffExpires(spell_power_multiplier any=1) or BuffExpires(critical_strike any=1) Spell(arcane_brilliance)
-		if BuffExpires(molten_armor) Spell(molten_armor)
-		Spell(rune_of_power)
-	}
-	if ItemCharges(36799) <3 and False() Spell(conjure_mana_gem)
-	if BuffRemains(rune_of_power_aura) <CastTime(rune_of_power) and BuffExpires(alter_time) Spell(rune_of_power)
-	if SpellCooldown(alter_time_activate) ==0 and BuffRemains(rune_of_power_aura) <6 Spell(rune_of_power)
-	if BuffStacks(pyroblast_aura) or BuffPresent(presence_of_mind) Spell(pyroblast)
-	if BuffStacks(heating_up) and BuffExpires(pyroblast_aura) Spell(inferno_blast)
-	if {not target.DebuffPresent(living_bomb) or target.DebuffRemains(living_bomb) <TickTime(living_bomb) } and target.DeadIn() >TickTime(living_bomb) *3 Spell(living_bomb)
-	if not target.DebuffPresent(pyroblast) Spell(pyroblast)
-	Spell(fireball)
-}
-AddIcon mastery=2 help=offgcd
-{
-	if target.IsInterruptible() if target.IsInterruptible() Spell(counterspell)
-	cancel.Spell(alter_time)
-	if target.HealthPercent() <25 or TimeInCombat() >5 Spell(time_warp)
-	if target.DeadIn() <22 Spell(combustion)
-	if LastSpellDamage(ignite) >={{CritDamage(fireball) +CritDamage(inferno_blast) +Damage(pyroblast) } *{Mastery() /100} *0.5 } and target.DebuffPresent(pyroblast) Spell(combustion)
-	if BuffExpires(alter_time) and BuffStacks(pyroblast_aura) Spell(alter_time)
-}
-AddIcon mastery=2 help=moving
-{
-	Spell(scorch)
-}
-AddIcon mastery=2 help=cd
-{
-	if not InCombat()
-	{
-		Spell(mirror_image)
-	}
-	if BuffExpires(alter_time) and target.DeadIn() <18 Spell(berserking)
-	if BuffExpires(alter_time) Spell(berserking)
-	if BuffExpires(alter_time) Spell(presence_of_mind)
-	if SpellCooldown(alter_time) >30 or target.DeadIn() <15 Spell(presence_of_mind)
-}
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		if BuffExpires(spell_power_multiplier any=1) or BuffExpires(critical_strike any=1) Spell(arcane_brilliance)
-		if BuffExpires(frost_armor) Spell(frost_armor)
-		Spell(rune_of_power)
-	}
-	if ItemCharges(36799) <3 and False() Spell(conjure_mana_gem)
-	if BuffRemains(rune_of_power_aura) <CastTime(rune_of_power) and BuffExpires(alter_time) Spell(rune_of_power)
-	if SpellCooldown(icy_veins) ==0 and BuffRemains(rune_of_power_aura) <20 Spell(rune_of_power)
-	if not BuffStacks(fingers_of_frost_aura) Spell(frozen_orb)
-	if BuffPresent(alter_time) and BuffPresent(brain_freeze) Spell(frostfire_bolt)
-	if BuffPresent(alter_time) and BuffPresent(fingers_of_frost_aura) Spell(ice_lance)
-	if target.DebuffStacks(frostbolt) <3 Spell(frostbolt)
-	if BuffStacks(brain_freeze) and SpellCooldown(icy_veins) >2 Spell(frostfire_bolt)
-	if BuffStacks(fingers_of_frost_aura) and SpellCooldown(icy_veins) >2 Spell(ice_lance)
-	Spell(frostbolt)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if not InCombat()
-	{
-		Spell(water_elemental)
-	}
-	if target.IsInterruptible() if target.IsInterruptible() Spell(counterspell)
-	cancel.Spell(alter_time)
-	if target.HealthPercent() <25 or TimeInCombat() >5 Spell(time_warp)
-	if BuffExpires(alter_time) and BuffPresent(icy_veins) Spell(alter_time)
-	if target.DeadIn() >CastTime(frost_bomb) +TickTime(frost_bomb) Spell(frost_bomb)
-}
-AddIcon mastery=3 help=moving
-{
-	Spell(fire_blast)
-	Spell(ice_lance)
-}
-AddIcon mastery=3 help=cd
-{
-	if not InCombat()
-	{
-		Spell(mirror_image)
-	}
-	Spell(mirror_image)
-	if {target.DebuffStacks(frostbolt) >=3 and {BuffStacks(brain_freeze) or BuffStacks(fingers_of_frost_aura) } } or target.DeadIn() <22 Spell(icy_veins)
-	if BuffPresent(icy_veins) or target.DeadIn() <18 Spell(berserking)
-	if BuffPresent(icy_veins) or SpellCooldown(icy_veins) >15 or target.DeadIn() <15 Spell(presence_of_mind)
-}
-]]
-
-	OvaleScripts:RegisterScript("MAGE", name, desc, code)
-end
diff --git a/class/Monk.lua b/class/Monk.lua
deleted file mode 100644
index 6873619..0000000
--- a/class/Monk.lua
+++ /dev/null
@@ -1,104 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Windwalker"
-	local code = [[
-Define(berserking 26297)
-  SpellInfo(berserking duration=10 cd=180 )
-  SpellAddBuff(berserking berserking=1)
-Define(blackout_kick 100784)
-  SpellInfo(blackout_kick chi=2 )
-Define(chi_brew 115399)
-  SpellInfo(chi_brew chi=-4 cd=90 )
-Define(chi_sphere 121286)
-  SpellInfo(chi_sphere duration=120 )
-Define(chi_wave 115098)
-  SpellInfo(chi_wave cd=15 )
-Define(combo_breaker_bok 116768)
-  SpellInfo(combo_breaker_bok duration=15 )
-  SpellAddBuff(combo_breaker_bok combo_breaker_bok=1)
-Define(combo_breaker_tp 118864)
-  SpellInfo(combo_breaker_tp duration=15 )
-  SpellAddBuff(combo_breaker_tp combo_breaker_tp=1)
-Define(energizing_brew 115288)
-  SpellInfo(energizing_brew duration=6 cd=60 )
-  SpellAddBuff(energizing_brew energizing_brew=1)
-Define(fists_of_fury 113656)
-  SpellInfo(fists_of_fury duration=4 chi=3 cd=25 )
-  SpellAddBuff(fists_of_fury fists_of_fury=1)
-Define(invoke_xuen 123904)
-  SpellInfo(invoke_xuen duration=45 cd=180 )
-Define(jab 100780)
-  SpellInfo(jab energy=40 chi=-1 )
-Define(rising_sun_kick 107428)
-  SpellInfo(rising_sun_kick chi=2 cd=8 )
-Define(rushing_jade_wind 116847)
-  SpellInfo(rushing_jade_wind duration=8 chi=2 cd=30 )
-  SpellAddBuff(rushing_jade_wind rushing_jade_wind=1)
-Define(spinning_crane_kick 101546)
-  SpellInfo(spinning_crane_kick duration=2.25 energy=40 )
-  SpellAddBuff(spinning_crane_kick spinning_crane_kick=1)
-Define(tiger_palm 100787)
-  SpellInfo(tiger_palm chi=1 )
-Define(tiger_power 125359)
-  SpellInfo(tiger_power duration=20 )
-  SpellAddBuff(tiger_power tiger_power=1)
-Define(tigereye_brew 125195)
-  SpellInfo(tigereye_brew duration=120 )
-  SpellAddBuff(tigereye_brew tigereye_brew=1)
-Define(tigereye_brew_use 116740)
-  SpellInfo(tigereye_brew_use duration=15 cd=1 )
-  SpellAddBuff(tigereye_brew_use tigereye_brew_use=1)
-Define(ascension_talent 8)
-Define(chi_brew_talent 9)
-Define(chi_wave_talent 4)
-Define(invoke_xuen_the_white_tiger_talent 17)
-Define(power_strikes_talent 7)
-Define(rushing_jade_wind_talent 16)
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		False()
-	}
-	if not target.DebuffRemains(rising_sun_kick) or target.DebuffRemains(rising_sun_kick) <=3 Spell(rising_sun_kick)
-	if BuffRemains(tiger_power) <=3 Spell(tiger_palm)
-	if TalentPoints(rushing_jade_wind_talent) Spell(rushing_jade_wind)
-
-	if BuffStacks(combo_breaker_bok) and TimeToMaxEnergy() <=2 Spell(blackout_kick)
-	Spell(rising_sun_kick)
-	if not BuffPresent(energizing_brew) and TimeToMaxEnergy() >{4 } and BuffRemains(tiger_power) >{4 } Spell(fists_of_fury)
-	if BuffStacks(combo_breaker_bok) Spell(blackout_kick)
-	if {BuffStacks(combo_breaker_tp) and TimeToMaxEnergy() >=2 } or {BuffRemains(combo_breaker_tp) <=2 and BuffStacks(combo_breaker_tp) } Spell(tiger_palm)
-	if TalentPoints(chi_wave_talent) and TimeToMaxEnergy() >2 Spell(chi_wave)
-	if TalentPoints(ascension_talent) and Chi() <=3 Spell(jab)
-	if not TalentPoints(ascension_talent) and Chi() <=2 Spell(jab)
-	if {Energy() +{EnergyRegen() *{SpellCooldown(rising_sun_kick) } } } >=40 Spell(blackout_kick)
-
-}
-AddIcon mastery=3 help=offgcd
-{
-	if TalentPoints(power_strikes_talent) and BuffStacks(chi_sphere) and Chi() <4 Spell(chi_sphere)
-	if not BuffPresent(tigereye_brew_use) Spell(tigereye_brew)
-	if TimeToMaxEnergy() >5 Spell(energizing_brew)
-}
-AddIcon mastery=3 help=aoe
-{
-
-	if Chi() ==4 Spell(rising_sun_kick)
-	Spell(spinning_crane_kick)
-
-}
-AddIcon mastery=3 help=cd
-{
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	Spell(berserking)
-	if TalentPoints(chi_brew_talent) and Chi() ==0 Spell(chi_brew)
-	if TalentPoints(invoke_xuen_talent) Spell(invoke_xuen)
-}
-]]
-
-	OvaleScripts:RegisterScript("MONK", name, desc, code)
-end
diff --git a/class/Paladin.lua b/class/Paladin.lua
deleted file mode 100644
index 5793717..0000000
--- a/class/Paladin.lua
+++ /dev/null
@@ -1,108 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Retribution"
-	local code = [[
-Define(avenging_wrath 31884)
-  SpellInfo(avenging_wrath duration=20 cd=180 )
-  SpellAddBuff(avenging_wrath avenging_wrath=1)
-Define(blessing_of_kings 20217)
-  SpellInfo(blessing_of_kings duration=3600 )
-  SpellAddBuff(blessing_of_kings blessing_of_kings=1)
-Define(blessing_of_might 19740)
-  SpellInfo(blessing_of_might duration=3600 )
-  SpellAddBuff(blessing_of_might blessing_of_might=1)
-Define(crusader_strike 35395)
-  SpellInfo(crusader_strike holy=-1 cd=4.5 )
-Define(divine_storm 53385)
-  SpellInfo(divine_storm holy=3 )
-Define(execution_sentence_aura 114916)
-  SpellInfo(execution_sentence_aura duration=10 tick=1 haste=spell )
-Define(execution_sentence 114157)
-  SpellInfo(execution_sentence cd=60)
-  SpellAddTargetDebuff(execution_sentence execution_sentence_aura=1)
-Define(exorcism 879)
-  SpellInfo(exorcism holy=-1 cd=15 )
-Define(exorcism_glyphed 122032)
-  SpellInfo(exorcism_glyphed holy=-1 cd=15)
-Define(glyph_of_double_jeopardy 121027)
-  SpellInfo(glyph_of_double_jeopardy duration=10 )
-  SpellAddBuff(glyph_of_double_jeopardy glyph_of_double_jeopardy=1)
-Define(guardian_of_ancient_kings 86698)
-  SpellInfo(guardian_of_ancient_kings duration=30 cd=300 )
-  SpellAddBuff(guardian_of_ancient_kings guardian_of_ancient_kings=1)
-Define(hammer_of_the_righteous 53595)
-  SpellInfo(hammer_of_the_righteous holy=-1 cd=4.5 )
-Define(hammer_of_wrath 24275)
-  SpellInfo(hammer_of_wrath holy=-0 cd=6 )
-Define(inquisition 84963)
-  SpellInfo(inquisition duration=10 holy=1 )
-  SpellAddBuff(inquisition inquisition=1)
-Define(judgment 20271)
-  SpellInfo(judgment cd=6 )
-Define(rebuke 96231)
-  SpellInfo(rebuke duration=4 cd=15 )
-Define(seal_of_righteousness 20154)
-  SpellAddBuff(seal_of_righteousness seal_of_righteousness=1)
-Define(seal_of_truth 31801)
-  SpellAddBuff(seal_of_truth seal_of_truth=1)
-Define(templars_verdict 85256)
-  SpellInfo(templars_verdict holy=3 )
-Define(glyph_of_mass_exorcism 122028)
-AddCheckBox(showwait L(showwait) default)
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		if not BuffPresent(str_agi_int any=1) Spell(blessing_of_kings)
-		if not BuffPresent(mastery any=1) and not BuffPresent(str_agi_int any=1) Spell(blessing_of_might)
-		unless Stance(1) Spell(seal_of_truth)
-	}
-	if {BuffExpires(inquisition) or BuffRemains(inquisition) <=2 } and {HolyPower() >=3 or target.DeadIn() <HolyPower() *10 } Spell(inquisition)
-	if HolyPower() ==5 Spell(templars_verdict)
-	Spell(hammer_of_wrath usable=1)
-	if SpellCooldown(hammer_of_wrath) >0 and SpellCooldown(hammer_of_wrath) <=0.2 if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
-	if Glyph(glyph_of_mass_exorcism no)
-	{
-		Spell(exorcism)
-		if SpellCooldown(exorcism) >0 and SpellCooldown(exorcism) <=0.2 if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
-	}
-	if Glyph(glyph_of_mass_exorcism)
-	{
-		Spell(exorcism_glyphed)
-		if SpellCooldown(exorcism_glyphed) >0 and SpellCooldown(exorcism_glyphed) <=0.2 if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
-	}
-	if not {ArmorSetParts(T15 more 4) } and {target.HealthPercent() <=20 or BuffPresent(avenging_wrath) } Spell(judgment)
-	Spell(crusader_strike)
-	if SpellCooldown(crusader_strike) >0 and SpellCooldown(crusader_strike) <=0.2 if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
-	Spell(judgment)
-	if BuffRemains(inquisition) >4 Spell(templars_verdict)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if target.IsInterruptible() Spell(rebuke)
-	if BuffPresent(inquisition) Spell(execution_sentence)
-}
-AddIcon mastery=3 help=aoe
-{
-	if not InCombat()
-	{
-		unless Stance(2) Spell(seal_of_righteousness)
-	}
-	if {HolyPower() ==5 } Spell(divine_storm)
-	Spell(hammer_of_the_righteous)
-	if BuffPresent(glyph_of_double_jeopardy) focus.Spell(judgment)
-	if BuffRemains(inquisition) >4 Spell(divine_storm)
-}
-AddIcon mastery=3 help=cd
-{
-	if BuffPresent(inquisition) Spell(avenging_wrath)
-	if BuffPresent(avenging_wrath) Spell(guardian_of_ancient_kings)
-	if BuffPresent(inquisition)  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-}
-]]
-
-	OvaleScripts:RegisterScript("PALADIN", name, desc, code)
-end
diff --git a/class/Priest.lua b/class/Priest.lua
deleted file mode 100644
index c56b720..0000000
--- a/class/Priest.lua
+++ /dev/null
@@ -1,128 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Shadow"
-	local code = [[
-Define(berserking 26297)
-  SpellInfo(berserking duration=10 cd=180 )
-  SpellAddBuff(berserking berserking=1)
-Define(cascade 120785)
-  SpellInfo(cascade duration=0.1 )
-Define(devouring_plague 2944)
-  SpellInfo(devouring_plague duration=6 tick=1 shadoworbs=1 haste=spell )
-  SpellAddTargetDebuff(devouring_plague devouring_plague=1)
-Define(dispersion 47585)
-  SpellInfo(dispersion duration=6 cd=120 )
-  SpellAddBuff(dispersion dispersion=1)
-Define(divine_insight_shadow 124430)
-  SpellInfo(divine_insight_shadow duration=12 )
-  SpellAddBuff(divine_insight_shadow divine_insight_shadow=1)
-Define(divine_star 110744)
-  SpellInfo(divine_star cd=15 )
-Define(halo 120517)
-  SpellInfo(halo duration=5.5 cd=40 )
-Define(inner_fire 588)
-  SpellAddBuff(inner_fire inner_fire=1)
-Define(inner_will 73413)
-  SpellAddBuff(inner_will inner_will=1)
-Define(mind_blast 8092)
-  SpellInfo(mind_blast shadoworbs=-1 cd=8)
-Define(mind_flay 15407)
-  SpellInfo(mind_flay duration=3 canStopChannelling=1 )
-  SpellAddTargetDebuff(mind_flay mind_flay=1)
-Define(mind_flay_insanity 129197)
-  SpellInfo(mind_flay_insanity duration=3 tick=1 haste=spell canStopChannelling=1 )
-  SpellAddTargetDebuff(mind_flay_insanity mind_flay_insanity=1)
-Define(mind_sear 48045)
-  SpellInfo(mind_sear duration=5 canStopChannelling=1 )
-  SpellAddBuff(mind_sear mind_sear=1)
-Define(mind_spike 73510)
-Define(mindbender 123040)
-  SpellInfo(mindbender duration=15 cd=60 )
-Define(power_infusion 10060)
-  SpellInfo(power_infusion duration=20 cd=120 )
-  SpellAddBuff(power_infusion power_infusion=1)
-Define(power_word_fortitude 21562)
-  SpellInfo(power_word_fortitude duration=3600 )
-  SpellAddBuff(power_word_fortitude power_word_fortitude=1)
-Define(shadow_word_death 32379)
-  SpellInfo(shadow_word_death cd=8 )
-Define(shadow_word_pain 589)
-  SpellInfo(shadow_word_pain duration=18 tick=3 haste=spell )
-  SpellAddTargetDebuff(shadow_word_pain shadow_word_pain=1)
-Define(shadowfiend 34433)
-  SpellInfo(shadowfiend duration=12 cd=180 )
-Define(shadowform 15473)
-  SpellAddBuff(shadowform shadowform=1)
-Define(surge_of_darkness 87160)
-  SpellInfo(surge_of_darkness duration=10 )
-  SpellAddBuff(surge_of_darkness surge_of_darkness=1)
-Define(vampiric_embrace 15286)
-  SpellInfo(vampiric_embrace duration=15 cd=180 )
-  SpellAddBuff(vampiric_embrace vampiric_embrace=1)
-Define(vampiric_touch 34914)
-  SpellInfo(vampiric_touch duration=15 tick=3 haste=spell )
-  SpellAddTargetDebuff(vampiric_touch vampiric_touch=1)
-Define(cascade_talent 16)
-Define(divine_star_talent 17)
-Define(halo_talent 18)
-Define(mindbender_talent 8)
-Define(power_infusion_talent 14)
-AddCheckBox(showwait L(showwait) default)
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		if not BuffPresent(stamina any=1) Spell(power_word_fortitude)
-		if BuffExpires(inner_fire) and BuffExpires(inner_will) Spell(inner_fire)
-		if BuffExpires(shadowform) Spell(shadowform)
-	}
-	if BuffExpires(shadowform) Spell(shadowform)
-	if TalentPoints(mindbender_talent) Spell(mindbender)
-	if ShadowOrbs() ==3 and {SpellCooldown(mind_blast) <1.5 or target.HealthPercent() <20 and SpellCooldown(shadow_word_death) <1.5 } Spell(devouring_plague)
-	if target.HealthPercent(less 20) Spell(shadow_word_death)
-	Spell(mind_blast)
-	if target.TicksRemain(devouring_plague) ==1 Spell(mind_flay_insanity)
-	Spell(mind_flay_insanity)
-	if not target.DebuffPresent(shadow_word_pain) Spell(shadow_word_pain)
-	if target.DebuffRemains(vampiric_touch) <CastTime(vampiric_touch) Spell(vampiric_touch)
-	if BuffStacks(surge_of_darkness) ==2 Spell(mind_spike)
-	if target.TicksRemain(shadow_word_pain) <=1 Spell(shadow_word_pain)
-	if target.DebuffRemains(vampiric_touch) <CastTime(vampiric_touch) +TickTime(vampiric_touch) Spell(vampiric_touch)
-	if ShadowOrbs() ==3 and target.TicksRemain(devouring_plague) <=1 Spell(devouring_plague)
-	if TalentPoints(halo_talent) Spell(halo)
-	if TalentPoints(cascade_talent) Spell(cascade)
-	if target.HealthPercent() <20 and SpellCooldown(shadow_word_death) <0.5 if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
-	if SpellCooldown(mind_blast) <0.5 if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
-	if BuffStacks(surge_of_darkness) Spell(mind_spike)
-	Spell(mind_flay)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if TalentPoints(divine_star_talent) Spell(divine_star)
-}
-AddIcon mastery=3 help=moving
-{
-	if target.HealthPercent(less 20) Spell(shadow_word_death)
-	if BuffStacks(divine_insight_shadow) and SpellCooldown(mind_blast) Spell(mind_blast)
-	Spell(shadow_word_pain)
-}
-AddIcon mastery=3 help=aoe
-{
-	Spell(mind_sear)
-}
-AddIcon mastery=3 help=cd
-{
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if not TalentPoints(mindbender_talent) Spell(shadowfiend)
-	if TalentPoints(power_infusion_talent) Spell(power_infusion)
-	Spell(berserking)
-	if ShadowOrbs() ==3 and Health() <=40 Spell(vampiric_embrace)
-	Spell(dispersion)
-}
-]]
-
-	OvaleScripts:RegisterScript("PRIEST", name, desc, code)
-end
diff --git a/class/Rogue.lua b/class/Rogue.lua
deleted file mode 100644
index c575617..0000000
--- a/class/Rogue.lua
+++ /dev/null
@@ -1,209 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Assassination, Combat, Subtlety"
-	local code = [[
-Define(adrenaline_rush 13750)
-  SpellInfo(adrenaline_rush duration=15 cd=180 )
-  SpellAddBuff(adrenaline_rush adrenaline_rush=1)
-Define(ambush 8676)
-  SpellInfo(ambush energy=60 combo=2 buff_combo=shadow_blades )
-Define(anticipation 114015)
-Define(backstab 53)
-  SpellInfo(backstab energy=35 combo=1 buff_combo=shadow_blades )
-Define(bandits_guile 84654)
-Define(berserking 26297)
-  SpellInfo(berserking duration=10 cd=180 )
-  SpellAddBuff(berserking berserking=1)
-Define(deep_insight 84747)
-  SpellInfo(deep_insight duration=15 )
-  SpellAddBuff(deep_insight deep_insight=1)
-Define(dispatch 111240)
-  SpellInfo(dispatch energy=30 combo=1 buff_combo=shadow_blades )
-Define(envenom 32645)
-  SpellInfo(envenom duration=1 combo=0 energy=35 )
-  SpellAddBuff(envenom envenom=1)
-Define(eviscerate 2098)
-  SpellInfo(eviscerate combo=0 energy=35 )
-Define(expose_armor 8647)
-  SpellInfo(expose_armor energy=25 combo=1 buff_combo=shadow_blades )
-  AddCheckBox(expose_armor_check SpellName(expose_armor))
-Define(find_weakness 91021)
-  SpellInfo(find_weakness duration=10 )
-  SpellAddBuff(find_weakness find_weakness=1)
-Define(hemorrhage 16511)
-  SpellInfo(hemorrhage energy=30 combo=1 buff_combo=shadow_blades )
-Define(honor_among_thieves 51701)
-Define(kick 1766)
-  SpellInfo(kick duration=5 cd=15 )
-Define(killing_spree 51690)
-  SpellInfo(killing_spree duration=3 cd=120 )
-  SpellAddBuff(killing_spree killing_spree=1)
-Define(master_of_subtlety 31223)
-Define(mutilate 1329)
-  SpellInfo(mutilate energy=55 combo=2 buff_combo=shadow_blades )
-Define(premeditation 14183)
-  SpellInfo(premeditation duration=18 combo=2 cd=20 )
-Define(preparation 14185)
-  SpellInfo(preparation cd=300 )
-Define(revealing_strike 84617)
-  SpellInfo(revealing_strike duration=24 tick=3 energy=40 combo=1 buff_combo=shadow_blades )
-  SpellAddTargetDebuff(revealing_strike revealing_strike=1)
-Define(rupture 1943)
-  SpellInfo(rupture duration=4 tick=2 combo=0 energy=25 )
-  SpellAddTargetDebuff(rupture rupture=1)
-Define(shadow_blades 121471)
-  SpellInfo(shadow_blades duration=12 cd=180 )
-  SpellAddBuff(shadow_blades shadow_blades=1)
-Define(shadow_dance 51713)
-  SpellInfo(shadow_dance duration=8 cd=60 )
-  SpellAddBuff(shadow_dance shadow_dance=1)
-Define(sinister_strike 1752)
-  SpellInfo(sinister_strike energy=40 combo=1 buff_combo=shadow_blades )
-Define(slice_and_dice 5171)
-  SpellInfo(slice_and_dice duration=6 combo=0 energy=25 )
-  SpellAddBuff(slice_and_dice slice_and_dice=1)
-Define(stealth 63880)
-Define(stealthed 1784)
-  SpellInfo(stealthed cd=6 )
-  SpellAddBuff(stealthed stealthed=1)
-Define(tricks_of_the_trade 57933)
-  SpellInfo(tricks_of_the_trade duration=6 )
-  SpellAddBuff(tricks_of_the_trade tricks_of_the_trade=1)
-Define(vanish 1856)
-  SpellInfo(vanish cd=120 )
-  SpellAddBuff(vanish vanish=1)
-Define(vendetta 79140)
-  SpellInfo(vendetta duration=20 cd=120 )
-  SpellAddBuff(vendetta vendetta=1)
-Define(weakened_armor 113746)
-  SpellInfo(weakened_armor duration=30 )
-  SpellAddBuff(weakened_armor weakened_armor=1)
-Define(anticipation_talent 18)
-Define(shadow_focus_talent 3)
-Define(subterfuge_talent 2)
-AddIcon mastery=1 help=main
-{
-	if not InCombat()
-	{
-		if WeaponEnchantExpires(mainhand 300) Item(6497)
-	}
-	if {target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 } and ComboPoints() <5 if CheckBoxOn(expose_armor_check) Spell(expose_armor)
-	Spell(ambush usable=1)
-	if BuffRemains(slice_and_dice) <2 Spell(slice_and_dice)
-	if target.TicksRemain(rupture) <2 and Energy() >90 Spell(dispatch usable=1)
-	if target.TicksRemain(rupture) <2 and Energy() >90 Spell(mutilate)
-	if target.TicksRemain(rupture) <2 or {ComboPoints() ==5 and target.TicksRemain(rupture) <3 } Spell(rupture)
-	if ComboPoints() >4 Spell(envenom)
-	if ComboPoints() >=2 and BuffRemains(slice_and_dice) <3 Spell(envenom)
-	if ComboPoints() <5 Spell(dispatch usable=1)
-	Spell(mutilate)
-}
-AddIcon mastery=1 help=offgcd
-{
-	if not InCombat()
-	{
-		Spell(stealth)
-	}
-	if target.IsInterruptible() Spell(kick)
-	Spell(tricks_of_the_trade)
-}
-AddIcon mastery=1 help=cd
-{
-	if not BuffPresent(vanish) and SpellCooldown(vanish) >60 Spell(preparation)
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	Spell(berserking)
-	if TimeInCombat() >10 and not BuffPresent(stealthed) and not BuffPresent(shadow_blades) Spell(vanish)
-	if {BuffStacks(bloodlust any=1) or TimeInCombat() >60 } Spell(shadow_blades)
-	Spell(vendetta)
-}
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		if WeaponEnchantExpires(mainhand 300) Item(6497)
-	}
-	if {target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 } and ComboPoints() <5 if CheckBoxOn(expose_armor_check) Spell(expose_armor)
-	Spell(ambush usable=1)
-	if BuffRemains(slice_and_dice) <2 or {BuffRemains(slice_and_dice) <15 and BuffStacks(bandits_guile) ==11 and ComboPoints() >=4 } Spell(slice_and_dice)
-	if ComboPoints() <5 or not target.DebuffPresent(revealing_strike)
-	{
-		if target.TicksRemain(revealing_strike) <2 Spell(revealing_strike)
-		Spell(sinister_strike)
-	}
-	if not TalentPoints(anticipation_talent) or BuffPresent(deep_insight) or SpellCooldown(shadow_blades) <=11 or BuffStacks(anticipation) >=4 or {BuffPresent(shadow_blades) and BuffStacks(anticipation) >=3 }
-	{
-		if target.TicksRemain(rupture) <2 and target.DeadIn() >=26 Spell(rupture)
-		Spell(eviscerate)
-	}
-	if Energy() >60 or BuffExpires(deep_insight) or BuffRemains(deep_insight) >5 -ComboPoints()
-	{
-		if target.TicksRemain(revealing_strike) <2 Spell(revealing_strike)
-		Spell(sinister_strike)
-	}
-}
-AddIcon mastery=2 help=offgcd
-{
-	if not InCombat()
-	{
-		Spell(stealth)
-	}
-	if target.IsInterruptible() Spell(kick)
-}
-AddIcon mastery=2 help=cd
-{
-	if not BuffPresent(vanish) and SpellCooldown(vanish) >60 Spell(preparation)
-	if TimeInCombat() ==0 or BuffPresent(shadow_blades)  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if TimeInCombat() ==0 or BuffPresent(shadow_blades) Spell(berserking)
-	if TimeInCombat() >10 and {ComboPoints() <3 or {TalentPoints(anticipation_talent) and BuffStacks(anticipation) <3 } or {BuffExpires(shadow_blades) and {ComboPoints() <4 or {TalentPoints(anticipation_talent) and BuffStacks(anticipation) <4 } } } } and {{TalentPoints(shadow_focus_talent) and BuffExpires(adrenaline_rush) and Energy() <20 } or {TalentPoints(subterfuge_talent) and Energy() >=90 } or {not TalentPoints(shadow_focus_talent) and not TalentPoints(subterfuge_talent) and Energy() >=60 } } Spell(vanish)
-	if not ArmorSetParts(T14 more 4) and TimeInCombat() >5 Spell(shadow_blades)
-	if not ArmorSetParts(T14 more 4) and Energy() <35 and BuffExpires(adrenaline_rush) Spell(killing_spree)
-	if not ArmorSetParts(T14 more 4) and {Energy() <35 or BuffPresent(shadow_blades) } Spell(adrenaline_rush)
-	if ArmorSetParts(T14 more 4) and {{SpellCooldown(killing_spree) >30.5 and SpellCooldown(adrenaline_rush) <=9 } or {Energy() <35 and {SpellCooldown(killing_spree) ==0 or SpellCooldown(adrenaline_rush) ==0 } } } Spell(shadow_blades)
-	if ArmorSetParts(T14 more 4) and {{BuffPresent(shadow_blades) and BuffExpires(adrenaline_rush) and {Energy() <35 or BuffRemains(shadow_blades) <=3.5 } } or {BuffExpires(shadow_blades) and SpellCooldown(shadow_blades) >30 } } Spell(killing_spree)
-	if ArmorSetParts(T14 more 4) and BuffPresent(shadow_blades) and {Energy() <35 or BuffRemains(shadow_blades) <=15 } Spell(adrenaline_rush)
-}
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		if WeaponEnchantExpires(mainhand 300) Item(6497)
-		Spell(slice_and_dice)
-	}
-	if {target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 } and ComboPoints() <5 if CheckBoxOn(expose_armor_check) Spell(expose_armor)
-	if ComboPoints() <=5 and BuffStacks(anticipation) ==0 Spell(ambush usable=1)
-	if BuffRemains(slice_and_dice) <3 and ComboPoints() ==5 Spell(slice_and_dice)
-	if ComboPoints() ==5 and target.DebuffRemains(rupture) <5 Spell(rupture)
-	if BuffStacks(anticipation) <3 and BuffRemains(shadow_dance) <=2 Spell(ambush usable=1)
-	if ComboPoints() ==5 Spell(eviscerate)
-	if ComboPoints() <4 and {target.DebuffRemains(hemorrhage) <4 or target.TargetIsPlayer() } Spell(hemorrhage)
-	if ComboPoints() <5 and Energy() >80 and {target.DebuffRemains(hemorrhage) <4 or target.TargetIsPlayer() } Spell(hemorrhage)
-	if ComboPoints() <4 and {SpellCooldown(shadow_dance) >7 or {SpellCooldown(shadow_dance) ==0 and TimeInCombat() <=9 } } Spell(backstab)
-	if ComboPoints() <5 and Energy() >80 and SpellCooldown(shadow_dance) >=2 Spell(backstab)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if not InCombat()
-	{
-		Spell(stealth)
-		Spell(premeditation usable=1)
-	}
-	if target.IsInterruptible() Spell(kick)
-	if Energy() >=75 and BuffExpires(stealthed) and not target.DebuffPresent(find_weakness) Spell(shadow_dance)
-	if {ComboPoints() <=3 and SpellCooldown(honor_among_thieves) >1.75 } or ComboPoints() <=2 Spell(premeditation usable=1)
-	Spell(tricks_of_the_trade)
-}
-AddIcon mastery=3 help=cd
-{
-	if not BuffPresent(vanish) and SpellCooldown(vanish) >60 Spell(preparation)
-	Spell(shadow_blades)
-	if BuffPresent(shadow_dance)  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if BuffPresent(shadow_dance) Spell(berserking)
-	if TimeInCombat() >10 and Energy() >=45 and Energy() <=75 and ComboPoints() <=3 and not BuffPresent(shadow_dance) and not BuffPresent(master_of_subtlety) and not target.DebuffPresent(find_weakness) Spell(vanish)
-}
-]]
-
-	OvaleScripts:RegisterScript("ROGUE", name, desc, code)
-end
diff --git a/class/Shaman.lua b/class/Shaman.lua
deleted file mode 100644
index e892728..0000000
--- a/class/Shaman.lua
+++ /dev/null
@@ -1,219 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Elemental, Enhancement"
-	local code = [[
-Define(ancestral_swiftness 16188)
-  SpellInfo(ancestral_swiftness cd=90 )
-  SpellAddBuff(ancestral_swiftness ancestral_swiftness=1)
-Define(ascendance 114049)
-  SpellInfo(ascendance cd=180 )
-Define(berserking 26297)
-  SpellInfo(berserking duration=10 cd=180 )
-  SpellAddBuff(berserking berserking=1)
-Define(blood_fury 20572)
-  SpellInfo(blood_fury duration=15 cd=120 )
-  SpellAddBuff(blood_fury blood_fury=1)
-Define(bloodlust 2825)
-  SpellInfo(bloodlust duration=40 cd=300 )
-  SpellAddBuff(bloodlust bloodlust=1)
-Define(chain_lightning 421)
-  SpellInfo(chain_lightning cd=3 )
-Define(earth_elemental_totem 2062)
-  SpellInfo(earth_elemental_totem duration=60 cd=300 )
-Define(earth_shock 8042)
-  SpellInfo(earth_shock sharedcd=shock cd=6 )
-Define(earthquake 61882)
-  SpellInfo(earthquake duration=10 cd=10 )
-  SpellAddBuff(earthquake earthquake=1)
-Define(elemental_blast 117014)
-  SpellInfo(elemental_blast cd=12 )
-Define(elemental_mastery 16166)
-  SpellInfo(elemental_mastery duration=20 cd=90 )
-  SpellAddBuff(elemental_mastery elemental_mastery=1)
-Define(feral_spirit 51533)
-  SpellInfo(feral_spirit duration=30 cd=120 )
-Define(fire_elemental_totem 2894)
-  SpellInfo(fire_elemental_totem duration=60 cd=300 )
-Define(fire_nova 1535)
-  SpellInfo(fire_nova cd=4 )
-Define(flame_shock 8050)
-  SpellInfo(flame_shock duration=30 tick=3 haste=spell sharedcd=shock cd=6 )
-  SpellAddTargetDebuff(flame_shock flame_shock=1)
-Define(flametongue_weapon 8024)
-Define(heroism 32182)
-  SpellInfo(heroism duration=40 cd=300 )
-  SpellAddBuff(heroism heroism=1)
-Define(lava_beam 114074)
-Define(lava_burst 51505)
-  SpellInfo(lava_burst cd=8 )
-Define(lava_lash 60103)
-  SpellInfo(lava_lash cd=10 )
-Define(lava_surge 77756)
-Define(lifeblood 138724)
-  SpellInfo(lifeblood mana=-9935 )
-  SpellAddBuff(lifeblood lifeblood=1)
-Define(lightning_bolt 403)
-Define(lightning_shield 324)
-  SpellInfo(lightning_shield duration=3600 )
-  SpellAddBuff(lightning_shield lightning_shield=1)
-Define(maelstrom_weapon 53817)
-  SpellInfo(maelstrom_weapon duration=30 )
-  SpellAddBuff(maelstrom_weapon maelstrom_weapon=1)
-Define(magma_totem 8187)
-Define(searing_totem 3599)
-  SpellInfo(searing_totem duration=60 )
-Define(spiritwalkers_grace 79206)
-  SpellInfo(spiritwalkers_grace duration=15 cd=120 )
-  SpellAddBuff(spiritwalkers_grace spiritwalkers_grace=1)
-Define(stormblast 115356)
-  SpellInfo(stormblast duration=15 sharedcd=strike cd=8 )
-  SpellAddBuff(stormblast stormblast=1)
-Define(stormlash 120687)
-Define(stormlash_totem 120668)
-  SpellInfo(stormlash_totem duration=10 cd=300 )
-Define(stormstrike 17364)
-  SpellInfo(stormstrike duration=15 sharedcd=strike cd=8 )
-  SpellAddBuff(stormstrike stormstrike=1)
-Define(strike 138537)
-  SpellInfo(strike energy=40 )
-Define(thunderstorm 51490)
-  SpellInfo(thunderstorm duration=5 cd=45 )
-  SpellAddBuff(thunderstorm thunderstorm=1)
-Define(unleash_elements 73680)
-  SpellInfo(unleash_elements cd=15 )
-Define(unleash_flame 73683)
-  SpellInfo(unleash_flame duration=8 )
-  SpellAddBuff(unleash_flame unleash_flame=1)
-Define(wind_shear 57994)
-  SpellInfo(wind_shear duration=3 cd=12 )
-Define(windfury_weapon 8232)
-Define(ancestral_swiftness_talent 11)
-Define(elemental_blast_talent 18)
-Define(elemental_mastery_talent 10)
-Define(unleashed_fury_talent 16)
-AddIcon mastery=1 help=main
-{
-	if not InCombat()
-	{
-		if WeaponEnchantExpires(mainhand) main.Spell(flametongue_weapon)
-		if not BuffPresent(lightning_shield) Spell(lightning_shield)
-	}
-
-	if TalentPoints(unleashed_fury_talent) and not BuffPresent(ascendance) Spell(unleash_elements)
-	if target.DebuffRemains(flame_shock) >CastTime(lava_burst) and {BuffPresent(ascendance) or SpellCooldown(lava_burst) } Spell(lava_burst)
-	if target.TicksRemain(flame_shock) <2 Spell(flame_shock)
-	if TalentPoints(elemental_blast_talent) Spell(elemental_blast)
-	if BuffStacks(lightning_shield) ==7 Spell(earth_shock)
-	if BuffStacks(lightning_shield) >3 and target.DebuffRemains(flame_shock) >SpellCooldown(earth_shock) and target.DebuffRemains(flame_shock) <SpellCooldown(earth_shock) +TickTime(flame_shock) Spell(earth_shock)
-	if TimeInCombat() >60 and target.DebuffRemains(flame_shock) <=BuffDuration(ascendance) and SpellCooldown(ascendance) +BuffDuration(ascendance) <BuffDuration(flame_shock) Spell(flame_shock)
-	if SpellCooldown(fire_elemental_totem) >20 and not TotemPresent(fire) Spell(searing_totem)
-	Spell(lightning_bolt)
-
-}
-AddIcon mastery=1 help=offgcd
-{
-	if target.IsInterruptible() Spell(wind_shear)
-}
-AddIcon mastery=1 help=aoe
-{
-
-	Spell(lava_beam)
-	if not TotemPresent(fire) Spell(magma_totem)
-	if Enemies() <=2 and not TotemPresent(fire) Spell(searing_totem)
-	if Enemies() <3 and target.DebuffRemains(flame_shock) >CastTime(lava_burst) and SpellCooldown(lava_burst) Spell(lava_burst)
-	if not target.DebuffPresent(flame_shock) and Enemies() <3 Spell(flame_shock)
-	Spell(earthquake)
-	if ManaPercent() <80 Spell(thunderstorm)
-	if ManaPercent() >10 Spell(chain_lightning)
-	Spell(lightning_bolt)
-
-}
-AddIcon mastery=1 help=cd
-{
-	if target.HealthPercent() <25 or TimeInCombat() >5 { Spell(bloodlust) Spell(heroism) }
-	if not TotemPresent(air) and not BuffPresent(stormlash) and {BuffPresent(bloodlust any=1) or TimeInCombat() >=60 } Spell(stormlash_totem)
-	if BuffPresent(bloodlust any=1) or BuffPresent(ascendance) or {{SpellCooldown(ascendance) >10 or Level() <87 } and SpellCooldown(fire_elemental_totem) >10 } Spell(blood_fury)
-	if TalentPoints(elemental_mastery_talent) and {TimeInCombat() >15 and {{not BuffPresent(bloodlust any=1) and TimeInCombat() <120 } or {not BuffPresent(berserking) and not BuffPresent(bloodlust any=1) and BuffPresent(ascendance) } or {TimeInCombat() >=200 and {SpellCooldown(ascendance) >30 or Level() <87 } } } } Spell(elemental_mastery)
-	if not TotemPresent(fire) Spell(fire_elemental_totem)
-	if Enemies() >1 or {target.DebuffRemains(flame_shock) >BuffDuration(ascendance) and {target.DeadIn() <20 or BuffPresent(bloodlust any=1) or TimeInCombat() >=60 } and SpellCooldown(lava_burst) >0 } Spell(ascendance)
-
-	if {{SpellCooldown(ascendance) >10 or Level() <87 } and SpellCooldown(fire_elemental_totem) >10 } or BuffPresent(ascendance) or BuffPresent(bloodlust any=1) or TotemPresent(fire)  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if TalentPoints(ancestral_swiftness_talent) and not BuffPresent(ascendance) Spell(ancestral_swiftness)
-	if BuffPresent(ascendance) Spell(spiritwalkers_grace)
-	if not TotemPresent(earth) and SpellCooldown(fire_elemental_totem) >=60 Spell(earth_elemental_totem)
-	if {{TalentPoints(elemental_blast_talent) and SpellCooldown(elemental_blast) ==0 } or {SpellCooldown(lava_burst) ==0 and not BuffStacks(lava_surge) } } or {BuffDuration(raid_movement) >=SpellCooldown(unleash_elements) +SpellCooldown(earth_shock) } Spell(spiritwalkers_grace)
-
-}
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		if WeaponEnchantExpires(mainhand) main.Spell(windfury_weapon)
-		if WeaponEnchantExpires(offhand) off.Spell(flametongue_weapon)
-		if not BuffPresent(lightning_shield) Spell(lightning_shield)
-	}
-
-	if not TotemPresent(fire) Spell(searing_totem)
-	if TalentPoints(unleashed_fury_talent) Spell(unleash_elements)
-	if TalentPoints(elemental_blast_talent) and BuffStacks(maelstrom_weapon) >=1 Spell(elemental_blast)
-	if BuffStacks(maelstrom_weapon) ==5 or {ArmorSetParts(T13 more 4) ==1 and BuffStacks(maelstrom_weapon) >=4 and False() } Spell(lightning_bolt)
-	Spell(stormblast)
-	Spell(stormstrike)
-	if BuffPresent(unleash_flame) and not target.DebuffPresent(flame_shock) Spell(flame_shock)
-	Spell(lava_lash)
-	if ArmorSetParts(T15 more 2) ==1 and BuffStacks(maelstrom_weapon) >=4 and not BuffPresent(ascendance) Spell(lightning_bolt)
-	if BuffPresent(unleash_flame) or {not BuffPresent(unleash_flame) and not target.DebuffPresent(flame_shock) and SpellCooldown(unleash_elements) >5 } Spell(flame_shock)
-	Spell(unleash_elements)
-	if BuffStacks(maelstrom_weapon) >=3 and not BuffPresent(ascendance) Spell(lightning_bolt)
-	if BuffPresent(ancestral_swiftness) Spell(lightning_bolt)
-	if BuffPresent(unleash_flame) and target.DebuffRemains(flame_shock) <=3 Spell(flame_shock)
-	Spell(earth_shock)
-	if BuffStacks(maelstrom_weapon) >1 and not BuffPresent(ascendance) Spell(lightning_bolt)
-
-}
-AddIcon mastery=2 help=offgcd
-{
-	if target.IsInterruptible() Spell(wind_shear)
-}
-AddIcon mastery=2 help=aoe
-{
-
-	if not TotemPresent(fire) Spell(magma_totem)
-	if Enemies() <=5 and not TotemPresent(fire) Spell(searing_totem)
-	if {Enemies() <=5 and DebuffCount(flame_shock) ==Enemies() } or DebuffCount(flame_shock) >=5 Spell(fire_nova)
-	if target.DebuffPresent(flame_shock) Spell(lava_lash)
-	if BuffStacks(maelstrom_weapon) >=3 Spell(chain_lightning)
-	Spell(unleash_elements)
-	if not target.DebuffPresent(flame_shock) Spell(flame_shock)
-	Spell(stormblast)
-	Spell(stormstrike)
-	if BuffStacks(maelstrom_weapon) ==5 and SpellCooldown(chain_lightning) >=2 Spell(lightning_bolt)
-	if BuffStacks(maelstrom_weapon) >1 Spell(chain_lightning)
-	if BuffStacks(maelstrom_weapon) >1 and not BuffPresent(ascendance) Spell(lightning_bolt)
-
-}
-AddIcon mastery=2 help=cd
-{
-	if target.HealthPercent() <25 or TimeInCombat() >5 { Spell(bloodlust) Spell(heroism) }
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	if not TotemPresent(air) and not BuffPresent(stormlash) and {BuffPresent(bloodlust any=1) or TimeInCombat() >=60 } Spell(stormlash_totem)
-	Spell(blood_fury)
-	if TalentPoints(elemental_mastery_talent) and {not Glyph(55455) or SpellCooldown(fire_elemental_totem) ==0 or SpellCooldown(fire_elemental_totem) >70 } Spell(elemental_mastery)
-	if not TotemPresent(fire) and {BuffPresent(bloodlust any=1) or BuffPresent(lifeblood) or BuffPresent(elemental_mastery) } or TimeInCombat() >=60 Spell(fire_elemental_totem)
-	if not TotemPresent(fire) and target.DeadIn() <=0 +10 Spell(fire_elemental_totem)
-	if SpellCooldown(strike) >=3 Spell(ascendance)
-
-	if ArmorSetParts(T15 more 4) ==1 Spell(feral_spirit)
-	if TalentPoints(ancestral_swiftness_talent) and BuffStacks(maelstrom_weapon) <2 Spell(ancestral_swiftness)
-	Spell(feral_spirit)
-	if not TotemPresent(earth) and SpellCooldown(fire_elemental_totem) >=50 Spell(earth_elemental_totem)
-	Spell(spiritwalkers_grace)
-
-}
-]]
-
-	OvaleScripts:RegisterScript("SHAMAN", name, desc, code)
-end
diff --git a/class/Warlock.lua b/class/Warlock.lua
deleted file mode 100644
index eea6ab4..0000000
--- a/class/Warlock.lua
+++ /dev/null
@@ -1,310 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Affliction, Demonology, Destruction"
-	local code = [[
-Define(agony 980)
-  SpellInfo(agony duration=24 tick=2 haste=spell )
-  SpellAddTargetDebuff(agony agony=1)
-Define(backdraft 117896)
-Define(blood_fury 20572)
-  SpellInfo(blood_fury duration=15 cd=120 )
-  SpellAddBuff(blood_fury blood_fury=1)
-Define(chaos_bolt 116858)
-  SpellInfo(chaos_bolt burningembers=10 tick=1 haste=spell )
-  SpellAddTargetDebuff(chaos_bolt chaos_bolt=1)
-Define(conflagrate 17962)
-  SpellInfo(conflagrate duration=5 )
-  SpellAddBuff(conflagrate conflagrate=1)
-Define(corruption 172)
-  SpellInfo(corruption duration=18 tick=2 haste=spell stance=0)
-  SpellAddTargetDebuff(corruption corruption=1)
-Define(curse_of_the_elements 1490)
-  SpellInfo(curse_of_the_elements duration=300 )
-  SpellAddTargetDebuff(curse_of_the_elements aura_of_the_elements=1)
-Define(dark_intent 109773)
-  SpellInfo(dark_intent duration=3600 )
-  SpellAddBuff(dark_intent dark_intent=1)
-Define(dark_soul_instability 113858)
-  SpellInfo(dark_soul_instability duration=20 cd=120 )
-  SpellAddBuff(dark_soul_instability dark_soul_instability=1)
-Define(dark_soul_knowledge 113861)
-  SpellInfo(dark_soul_knowledge duration=20 cd=120 )
-  SpellAddBuff(dark_soul_knowledge dark_soul_knowledge=1)
-Define(dark_soul_misery 113860)
-  SpellInfo(dark_soul_misery duration=20 cd=120 )
-  SpellAddBuff(dark_soul_misery dark_soul_misery=1)
-Define(doom 603)
-  SpellInfo(doom duration=60 demonicfury=60 tick=15 haste=spell stance=1)
-  SpellAddTargetDebuff(doom doom=1)
-Define(drain_soul 1120)
-  SpellInfo(drain_soul duration=12 tick=2 haste=spell canStopChannelling=1 )
-  SpellAddTargetDebuff(drain_soul drain_soul=1)
-Define(fel_flame 77799)
-Define(felstorm 89751)
-  SpellInfo(felstorm duration=6 energy=60 cd=45 )
-  SpellAddBuff(felstorm felstorm=1)
-Define(fire_and_brimstone 108683)
-  SpellInfo(fire_and_brimstone burningembers=10 cd=1 )
-  SpellAddBuff(fire_and_brimstone fire_and_brimstone=1)
-Define(grimoire_of_sacrifice 108503)
-  SpellInfo(grimoire_of_sacrifice duration=3600 cd=30 )
-  SpellAddBuff(grimoire_of_sacrifice grimoire_of_sacrifice=1)
-Define(hand_of_guldan 105174)
-  SpellInfo(hand_of_guldan stance=0)
-Define(haunt 48181)
-  SpellInfo(haunt duration=8 tick=2 shards=1 )
-  SpellAddBuff(haunt haunt=1)
-Define(havoc 80240)
-  SpellInfo(havoc duration=15 cd=25 )
-  SpellAddBuff(havoc havoc=1)
-Define(hellfire 1949)
-  SpellInfo(hellfire duration=14 tick=1 haste=spell canStopChannelling=1 )
-  SpellAddTargetDebuff(hellfire hellfire=1)
-Define(immolate 348)
-  SpellInfo(immolate duration=15 tick=3 haste=spell )
-  SpellAddTargetDebuff(immolate immolate=1)
-Define(immolate_aoe 108686)
-  SpellInfo(immolate_aoe duration=15 tick=3 haste=spell )
-SpellList(immolate_debuff immolate immolate_aoe)
-Define(immolation_aura 104025)
-  SpellInfo(immolation_aura duration=10 demonicfury=0 stance=1)
-  SpellAddBuff(immolation_aura immolation_aura=1)
-Define(incinerate 29722)
-Define(life_tap 1454)
-  SpellInfo(life_tap mana=-15 )
-  SpellAddBuff(life_tap life_tap=1)
-Define(malefic_grasp 103103)
-  SpellInfo(malefic_grasp duration=4 tick=1 haste=spell canStopChannelling=1 )
-  SpellAddTargetDebuff(malefic_grasp malefic_grasp=1)
-Define(melee 103988)
-  SpellInfo(melee stance=1)
-Define(metamorphosis 103958)
-  SpellInfo(metamorphosis demonicfury=0 cd=10 )
-  SpellAddBuff(metamorphosis metamorphosis=1)
-Define(molten_core 122355)
-  SpellInfo(molten_core duration=30 )
-  SpellAddBuff(molten_core molten_core=1)
-Define(rain_of_fire 5740)
-  SpellInfo(rain_of_fire duration=6 )
-  SpellAddBuff(rain_of_fire rain_of_fire=1)
-Define(rain_of_fire_aftermath 104232)
-Define(seed_of_corruption 27243)
-  SpellInfo(seed_of_corruption duration=18 tick=3 haste=spell )
-  SpellAddTargetDebuff(seed_of_corruption seed_of_corruption=1)
-Define(service_felguard 111898)
-  SpellInfo(service_felguard cd=120 )
-Define(service_felhunter 111897)
-  SpellInfo(service_felhunter cd=120 )
-Define(shadow_bolt 686)
-  SpellInfo(shadow_bolt demonicfury=40 stance=0)
-Define(shadowburn 17877)
-  SpellInfo(shadowburn burningembers=10 )
-Define(shadowflame 47960)
-  SpellInfo(shadowflame duration=6 tick=1 haste=spell )
-  SpellAddTargetDebuff(shadowflame shadowflame=1)
-Define(skull_banner 114207)
-  SpellInfo(skull_banner duration=10 cd=180 )
-Define(soul_fire 6353)
-  SpellAddBuff(soul_fire molten_core=-1)
-Define(soul_swap 86121)
-Define(soulburn 74434)
-  SpellInfo(soulburn duration=30 shards=1 cd=1 )
-  SpellAddBuff(soulburn soulburn=1)
-Define(soulburn_seed_of_corruption 86664)
-Define(summon_doomguard 18540)
-  SpellInfo(summon_doomguard cd=600 )
-Define(summon_felguard 30146)
-  SpellInfo(summon_felguard demonicfury=0 )
-Define(summon_felhunter 691)
-  SpellInfo(summon_felhunter demonicfury=0 )
-Define(summon_infernal 1122)
-  SpellInfo(summon_infernal cd=600 )
-Define(touch_of_chaos 103964)
-  SpellInfo(touch_of_chaos demonicfury=40 stance=1)
-Define(unstable_affliction 30108)
-  SpellInfo(unstable_affliction duration=14 tick=2 haste=spell )
-  SpellAddTargetDebuff(unstable_affliction unstable_affliction=1)
-Define(void_ray 115422)
-  SpellInfo(void_ray demonicfury=40 )
-Define(wrathstorm 115831)
-  SpellInfo(wrathstorm duration=6 energy=60 cd=45 )
-  SpellAddBuff(wrathstorm wrathstorm=1)
-Define(grimoire_of_sacrifice_talent 15)
-Define(grimoire_of_service_talent 14)
-AddIcon mastery=1 help=main
-{
-	if not InCombat()
-	{
-		if not BuffPresent(spell_power_multiplier any=1) Spell(dark_intent)
-		if not TalentPoints(grimoire_of_sacrifice_talent) or BuffExpires(grimoire_of_sacrifice) unless pet.CreatureFamily(Felhunter) Spell(summon_felhunter)
-		if TalentPoints(grimoire_of_service_talent) Spell(service_felhunter)
-	}
-	if target.DebuffExpires(magic_vulnerability any=1) Spell(curse_of_the_elements)
-	if TalentPoints(grimoire_of_service_talent) Spell(service_felhunter)
-	if BuffPresent(soulburn) Spell(soul_swap)
-	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt) <CastTime(haunt) +1 +TickTime(haunt) and SoulShards() and target.HealthPercent() <=20 Spell(haunt)
-	if BuffExpires(dark_soul_misery) and BuffExpires(bloodlust any=1) and ManaPercent() <10 and target.HealthPercent() <=20 Spell(life_tap)
-	if target.HealthPercent() <=20 Spell(drain_soul)
-	if target.HealthPercent() <=20 Spell(life_tap)
-	if target.DebuffRemains(agony) <GCD() and target.DebuffRemains(agony) +2 <SpellCooldown(dark_soul_misery) Spell(agony)
-	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt) <CastTime(haunt) +1 +TickTime(haunt) and {SoulShards() >2 or SpellCooldown(dark_soul_misery) >35 or {SoulShards() >1 and SpellCooldown(dark_soul_misery) <CastTime(haunt) } } and SoulShards() Spell(haunt)
-	if target.DebuffRemains(corruption) <GCD() and target.DebuffRemains(corruption) <SpellCooldown(dark_soul_misery) Spell(corruption)
-	if target.DebuffRemains(unstable_affliction) <GCD() +CastTime(unstable_affliction) and target.DebuffRemains(unstable_affliction) <SpellCooldown(dark_soul_misery) Spell(unstable_affliction)
-	if target.TicksRemain(agony) <=2 and target.DebuffRemains(agony) +2 <SpellCooldown(dark_soul_misery) Spell(agony)
-	if target.TicksRemain(corruption) <=2 and target.DebuffRemains(corruption) <SpellCooldown(dark_soul_misery) Spell(corruption)
-	if {target.DebuffRemains(unstable_affliction) -CastTime(unstable_affliction) } /{BuffDuration(unstable_affliction) /Ticks(unstable_affliction) } <=2 and target.DebuffRemains(unstable_affliction) <SpellCooldown(dark_soul_misery) Spell(unstable_affliction)
-	if SpellPower() >LastSpellSpellPower(agony) and target.TicksRemain(agony) <Ticks(agony) /2 and target.DebuffRemains(agony) +2 <SpellCooldown(dark_soul_misery) Spell(agony)
-	if SpellPower() >LastSpellSpellPower(corruption) and target.TicksRemain(corruption) <Ticks(corruption) /2 and target.DebuffRemains(corruption) <SpellCooldown(dark_soul_misery) Spell(corruption)
-	if SpellPower() >LastSpellSpellPower(unstable_affliction) and target.TicksRemain(unstable_affliction) <Ticks(unstable_affliction) /2 and target.DebuffRemains(unstable_affliction) <SpellCooldown(dark_soul_misery) Spell(unstable_affliction)
-	if BuffExpires(dark_soul_misery) and BuffExpires(bloodlust any=1) and ManaPercent() <50 Spell(life_tap)
-	Spell(malefic_grasp)
-	Spell(life_tap)
-}
-AddIcon mastery=1 help=offgcd
-{
-	if not InCombat()
-	{
-		if TalentPoints(grimoire_of_sacrifice_talent) Spell(grimoire_of_sacrifice)
-	}
-	if BuffPresent(dark_soul_misery) and {target.TicksRemain(agony) <=Ticks(agony) /2 or target.TicksRemain(corruption) <=Ticks(corruption) /2 or target.TicksRemain(unstable_affliction) <=Ticks(unstable_affliction) /2 } and SoulShards() Spell(soulburn)
-	if {target.TicksRemain(unstable_affliction) <=1 or target.TicksRemain(corruption) <=1 or target.TicksRemain(agony) <=1 } and SoulShards() and target.HealthPercent() <=20 Spell(soulburn)
-	if SpellPower() >LastSpellSpellPower(unstable_affliction) and target.TicksRemain(unstable_affliction) <=Ticks(unstable_affliction) /2 and SoulShards() and target.HealthPercent() <=20 Spell(soulburn)
-}
-AddIcon mastery=1 help=moving
-{
-	if ManaPercent() <80 and ManaPercent() <target.HealthPercent() Spell(life_tap)
-	Spell(fel_flame)
-}
-AddIcon mastery=1 help=aoe
-{
-
-	if BuffExpires(soulburn) and not target.DebuffPresent(soulburn_seed_of_corruption) and not InFlightToTarget(soulburn_seed_of_corruption) and SoulShards() Spell(soulburn)
-	if BuffPresent(soulburn) and not target.DebuffPresent(agony) and not target.DebuffPresent(corruption) Spell(soul_swap)
-	if BuffPresent(soulburn) and target.DebuffPresent(corruption) and not target.DebuffPresent(agony) Spell(soul_swap)
-	if {BuffExpires(soulburn) and not InFlightToTarget(seed_of_corruption) and not target.DebuffPresent(seed_of_corruption) } or {BuffPresent(soulburn) and not target.DebuffPresent(soulburn_seed_of_corruption) and not InFlightToTarget(soulburn_seed_of_corruption) } Spell(seed_of_corruption)
-	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt) <CastTime(haunt) +1 and SoulShards() Spell(haunt)
-	if ManaPercent() <70 Spell(life_tap)
-	if not InFlightToTarget(fel_flame) Spell(fel_flame)
-
-}
-AddIcon mastery=1 help=cd
-{
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	Spell(blood_fury)
-	Spell(dark_soul_misery)
-	Spell(summon_doomguard)
-}
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		if not BuffPresent(spell_power_multiplier any=1) Spell(dark_intent)
-		if not TalentPoints(grimoire_of_sacrifice_talent) or BuffExpires(grimoire_of_sacrifice) unless pet.CreatureFamily(Felguard) Spell(summon_felguard)
-		if TalentPoints(grimoire_of_service_talent) Spell(service_felguard)
-	}
-	if target.DebuffExpires(magic_vulnerability any=1) Spell(curse_of_the_elements)
-	if TalentPoints(grimoire_of_service_talent) Spell(service_felguard)
-	if BuffPresent(metamorphosis) and target.DebuffPresent(corruption) and target.DebuffRemains(corruption) <1.5 Spell(touch_of_chaos)
-	if BuffPresent(metamorphosis) and {target.TicksRemain(doom) <=1 or {target.TicksRemain(doom) +1 <Ticks(doom) and BuffPresent(dark_soul_knowledge) } } and target.DeadIn() >=30 Spell(doom)
-	if BuffPresent(metamorphosis) and target.DebuffPresent(corruption) and target.DebuffRemains(corruption) <20 Spell(touch_of_chaos)
-	if BuffPresent(metamorphosis) and BuffExpires(dark_soul_knowledge) and DemonicFury() <=650 and target.DeadIn() >30 if Stance(1) cancel.Texture(Spell_shadow_demonform)
-	if BuffPresent(metamorphosis) and BuffStacks(molten_core) and {BuffRemains(dark_soul_knowledge) <CastTime(shadow_bolt) or BuffRemains(dark_soul_knowledge) >CastTime(soul_fire) } Spell(soul_fire)
-	if BuffPresent(metamorphosis) Spell(touch_of_chaos)
-	if not target.DebuffPresent(corruption) and target.DeadIn() >=6 Spell(corruption)
-	if not InFlightToTarget(hand_of_guldan) and target.DebuffRemains(shadowflame) <1 +CastTime(shadow_bolt) Spell(hand_of_guldan)
-	if BuffStacks(molten_core) and {BuffRemains(dark_soul_knowledge) <CastTime(shadow_bolt) or BuffRemains(dark_soul_knowledge) >CastTime(soul_fire) } Spell(soul_fire)
-	if ManaPercent() <60 Spell(life_tap)
-	Spell(shadow_bolt)
-	Spell(life_tap)
-}
-AddIcon mastery=2 help=offgcd
-{
-	if not InCombat()
-	{
-		if TalentPoints(grimoire_of_sacrifice_talent) Spell(grimoire_of_sacrifice)
-	}
-	Spell(melee)
-	Spell(felstorm)
-	Spell(wrathstorm)
-	if {BuffPresent(dark_soul_knowledge) and DemonicFury() /32 >BuffRemains(dark_soul_knowledge) } or target.DebuffRemains(corruption) <5 or not target.DebuffPresent(doom) or DemonicFury() >=950 or DemonicFury() /32 >target.DeadIn() unless Stance(1) Spell(metamorphosis)
-}
-AddIcon mastery=2 help=moving
-{
-	Spell(fel_flame)
-}
-AddIcon mastery=2 help=aoe
-{
-
-	if BuffPresent(metamorphosis) and target.DebuffRemains(corruption) >10 and DemonicFury() <=650 and BuffExpires(dark_soul_knowledge) and not target.DebuffPresent(immolation_aura) if Stance(1) cancel.Texture(Spell_shadow_demonform)
-	if BuffPresent(metamorphosis) Spell(immolation_aura)
-	if BuffPresent(metamorphosis) and target.DebuffRemains(corruption) <10 Spell(void_ray)
-	if BuffPresent(metamorphosis) and {not target.DebuffPresent(doom) or target.DebuffRemains(doom) <TickTime(doom) or {target.TicksRemain(doom) +1 <Ticks(doom) and BuffPresent(dark_soul_knowledge) } } and target.DeadIn() >=30 Spell(doom)
-	if BuffPresent(metamorphosis) Spell(void_ray)
-	if not target.DebuffPresent(corruption) and target.DeadIn() >30 Spell(corruption)
-	Spell(hand_of_guldan)
-	if target.DebuffRemains(corruption) <10 or BuffPresent(dark_soul_knowledge) or DemonicFury() >=950 or DemonicFury() /32 >target.DeadIn() unless Stance(1) Spell(metamorphosis)
-	Spell(hellfire)
-	Spell(life_tap)
-
-}
-AddIcon mastery=2 help=cd
-{
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	Spell(blood_fury)
-	Spell(dark_soul_knowledge)
-	Spell(summon_doomguard)
-}
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		if not BuffPresent(spell_power_multiplier any=1) Spell(dark_intent)
-		if not TalentPoints(grimoire_of_sacrifice_talent) or BuffExpires(grimoire_of_sacrifice) unless pet.CreatureFamily(Felhunter) Spell(summon_felhunter)
-		if TalentPoints(grimoire_of_service_talent) Spell(service_felhunter)
-	}
-	if target.DebuffExpires(magic_vulnerability any=1) Spell(curse_of_the_elements)
-	if TalentPoints(grimoire_of_service_talent) Spell(service_felhunter)
-	if BurningEmbers() if target.HealthPercent(less 20) Spell(shadowburn)
-	if {target.TicksRemain(immolate_debuff) <Ticks(immolate-debuff) /2 or target.DebuffExpires(immolate_debuff) } and target.DeadIn() >=5 Spell(immolate)
-	if Charges(conflagrate) ==2 Spell(conflagrate)
-	if not target.DebuffPresent(rain_of_fire_aftermath) and not InFlightToTarget(rain_of_fire_aftermath) Spell(rain_of_fire_aftermath)
-	if BurningEmbers() and {BuffStacks(backdraft) <3 or Level() <86 } and {{BurningEmbers() / 10} >3.5 or BuffRemains(dark_soul_instability) >CastTime(chaos_bolt) or BuffRemains(skull_banner) >CastTime(chaos_bolt) } Spell(chaos_bolt)
-	Spell(conflagrate)
-	Spell(incinerate)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if not InCombat()
-	{
-		if TalentPoints(grimoire_of_sacrifice_talent) Spell(grimoire_of_sacrifice)
-	}
-}
-AddIcon mastery=3 help=aoe
-{
-
-	if not target.DebuffPresent(rain_of_fire_aftermath) and not InFlightToTarget(rain_of_fire_aftermath) Spell(rain_of_fire_aftermath)
-	if {BurningEmbers() / 10} >=3.5 and BurningEmbers() and target.HealthPercent() <=20 focus.Spell(havoc)
-	if {BurningEmbers() / 10} >=3.5 and BurningEmbers() and BuffStacks(havoc) >=1 if target.HealthPercent(less 20) Spell(shadowburn)
-	if BurningEmbers() and BuffExpires(fire_and_brimstone) Spell(fire_and_brimstone)
-	if BuffPresent(fire_and_brimstone) and not target.DebuffPresent(immolate_debuff) Spell(immolate)
-	if BuffPresent(fire_and_brimstone) Spell(conflagrate)
-	if BuffPresent(fire_and_brimstone) Spell(incinerate)
-	if not target.DebuffPresent(immolate_debuff) Spell(immolate)
-
-	if not target.DebuffPresent(rain_of_fire_aftermath) and not InFlightToTarget(rain_of_fire_aftermath) Spell(rain_of_fire_aftermath)
-	focus.Spell(havoc)
-}
-AddIcon mastery=3 help=cd
-{
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-	Spell(blood_fury)
-	Spell(dark_soul_instability)
-	Spell(summon_doomguard)
-}
-]]
-
-	OvaleScripts:RegisterScript("WARLOCK", name, desc, code)
-end
diff --git a/class/Warrior.lua b/class/Warrior.lua
deleted file mode 100644
index 7754a9f..0000000
--- a/class/Warrior.lua
+++ /dev/null
@@ -1,284 +0,0 @@
-local _, Ovale = ...
-local OvaleScripts = Ovale.OvaleScripts
-
-do
-	local name = "Ovale"
-	local desc = "[5.2] Ovale: Arms, Fury, Protection"
-	local code = [[
-Define(avatar 107574)
-  SpellInfo(avatar duration=24 cd=180 )
-  SpellAddBuff(avatar avatar=1)
-Define(battle_shout 6673)
-  SpellInfo(battle_shout duration=300 cd=60 )
-  SpellAddBuff(battle_shout battle_shout=1)
-Define(battle_stance 2457)
-  SpellInfo(battle_stance cd=3 )
-Define(berserker_rage 18499)
-  SpellInfo(berserker_rage duration=6 cd=30 )
-  SpellAddBuff(berserker_rage berserker_rage=1)
-Define(bladestorm 46924)
-  SpellInfo(bladestorm duration=6 cd=90 )
-  SpellAddBuff(bladestorm bladestorm=1)
-Define(bloodbath 113344)
-  SpellInfo(bloodbath duration=6 tick=1 )
-  SpellAddTargetDebuff(bloodbath bloodbath=1)
-Define(bloodsurge 46916)
-  SpellInfo(bloodsurge duration=10)
-Define(bloodthirst 23881)
-  SpellInfo(bloodthirst rage=-10 cd=4.5 )
-Define(cleave 845)
-  SpellInfo(cleave rage=30 cd=1.5 )
-Define(colossus_smash 86346)
-  SpellInfo(colossus_smash duration=6.5 cd=20 )
-  SpellAddTargetDebuff(colossus_smash colossus_smash=1)
-Define(defensive_stance 71)
-  SpellInfo(defensive_stance cd=3 )
-Define(demoralizing_shout 1160)
-  SpellInfo(demoralizing_shout duration=10 cd=60 )
-  SpellAddTargetDebuff(demoralizing_shout demoralizing_shout=1)
-Define(devastate 20243)
-Define(dragon_roar 118000)
-  SpellInfo(dragon_roar cd=60 )
-Define(enrage 5229)
-  SpellInfo(enrage duration=10 rage=-20 cd=60 )
-  SpellAddBuff(enrage enrage=1)
-Define(execute 5308)
-  SpellInfo(execute rage=30 )
-Define(heroic_leap 6544)
-  SpellInfo(heroic_leap duration=1 cd=45 )
-  AddCheckBox(heroic_leap_check SpellName(heroic_leap))
-Define(heroic_strike 78)
-  SpellInfo(heroic_strike rage=30 cd=1.5 )
-Define(heroic_throw 57755)
-  SpellInfo(heroic_throw cd=30 )
-Define(impending_victory 103840)
-  SpellInfo(impending_victory rage=10 cd=30 )
-Define(last_stand 12975)
-  SpellInfo(last_stand duration=20 cd=180 )
-  SpellAddBuff(last_stand last_stand=1)
-Define(meat_cleaver 85739)
-  SpellInfo(meat_cleaver duration=10 )
-  SpellAddBuff(meat_cleaver meat_cleaver=1)
-Define(mortal_strike 12294)
-  SpellInfo(mortal_strike duration=10 rage=-10 cd=6 )
-  SpellAddTargetDebuff(mortal_strike mortal_wounds=1)
-Define(overpower 7384)
-  SpellInfo(overpower rage=10 )
-  SpellAddBuff(overpower taste_for_blood=-1)
-Define(pummel 6552)
-  SpellInfo(pummel duration=4 cd=15 )
-Define(raging_blow 85288)
-  SpellInfo(raging_blow rage=10 )
-  SpellAddBuff(raging_blow raging_blow_aura=-1)
-Define(raging_blow_aura 131116)
-  SpellInfo(raging_blow_aura duration=12 )
-  SpellAddBuff(raging_blow_aura raging_blow_aura=1)
-Define(recklessness 1719)
-  SpellInfo(recklessness duration=12 cd=180 )
-  SpellAddBuff(recklessness recklessness=1)
-Define(revenge 6572)
-  SpellInfo(revenge rage=-15 cd=9 )
-Define(shield_barrier 112048)
-  SpellInfo(shield_barrier duration=6 rage=20 cd=1.5 )
-  SpellAddBuff(shield_barrier shield_barrier=1)
-Define(shield_block 2565)
-  SpellInfo(shield_block rage=60 cd=1.5 )
-  SpellAddTargetDebuff(shield_block shield_block_aura=1)
-Define(shield_block_aura 132404)
-  SpellInfo(shield_block_aura duration=6 )
-  SpellAddBuff(shield_block_aura shield_block_aura=1)
-Define(shield_slam 23922)
-  SpellInfo(shield_slam rage=-20 cd=6 )
-Define(shield_wall 871)
-  SpellInfo(shield_wall duration=12 cd=300 )
-  SpellAddBuff(shield_wall shield_wall=1)
-Define(shockwave 46968)
-  SpellInfo(shockwave cd=40 )
-  SpellAddBuff(shockwave shockwave=1)
-Define(skull_banner 114207)
-  SpellInfo(skull_banner duration=10 cd=180 )
-Define(slam 1464)
-  SpellInfo(slam rage=20 )
-Define(storm_bolt 107570)
-  SpellInfo(storm_bolt cd=30 )
-  SpellAddBuff(storm_bolt storm_bolt=1)
-Define(sudden_execute 139958)
-  SpellInfo(sudden_execute duration=10 )
-  SpellAddBuff(sudden_execute sudden_execute=1)
-Define(sunder_armor 7386)
-  SpellInfo(sunder_armor rage=15 )
-  SpellAddTargetDebuff(sunder_armor weakened_armor=1)
-  AddCheckBox(sunder_armor_check SpellName(sunder_armor))
-Define(sweeping_strikes 12328)
-  SpellInfo(sweeping_strikes duration=10 rage=30 cd=10 )
-  SpellAddBuff(sweeping_strikes sweeping_strikes=1)
-Define(taste_for_blood 56636)
-Define(thunder_clap 6343)
-  SpellInfo(thunder_clap rage=20 cd=6 )
-  SpellAddTargetDebuff(thunder_clap weakened_blows=1)
-Define(ultimatum 122510)
-  SpellInfo(ultimatum duration=10 )
-  SpellAddBuff(ultimatum ultimatum=1)
-Define(weakened_armor 113746)
-  SpellInfo(weakened_armor duration=30 )
-  SpellAddBuff(weakened_armor weakened_armor=1)
-Define(weakened_blows 115798)
-  SpellInfo(weakened_blows duration=30 )
-  SpellAddBuff(weakened_blows weakened_blows=1)
-Define(whirlwind 1680)
-  SpellInfo(whirlwind rage=30 )
-Define(wild_strike 100130)
-  SpellInfo(wild_strike rage=30 )
-  SpellAddBuff(wild_strike bloodsurge=-1)
-  SpellAddTargetDebuff(wild_strike wild_strike=1)
-Define(avatar_talent 16)
-Define(bloodbath_talent 17)
-Define(dragon_roar_talent 12)
-Define(impending_victory_talent 6)
-Define(shockwave_talent 11)
-Define(storm_bolt_talent 18)
-AddCheckBox(showwait L(showwait) default)
-AddIcon mastery=1 help=main
-{
-	if not InCombat()
-	{
-		unless Stance(1) Spell(battle_stance)
-	}
-	if target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 if CheckBoxOn(sunder_armor_check) Spell(sunder_armor)
-	Spell(mortal_strike)
-	if TalentPoints(dragon_roar_talent) and TalentPoints(bloodbath_talent) and BuffPresent(bloodbath) and target.DebuffExpires(colossus_smash) and target.HealthPercent() >=20 Spell(dragon_roar)
-	if TalentPoints(storm_bolt_talent) and target.DebuffPresent(colossus_smash) Spell(storm_bolt)
-	if target.DebuffRemains(colossus_smash) <1 Spell(colossus_smash)
-	if target.DebuffPresent(colossus_smash) or BuffPresent(recklessness) or Rage() >=Rage() -25 if target.HealthPercent(less 20) Spell(execute)
-	if TalentPoints(dragon_roar_talent) and {TalentPoints(bloodbath_talent) and BuffPresent(bloodbath) and target.HealthPercent() >=20 } or {target.DebuffExpires(colossus_smash) and target.HealthPercent() <20 } Spell(dragon_roar)
-	if target.DebuffPresent(colossus_smash) and {target.DebuffRemains(colossus_smash) <1 or BuffPresent(recklessness) } and target.HealthPercent() >=20 Spell(slam)
-	if BuffStacks(taste_for_blood) >=3 and target.HealthPercent() >=20 Spell(overpower usable=1)
-	if target.DebuffPresent(colossus_smash) and target.DebuffRemains(colossus_smash) <2.5 and target.HealthPercent() >=20 Spell(slam)
-	if BuffExpires(sudden_execute) if target.HealthPercent(less 20) Spell(execute)
-	if target.HealthPercent() >=20 or BuffPresent(sudden_execute) Spell(overpower usable=1)
-	if Rage() >=40 and target.HealthPercent() >=20 Spell(slam)
-	Spell(battle_shout)
-	Spell(heroic_throw)
-}
-AddIcon mastery=1 help=offgcd
-{
-	if target.IsInterruptible() Spell(pummel)
-	if TalentPoints(bloodbath_talent) and {target.DeadIn() <=18 or BuffPresent(recklessness) or target.DeadIn() >=75 } Spell(bloodbath)
-	if BuffExpires(enrage) and Rage() <=Rage() -10 Spell(berserker_rage)
-	if target.DebuffPresent(colossus_smash) if CheckBoxOn(heroic_leap_check) Spell(heroic_leap)
-	if {target.DebuffPresent(colossus_smash) and Rage() >=Rage() -40 and target.HealthPercent() >=20 } or Rage() >=Rage() -15 Spell(heroic_strike)
-}
-AddIcon mastery=1 help=aoe
-{
-
-	Spell(dragon_roar)
-	Spell(shockwave)
-	Spell(whirlwind)
-	Spell(sweeping_strikes)
-	if Rage() >=90 Spell(cleave)
-	Spell(bloodthirst)
-
-}
-AddIcon mastery=1 help=cd
-{
-	if target.DeadIn() <=18 or {{target.DeadIn() >=186 or {target.HealthPercent() <20 and {target.DebuffRemains(colossus_smash) >=5 or SpellCooldown(colossus_smash) <=1.5 } } } and {not TalentPoints(bloodbath_talent) or not SpellCooldown(bloodbath) } } Spell(recklessness)
-	if TalentPoints(avatar_talent) and {BuffPresent(recklessness) or target.DeadIn() <=25 } Spell(avatar)
-	if BuffPresent(recklessness) Spell(skull_banner)
-	if TalentPoints(bloodbath_talent) and BuffPresent(bloodbath)  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-}
-AddIcon mastery=2 help=main
-{
-	if not InCombat()
-	{
-		unless Stance(1) Spell(battle_stance)
-	}
-	if target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 if CheckBoxOn(sunder_armor_check) Spell(sunder_armor)
-	if BuffStacks(raging_blow_aura) ==2 and target.DebuffPresent(colossus_smash) and target.HealthPercent() >=20 Spell(raging_blow)
-	if not {target.HealthPercent() <20 and target.DebuffPresent(colossus_smash) and Rage() >=30 } Spell(bloodthirst)
-	if BuffStacks(bloodsurge) and target.HealthPercent() >=20 and SpellCooldown(bloodthirst) <=1 Spell(wild_strike)
-	if not {target.HealthPercent() <20 and target.DebuffPresent(colossus_smash) and Rage() >=30 } and SpellCooldown(bloodthirst) <=1 and SpellCooldown(bloodthirst) if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
-	if TalentPoints(dragon_roar_talent) and {not target.DebuffPresent(colossus_smash) and {BuffPresent(bloodbath) or not TalentPoints(bloodbath_talent) } } Spell(dragon_roar)
-	Spell(colossus_smash)
-	if BuffPresent(enrage) or target.DebuffPresent(colossus_smash) or Rage() >90 or target.DeadIn() <12 or BuffPresent(recklessness) if target.HealthPercent(less 20) Spell(execute)
-	if TalentPoints(storm_bolt_talent) Spell(storm_bolt)
-	if BuffStacks(raging_blow_aura) ==2 or {BuffPresent(raging_blow_aura) and {target.DebuffPresent(colossus_smash) or SpellCooldown(colossus_smash) >=3 or {SpellCooldown(bloodthirst) >=1 and BuffRemains(raging_blow_aura) <=3 } } } Spell(raging_blow)
-	if BuffStacks(bloodsurge) Spell(wild_strike)
-	if TalentPoints(shockwave_talent) Spell(shockwave)
-	if target.DebuffExpires(colossus_smash) Spell(heroic_throw)
-	if Rage() <70 and not target.DebuffPresent(colossus_smash) Spell(battle_shout)
-	if target.DebuffPresent(colossus_smash) and target.HealthPercent() >=20 Spell(wild_strike)
-	if TalentPoints(impending_victory_talent) and target.HealthPercent() >=20 Spell(impending_victory)
-	if SpellCooldown(colossus_smash) >=2 and Rage() >=80 and target.HealthPercent() >=20 Spell(wild_strike)
-	if Rage() <70 Spell(battle_shout)
-}
-AddIcon mastery=2 help=offgcd
-{
-	if target.IsInterruptible() Spell(pummel)
-	if TalentPoints(bloodbath_talent) and {SpellCooldown(colossus_smash) <2 or target.DebuffRemains(colossus_smash) >=5 or target.DeadIn() <=20 } Spell(bloodbath)
-	if not {BuffStacks(enrage) or {BuffStacks(raging_blow_aura) ==2 and target.HealthPercent() >=20 } } or {BuffRemains(recklessness) >=10 and not BuffStacks(raging_blow_aura) } Spell(berserker_rage)
-	if target.DebuffPresent(colossus_smash) if CheckBoxOn(heroic_leap_check) Spell(heroic_leap)
-	if {{target.DebuffPresent(colossus_smash) and Rage() >=40 } and target.HealthPercent() >=20 } or Rage() >=110 Spell(heroic_strike)
-}
-AddIcon mastery=2 help=aoe
-{
-
-	Spell(dragon_roar)
-	Spell(shockwave)
-	if BuffStacks(meat_cleaver) and BuffStacks(raging_blow_aura) Spell(raging_blow)
-	Spell(whirlwind)
-	if Rage() >=90 Spell(cleave)
-	Spell(bloodthirst)
-
-}
-AddIcon mastery=2 help=cd
-{
-	if {TalentPoints(avatar_talent) and {SpellCooldown(colossus_smash) <2 or target.DebuffRemains(colossus_smash) >=5 } } or {TalentPoints(bloodbath_talent) and {BuffPresent(bloodbath) and {target.DeadIn() >192 or target.HealthPercent() <20 } } } or target.DeadIn() <=12 Spell(recklessness)
-	if BuffPresent(recklessness) and TalentPoints(avatar_talent) Spell(avatar)
-	if BuffPresent(recklessness) Spell(skull_banner)
-	if {not TalentPoints(bloodbath_talent) and target.DebuffPresent(colossus_smash) } or {TalentPoints(bloodbath_talent) and BuffPresent(bloodbath) }  { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-}
-AddIcon mastery=3 help=main
-{
-	if not InCombat()
-	{
-		unless Stance(2) Spell(defensive_stance)
-	}
-	if Rage() <80 Spell(shield_slam)
-	if Rage() <85 Spell(revenge)
-	if Rage() <90 Spell(battle_shout)
-	if target.DebuffExpires(weakened_blows) Spell(thunder_clap)
-	if target.HealthPercent(less 20) Spell(execute)
-	Spell(devastate)
-}
-AddIcon mastery=3 help=offgcd
-{
-	if target.IsInterruptible() Spell(pummel)
-	if {BuffPresent(ultimatum) and target.HealthPercent() >=20 } Spell(heroic_strike)
-	if Rage() <90 Spell(berserker_rage)
-	if BuffExpires(shield_block_aura) Spell(shield_block)
-	if BuffExpires(shield_barrier) and Rage() >80 Spell(shield_barrier)
-	Spell(demoralizing_shout)
-}
-AddIcon mastery=3 help=aoe
-{
-
-	Spell(dragon_roar)
-	Spell(shockwave)
-	Spell(thunder_clap)
-	if BuffPresent(ultimatum) Spell(cleave)
-	if Rage() >=90 Spell(cleave)
-	Spell(shield_slam)
-
-}
-AddIcon mastery=3 help=cd
-{
-	if Health() <130000 Spell(last_stand)
-	if TalentPoints(avatar_talent) Spell(avatar)
-	Spell(recklessness)
-	if BuffExpires(shield_block_aura) Spell(shield_wall)
-	 { Item(Trinket0Slot usable=1) Item(Trinket1Slot usable=1) }
-}
-]]
-
-	OvaleScripts:RegisterScript("WARRIOR", name, desc, code)
-end
diff --git a/class/files.xml b/class/files.xml
deleted file mode 100644
index 04fc5c6..0000000
--- a/class/files.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
-	<Script file="DeathKnight.lua" />
-	<Script file="Druid.lua" />
-	<Script file="Hunter.lua" />
-	<Script file="Mage.lua" />
-	<Script file="Monk.lua" />
-	<Script file="Paladin.lua" />
-	<Script file="Priest.lua" />
-	<Script file="Rogue.lua" />
-	<Script file="Shaman.lua" />
-	<Script file="Warlock.lua" />
-	<Script file="Warrior.lua" />
-</Ui>
diff --git a/scripts/files.xml b/scripts/files.xml
new file mode 100644
index 0000000..6fcfd14
--- /dev/null
+++ b/scripts/files.xml
@@ -0,0 +1,15 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
+	<Script file="ovale_items.lua" />
+	<Script file="ovale_racials.lua" />
+
+	<Script file="ovale_druid.lua" />
+	<Script file="ovale_druid_spells.lua" />
+	<Script file="ovale_hunter.lua" />
+	<Script file="ovale_hunter_spells.lua" />
+	<Script file="ovale_monk.lua" />
+	<Script file="ovale_monk_spells.lua" />
+	<Script file="ovale_paladin.lua" />
+	<Script file="ovale_paladin_spells.lua" />
+	<Script file="ovale_shaman.lua" />
+	<Script file="ovale_shaman_spells.lua" />
+</Ui>
diff --git a/scripts/ovale_druid.lua b/scripts/ovale_druid.lua
new file mode 100644
index 0000000..a13c44e
--- /dev/null
+++ b/scripts/ovale_druid.lua
@@ -0,0 +1,635 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "Ovale"
+	local desc = "[5.4] Ovale: Balance, Feral"
+	local code = [[
+# Ovale druid script based on SimulationCraft.
+#	Last updated: 2014-04-18
+
+Include(ovale_items)
+Include(ovale_racials)
+Include(ovale_druid_spells)
+
+AddCheckBox(opt_aoe L(AOE) default)
+AddCheckBox(opt_icons_left "Left icons")
+AddCheckBox(opt_icons_right "Right icons")
+
+###
+### Balance
+###
+# Based on SimulationCraft profile "Druid_Balance_T16H".
+#	class=druid
+#	spec=balance
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#Ua!.0.1.0
+
+AddFunction BalanceDefaultActions
+{
+	#healing_touch,if=talent.dream_of_cenarius.enabled&!buff.dream_of_cenarius.up&mana.pct>25
+	if TalentPoints(dream_of_cenarius_talent) and not BuffPresent(dream_of_cenarius_caster_buff) and ManaPercent() > 25 Spell(healing_touch)
+	#starsurge,if=buff.shooting_stars.react&(active_enemies<5|!buff.solar_eclipse.up)
+	if BuffPresent(shooting_stars_buff) and not BuffPresent(solar_eclipse_buff) Spell(starsurge)
+	#moonfire,cycle_targets=1,if=buff.lunar_eclipse.up&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if BuffPresent(lunar_eclipse_buff) and { target.DebuffRemains(moonfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } } Spell(moonfire)
+	#sunfire,cycle_targets=1,if=buff.solar_eclipse.up&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if BuffPresent(solar_eclipse_buff) and { target.DebuffRemains(sunfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } } Spell(sunfire)
+	#moonfire,cycle_targets=1,if=active_enemies<5&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if target.DebuffRemains(moonfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } Spell(moonfire)
+	#sunfire,cycle_targets=1,if=active_enemies<5&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if target.DebuffRemains(sunfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } Spell(sunfire)
+	#moonfire,cycle_targets=1,if=buff.lunar_eclipse.up&ticks_remain<2
+	if BuffPresent(lunar_eclipse_buff) and target.TicksRemain(moonfire_debuff) < 2 Spell(moonfire)
+	#sunfire,cycle_targets=1,if=buff.solar_eclipse.up&ticks_remain<2
+	if BuffPresent(solar_eclipse_buff) and target.TicksRemain(sunfire_debuff) < 2 Spell(sunfire)
+	#starsurge,if=cooldown_react
+	if Spell(starsurge) Spell(starsurge)
+	#starfire,if=buff.celestial_alignment.up&cast_time<buff.celestial_alignment.remains
+	if BuffPresent(celestial_alignment_buff) and CastTime(starfire) < BuffRemains(celestial_alignment_buff) Spell(starfire)
+	#wrath,if=buff.celestial_alignment.up&cast_time<buff.celestial_alignment.remains
+	if BuffPresent(celestial_alignment_buff) and CastTime(wrath) < BuffRemains(celestial_alignment_buff) Spell(wrath)
+	#starfire,if=eclipse_dir=1|(eclipse_dir=0&eclipse>0)
+	if EclipseDir() == 1 or { EclipseDir() == 0 and Eclipse() > 0 } Spell(starfire)
+	#wrath,if=eclipse_dir=-1|(eclipse_dir=0&eclipse<=0)
+	if EclipseDir() < 0 or { EclipseDir() == 0 and Eclipse() <= 0 } Spell(wrath)
+}
+
+AddFunction BalanceDefaultMovingActions
+{
+	#starsurge,if=buff.shooting_stars.react&(active_enemies<5|!buff.solar_eclipse.up)
+	if BuffPresent(shooting_stars_buff) and not BuffPresent(solar_eclipse_buff) Spell(starsurge)
+	#moonfire,cycle_targets=1,if=buff.lunar_eclipse.up&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if BuffPresent(lunar_eclipse_buff) and { target.DebuffRemains(moonfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } } Spell(moonfire)
+	#sunfire,cycle_targets=1,if=buff.solar_eclipse.up&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if BuffPresent(solar_eclipse_buff) and { target.DebuffRemains(sunfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } } Spell(sunfire)
+	#moonfire,cycle_targets=1,if=active_enemies<5&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if target.DebuffRemains(moonfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } Spell(moonfire)
+	#sunfire,cycle_targets=1,if=active_enemies<5&(remains<(buff.natures_grace.remains-2+2*set_bonus.tier14_4pc_caster))
+	if target.DebuffRemains(sunfire_debuff) < { BuffRemains(natures_grace_buff) -2 + 2 * ArmorSetBonus(T14_caster 4) } Spell(sunfire)
+	#moonfire,cycle_targets=1,if=buff.lunar_eclipse.up&ticks_remain<2
+	if BuffPresent(lunar_eclipse_buff) and target.TicksRemain(moonfire_debuff) < 2 Spell(moonfire)
+	#sunfire,cycle_targets=1,if=buff.solar_eclipse.up&ticks_remain<2
+	if BuffPresent(solar_eclipse_buff) and target.TicksRemain(sunfire_debuff) < 2 Spell(sunfire)
+	#moonfire,moving=1,cycle_targets=1,if=ticks_remain<2
+	if target.TicksRemain(moonfire_debuff) < 2 Spell(moonfire)
+	#sunfire,moving=1,cycle_targets=1,if=ticks_remain<2
+	if target.TicksRemain(sunfire_debuff) < 2 Spell(sunfire)
+	#wild_mushroom,moving=1,if=buff.wild_mushroom.stack<buff.wild_mushroom.max_stack
+	if WildMushroomCount() < 3 Spell(wild_mushroom_caster)
+	#starsurge,moving=1,if=buff.shooting_stars.react
+	if BuffPresent(shooting_stars_buff) Spell(starsurge)
+	#moonfire,moving=1,if=buff.lunar_eclipse.up
+	if BuffPresent(lunar_eclipse_buff) Spell(moonfire)
+	#sunfire,moving=1
+	Spell(sunfire)
+}
+
+AddFunction BalanceHurricaneActions
+{
+	unless { TalentPoints(dream_of_cenarius_talent) and not BuffPresent(dream_of_cenarius_caster_buff) and ManaPercent() > 25 and Spell(healing_touch) }
+	{
+		#hurricane,if=active_enemies>4&buff.solar_eclipse.up&buff.natures_grace.up
+		if BuffPresent(solar_eclipse_buff) and BuffPresent(natures_grace_buff) Spell(hurricane)
+		#hurricane,if=active_enemies>5&buff.solar_eclipse.up&mana.pct>25
+		if BuffPresent(solar_eclipse_buff) and ManaPercent() > 25 Spell(hurricane)
+	}
+}
+
+AddFunction BalanceDefaultShortCdActions
+{
+	#starfall,if=!buff.starfall.up
+	if not BuffPresent(starfall_buff) Spell(starfall)
+	#force_of_nature,if=talent.force_of_nature.enabled
+	if TalentPoints(force_of_nature_talent) Spell(force_of_nature_caster)
+}
+
+AddFunction BalanceDefaultCdActions
+{
+	#jade_serpent_potion,if=buff.bloodlust.react|target.time_to_die<=40|buff.celestial_alignment.up
+	if BuffPresent(burst_haste any=1) or target.TimeToDie() <= 40 or BuffPresent(celestial_alignment_buff) UsePotionIntellect()
+
+	unless { not BuffPresent(starfall_buff) and Spell(starfall) }
+	{
+		#berserking,if=buff.celestial_alignment.up
+		if BuffPresent(celestial_alignment_buff) Spell(berserking)
+		#use_item,slot=hands,if=buff.celestial_alignment.up|cooldown.celestial_alignment.remains>30
+		if BuffPresent(celestial_alignment_buff) or SpellCooldown(celestial_alignment) > 30 UseItemActions()
+		#wild_mushroom_detonate,moving=0,if=buff.wild_mushroom.stack>0&buff.solar_eclipse.up
+		if WildMushroomCount() > 0 and BuffPresent(solar_eclipse_buff) Spell(wild_mushroom_detonate)
+		#natures_swiftness,if=talent.dream_of_cenarius.enabled
+		if TalentPoints(dream_of_cenarius_talent) Spell(natures_swiftness)
+
+		unless { TalentPoints(dream_of_cenarius_talent) and not BuffPresent(dream_of_cenarius_caster_buff) and ManaPercent() > 25 and Spell(healing_touch) }
+		{
+			#incarnation,if=talent.incarnation.enabled&(buff.lunar_eclipse.up|buff.solar_eclipse.up)
+			if TalentPoints(incarnation_talent) and { BuffPresent(lunar_eclipse_buff) or BuffPresent(solar_eclipse_buff) } Spell(incarnation)
+			#celestial_alignment,if=(!buff.lunar_eclipse.up&!buff.solar_eclipse.up)&(buff.chosen_of_elune.up|!talent.incarnation.enabled|cooldown.incarnation.remains>10)
+			if { not BuffPresent(lunar_eclipse_buff) and not BuffPresent(solar_eclipse_buff) } and { BuffPresent(chosen_of_elune_buff) or not TalentPoints(incarnation_talent) or SpellCooldown(incarnation) > 10 } Spell(celestial_alignment)
+			#natures_vigil,if=talent.natures_vigil.enabled
+			if TalentPoints(natures_vigil_talent) Spell(natures_vigil)
+		}
+	}
+}
+
+AddFunction BalancePrecombatActions
+{
+	#flask,type=warm_sun
+	#food,type=mogu_fish_stew
+	#mark_of_the_wild,if=!aura.str_agi_int.up
+	if not BuffPresent(str_agi_int any=1) Spell(mark_of_the_wild)
+	#wild_mushroom,if=buff.wild_mushroom.stack<buff.wild_mushroom.max_stack
+	if WildMushroomCount() < 3 Spell(wild_mushroom_caster)
+	#healing_touch,if=!buff.dream_of_cenarius.up&talent.dream_of_cenarius.enabled
+	if not BuffPresent(dream_of_cenarius_caster_buff) and TalentPoints(dream_of_cenarius_talent) Spell(healing_touch)
+	#moonkin_form
+	if not Stance(druid_moonkin_form) Spell(moonkin_form)
+	# Snapshot raid buffed stats before combat begins and pre-potting is done.
+	#snapshot_stats
+}
+
+AddFunction BalancePrecombatCdActions
+{
+	#jade_serpent_potion
+	UsePotionIntellect()
+}
+
+### Balance Icons
+
+AddIcon mastery=balance help=cd size=small checkboxon=opt_icons_left
+{
+	Spell(barkskin)
+	Spell(survival_instincts)
+	Spell(might_of_ursoc)
+	if TalentPoints(renewal_talent) Spell(renewal)
+	if TalentPoints(cenarion_ward_talent) Spell(cenarion_ward)
+	Spell(tranquility)
+}
+
+AddIcon mastery=balance size=small checkboxon=opt_icons_left
+{
+	#wild_mushroom_detonate,moving=0,if=buff.wild_mushroom.stack>0&buff.solar_eclipse.up
+	if WildMushroomCount() > 0 and BuffPresent(solar_eclipse_buff) Spell(wild_mushroom_detonate)
+}
+
+AddIcon mastery=balance help=shortcd
+{
+	if not Stance(druid_moonkin_form) Spell(moonkin_form)
+
+	BalanceDefaultShortCdActions()
+	BalanceHurricaneActions()
+}
+
+AddIcon mastery=balance help=main
+{
+	if InCombat(no) BalancePrecombatActions()
+	BalanceDefaultActions()
+}
+
+AddIcon mastery=balance help=moving
+{
+	if InCombat(no) BalancePrecombatActions()
+	BalanceDefaultMovingActions()
+}
+
+AddIcon mastery=balance help=cd
+{
+	BalanceInterrupt()
+	BalanceDefaultCdActions()
+}
+
+AddIcon mastery=balance help=cd size=small checkboxon=opt_icons_right
+{
+	if TalentPoints(heart_of_the_wild_talent) Spell(heart_of_the_wild)
+	if TalentPoints(natures_vigil_talent) Spell(natures_vigil)
+}
+
+AddIcon mastery=balance help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Feral
+###
+# Based on SimulationCraft profile "Druid_Feral_T16H_Adv_Rotation".
+#	class=druid
+#	spec=feral
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#UZ!...2.1
+#	glyphs=savagery/cat_form
+
+AddFunction FeralFillerActions
+{
+	#ravage
+	Spell(ravage usable=1)
+	#rake,if=target.time_to_die-dot.rake.remains>3&action.rake.tick_damage*(dot.rake.ticks_remain+1)-dot.rake.tick_dmg*dot.rake.ticks_remain>action.mangle_cat.hit_damage
+	if target.TimeToDie() - target.DebuffRemains(rake_debuff) > 3 and Damage(rake) * { target.TicksRemain(rake_debuff) + 1 } - target.LastEstimatedDamage(rake_debuff) * target.TicksRemain(rake_debuff) > Damage(mangle_cat) Spell(rake)
+	#shred,if=(buff.omen_of_clarity.react|buff.berserk.up|energy.regen>=15)&buff.king_of_the_jungle.down
+	if { BuffPresent(omen_of_clarity_buff) or BuffPresent(berserk_cat_buff) or EnergyRegen() >= 15 } and BuffExpires(king_of_the_jungle_buff) Spell(shred)
+	#mangle_cat,if=buff.king_of_the_jungle.down
+	if BuffExpires(king_of_the_jungle_buff) Spell(mangle_cat)
+}
+
+AddFunction FeralBasicActions
+{
+	#auto_attack
+	#force_of_nature,if=charges=3|trinket.proc.agility.react|(buff.rune_of_reorigination.react&buff.rune_of_reorigination.remains<1)|target.time_to_die<20
+	if Charges(force_of_nature_melee) == 3 or BuffPresent(trinket_proc_agility_buff) or { BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) < 1 } or target.TimeToDie() < 20 Spell(force_of_nature_melee)
+	#ferocious_bite,if=dot.rip.ticking&dot.rip.remains<=3&target.health.pct<=25
+	if target.DebuffPresent(rip_debuff) and target.DebuffRemains(rip_debuff) <= 3 and target.HealthPercent() <= 25 Spell(ferocious_bite)
+	#faerie_fire,if=debuff.weakened_armor.stack<3
+	if target.DebuffStacks(weakened_armor_debuff any=1) < 3 Spell(faerie_fire)
+	#healing_touch,if=talent.dream_of_cenarius.enabled&buff.predatory_swiftness.up&buff.dream_of_cenarius.down&(buff.predatory_swiftness.remains<1.5|combo_points>=4)
+	if TalentPoints(dream_of_cenarius_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(dream_of_cenarius_melee_buff) and { BuffRemains(predatory_swiftness_buff) < 1.5 or ComboPoints() >= 4 } Spell(healing_touch)
+	#savage_roar,if=buff.savage_roar.remains<3
+	if BuffRemains(savage_roar_buff) < 3 SavageRoar()
+	#tigers_fury,if=energy<=35&!buff.omen_of_clarity.react
+	if Energy() <= 35 and not BuffPresent(omen_of_clarity_buff) Spell(tigers_fury)
+	#rip,if=combo_points>=5&target.health.pct<=25&action.rip.tick_damage%dot.rip.tick_dmg>=1.15
+	if ComboPoints() >= 5 and target.HealthPercent() <= 25 and Damage(rip) / target.LastEstimatedDamage(rip_debuff) >= 1.15 Spell(rip)
+	#ferocious_bite,if=combo_points>=5&target.health.pct<=25&dot.rip.ticking
+	if ComboPoints() >= 5 and target.HealthPercent() <= 25 and target.DebuffPresent(rip_debuff) Spell(ferocious_bite)
+	#rip,if=combo_points>=5&dot.rip.remains<2
+	if ComboPoints() >= 5 and target.DebuffRemains(rip_debuff) < 2 Spell(rip)
+	#thrash_cat,if=buff.omen_of_clarity.react&dot.thrash_cat.remains<3
+	if BuffPresent(omen_of_clarity_buff) and target.DebuffRemains(thrash_cat_debuff) < 3 Spell(thrash_cat)
+	#rake,cycle_targets=1,if=dot.rake.remains<3|action.rake.tick_damage>dot.rake.tick_dmg
+	if target.DebuffRemains(rake_debuff) < 3 or Damage(rake) > target.LastEstimatedDamage(rake_debuff) Spell(rake)
+	#pool_resource,for_next=1
+	#thrash_cat,if=dot.thrash_cat.remains<3&(dot.rip.remains>=8&buff.savage_roar.remains>=12|buff.berserk.up|combo_points>=5)
+	if Energy() >= EnergyCost(thrash_cat) and target.DebuffRemains(thrash_cat_debuff) < 3 and { target.DebuffRemains(rip_debuff) >= 8 and BuffRemains(savage_roar_buff) >= 12 or BuffPresent(berserk_cat_buff) or ComboPoints() >= 5 } wait Spell(thrash_cat)
+	#pool_resource,if=combo_points>=5&!(energy.time_to_max<=1|(buff.berserk.up&energy>=25)|(buff.feral_rage.up&buff.feral_rage.remains<=1))&dot.rip.ticking
+	unless ComboPoints() >= 5 and not { TimeToMaxEnergy() <= 1 or { BuffPresent(berserk_cat_buff) and Energy() >= 25 } or { BuffPresent(feral_rage_buff) and BuffRemains(feral_rage_buff) <= 1 } } and target.DebuffPresent(rip_debuff)
+	{
+		#ferocious_bite,if=combo_points>=5&dot.rip.ticking
+		if ComboPoints() >= 5 and target.DebuffPresent(rip_debuff) Spell(ferocious_bite)
+		#run_action_list,name=filler,if=buff.omen_of_clarity.react
+		if BuffPresent(omen_of_clarity_buff) FeralFillerActions()
+		#run_action_list,name=filler,if=buff.feral_fury.react
+		if BuffPresent(feral_fury_buff) FeralFillerActions()
+		#run_action_list,name=filler,if=(combo_points<5&dot.rip.remains<3.0)|(combo_points=0&buff.savage_roar.remains<2)
+		if { ComboPoints() < 5 and target.DebuffRemains(rip_debuff) < 3 } or { ComboPoints() == 0 and BuffRemains(savage_roar_buff) < 2 } FeralFillerActions()
+		#run_action_list,name=filler,if=target.time_to_die<=8.5
+		if target.TimeToDie() <= 8.5 FeralFillerActions()
+		#run_action_list,name=filler,if=buff.tigers_fury.up|buff.berserk.up
+		if BuffPresent(tigers_fury_buff) or BuffPresent(berserk_cat_buff) FeralFillerActions()
+		#run_action_list,name=filler,if=cooldown.tigers_fury.remains<=3
+		if SpellCooldown(tigers_fury) <= 3 FeralFillerActions()
+		#run_action_list,name=filler,if=energy.time_to_max<=1.0
+		if TimeToMaxEnergy() <= 1 FeralFillerActions()
+	}
+}
+
+AddFunction FeralBasicPredictiveActions
+{
+	#auto_attack
+	#force_of_nature,if=charges=3|trinket.proc.agility.react|(buff.rune_of_reorigination.react&buff.rune_of_reorigination.remains<1)|target.time_to_die<20
+	if Charges(force_of_nature_melee) == 3 or BuffPresent(trinket_proc_agility_buff) or { BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) < 1 } or target.TimeToDie() < 20 Spell(force_of_nature_melee)
+	#ferocious_bite,if=dot.rip.ticking&dot.rip.remains<=3&target.health.pct<=25
+	if target.DebuffPresent(rip_debuff) and target.DebuffRemains(rip_debuff) <= 3 and target.HealthPercent() <= 25 Spell(ferocious_bite)
+	#faerie_fire,if=debuff.weakened_armor.stack<3
+	if target.DebuffStacks(weakened_armor_debuff any=1) < 3 Spell(faerie_fire)
+	#healing_touch,if=talent.dream_of_cenarius.enabled&buff.predatory_swiftness.up&buff.dream_of_cenarius.down&(buff.predatory_swiftness.remains<1.5|combo_points>=4)
+	if TalentPoints(dream_of_cenarius_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(dream_of_cenarius_melee_buff) and { BuffRemains(predatory_swiftness_buff) < 1.5 or ComboPoints() >= 4 } Spell(healing_touch)
+	#savage_roar,if=buff.savage_roar.remains<3
+	if BuffRemains(savage_roar_buff) < 3 SavageRoar()
+	#tigers_fury,if=energy<=35&!buff.omen_of_clarity.react
+	if Energy() <= 35 and not BuffPresent(omen_of_clarity_buff) Spell(tigers_fury)
+	#rip,if=combo_points>=5&target.health.pct<=25&action.rip.tick_damage%dot.rip.tick_dmg>=1.15
+	if ComboPoints() >= 5 and target.HealthPercent() <= 25 and Damage(rip) / target.LastEstimatedDamage(rip_debuff) >= 1.15 Spell(rip)
+	#ferocious_bite,if=combo_points>=5&target.health.pct<=25&dot.rip.ticking
+	if ComboPoints() >= 5 and target.HealthPercent() <= 25 and target.DebuffPresent(rip_debuff) Spell(ferocious_bite)
+	#rip,if=combo_points>=5&dot.rip.remains<2
+	if ComboPoints() >= 5 and target.DebuffRemains(rip_debuff) < 2 Spell(rip)
+	#thrash_cat,if=buff.omen_of_clarity.react&dot.thrash_cat.remains<3
+	if BuffPresent(omen_of_clarity_buff) and target.DebuffRemains(thrash_cat_debuff) < 3 Spell(thrash_cat)
+	#rake,cycle_targets=1,if=dot.rake.remains<3|action.rake.tick_damage>dot.rake.tick_dmg
+	if target.DebuffRemains(rake_debuff) < 3 or Damage(rake) > target.LastEstimatedDamage(rake_debuff) Spell(rake)
+	#pool_resource,for_next=1
+	#thrash_cat,if=dot.thrash_cat.remains<3&(dot.rip.remains>=8&buff.savage_roar.remains>=12|buff.berserk.up|combo_points>=5)
+	if Energy() >= EnergyCost(thrash_cat) and target.DebuffRemains(thrash_cat_debuff) < 3 and { target.DebuffRemains(rip_debuff) >= 8 and BuffRemains(savage_roar_buff) >= 12 or BuffPresent(berserk_cat_buff) or ComboPoints() >= 5 } wait Spell(thrash_cat)
+	#pool_resource,if=combo_points>=5&!(energy.time_to_max<=1|(buff.berserk.up&energy>=25)|(buff.feral_rage.up&buff.feral_rage.remains<=1))&dot.rip.ticking
+	unless ComboPoints() >= 5 and not { TimeToMaxEnergy() <= 1 or { BuffPresent(berserk_cat_buff) and Energy() >= 25 } or { BuffPresent(feral_rage_buff) and BuffRemains(feral_rage_buff) <= 1 } } and target.DebuffPresent(rip_debuff)
+	{
+		#ferocious_bite,if=combo_points>=5&dot.rip.ticking
+		if ComboPoints() >= 5 and target.DebuffPresent(rip_debuff) Spell(ferocious_bite)
+	}
+}
+
+AddFunction FeralBasicCdActions
+{
+	#skull_bash_cat
+	FeralInterrupt()
+
+	unless { target.DebuffPresent(rip_debuff) and target.DebuffRemains(rip_debuff) <= 3 and target.HealthPercent() <= 25 and Spell(ferocious_bite) }
+		or { target.DebuffStacks(weakened_armor_debuff any=1) < 3 and Spell(faerie_fire) }
+		or { TalentPoints(dream_of_cenarius_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(dream_of_cenarius_melee_buff) and { BuffRemains(predatory_swiftness_buff) < 1.5 or ComboPoints() >= 4 } and Spell(healing_touch) }
+		or { BuffRemains(savage_roar_buff) < 3 and SavageRoar() }
+	{
+		#virmens_bite_potion,if=(target.health.pct<30&buff.berserk.up)|target.time_to_die<=40
+		if { target.HealthPercent() < 30 and BuffPresent(berserk_cat_buff) } or target.TimeToDie() <= 40 UsePotionAgility()
+
+		# Synchronize display with Tiger's Fury buff in main actions.
+		if { Energy() <= 35 and not BuffPresent(omen_of_clarity_buff) } or BuffPresent(tigers_fury_buff)
+		{
+			#berserk,if=buff.tigers_fury.up
+			Spell(berserk_cat)
+			#use_item,slot=hands,if=buff.tigers_fury.up
+			UseItemActions()
+			#berserking,if=buff.tigers_fury.up
+			UseRacialActions()
+		}
+	}
+}
+
+AddFunction FeralAoeActions
+{
+	#auto_attack
+	#faerie_fire,cycle_targets=1,if=debuff.weakened_armor.stack<3
+	if target.DebuffStacks(weakened_armor_debuff any=1) < 3 Spell(faerie_fire)
+	#savage_roar,if=buff.savage_roar.down|(buff.savage_roar.remains<3&combo_points>0)
+	if BuffExpires(savage_roar_buff) or { BuffRemains(savage_roar_buff) < 3 and ComboPoints() > 0 } SavageRoar()
+	#use_item,slot=hands,if=buff.tigers_fury.up
+	#tigers_fury,if=energy<=35&!buff.omen_of_clarity.react
+	if Energy() <= 35 and not BuffPresent(omen_of_clarity_buff) Spell(tigers_fury)
+	#berserk,if=buff.tigers_fury.up
+	if BuffPresent(tigers_fury_buff) Spell(berserk_cat)
+	#pool_resource,for_next=1
+	#thrash_cat,if=buff.rune_of_reorigination.up
+	if Energy() >= EnergyCost(thrash_cat) and BuffPresent(rune_of_reorigination_buff) wait Spell(thrash_cat)
+	#pool_resource,wait=0.1,for_next=1
+	#thrash_cat,if=dot.thrash_cat.remains<3|(buff.tigers_fury.up&dot.thrash_cat.remains<9)
+	if Energy() >= EnergyCost(thrash_cat) and target.DebuffRemains(thrash_cat_debuff) < 3 or { BuffPresent(tigers_fury_buff) and target.DebuffRemains(thrash_cat_debuff) < 9 } wait Spell(thrash_cat)
+	#savage_roar,if=buff.savage_roar.remains<9&combo_points>=5
+	if BuffRemains(savage_roar_buff) < 9 and ComboPoints() >= 5 SavageRoar()
+	#rip,if=combo_points>=5
+	if ComboPoints() >= 5 Spell(rip)
+	#rake,cycle_targets=1,if=(active_enemies<8|buff.rune_of_reorigination.up)&dot.rake.remains<3&target.time_to_die>=15
+	if { Enemies() < 8 or BuffPresent(rune_of_reorigination_buff) } and target.DebuffRemains(rake_debuff) < 3 and target.TimeToDie() >= 15 Spell(rake)
+	#swipe_cat,if=buff.savage_roar.remains<=5
+	if BuffRemains(savage_roar_buff) <= 5 Spell(swipe_cat)
+	#swipe_cat,if=buff.tigers_fury.up|buff.berserk.up
+	if BuffPresent(tigers_fury_buff) or BuffPresent(berserk_cat_buff) Spell(swipe_cat)
+	#swipe_cat,if=cooldown.tigers_fury.remains<3
+	if SpellCooldown(tigers_fury) < 3 Spell(swipe_cat)
+	#swipe_cat,if=buff.omen_of_clarity.react
+	if BuffPresent(omen_of_clarity_buff) Spell(swipe_cat)
+	#swipe_cat,if=energy.time_to_max<=1
+	if TimeToMaxEnergy() <= 1 Spell(swipe_cat)
+}
+
+AddFunction FeralPrecombatActions
+{
+	#flask,type=spring_blossoms
+	#food,type=sea_mist_rice_noodles
+	#mark_of_the_wild,if=!aura.str_agi_int.up
+	if not BuffPresent(str_agi_int any=1) Spell(mark_of_the_wild)
+	#healing_touch,if=!buff.dream_of_cenarius.up&talent.dream_of_cenarius.enabled
+	if not BuffPresent(dream_of_cenarius_melee_buff) and TalentPoints(dream_of_cenarius_talent) Spell(healing_touch)
+	#cat_form
+	if not Stance(druid_cat_form) Spell(cat_form)
+	#savage_roar
+	SavageRoar()
+	#stealth
+	if Stealthed(no) Spell(prowl)
+	#snapshot_stats
+}
+
+AddFunction FeralPrecombatCdActions
+{
+	#virmens_bite_potion
+	UsePotionAgility()
+}
+
+AddFunction FeralAdvancedActions
+{
+	#auto_attack
+	#force_of_nature,if=charges=3|(buff.rune_of_reorigination.react&buff.rune_of_reorigination.remains<1)|(buff.vicious.react&buff.vicious.remains<1)|target.time_to_die<20
+	if Charges(force_of_nature_melee) == 3 or { BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) < 1 } or { BuffPresent(trinket_proc_agility_buff) and BuffRemains(trinket_proc_agility_buff) < 1 } or target.TimeToDie() < 20 Spell(force_of_nature_melee)
+	#ravage,if=buff.stealthed.up
+	if Stealthed() Spell(ravage)
+	#ferocious_bite,if=dot.rip.ticking&dot.rip.remains<=3&target.health.pct<=25
+	if target.DebuffPresent(rip_debuff) and target.DebuffRemains(rip_debuff) <= 3 and target.HealthPercent() <= 25 Spell(ferocious_bite)
+	#faerie_fire,if=debuff.weakened_armor.stack<3
+	if target.DebuffStacks(weakened_armor_debuff any=1) < 3 Spell(faerie_fire)
+	#healing_touch,if=talent.dream_of_cenarius.enabled&buff.predatory_swiftness.up&buff.dream_of_cenarius.down&(buff.predatory_swiftness.remains<1.5|combo_points>=4)
+	if TalentPoints(dream_of_cenarius_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(dream_of_cenarius_melee_buff) and { BuffRemains(predatory_swiftness_buff) < 1.5 or ComboPoints() >= 4 } Spell(healing_touch)
+	#savage_roar,if=buff.savage_roar.down
+	if BuffExpires(savage_roar_buff) SavageRoar()
+	#tigers_fury,if=energy<=35&!buff.omen_of_clarity.react
+	if Energy() <= 35 and not BuffPresent(omen_of_clarity_buff) Spell(tigers_fury)
+	#thrash_cat,if=buff.omen_of_clarity.react&dot.thrash_cat.remains<3&target.time_to_die>=6
+	if BuffPresent(omen_of_clarity_buff) and target.DebuffRemains(thrash_cat_debuff) < 3 and target.TimeToDie() >= 6 Spell(thrash_cat)
+	#ferocious_bite,if=target.time_to_die<=1&combo_points>=3
+	if target.TimeToDie() <= 1 and ComboPoints() >= 3 Spell(ferocious_bite)
+	#savage_roar,if=buff.savage_roar.remains<=3&combo_points>0&target.health.pct<25
+	if BuffRemains(savage_roar_buff) <= 3 and ComboPoints() > 0 and target.HealthPercent() < 25 SavageRoar()
+	#rip,if=combo_points>=5&action.rip.tick_damage%dot.rip.tick_dmg>=1.15&target.time_to_die>30
+	if ComboPoints() >= 5 and Damage(rip) / target.LastEstimatedDamage(rip_debuff) >= 1.15 and target.TimeToDie() > 30 Spell(rip)
+	#rip,if=combo_points>=4&action.rip.tick_damage%dot.rip.tick_dmg>=0.95&target.time_to_die>30&buff.rune_of_reorigination.up&buff.rune_of_reorigination.remains<=1.5
+	if ComboPoints() >= 4 and Damage(rip) / target.LastEstimatedDamage(rip_debuff) >= 0.95 and target.TimeToDie() > 30 and BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) <= 1.5 Spell(rip)
+	#pool_resource,if=combo_points>=5&target.health.pct<=25&dot.rip.ticking&!(energy>=50|(buff.berserk.up&energy>=25))
+	unless ComboPoints() >= 5 and target.HealthPercent() <= 25 and target.DebuffPresent(rip_debuff) and not { Energy() >= 50 or { BuffPresent(berserk_cat_buff) and Energy() >= 25 } }
+	{
+		#ferocious_bite,if=combo_points>=5&dot.rip.ticking&target.health.pct<=25
+		if ComboPoints() >= 5 and target.DebuffPresent(rip_debuff) and target.HealthPercent() <= 25 Spell(ferocious_bite)
+		#rip,if=combo_points>=5&target.time_to_die>=6&dot.rip.remains<2&(buff.berserk.up|dot.rip.remains+1.9<=cooldown.tigers_fury.remains)
+		if ComboPoints() >= 5 and target.TimeToDie() >= 6 and target.DebuffRemains(rip_debuff) < 2 and { BuffPresent(berserk_cat_buff) or target.DebuffRemains(rip_debuff) + 1.9 <= SpellCooldown(tigers_fury) } Spell(rip)
+		#savage_roar,if=buff.savage_roar.remains<=3&combo_points>0&buff.savage_roar.remains+2>dot.rip.remains
+		if BuffRemains(savage_roar_buff) <= 3 and ComboPoints() > 0 and BuffRemains(savage_roar_buff) + 2 > target.DebuffRemains(rip_debuff) SavageRoar()
+		#savage_roar,if=buff.savage_roar.remains<=6&combo_points>=5&buff.savage_roar.remains+2<=dot.rip.remains&dot.rip.ticking
+		if BuffRemains(savage_roar_buff) <= 6 and ComboPoints() >= 5 and BuffRemains(savage_roar_buff) + 2 <= target.DebuffRemains(rip_debuff) and target.DebuffPresent(rip_debuff) SavageRoar()
+		#savage_roar,if=buff.savage_roar.remains<=12&combo_points>=5&energy.time_to_max<=1&buff.savage_roar.remains<=dot.rip.remains+6&dot.rip.ticking
+		if BuffRemains(savage_roar_buff) <= 12 and ComboPoints() >= 5 and TimeToMaxEnergy() <= 1 and BuffRemains(savage_roar_buff) <= target.DebuffRemains(rip_debuff) + 6 and target.DebuffPresent(rip_debuff) SavageRoar()
+		#rake,if=buff.rune_of_reorigination.up&dot.rake.remains<9&buff.rune_of_reorigination.remains<=1.5
+		if BuffPresent(rune_of_reorigination_buff) and target.DebuffRemains(rake_debuff) < 9 and BuffRemains(rune_of_reorigination_buff) <= 1.5 Spell(rake)
+		#rake,cycle_targets=1,if=target.time_to_die-dot.rake.remains>3&(action.rake.tick_damage>dot.rake.tick_dmg|(dot.rake.remains<3&action.rake.tick_damage%dot.rake.tick_dmg>=0.75))
+		if target.TimeToDie() - target.DebuffRemains(rake_debuff) > 3 and { Damage(rake) > target.LastEstimatedDamage(rake_debuff) or { target.DebuffRemains(rake_debuff) < 3 and Damage(rake) / target.LastEstimatedDamage(rake_debuff) >= 0.75 } } Spell(rake)
+		#pool_resource,for_next=1
+		#thrash_cat,if=target.time_to_die>=6&dot.thrash_cat.remains<3&(dot.rip.remains>=8&buff.savage_roar.remains>=12|buff.berserk.up|combo_points>=5)&dot.rip.ticking
+		if Energy() >= EnergyCost(thrash_cat) and target.TimeToDie() >= 6 and target.DebuffRemains(thrash_cat_debuff) < 3 and { target.DebuffRemains(rip_debuff) >= 8 and BuffRemains(savage_roar_buff) >= 12 or BuffPresent(berserk_cat_buff) or ComboPoints() >= 5 } and target.DebuffPresent(rip_debuff) wait Spell(thrash_cat)
+		#pool_resource,for_next=1
+		#thrash_cat,if=target.time_to_die>=6&dot.thrash_cat.remains<9&buff.rune_of_reorigination.up&buff.rune_of_reorigination.remains<=1.5&dot.rip.ticking
+		if target.TimeToDie() >= 6 and target.DebuffRemains(thrash_cat_debuff) < 9 and BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) <= 1.5 and target.DebuffPresent(rip_debuff) wait Spell(thrash_cat)
+		#pool_resource,if=combo_points>=5&!(energy.time_to_max<=1|(buff.berserk.up&energy>=25)|(buff.feral_rage.up&buff.feral_rage.remains<=1))&dot.rip.ticking
+		unless ComboPoints() >= 5 and not { TimeToMaxEnergy() <= 1 or { BuffPresent(berserk_cat_buff) and Energy() >= 25 } or { BuffPresent(feral_rage_buff) and BuffRemains(feral_rage_buff) <= 1 } } and target.DebuffPresent(rip_debuff)
+		{
+			#ferocious_bite,if=combo_points>=5&dot.rip.ticking
+			if ComboPoints() >= 5 and target.DebuffPresent(rip_debuff) Spell(ferocious_bite)
+			#run_action_list,name=filler,if=buff.omen_of_clarity.react
+			if BuffPresent(omen_of_clarity_buff) FeralFillerActions()
+			#run_action_list,name=filler,if=buff.feral_fury.react
+			if BuffPresent(feral_fury_buff) FeralFillerActions()
+			#run_action_list,name=filler,if=(combo_points<5&dot.rip.remains<3.0)|(combo_points=0&buff.savage_roar.remains<2)
+			if { ComboPoints() < 5 and target.DebuffRemains(rip_debuff) < 3 } or { ComboPoints() == 0 and BuffRemains(savage_roar_buff) < 2 } FeralFillerActions()
+			#run_action_list,name=filler,if=target.time_to_die<=8.5
+			if target.TimeToDie() <= 8.5 FeralFillerActions()
+			#run_action_list,name=filler,if=buff.tigers_fury.up|buff.berserk.up
+			if BuffPresent(tigers_fury_buff) or BuffPresent(berserk_cat_buff) FeralFillerActions()
+			#run_action_list,name=filler,if=cooldown.tigers_fury.remains<=3
+			if SpellCooldown(tigers_fury) <= 3 FeralFillerActions()
+			#run_action_list,name=filler,if=energy.time_to_max<=1.0
+			if TimeToMaxEnergy() <= 1 FeralFillerActions()
+		}
+	}
+}
+
+AddFunction FeralAdvancedPredictiveActions
+{
+	#auto_attack
+	#force_of_nature,if=charges=3|(buff.rune_of_reorigination.react&buff.rune_of_reorigination.remains<1)|(buff.vicious.react&buff.vicious.remains<1)|target.time_to_die<20
+	if Charges(force_of_nature_melee) == 3 or { BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) < 1 } or { BuffPresent(trinket_proc_agility_buff) and BuffRemains(trinket_proc_agility_buff) < 1 } or target.TimeToDie() < 20 Spell(force_of_nature_melee)
+	#ravage,if=buff.stealthed.up
+	if Stealthed() Spell(ravage)
+	#ferocious_bite,if=dot.rip.ticking&dot.rip.remains<=3&target.health.pct<=25
+	if target.DebuffPresent(rip_debuff) and target.DebuffRemains(rip_debuff) <= 3 and target.HealthPercent() <= 25 Spell(ferocious_bite)
+	#faerie_fire,if=debuff.weakened_armor.stack<3
+	if target.DebuffStacks(weakened_armor_debuff any=1) < 3 Spell(faerie_fire)
+	#healing_touch,if=talent.dream_of_cenarius.enabled&buff.predatory_swiftness.up&buff.dream_of_cenarius.down&(buff.predatory_swiftness.remains<1.5|combo_points>=4)
+	if TalentPoints(dream_of_cenarius_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(dream_of_cenarius_melee_buff) and { BuffRemains(predatory_swiftness_buff) < 1.5 or ComboPoints() >= 4 } Spell(healing_touch)
+	#savage_roar,if=buff.savage_roar.down
+	if BuffExpires(savage_roar_buff) SavageRoar()
+	#tigers_fury,if=energy<=35&!buff.omen_of_clarity.react
+	if Energy() <= 35 and not BuffPresent(omen_of_clarity_buff) Spell(tigers_fury)
+	#thrash_cat,if=buff.omen_of_clarity.react&dot.thrash_cat.remains<3&target.time_to_die>=6
+	if BuffPresent(omen_of_clarity_buff) and target.DebuffRemains(thrash_cat_debuff) < 3 and target.TimeToDie() >= 6 Spell(thrash_cat)
+	#ferocious_bite,if=target.time_to_die<=1&combo_points>=3
+	if target.TimeToDie() <= 1 and ComboPoints() >= 3 Spell(ferocious_bite)
+	#savage_roar,if=buff.savage_roar.remains<=3&combo_points>0&target.health.pct<25
+	if BuffRemains(savage_roar_buff) <= 3 and ComboPoints() > 0 and target.HealthPercent() < 25 SavageRoar()
+	#rip,if=combo_points>=5&action.rip.tick_damage%dot.rip.tick_dmg>=1.15&target.time_to_die>30
+	if ComboPoints() >= 5 and Damage(rip) / target.LastEstimatedDamage(rip_debuff) >= 1.15 and target.TimeToDie() > 30 Spell(rip)
+	#rip,if=combo_points>=4&action.rip.tick_damage%dot.rip.tick_dmg>=0.95&target.time_to_die>30&buff.rune_of_reorigination.up&buff.rune_of_reorigination.remains<=1.5
+	if ComboPoints() >= 4 and Damage(rip) / target.LastEstimatedDamage(rip_debuff) >= 0.95 and target.TimeToDie() > 30 and BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) <= 1.5 Spell(rip)
+	#pool_resource,if=combo_points>=5&target.health.pct<=25&dot.rip.ticking&!(energy>=50|(buff.berserk.up&energy>=25))
+	unless ComboPoints() >= 5 and target.HealthPercent() <= 25 and target.DebuffPresent(rip_debuff) and not { Energy() >= 50 or { BuffPresent(berserk_cat_buff) and Energy() >= 25 } }
+	{
+		#ferocious_bite,if=combo_points>=5&dot.rip.ticking&target.health.pct<=25
+		if ComboPoints() >= 5 and target.DebuffPresent(rip_debuff) and target.HealthPercent() <= 25 Spell(ferocious_bite)
+		#rip,if=combo_points>=5&target.time_to_die>=6&dot.rip.remains<2&(buff.berserk.up|dot.rip.remains+1.9<=cooldown.tigers_fury.remains)
+		if ComboPoints() >= 5 and target.TimeToDie() >= 6 and target.DebuffRemains(rip_debuff) < 2 and { BuffPresent(berserk_cat_buff) or target.DebuffRemains(rip_debuff) + 1.9 <= SpellCooldown(tigers_fury) } Spell(rip)
+		#savage_roar,if=buff.savage_roar.remains<=3&combo_points>0&buff.savage_roar.remains+2>dot.rip.remains
+		if BuffRemains(savage_roar_buff) <= 3 and ComboPoints() > 0 and BuffRemains(savage_roar_buff) + 2 > target.DebuffRemains(rip_debuff) SavageRoar()
+		#savage_roar,if=buff.savage_roar.remains<=6&combo_points>=5&buff.savage_roar.remains+2<=dot.rip.remains&dot.rip.ticking
+		if BuffRemains(savage_roar_buff) <= 6 and ComboPoints() >= 5 and BuffRemains(savage_roar_buff) + 2 <= target.DebuffRemains(rip_debuff) and target.DebuffPresent(rip_debuff) SavageRoar()
+		#savage_roar,if=buff.savage_roar.remains<=12&combo_points>=5&energy.time_to_max<=1&buff.savage_roar.remains<=dot.rip.remains+6&dot.rip.ticking
+		if BuffRemains(savage_roar_buff) <= 12 and ComboPoints() >= 5 and TimeToMaxEnergy() <= 1 and BuffRemains(savage_roar_buff) <= target.DebuffRemains(rip_debuff) + 6 and target.DebuffPresent(rip_debuff) SavageRoar()
+		#rake,if=buff.rune_of_reorigination.up&dot.rake.remains<9&buff.rune_of_reorigination.remains<=1.5
+		if BuffPresent(rune_of_reorigination_buff) and target.DebuffRemains(rake_debuff) < 9 and BuffRemains(rune_of_reorigination_buff) <= 1.5 Spell(rake)
+		#rake,cycle_targets=1,if=target.time_to_die-dot.rake.remains>3&(action.rake.tick_damage>dot.rake.tick_dmg|(dot.rake.remains<3&action.rake.tick_damage%dot.rake.tick_dmg>=0.75))
+		if target.TimeToDie() - target.DebuffRemains(rake_debuff) > 3 and { Damage(rake) > target.LastEstimatedDamage(rake_debuff) or { target.DebuffRemains(rake_debuff) < 3 and Damage(rake) / target.LastEstimatedDamage(rake_debuff) >= 0.75 } } Spell(rake)
+		#pool_resource,for_next=1
+		#thrash_cat,if=target.time_to_die>=6&dot.thrash_cat.remains<3&(dot.rip.remains>=8&buff.savage_roar.remains>=12|buff.berserk.up|combo_points>=5)&dot.rip.ticking
+		if Energy() >= EnergyCost(thrash_cat) and target.TimeToDie() >= 6 and target.DebuffRemains(thrash_cat_debuff) < 3 and { target.DebuffRemains(rip_debuff) >= 8 and BuffRemains(savage_roar_buff) >= 12 or BuffPresent(berserk_cat_buff) or ComboPoints() >= 5 } and target.DebuffPresent(rip_debuff) wait Spell(thrash_cat)
+		#pool_resource,for_next=1
+		#thrash_cat,if=target.time_to_die>=6&dot.thrash_cat.remains<9&buff.rune_of_reorigination.up&buff.rune_of_reorigination.remains<=1.5&dot.rip.ticking
+		if target.TimeToDie() >= 6 and target.DebuffRemains(thrash_cat_debuff) < 9 and BuffPresent(rune_of_reorigination_buff) and BuffRemains(rune_of_reorigination_buff) <= 1.5 and target.DebuffPresent(rip_debuff) wait Spell(thrash_cat)
+		#pool_resource,if=combo_points>=5&!(energy.time_to_max<=1|(buff.berserk.up&energy>=25)|(buff.feral_rage.up&buff.feral_rage.remains<=1))&dot.rip.ticking
+		unless ComboPoints() >= 5 and not { TimeToMaxEnergy() <= 1 or { BuffPresent(berserk_cat_buff) and Energy() >= 25 } or { BuffPresent(feral_rage_buff) and BuffRemains(feral_rage_buff) <= 1 } } and target.DebuffPresent(rip_debuff)
+		{
+			#ferocious_bite,if=combo_points>=5&dot.rip.ticking
+			if ComboPoints() >= 5 and target.DebuffPresent(rip_debuff) Spell(ferocious_bite)
+		}
+	}
+}
+
+AddFunction FeralAdvancedCdActions
+{
+	#skull_bash_cat
+	FeralInterrupt()
+	#berserking
+	Spell(berserking)
+	unless { Stealthed() and Spell(ravage) }
+		or { target.DebuffPresent(rip_debuff) and target.DebuffRemains(rip_debuff) <= 3 and target.HealthPercent() <= 25 and Spell(ferocious_bite) }
+		or { target.DebuffStacks(weakened_armor_debuff any=1) < 3 and Spell(faerie_fire) }
+		or { TalentPoints(dream_of_cenarius_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(dream_of_cenarius_melee_buff) and { BuffRemains(predatory_swiftness_buff) < 1.5 or ComboPoints() >= 4 } and Spell(healing_touch) }
+		or { BuffExpires(savage_roar_buff) and SavageRoar() }
+	{
+		# Synchronize display with Tiger's Fury buff in main actions.
+		if target.TimeToDie() < 18 and SpellCooldown(tigers_fury) > 6 Spell(berserk_cat)
+		if { Energy() <= 35 and not BuffPresent(omen_of_clarity_buff) } or BuffPresent(tigers_fury_buff)
+		{
+			#berserk,if=buff.tigers_fury.up|(target.time_to_die<18&cooldown.tigers_fury.remains>6)
+			Spell(berserk_cat)
+			#use_item,slot=hands,if=buff.tigers_fury.up
+			UseItemActions()
+		}
+
+		unless { BuffPresent(omen_of_clarity_buff) and target.DebuffRemains(thrash_cat_debuff) < 3 and target.TimeToDie() >= 6 and Spell(thrash_cat) }
+			or { target.TimeToDie() <= 1 and ComboPoints() >= 3 or Spell(ferocious_bite) }
+			or { BuffRemains(savage_roar_buff) <= 3 and ComboPoints() > 0 and target.HealthPercent() < 25 and SavageRoar() }
+		{
+			#virmens_bite_potion,if=(combo_points>=5&(target.time_to_die*(target.health.pct-25)%target.health.pct)<15&buff.rune_of_reorigination.up)|target.time_to_die<=40
+			if { ComboPoints() >= 5 and { target.TimeToDie() * { target.HealthPercent() -25 } / target.HealthPercent() } < 15 and BuffPresent(rune_of_reorigination_buff) } or target.TimeToDie() <= 40 UsePotionAgility()
+		}
+	}
+}
+
+AddListItem(opt_feral_rotation basic "Use basic rotation" default mastery=feral)
+AddListItem(opt_feral_rotation advanced "Use advanced rotation" mastery=feral)
+
+### Feral Icons
+
+AddIcon mastery=feral help=cd size=small checkboxon=opt_icons_left
+{
+	Spell(barkskin)
+	Spell(survival_instincts)
+	Spell(might_of_ursoc)
+	if TalentPoints(renewal_talent) Spell(renewal)
+	if TalentPoints(cenarion_ward_talent) Spell(cenarion_ward)
+	Spell(tranquility)
+}
+
+AddIcon mastery=feral size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(displacer_beast_talent) Spell(displacer_beast)
+	if TalentPoints(wild_charge_talent)
+	{
+		if Stance(druid_bear_form) and target.InRange(wild_charge_bear) and not target.InRange(mangle_bear) Spell(wild_charge_bear)
+		if Stance(druid_cat_form) and target.InRange(wild_charge_cat) and not target.InRange(mangle_cat) Spell(wild_charge_cat)
+		if target.InRange(wild_charge) Spell(wild_charge)
+	}
+	Spell(dash)
+}
+
+AddIcon mastery=feral help=main
+{
+	if InCombat(no) FeralPrecombatActions()
+	if not target.InRange(mangle_cat) Texture(ability_druid_catformattack)
+	if List(opt_feral_rotation basic) FeralBasicActions()
+	if List(opt_feral_rotation advanced) FeralAdvancedActions()
+}
+
+AddIcon mastery=feral help=main
+{
+	if InCombat(no) FeralPrecombatActions()
+	if not target.InRange(mangle_cat) Texture(ability_druid_catformattack)
+	if List(opt_feral_rotation basic) FeralBasicPredictiveActions()
+	if List(opt_feral_rotation advanced) FeralAdvancedPredictiveActions()
+}
+
+AddIcon mastery=feral help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) FeralPrecombatActions()
+	FeralAoeActions()
+}
+
+AddIcon mastery=feral help=cd
+{
+	if List(opt_feral_rotation basic) FeralBasicCdActions()
+	if List(opt_feral_rotation advanced) FeralAdvancedCdActions()
+}
+
+AddIcon mastery=feral help=cd size=small checkboxon=opt_icons_right
+{
+	if TalentPoints(heart_of_the_wild_talent) Spell(heart_of_the_wild)
+	if TalentPoints(natures_vigil_talent) Spell(natures_vigil)
+}
+
+AddIcon mastery=feral help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+]]
+
+	OvaleScripts:RegisterScript("DRUID", name, desc, code)
+end
diff --git a/scripts/ovale_druid_spells.lua b/scripts/ovale_druid_spells.lua
new file mode 100644
index 0000000..1e8cb17
--- /dev/null
+++ b/scripts/ovale_druid_spells.lua
@@ -0,0 +1,295 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "ovale_druid_spells"
+	local desc = "[5.4.7] Ovale: Druid spells"
+	local code = [[
+Define(barkskin 22812)
+	SpellInfo(barkskin cd=60)
+	SpellInfo(barkskin addcd=-15 if_spell=malfurions_gift)
+Define(berserk_cat 106951)
+	SpellInfo(berserk_cat cd=180)
+	SpellAddBuff(berserk_cat berserk_cat_buff=1)
+Define(berserk_cat_buff 106951)
+	SpellInfo(berserk_cat duration=15)
+Define(cat_form 768)
+Define(celestial_alignment 112071)
+	SpellInfo(celestial_alignment cd=180)
+	SpellAddBuff(celestial_alignment celestial_alignment_buff=1)
+Define(celestial_alignment_buff 112071)
+	SpellInfo(celestial_alignment_buff duration=15)
+Define(cenarion_ward 102351)
+	SpellInfo(cenarion_ward cd=30)
+Define(cenarion_ward_talent 6)
+Define(chosen_of_elune_buff 102560)
+	SpellInfo(chosen_of_elune_buff duration=30)
+Define(dash 1850)
+	SpellInfo(dash cd=180)
+	SpellInfo(dash addcd=-60 glyph=glyph_of_dash)
+Define(displacer_beast 102280)
+	SpellInfo(displacer_beast cd=30)
+Define(displacer_beast_talent 2)
+Define(dream_of_cenarius_caster_buff 145151)
+	SpellInfo(dream_of_cenarius_caster_buff duration=30)
+Define(dream_of_cenarius_melee_buff 145152)
+	SpellInfo(dream_of_cenarius_melee_buff duration=30)
+Define(dream_of_cenarius_talent 17)
+Define(faerie_fire 770)
+	SpellInfo(faerie_fire cd=6 if_stance=druid_bear_form)
+	SpellInfo(faerie_fire cd=6 if_stance=druid_cat_form)
+	SpellInfo(faerie_fire cd=15 glyph=glyph_of_fae_silence if_stance=druid_bear_form)
+	SpellAddTargetDebuff(faerie_fire weakened_armor_debuff=3)
+Define(faerie_swarm 102355)
+	SpellInfo(faerie_swarm cd=6 if_stance=druid_bear_form)
+	SpellInfo(faerie_swarm cd=6 if_stance=druid_cat_form)
+	SpellInfo(faerie_swarm cd=15 glyph=glyph_of_fae_silence if_stance=druid_bear_form)
+	SpellAddTargetDebuff(faerie_swarm weakened_armor_debuff=3)
+Define(faerie_swarm_talent 7)
+Define(feral_fury_buff 48848)
+	SpellInfo(feral_fury_buff duration=6)
+Define(feral_rage_buff 146874)
+	SpellInfo(feral_rage_buff duration=20)
+Define(ferocious_bite 22568)
+	SpellInfo(ferocious_bite combo=finisher energy=25)
+	SpellInfo(ferocious_bite buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(ferocious_bite buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(ferocious_bite omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+	# Ferocious Bite does ((316 to 658) + 762 * CP + 0.196 * AP * CP) damage (from Wowhead).
+	# Average the base damage to (316 + 658) / 2 = 487.
+	SpellInfo(ferocious_bite base=487 bonuscp=762 bonusapcp=0.196)
+	SpellDamageBuff(ferocious_bite dream_of_cenarius_melee_buff=1.3)
+Define(force_of_nature_caster 33831)
+	SpellInfo(force_of_nature_caster gcd=0)
+Define(force_of_nature_melee 102703)
+	SpellInfo(force_of_nature_melee gcd=0)
+Define(force_of_nature_talent 12)
+Define(glyph_of_dash 59219)
+Define(glyph_of_fae_silence 114237)
+Define(glyph_of_might_of_ursoc 116238)
+Define(glyph_of_savagery 127540)
+Define(glyph_of_skull_bash 116216)
+Define(glyph_of_survival_instincts 114223)
+Define(healing_touch 5185)
+	SpellAddBuff(healing_touch dream_of_cenarius_caster_buff=1 talent=dream_of_cenarius_talent)
+	SpellAddBuff(healing_touch predatory_swiftness_buff=0 )
+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)
+Define(incarnation 106731)
+	SpellInfo(incarnation cd=180)
+Define(incarnation_talent 11)
+Define(king_of_the_jungle_buff 102543)
+	SpellInfo(king_of_the_jungle_buff duration=30)
+Define(lunar_eclipse_buff 48518)
+Define(maim 22570)
+	SpellInfo(maim cd=10 combo=finisher energy=35)
+	SpellInfo(maim buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(maim buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(maim omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+Define(malfurions_gift 92364)
+Define(mangle_cat 33876)
+	SpellInfo(mangle_cat combo=1 energy=35)
+	SpellInfo(mangle_cat critcombo=1 if_spell=primal_fury)
+	SpellInfo(mangle_cat buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(mangle_cat buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(mangle_cat omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+Define(mark_of_the_wild 1126)
+Define(might_of_ursoc 106922)
+	SpellInfo(might_of_ursoc cd=180)
+	SpellInfo(might_of_ursoc addcd=120 glyph=glyph_of_might_of_ursoc)
+	SpellInfo(might_of_ursoc addcd=-60 itemset=T14_tank itemcount=2)
+Define(mighty_bash 5211)
+	SpellInfo(mighty_bash cd=50)
+Define(mighty_bash_talent 15)
+Define(moonfire 8921)
+	SpellAddTargetDebuff(moonfire moonfire_debuff=1)
+Define(moonfire_debuff 8921)
+	SpellInfo(moonfire_debuff duration=14 haste=spell tick=2)
+	SpellInfo(moonfire_debuff addduration=2 itemset=T14_caster itemcount=4)
+Define(moonkin_form 24858)
+Define(natures_grace_buff 16886)
+	SpellInfo(natures_grace_buff duration=15)
+Define(natures_swiftness 132158)
+	SpellInfo(natures_swiftness cd=60)
+Define(natures_vigil 124974)
+	SpellInfo(natures_vigil cd=90)
+Define(natures_vigil_talent 18)
+Define(omen_of_clarity 16864)
+Define(omen_of_clarity_buff 135700)
+	SpellInfo(omen_of_clarity_buff duration=15)
+Define(predatory_swiftness_buff 69369)
+	SpellInfo(predatory_swiftness_buff duration=8)
+Define(prowl 5215)
+Define(rake 1822)
+	SpellInfo(rake combo=1 energy=35)
+	SpellInfo(rake critcombo=1 if_spell=primal_fury)
+	SpellInfo(rake buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(rake buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(rake omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+	SpellAddTargetDebuff(rake rake_debuff=1)
+Define(rake_debuff 1822)
+	SpellInfo(rake_debuff duration=15 tick=3)
+	# Damage(rake_debuff) = (99 + 0.3 * AP) damage per tick (from Catus).
+	SpellInfo(rake_debuff base=99 bonusap=0.3)
+	SpellDamageBuff(rake_debuff dream_of_cenarius_melee_buff=1.3)
+Define(ravage 6785)
+	SpellInfo(ravage combo=1 energy=45)
+	SpellInfo(ravage critcombo=1 if_spell=primal_fury)
+	SpellInfo(ravage buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(ravage buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(ravage omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+Define(renewal 108238)
+	SpellInfo(renewal cd=120)
+Define(renewal_talent 5)
+Define(rip 1079)
+	SpellInfo(rip combo=finisher energy=30)
+	SpellAddTargetDebuff(rip rip_debuff=1)
+	SpellInfo(rip buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(rip buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(rip omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+Define(rip_debuff 1079)
+	SpellInfo(rip_debuff duration=16 resetcounter=ripshreds tick=2)
+	SpellInfo(rip_debuff addduration=4 itemset=T14_melee itemcount=4)
+	# Rip does (113 + 320 * CP + 0.0484 * AP * CP * 8) damage over 16 seconds (from Wowhead).
+	# Damage(rip_debuff) = (14.125 + 40 * CP + 0.0484 * AP * CP) damage per tick.
+	SpellInfo(rip_debuff base=14.125 bonuscp=40 bonusapcp=0.0484)
+	SpellDamageBuff(rip_debuff dream_of_cenarius_damage_buff=1.3)
+Define(rune_of_reorigination_buff 139120)
+	SpellInfo(rune_of_reorigination_buff duration=10)
+Define(savage_roar 52610)
+	SpellInfo(savage_roar combo=finisher energy=25 min_combo=1)
+	SpellInfo(savage_roar duration=12 adddurationcp=6)
+	SpellInfo(savage_roar buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(savage_roar buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(savage_roar savage_roar=1)
+	SpellAddBuff(savage_roar omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+Define(savage_roar_glyphed 127538)
+	SpellInfo(savage_roar_glyphed combo=finisher energy=25)
+	SpellInfo(savage_roar_glyphed duration=12 adddurationcp=6)
+	SpellInfo(savage_roar_glyphed buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(savage_roar_glyphed buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(savage_roar_glyphed savage_roar_glyphed=1)
+	SpellAddBuff(savage_roar_glyphed omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+SpellList(savage_roar_buff savage_roar savage_roar_glyphed)
+Define(shred 5221)
+	SpellInfo(shred combo=1 energy=40)
+	SpellInfo(shred critcombo=1 if_spell=primal_fury)
+	SpellInfo(shred buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(shred buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(shred omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+Define(shooting_stars_buff 93400)
+	SpellInfo(shooting_stars_buff duration=12)
+Define(skull_bash_cat 80965)
+	SpellInfo(skull_bash_cat cd=15)
+	SpellInfo(skull_bash_cat addcd=5 glyph=glyph_of_skull_bash)
+Define(solar_beam 78675)
+	SpellInfo(solar_beam cd=60)
+Define(solar_eclipse_buff 48517)
+Define(starfall 48505)
+	SpellInfo(starfall cd=90)
+	SpellAddBuff(starfall starfall_buff=1)
+Define(starfall_buff 48505)
+	SpellInfo(starfall_buff duration=10)
+Define(starfire 2912)
+	SpellInfo(starfire eclipse=20)
+Define(starsurge 78674)
+	SpellInfo(starsurge cd=15 eclipse=20 eclipsedir=1)
+	SpellAddBuff(starsurge shooting_stars_buff=0)
+Define(sunfire 93402)
+	SpellAddTargetDebuff(sunfire sunfire_debuff=1)
+Define(sunfire_debuff 93402)
+	SpellInfo(sunfire_debuff duration=14 haste=spell tick=2)
+	SpellInfo(sunfire addduration=2 itemset=T14_caster itemcount=4)
+Define(survival_instincts 61336)
+	SpellInfo(survival_instincts cd=180)
+	SpellInfo(survival_instincts addcd=-60 glyph=glyph_of_survival_instincts)
+	SpellAddBuff(survival_instincts survival_instincts=1)
+Define(swipe_cat 62078)
+	SpellInfo(swipe_cat combo=1 energy=45)
+	SpellInfo(swipe_cat buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(swipe_cat buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(swipe_cat omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+Define(symbiosis_mirror_image 110621)
+	SpellInfo(symbiosis_mirror_image cd=180)
+Define(thrash_cat 106830)
+	SpellInfo(thrash_cat energy=50)
+	SpellInfo(thrash_cat buff_energy_half=berserk_cat_buff if_stance=druid_cat_form)
+	SpellInfo(thrash_cat buff_energy_none=omen_of_clarity_buff if_spell=omen_of_clarity)
+	SpellAddBuff(thrash_cat omen_of_clarity_buff=0 if_spell=omen_of_clarity)
+	SpellAddTargetDebuff(thrash_cat thrash_cat_debuff=1)
+Define(thrash_cat_debuff 106830)
+	SpellInfo(thrash_cat_debuff duration=15 tick=3)
+Define(tigers_fury 5217)
+	SpellInfo(tigers_fury cd=30 energy=-60)
+	SpellAddBuff(tigers_fury tigers_fury_buff=1)
+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 cd=180 if_spell=malfurions_gift)
+Define(typhoon 132469)
+	SpellInfo(typhoon cd=30)
+Define(typhoon_talent 9)
+Define(weakened_armor_debuff 113746)
+	SpellInfo(weakened_armor_debuff duration=30)
+Define(wild_charge 102401)
+	SpellInfo(wild_charge cd=15)
+Define(wild_charge_bear 16979)
+	SpellInfo(wild_charge_bear cd=15)
+Define(wild_charge_cat 49376)
+	SpellInfo(wild_charge_cat cd=15)
+Define(wild_charge_moonkin 102383)
+	SpellInfo(wild_charge_moonkin cd=15)
+Define(wild_charge_talent 3)
+Define(wild_mushroom_caster 88747)
+	SpellInfo(wild_mushroom_caster gcd=1)
+Define(wild_mushroom_detonate 88751)
+	SpellInfo(wild_mushroom_detonate cd=10 gcd=0)
+Define(wrath 5176)
+	SpellInfo(wrath eclipse=-15)
+
+AddFunction FaerieFire
+{
+	if TalentPoints(faerie_swarm_talent) Spell(faerie_swarm)
+	if not TalentPoints(faerie_swarm_talent) Spell(faerie_fire)
+}
+
+AddFunction SavageRoar
+{
+    if Glyph(glyph_of_savagery) Spell(savage_roar_glyphed)
+    if Glyph(glyph_of_savagery no) and ComboPoints() >0 Spell(savage_roar)
+}
+
+AddFunction BalanceInterrupt
+{
+	if not target.IsFriend() and target.IsInterruptible()
+	{
+		if not target.Classification(worldboss)
+		{
+			if TalentPoints(mighty_bash_talent) and target.InRange(mighty_bash) Spell(mighty_bash)
+			if TalentPoints(typhoon_talent) Spell(typhoon)
+			Spell(solar_beam)
+		}
+	}
+}
+
+AddFunction FeralInterrupt
+{
+	if not target.IsFriend() and target.IsInterruptible()
+	{
+		if target.InRange(skull_bash_cat) Spell(skull_bash_cat)
+		if not target.Classification(worldboss)
+		{
+			if TalentPoints(mighty_bash_talent) and target.InRange(mighty_bash) Spell(mighty_bash)
+			if TalentPoints(typhoon_talent) and target.InRange(skull_bash_cat) Spell(typhoon)
+			if ComboPoints() > 0 and target.InRange(maim) Spell(maim)
+		}
+	}
+}
+]]
+
+	OvaleScripts:RegisterScript("DRUID", name, desc, code, "include")
+end
diff --git a/scripts/ovale_hunter.lua b/scripts/ovale_hunter.lua
new file mode 100644
index 0000000..b9af270
--- /dev/null
+++ b/scripts/ovale_hunter.lua
@@ -0,0 +1,603 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "Ovale"
+	local desc = "[5.4] Ovale: Beast Mastery, Marksmanship, Survival"
+	local code = [[
+# Ovale hunter script based on SimulationCraft.
+#	Last updated: 2014-04-18
+
+Include(ovale_items)
+Include(ovale_racials)
+Include(ovale_hunter_spells)
+
+AddCheckBox(opt_aoe L(AOE) default)
+AddCheckBox(opt_icons_left "Left icons")
+AddCheckBox(opt_icons_right "Right icons")
+AddCheckBox(opt_proc_on_use_agility_trinket "Proc/On-Use Agility Trinket")
+
+###
+### Beast Mastery
+###
+# Based on SimulationCraft profile "Hunter_BM_T16H".
+#	class=hunter
+#	spec=beast_mastery
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#Ya!...100
+
+AddFunction BeastMasteryDefaultActions
+{
+	#auto_shot
+	#serpent_sting,if=!ticking
+	if not target.DebuffPresent(serpent_sting_debuff) Spell(serpent_sting)
+	#dire_beast,if=enabled
+	if TalentPoints(dire_beast_talent) Spell(dire_beast)
+	#fervor,if=enabled&focus<=65
+	if TalentPoints(fervor_talent) and Focus() <= 65 Spell(fervor)
+	#kill_shot
+	Spell(kill_shot usable=1)
+	#kill_command
+	Spell(kill_command)
+	#glaive_toss,if=enabled
+	if TalentPoints(glaive_toss_talent) Spell(glaive_toss)
+	#arcane_shot,if=buff.thrill_of_the_hunt.react|buff.beast_within.up
+	if BuffPresent(thrill_of_the_hunt_buff) or BuffPresent(beast_within_buff) Spell(arcane_shot)
+	#focus_fire,five_stacks=1
+	if pet.BuffStacks(pet_frenzy_buff any=1) == 5 Spell(focus_fire)
+	#cobra_shot,if=dot.serpent_sting.remains<6
+	if target.DebuffRemains(serpent_sting_debuff) < 6 Spell(cobra_shot)
+	#arcane_shot,if=focus>=61
+	if Focus() >= 61 Spell(arcane_shot)
+	#cobra_shot
+	Spell(cobra_shot)
+	Spell(steady_shot)
+}
+
+AddFunction BeastMasteryDefaultAoeActions
+{
+	#auto_shot
+	#explosive_trap,if=active_enemies>1
+	if Enemies() > 1 Spell(explosive_trap)
+	#serpent_sting,if=!ticking
+	if not target.DebuffPresent(serpent_sting_debuff) Spell(serpent_sting)
+	#dire_beast,if=enabled
+	if TalentPoints(dire_beast_talent) Spell(dire_beast)
+	#fervor,if=enabled&focus<=65
+	if TalentPoints(fervor_talent) and Focus() <= 65 Spell(fervor)
+	#multi_shot,if=active_enemies>5|(active_enemies>1&buff.beast_cleave.down)
+	if Enemies() > 5 or { Enemies() > 1 and pet.BuffExpires(beast_cleave_buff any=1) } Spell(multi_shot)
+	#kill_shot
+	Spell(kill_shot usable=1)
+	#kill_command
+	Spell(kill_command)
+	#glaive_toss,if=enabled
+	if TalentPoints(glaive_toss_talent) Spell(glaive_toss)
+	#cobra_shot,if=active_enemies>5
+	if Enemies() > 5 Spell(cobra_shot)
+	#arcane_shot,if=buff.thrill_of_the_hunt.react|buff.beast_within.up
+	if BuffPresent(thrill_of_the_hunt_buff) or BuffPresent(beast_within_buff) Spell(arcane_shot)
+	#focus_fire,five_stacks=1
+	if pet.BuffStacks(pet_frenzy_buff any=1) == 5 Spell(focus_fire)
+	#cobra_shot,if=dot.serpent_sting.remains<6
+	if target.DebuffRemains(serpent_sting_debuff) < 6 Spell(cobra_shot)
+	#arcane_shot,if=focus>=61
+	if Focus() >= 61 Spell(arcane_shot)
+	#cobra_shot
+	Spell(cobra_shot)
+	Spell(steady_shot)
+}
+
+AddFunction BeastMasteryDefaultShortCdActions
+{
+	unless { not target.DebuffPresent(serpent_sting_debuff) and Spell(serpent_sting) }
+		or { TalentPoints(dire_beast_talent) and Spell(dire_beast) }
+	{
+		#bestial_wrath,if=focus>60&!buff.beast_within.up
+		if Focus() > 60 and not BuffPresent(beast_within_buff) Spell(bestial_wrath)
+		#barrage,if=enabled&active_enemies>5
+		if TalentPoints(barrage_talent) and Enemies() > 5 Spell(barrage)
+
+		unless Spell(kill_shot usable=1)
+			or Spell(kill_command)
+			or { TalentPoints(glaive_toss_talent) and Spell(glaive_toss) }
+		{
+			#barrage,if=enabled
+			if TalentPoints(barrage_talent) Spell(barrage)
+			#powershot,if=enabled
+			if TalentPoints(powershot_talent) Spell(powershot)
+		}
+	}
+}
+
+AddFunction BeastMasteryDefaultCdActions
+{
+	#virmens_bite_potion,if=target.time_to_die<=25|buff.stampede.up
+	if target.TimeToDie() <= 25 or BuffPresent(stampede_buff) UsePotionAgility()
+	#use_item,slot=hands
+	UseItemActions()
+
+	unless { not target.DebuffPresent(serpent_sting_debuff) and Spell(serpent_sting) }
+	{
+		#blood_fury
+		UseRacialActions()
+
+		unless { TalentPoints(dire_beast_talent) and Spell(dire_beast) }
+		{
+			#rapid_fire,if=!buff.rapid_fire.up
+			if not BuffPresent(rapid_fire_buff) Spell(rapid_fire)
+			#stampede,if=trinket.stat.agility.up|target.time_to_die<=20|(trinket.stacking_stat.agility.stack>10&trinket.stat.agility.cooldown_remains<=3)
+			if CheckBoxOff(opt_proc_on_use_agility_trinket) or BuffPresent(trinket_stat_agility_buff) or target.TimeToDie() <= 20 or { BuffStacks(trinket_stacking_stat_agility_buff) > 10 and { ItemCooldown(Trinket0Slot) + ItemCooldown(Trinket1Slot) } <= 3 } Spell(stampede)
+
+			unless Spell(kill_shot usable=1)
+				or Spell(kill_command)
+			{
+				#a_murder_of_crows,if=enabled&!ticking
+				if TalentPoints(a_murder_of_crows_talent) and not target.DebuffPresent(a_murder_of_crows_debuff) Spell(a_murder_of_crows)
+
+				unless { TalentPoints(glaive_toss_talent) and Spell(glaive_toss) }
+				{
+					#lynx_rush,if=enabled&!dot.lynx_rush.ticking
+					if TalentPoints(lynx_rush_talent) and not target.DebuffPresent(lynx_rush_debuff) Spell(lynx_rush)
+				}
+			}
+		}
+	}
+}
+
+AddFunction BeastMasteryPrecombatActions
+{
+	#flask,type=spring_blossoms
+	#food,type=sea_mist_rice_noodles
+	#aspect_of_the_hawk
+	if TalentPoints(aspect_of_the_iron_hawk_talent) and not Stance(hunter_aspect_of_the_iron_hawk) Spell(aspect_of_the_iron_hawk)
+	if not TalentPoints(aspect_of_the_iron_hawk_talent) and not Stance(hunter_aspect_of_the_hawk) Spell(aspect_of_the_hawk)
+	#summon_pet
+	SummonPet()
+	#snapshot_stats
+}
+
+AddFunction BeastMasteryPrecombatCdActions
+{
+	#hunters_mark,if=target.time_to_die>=21&!debuff.ranged_vulnerability.up
+	if target.TimeToDie() >= 21 and not target.DebuffPresent(ranged_vulnerability any=1) Spell(hunters_mark)
+	#virmens_bite_potion
+	UsePotionAgility()
+}
+
+### Beast Mastery icons
+
+AddIcon mastery=beast_mastery size=small checkboxon=opt_icons_left
+{
+	Spell(misdirection)
+}
+
+AddIcon mastery=beast_mastery size=small checkboxon=opt_icons_left
+{
+	Spell(disengage)
+}
+
+AddIcon mastery=beast_mastery help=shortcd
+{
+	SummonPet()
+	BeastMasteryDefaultShortCdActions()
+}
+
+AddIcon mastery=beast_mastery help=main
+{
+	if InCombat(no) BeastMasteryPrecombatActions()
+	BeastMasteryDefaultActions()
+}
+
+AddIcon mastery=beast_mastery help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) BeastMasteryPrecombatActions()
+	BeastMasteryDefaultAoeActions()
+}
+
+AddIcon mastery=beast_mastery help=cd
+{
+	if InCombat(no) BeastMasteryPrecombatCdActions()
+	Interrupt()
+	BeastMasteryDefaultCdActions()
+}
+
+AddIcon mastery=beast_mastery size=small checkboxon=opt_icons_right
+{
+	Spell(explosive_trap)
+}
+
+AddIcon mastery=beast_mastery size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Marksmanship
+###
+# Based on SimulationCraft profile "Hunter_MM_T16H".
+#	class=hunter
+#	spec=marksmanship
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#YZ!...000
+
+AddFunction MarksmanshipCarefulAimActions
+{
+	#serpent_sting,if=!ticking
+	if not target.DebuffPresent(serpent_sting_debuff) Spell(serpent_sting)
+	#chimera_shot
+	Spell(chimera_shot)
+	#steady_shot,if=buff.pre_steady_focus.up&buff.steady_focus.remains<6
+	if BuffPresent(pre_steady_focus_buff) and BuffRemains(steady_focus_buff) < 6 Spell(steady_shot)
+	#aimed_shot
+	Spell(aimed_shot)
+	#glaive_toss,if=enabled
+	if TalentPoints(glaive_toss_talent) Spell(glaive_toss)
+	#steady_shot
+	Spell(steady_shot)
+}
+
+AddFunction MarksmanshipDefaultActions
+{
+	#auto_shot
+	#fervor,if=enabled&focus<=50
+	if TalentPoints(fervor_talent) and Focus() <= 50 Spell(fervor)
+	#dire_beast,if=enabled
+	if TalentPoints(dire_beast_talent) Spell(dire_beast)
+	#run_action_list,name=careful_aim,if=target.health.pct>80
+	if target.HealthPercent() > 80 MarksmanshipCarefulAimActions()
+	#steady_shot,if=buff.pre_steady_focus.up&buff.steady_focus.remains<=4
+	if BuffPresent(pre_steady_focus_buff) and BuffRemains(steady_focus_buff) <= 4 Spell(steady_shot)
+	#glaive_toss,if=enabled
+	if TalentPoints(glaive_toss_talent) Spell(glaive_toss)
+	#serpent_sting,if=!ticking
+	if not target.DebuffPresent(serpent_sting_debuff) Spell(serpent_sting)
+	#chimera_shot
+	Spell(chimera_shot)
+	#steady_shot,if=buff.steady_focus.remains<(action.steady_shot.cast_time+1)&!in_flight
+	if BuffRemains(steady_focus_buff) < { CastTime(steady_shot) + 1 } and not InFlightToTarget(steady_shot) Spell(steady_shot)
+	#kill_shot
+	Spell(kill_shot usable=1)
+	#aimed_shot,if=buff.master_marksman_fire.react
+	if BuffPresent(master_marksman_fire_buff) Spell(aimed_shot)
+	#arcane_shot,if=buff.thrill_of_the_hunt.react
+	if BuffPresent(thrill_of_the_hunt_buff) Spell(arcane_shot)
+	#aimed_shot,if=cast_time<1.6
+	if CastTime(aimed_shot) < 1.6 Spell(aimed_shot)
+	#arcane_shot,if=focus>=60|(focus>=43&(cooldown.chimera_shot.remains>=action.steady_shot.cast_time))&(!buff.rapid_fire.up&!buff.bloodlust.react)
+	if Focus() >= 60 or { Focus() >= 43 and { SpellCooldown(chimera_shot) >= CastTime(steady_shot) } } and { not BuffPresent(rapid_fire_buff) and not BuffPresent(burst_haste any=1) } Spell(arcane_shot)
+	#steady_shot
+	Spell(steady_shot)
+}
+
+AddFunction MarksmanshipDefaultAoeActions
+{
+	#auto_shot
+	#explosive_trap,if=active_enemies>1
+	if Enemies() > 1 Spell(explosive_trap)
+	#fervor,if=enabled&focus<=50
+	if TalentPoints(fervor_talent) and Focus() <= 50 Spell(fervor)
+	#dire_beast,if=enabled
+	if TalentPoints(dire_beast_talent) Spell(dire_beast)
+	#run_action_list,name=careful_aim,if=target.health.pct>80
+	if target.HealthPercent() > 80 MarksmanshipCarefulAimActions()
+	#steady_shot,if=buff.pre_steady_focus.up&buff.steady_focus.remains<=4
+	if BuffPresent(pre_steady_focus_buff) and BuffRemains(steady_focus_buff) <= 4 Spell(steady_shot)
+	#glaive_toss,if=enabled
+	if TalentPoints(glaive_toss_talent) Spell(glaive_toss)
+	#serpent_sting,if=!ticking
+	if not target.DebuffPresent(serpent_sting_debuff) Spell(serpent_sting)
+	#chimera_shot
+	Spell(chimera_shot)
+	#steady_shot,if=buff.steady_focus.remains<(action.steady_shot.cast_time+1)&!in_flight
+	if BuffRemains(steady_focus_buff) < { CastTime(steady_shot) + 1 } and not InFlightToTarget(steady_shot) Spell(steady_shot)
+	#kill_shot
+	Spell(kill_shot usable=1)
+	#multi_shot,if=active_enemies>=4
+	if Enemies() >= 4 Spell(multi_shot)
+	#aimed_shot,if=buff.master_marksman_fire.react
+	if BuffPresent(master_marksman_fire_buff) Spell(aimed_shot)
+	#arcane_shot,if=buff.thrill_of_the_hunt.react
+	if BuffPresent(thrill_of_the_hunt_buff) Spell(arcane_shot)
+	#aimed_shot,if=cast_time<1.6
+	if CastTime(aimed_shot) < 1.6 Spell(aimed_shot)
+	#arcane_shot,if=focus>=60|(focus>=43&(cooldown.chimera_shot.remains>=action.steady_shot.cast_time))&(!buff.rapid_fire.up&!buff.bloodlust.react)
+	if Focus() >= 60 or { Focus() >= 43 and { SpellCooldown(chimera_shot) >= CastTime(steady_shot) } } and { not BuffPresent(rapid_fire_buff) and not BuffPresent(burst_haste any=1) } Spell(arcane_shot)
+	#steady_shot
+	Spell(steady_shot)
+}
+
+AddFunction MarksmanshipDefaultShortCdActions
+{
+	#powershot,if=enabled
+	if TalentPoints(powershot_talent) Spell(powershot)
+
+	unless target.HealthPercent() > 80
+		or { BuffPresent(pre_steady_focus_buff) and BuffRemains(steady_focus_buff) <= 4 and Spell(steady_shot) }
+		or { TalentPoints(glaive_toss_talent) and Spell(glaive_toss) }
+	{
+		#barrage,if=enabled
+		if TalentPoints(barrage_talent) Spell(barrage)
+	}
+}
+
+AddFunction MarksmanshipDefaultCdActions
+{
+	#virmens_bite_potion,if=target.time_to_die<=25|buff.stampede.up
+	if target.TimeToDie() <= 25 or BuffPresent(stampede_buff) UsePotionAgility()
+	#use_item
+	UseItemActions()
+	#blood_fury
+	UseRacialActions()
+
+	unless { TalentPoints(powershot_talent) and Spell(powershot) }
+	{
+		#lynx_rush,if=enabled&!dot.lynx_rush.ticking
+		if TalentPoints(lynx_rush_talent) and not target.DebuffPresent(lynx_rush_debuff) Spell(lynx_rush)
+		#rapid_fire,if=!buff.rapid_fire.up
+		if not BuffPresent(rapid_fire_buff) Spell(rapid_fire)
+		#stampede,if=trinket.stat.agility.up|target.time_to_die<=20|(trinket.stacking_stat.agility.stack>10&trinket.stat.agility.cooldown_remains<=3)
+		if CheckBoxOff(opt_proc_on_use_agility_trinket) or BuffPresent(trinket_stat_agility_buff) or target.TimeToDie() <= 20 or { BuffStacks(trinket_stacking_stat_agility_buff) > 10 and { ItemCooldown(Trinket0Slot) + ItemCooldown(Trinket1Slot) } <= 3 } Spell(stampede)
+		#a_murder_of_crows,if=enabled&!ticking
+		if TalentPoints(a_murder_of_crows_talent) and not target.DebuffPresent(a_murder_of_crows_debuff) Spell(a_murder_of_crows)
+	}
+}
+
+AddFunction MarksmanshipPrecombatActions
+{
+	#flask,type=spring_blossoms
+	#food,type=sea_mist_rice_noodles
+	#aspect_of_the_hawk
+	if TalentPoints(aspect_of_the_iron_hawk_talent) and not Stance(hunter_aspect_of_the_iron_hawk) Spell(aspect_of_the_iron_hawk)
+	if not TalentPoints(aspect_of_the_iron_hawk_talent) and not Stance(hunter_aspect_of_the_hawk) Spell(aspect_of_the_hawk)
+	#summon_pet
+	SummonPet()
+	#snapshot_stats
+}
+
+AddFunction MarksmanshipPrecombatCdActions
+{
+	#hunters_mark,if=target.time_to_die>=21&!debuff.ranged_vulnerability.up
+	if target.TimeToDie() >= 21 and not target.DebuffPresent(ranged_vulnerability any=1) Spell(hunters_mark)
+	#virmens_bite_potion
+	UsePotionAgility()
+}
+
+### Marksmanship icons
+
+AddIcon mastery=marksmanship size=small checkboxon=opt_icons_left
+{
+	Spell(misdirection)
+}
+
+AddIcon mastery=marksmanship size=small checkboxon=opt_icons_left
+{
+	Spell(disengage)
+}
+
+AddIcon mastery=marksmanship help=shortcd
+{
+	SummonPet()
+	MarksmanshipDefaultShortCdActions()
+}
+
+AddIcon mastery=marksmanship help=main
+{
+	if InCombat(no) MarksmanshipPrecombatActions()
+	MarksmanshipDefaultActions()
+}
+
+AddIcon mastery=marksmanship help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) MarksmanshipPrecombatActions()
+	MarksmanshipDefaultAoeActions()
+}
+
+AddIcon mastery=marksmanship help=cd
+{
+	if InCombat(no) MarksmanshipPrecombatCdActions()
+	Interrupt()
+	MarksmanshipDefaultCdActions()
+}
+
+AddIcon mastery=marksmanship size=small checkboxon=opt_icons_right
+{
+	Spell(explosive_trap)
+}
+
+AddIcon mastery=marksmanship size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Survival
+###
+# Based on SimulationCraft profile "Hunter_SV_T16H".
+#	class=hunter
+#	spec=survival
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#Yb!...200
+
+AddFunction SurvivalDefaultActions
+{
+	#auto_shot
+	#fervor,if=enabled&focus<=50
+	if TalentPoints(fervor_talent) and Focus() <= 50 Spell(fervor)
+	#explosive_shot,if=buff.lock_and_load.react
+	if BuffPresent(lock_and_load_buff) Spell(explosive_shot)
+	#glaive_toss,if=enabled
+	if TalentPoints(glaive_toss_talent) Spell(glaive_toss)
+	#serpent_sting,if=!ticking&target.time_to_die>=10
+	if not target.DebuffPresent(serpent_sting_debuff) and target.TimeToDie() >= 10 Spell(serpent_sting)
+	#explosive_shot,if=cooldown_react
+	Spell(explosive_shot)
+	#kill_shot
+	Spell(kill_shot usable=1)
+	#black_arrow,if=!ticking&target.time_to_die>=8
+	if not target.DebuffPresent(black_arrow_debuff) and target.TimeToDie() >= 8 Spell(black_arrow)
+	#multi_shot,if=buff.thrill_of_the_hunt.react&dot.serpent_sting.remains<2
+	if BuffPresent(thrill_of_the_hunt_buff) and target.DebuffRemains(serpent_sting_debuff) < 2 Spell(multi_shot)
+	#arcane_shot,if=buff.thrill_of_the_hunt.react
+	if BuffPresent(thrill_of_the_hunt_buff) Spell(arcane_shot)
+	#dire_beast,if=enabled
+	if TalentPoints(dire_beast_talent) Spell(dire_beast)
+	#cobra_shot,if=dot.serpent_sting.remains<6
+	if target.DebuffRemains(serpent_sting_debuff) < 6 Spell(cobra_shot)
+	#arcane_shot,if=focus>=67&active_enemies<2
+	if Focus() >= 67 Spell(arcane_shot)
+	#cobra_shot
+	Spell(cobra_shot)
+}
+
+AddFunction SurvivalDefaultAoeActions
+{
+	#auto_shot
+	#explosive_trap,if=active_enemies>1
+	if Enemies() > 1 Spell(explosive_trap)
+	#fervor,if=enabled&focus<=50
+	if TalentPoints(fervor_talent) and Focus() <= 50 Spell(fervor)
+	#explosive_shot,if=buff.lock_and_load.react
+	if BuffPresent(lock_and_load_buff) Spell(explosive_shot)
+	#glaive_toss,if=enabled
+	if TalentPoints(glaive_toss_talent) Spell(glaive_toss)
+	#serpent_sting,if=!ticking&target.time_to_die>=10
+	if not target.DebuffPresent(serpent_sting_debuff) and target.TimeToDie() >= 10 Spell(serpent_sting)
+	#explosive_shot,if=cooldown_react
+	Spell(explosive_shot)
+	#kill_shot
+	Spell(kill_shot usable=1)
+	#black_arrow,if=!ticking&target.time_to_die>=8
+	if not target.DebuffPresent(black_arrow_debuff) and target.TimeToDie() >= 8 Spell(black_arrow)
+	#multi_shot,if=active_enemies>3
+	if Enemies() > 3 Spell(multi_shot)
+	#multi_shot,if=buff.thrill_of_the_hunt.react&dot.serpent_sting.remains<2
+	if BuffPresent(thrill_of_the_hunt_buff) and target.DebuffRemains(serpent_sting_debuff) < 2 Spell(multi_shot)
+	#arcane_shot,if=buff.thrill_of_the_hunt.react
+	if BuffPresent(thrill_of_the_hunt_buff) Spell(arcane_shot)
+	#dire_beast,if=enabled
+	if TalentPoints(dire_beast_talent) Spell(dire_beast)
+	#cobra_shot,if=dot.serpent_sting.remains<6
+	if target.DebuffRemains(serpent_sting_debuff) < 6 Spell(cobra_shot)
+	#arcane_shot,if=focus>=67&active_enemies<2
+	if Focus() >= 67 and Enemies() < 2 Spell(arcane_shot)
+	#multi_shot,if=focus>=67&active_enemies>1
+	if Focus() >= 67 and Enemies() > 1 Spell(multi_shot)
+	#cobra_shot
+	Spell(cobra_shot)
+}
+
+AddFunction SurvivalDefaultShortCdActions
+{
+	unless { BuffPresent(lock_and_load_buff) and Spell(explosive_shot) }
+		or { TalentPoints(glaive_toss_talent) and Spell(glaive_toss) }
+	{
+		#powershot,if=enabled
+		if TalentPoints(powershot_talent) Spell(powershot)
+		#barrage,if=enabled
+		if TalentPoints(barrage_talent) Spell(barrage)
+	}
+}
+
+AddFunction SurvivalDefaultCdActions
+{
+	#virmens_bite_potion,if=target.time_to_die<=25|buff.stampede.up
+	if target.TimeToDie() <= 25 or BuffPresent(stampede_buff) UsePotionAgility()
+	#blood_fury
+	UseRacialActions()
+	#use_item
+	UseItemActions()
+	#a_murder_of_crows,if=enabled&!ticking
+	if TalentPoints(a_murder_of_crows_talent) and not target.DebuffPresent(a_murder_of_crows_debuff) Spell(a_murder_of_crows)
+	#lynx_rush,if=enabled&!dot.lynx_rush.ticking
+	if TalentPoints(lynx_rush_talent) and not target.DebuffPresent(lynx_rush_debuff) Spell(lynx_rush)
+
+	unless { BuffPresent(lock_and_load_buff) and Spell(explosive_shot) }
+		or { TalentPoints(glaive_toss_talent) and Spell(glaive_toss) }
+		or { TalentPoints(powershot_talent) and Spell(powershot) }
+		or { TalentPoints(barrage_talent) and Spell(barrage) }
+		or { not target.DebuffPresent(serpent_sting_debuff) and target.TimeToDie() >= 10 and Spell(serpent_sting) }
+		or Spell(explosive_shot)
+		or Spell(kill_shot usable=1)
+		or { not target.DebuffPresent(black_arrow_debuff) and target.TimeToDie() >= 8 and Spell(black_arrow) }
+		or { BuffPresent(thrill_of_the_hunt_buff) and target.DebuffRemains(serpent_sting_debuff) < 2 and Spell(multi_shot) }
+		or { BuffPresent(thrill_of_the_hunt_buff) and Spell(arcane_shot) }
+	{
+		#rapid_fire,if=!buff.rapid_fire.up
+		if not BuffPresent(rapid_fire_buff) Spell(rapid_fire)
+
+		unless { TalentPoints(dire_beast_talent) and Spell(dire_beast) }
+		{
+			#stampede,if=trinket.stat.agility.up|target.time_to_die<=20|(trinket.stacking_stat.agility.stack>10&trinket.stat.agility.cooldown_remains<=3)
+			if CheckBoxOff(opt_proc_on_use_agility_trinket) or BuffPresent(trinket_stat_agility_buff) or target.TimeToDie() <= 20 or { BuffStacks(trinket_stacking_stat_agility_buff) > 10 and { ItemCooldown(Trinket0Slot) + ItemCooldown(Trinket1Slot) } <= 3 } Spell(stampede)
+		}
+	}
+}
+
+AddFunction SurvivalPrecombatActions
+{
+	#flask,type=spring_blossoms
+	#food,type=sea_mist_rice_noodles
+	#aspect_of_the_hawk
+	if TalentPoints(aspect_of_the_iron_hawk_talent) and not Stance(hunter_aspect_of_the_iron_hawk) Spell(aspect_of_the_iron_hawk)
+	if not TalentPoints(aspect_of_the_iron_hawk_talent) and not Stance(hunter_aspect_of_the_hawk) Spell(aspect_of_the_hawk)
+	#summon_pet
+	SummonPet()
+	#snapshot_stats
+}
+
+AddFunction SurvivalPrecombatCdActions
+{
+	#hunters_mark,if=target.time_to_die>=21&!debuff.ranged_vulnerability.up
+	if target.TimeToDie() >= 21 and not target.DebuffPresent(ranged_vulnerability any=1) Spell(hunters_mark)
+	#virmens_bite_potion
+	UsePotionAgility()
+}
+
+### Survival icons
+
+AddIcon mastery=survival size=small checkboxon=opt_icons_left
+{
+	Spell(misdirection)
+}
+
+AddIcon mastery=survival size=small checkboxon=opt_icons_left
+{
+	Spell(disengage)
+}
+
+AddIcon mastery=survival help=shortcd
+{
+	SummonPet()
+	SurvivalDefaultShortCdActions()
+}
+
+AddIcon mastery=survival help=main
+{
+	if InCombat(no) SurvivalPrecombatActions()
+	SurvivalDefaultActions()
+}
+
+AddIcon mastery=survival help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) SurvivalPrecombatActions()
+	SurvivalDefaultAoeActions()
+}
+
+AddIcon mastery=survival help=cd
+{
+	if InCombat(no) SurvivalPrecombatCdActions()
+	Interrupt()
+	SurvivalDefaultCdActions()
+}
+
+AddIcon mastery=survival size=small checkboxon=opt_icons_right
+{
+	Spell(explosive_trap)
+}
+
+AddIcon mastery=survival size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+]]
+
+	OvaleScripts:RegisterScript("HUNTER", name, desc, code)
+end
diff --git a/scripts/ovale_hunter_spells.lua b/scripts/ovale_hunter_spells.lua
new file mode 100644
index 0000000..1dbab91
--- /dev/null
+++ b/scripts/ovale_hunter_spells.lua
@@ -0,0 +1,167 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "ovale_hunter_spells"
+	local desc = "[5.4.7] Ovale: Hunter spells"
+	local code = [[
+Define(a_murder_of_crows 131894)
+	SpellInfo(a_murder_of_crows cd=120 focus=60)
+	SpellInfo(a_murder_of_crows buff_focus_half=beast_within_buff mastery=beast_mastery)
+	SpellAddTargetDebuff(a_murder_of_crows a_murder_of_crows_debuff=1)
+Define(a_murder_of_crows_debuff 131894)
+	SpellInfo(a_murder_of_crows duration=30)
+Define(a_murder_of_crows_talent 13)
+Define(aimed_shot 19434)
+	SpellInfo(aimed_shot buff_focus_none=master_marksman_fire_buff focus=50)
+	SpellAddBuff(aimed_shot master_marksman_fire_buff=0)
+Define(arcane_shot 3044)
+	SpellInfo(arcane_shot focus=30)
+	SpellInfo(arcane_shot buff_focus_half=beast_within_buff mastery=beast_mastery)
+	SpellInfo(arcane_shot buff_focus=thrill_of_the_hunt_buff buff_focus_amount=-20 talent=thrill_of_the_hunt_talent)
+	SpellAddBuff(arcane_shot thrill_of_the_hunt_buff=-1)
+	SpellAddTargetDebuff(arcane_shot hunters_mark_debuff=1)
+Define(aspect_of_the_hawk 13165)
+	SpellInfo(aspect_of_the_hawk cd=1)
+Define(aspect_of_the_iron_hawk 109260)
+	SpellInfo(aspect_of_the_iron_hawk cd=1)
+Define(aspect_of_the_iron_hawk_talent 8)
+Define(barrage 120360)
+	SpellInfo(barrage cd=30 focus=30)
+	SpellInfo(barrage buff_focus_half=beast_within_buff mastery=beast_mastery)
+Define(barrage_talent 18)
+Define(beast_within_buff 34471)
+	SpellInfo(beast_within_buff duration=10)
+	SpellInfo(beast_within_buff addduration=6 itemset=T14 itemcount=4)
+Define(bestial_wrath 19574)
+	SpellInfo(bestial_wrath cd=60)
+	SpellAddBuff(bestial_wrath beast_within_buff=1)
+Define(black_arrow 3674)
+	SpellInfo(black_arrow cd=30 focus=35)
+	SpellInfo(black_arrow addcd=-6 if_spell=trap_mastery)
+	SpellAddTargetDebuff(black_arrow black_arrow_debuff=1)
+Define(black_arrow_debuff 3674)
+	SpellInfo(black_arrow_debuff duration=20 tick=2)
+Define(bombardment_buff 82921)
+	SpellInfo(bombardment_buff duration=5)
+Define(chimera_shot 53209)
+	SpellInfo(chimera_shot cd=9 focus=45)
+	SpellAddTargetDebuff(chimera_shot serpent_sting_debuff=refresh)
+	SpellAddTargetDebuff(chimera_shot hunters_mark_debuff=1)
+Define(cobra_shot 77767)
+	SpellInfo(cobra_shot focus=-14)
+	SpellInfo(cobra_shot focus=-28 itemset=T13 itemcount=2)
+Define(counter_shot 147362)
+	SpellInfo(counter_shot cd=24)
+Define(crouching_tiger_hidden_chimera_talent 3)
+Define(deterrence 19263)
+	SpellInfo(deterrence cd=180)
+	SpellInfo(deterrence addcd=-60 talent=crouching_tiger_hidden_chimera_talent)
+Define(dire_beast 120679)
+	SpellInfo(dire_beast cd=30)
+Define(dire_beast_talent 11)
+Define(disengage 781)
+	SpellInfo(disengage cd=20)
+	SpellInfo(disengage addcd=-10 talent=crouching_tiger_hidden_chimera_talent)
+Define(explosive_shot 53301)
+	SpellInfo(explosive_shot buffnocd=lock_and_load_buff buff_focus_none=lock_and_load_buff cd=6 focus=25)
+	SpellAddTargetDebuff(explosive_shot hunters_mark_debuff=1)
+Define(explosive_trap 13813)
+	SpellInfo(explosive_trap cd=30)
+	SpellInfo(explosive_trap addcd=-6 if_spell=trap_mastery)
+Define(fervor 82726)
+	SpellInfo(fervor cd=30 focus=-50)
+Define(fervor_talent 10)
+Define(focus_fire 82692)
+	SpellAddBuff(focus_fire frenzy_buff=0)
+Define(glaive_toss 117050)
+	SpellInfo(glaive_toss cd=15 focus=15)
+	SpellInfo(glaive_toss buff_focus_half=beast_within_buff mastery=beast_mastery)
+Define(glaive_toss_talent 16)
+Define(hunters_mark 1130)
+Define(hunters_mark_debuff 1130)
+	SpellInfo(hunters_mark_debuff duration=300)
+	SpellAddTargetDebuff(hunters_mark hunters_mark_debuff=1)
+Define(kill_command 34026)
+	SpellInfo(kill_command cd=6 focus=40)
+	SpellInfo(kill_command buff_focus_half=beast_within_buff)
+	SpellAddTargetDebuff(kill_command hunters_mark=1)
+Define(kill_shot 53351)
+	SpellInfo(kill_shot cd=10)
+Define(lock_and_load_buff 56453)
+	SpellInfo(lock_and_load_buff duration=12)
+Define(lynx_rush 120697)
+	SpellInfo(lynx_rush cd=90)
+	SpellAddTargetDebuff(lynx_rush lynx_rush_debuff=1)
+Define(lynx_rush_debuff 120699)
+	SpellInfo(lynx_rush_debuff duration=15 tick=3)
+Define(lynx_rush_talent 15)
+Define(master_marksman_fire_buff 82926)
+	SpellInfo(master_marksman_fire_buff duration=10)
+Define(misdirection 34477)
+	SpellInfo(misdirection cd=30)
+Define(multi_shot 2643)
+	SpellInfo(multi_shot focus=40)
+	SpellInfo(multi_shot buff_focus=thrill_of_the_hunt_buff buff_focus_amount=-20 talent=thrill_of_the_hunt_talent)
+	SpellInfo(multi_shot buff_focus_half=beast_within_buff mastery=beast_mastery)
+	SpellInfo(multi_shot buff_focus=bombardment_buff buff_focus_amount=-20 mastery=marksmanship)
+	SpellAddBuff(multi_shot thrill_of_the_hunt_buff=-1)
+	SpellAddTargetDebuff(multi_shot serpent_sting_debuff=1 if_spell=serpent_spread)
+Define(pet_beast_cleave_buff 118455)
+	SpellInfo(pet_beast_cleave_buff duration=4)
+Define(pet_frenzy_buff 19615)
+	SpellInfo(pet_frenzy_buff duration=30)
+Define(powershot 109259)
+	SpellInfo(powershot cd=60 focus=15)
+	SpellInfo(powershot buff_focus_half=beast_within_buff mastery=beast_mastery)
+Define(powershot_talent 17)
+Define(pre_steady_focus_buff 53224)
+Define(rapid_fire 3045)
+	SpellInfo(rapid_fire cd=180)
+	SpellAddBuff(rapid_fire rapid_fire_buff=1)
+Define(rapid_fire_buff 3045)
+	SpellInfo(rapid_fire_buff duration=15)
+Define(revive_pet 982)
+	SpellInfo(revive_pet focus=35)
+	SpellInfo(revive_pet buff_focus_half=beast_within_buff mastery=beast_mastery)
+Define(serpent_spread 87935)
+Define(serpent_sting 1978)
+	SpellInfo(serpent_sting focus=15)
+	SpellInfo(serpent_sting buff_focus_half=beast_within_buff mastery=beast_mastery)
+	SpellAddTargetDebuff(serpent_sting serpent_sting_debuff=1)
+Define(serpent_sting_debuff 118253)
+	SpellInfo(serpent_sting_debuff duration=15 tick=3)
+Define(silencing_shot 34490)
+	SpellInfo(silencing_shot cd=24)
+Define(stampede 121818)
+	SpellInfo(stampede cd=300)
+Define(stampede_buff 121818)
+Define(steady_focus 53224)
+Define(steady_focus_buff 53220)
+	SpellInfo(steady_focus_buff duration=20)
+Define(steady_shot 56641)
+	SpellInfo(steady_shot focus=-14)
+	SpellInfo(steady_shot focus=-28 itemset=T13 itemcount=2)
+	SpellInfo(steady_shot buff_focus=steady_focus_buff buff_focus_amount=-3 if_spell=steady_focus)
+Define(thrill_of_the_hunt_buff 34720)
+	SpellInfo(thrill_of_the_hunt_buff duration=15)
+Define(thrill_of_the_hunt_talent 12)
+
+AddFunction Interrupt
+{
+	if not target.IsFriend() and target.IsInterruptible()
+	{
+		Spell(silencing_shot)
+		Spell(counter_shot)
+	}
+}
+
+AddFunction SummonPet
+{
+	if pet.Present(no) Texture(ability_hunter_beastcall)
+	if pet.IsDead() Spell(revive_pet)
+}
+]]
+
+	OvaleScripts:RegisterScript("HUNTER", name, desc, code, "include")
+end
diff --git a/scripts/ovale_items.lua b/scripts/ovale_items.lua
new file mode 100644
index 0000000..3d84076
--- /dev/null
+++ b/scripts/ovale_items.lua
@@ -0,0 +1,85 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "ovale_items"
+	local desc = "[5.4.7] Ovale: Items & Trinkets"
+	local code = [[
+###
+### Potions (Mists of Pandaria only)
+###
+
+Define(jade_serpent_potion 76093)
+Define(jade_serpent_potion_buff 105702)
+	SpellInfo(jade_serpent_potion_buff duration=25)
+Define(mogu_power_potion 76095)
+Define(mogu_power_potion_buff 105706)
+	SpellInfo(mogu_power_potion_buff duration=25)
+Define(virmens_bite_potion 76089)
+Define(virmens_bite_potion_buff 105697)
+	SpellInfo(virmens_bite_potion_buff duration=25)
+
+AddCheckBox(potions "Use potions" default)
+
+AddFunction UsePotionAgility
+{
+	if CheckBoxOn(potions) and target.Classification(worldboss) Item(virmens_bite_potion usable=1)
+}
+
+AddFunction UsePotionIntellect
+{
+	if CheckBoxOn(potions) and target.Classification(worldboss) Item(jade_serpent_potion usable=1)
+}
+
+AddFunction UsePotionStrength
+{
+	if CheckBoxOn(potions) and target.Classification(worldboss) Item(mogu_power_potion usable=1)
+}
+
+###
+### Trinkets (Mists of Pandaria only)
+###
+
+# Agility
+SpellList(trinket_proc_agility_buff 126554 126690 126707 128984 138699 138938 146308 146310 148896 148903)
+SpellList(trinket_stacking_proc_agility_buff 138756)
+SpellList(trinket_stat_agility_buff 126554 126690 126707 128984 138699 138938 146308 146310 148896 148903)
+SpellList(trinket_stacking_stat_agility_buff 138756)
+
+# Intellect
+SpellList(trinket_proc_intellect_buff 126554 126690 126707 128984 138699 138938 146308 146310 148896 148903)
+SpellList(trinket_stacking_proc_intellect_buff 138756)
+
+# Strength
+SpellList(trinket_proc_strength_buff 126554 126690 126707 128984 138699 138938 146308 146310 148896 148903)
+
+# Critical Strike
+SpellList(trinket_stacking_stat_crit_buff 138756)
+
+AddCheckBox(opt_use_trinket0 "Use trinket 0" default)
+AddCheckBox(opt_use_trinket1 "Use trinket 1" default)
+
+AddFunction UseItemActions
+{
+	Item(HandsSlot usable=1)
+	if CheckBoxOn(opt_use_trinket0) Item(Trinket0Slot usable=1)
+	if CheckBoxOn(opt_use_trinket1) Item(Trinket1Slot usable=1)
+}
+
+###
+### Legendary Meta Gem
+###
+Define(lucidity_druid_buff 137247)
+	SpellInfo(lucidity_druid_buff duration=4)
+Define(lucidity_monk_buff 137331)
+	SpellInfo(lucidity_monk_buff duration=4)
+Define(lucidity_paladin_buff 137288)
+	SpellInfo(lucidity_paladin_buff duration=4)
+Define(lucidity_priest_buff 137323)
+	SpellInfo(lucidity_priest_buff duration=4)
+Define(lucidity_shaman_buff 137326)
+	SpellInfo(lucidity_shaman_buff duration=4)
+]]
+
+	OvaleScripts:RegisterScript(nil, name, desc, code, "include")
+end
diff --git a/scripts/ovale_monk.lua b/scripts/ovale_monk.lua
new file mode 100644
index 0000000..e71a5ac
--- /dev/null
+++ b/scripts/ovale_monk.lua
@@ -0,0 +1,537 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "Ovale"
+	local desc = "[5.4] Ovale: Brewmaster, Mistweaver, Windwalker"
+	local code = [[
+# Ovale monk script based on SimulationCraft.
+#	Last updated: 2014-04-16
+
+Include(ovale_items)
+Include(ovale_racials)
+Include(ovale_monk_spells)
+
+AddCheckBox(opt_aoe L(AOE) default)
+AddCheckBox(opt_icons_left "Left icons")
+AddCheckBox(opt_icons_right "Right icons")
+
+###
+### Brewmaster
+###
+# Rotation from Elitist Jerks, "Like Water - The Brewmaster's Resource"
+#	http://forums.elitistjerks.com/page/articles.html/_/world-of-warcraft/monk/like-water-the-brewmasters-resource-r83
+
+AddFunction StaggerDamageRemaining
+{
+	if DebuffPresent(light_stagger_debuff)		{ TicksRemain(light_stagger_debuff)    * TickValue(light_stagger_debuff) }
+	if DebuffPresent(moderate_stagger_debuff)	{ TicksRemain(moderate_stagger_debuff) * TickValue(moderate_stagger_debuff) }
+	if DebuffPresent(heavy_stagger_debuff)		{ TicksRemain(heavy_stagger_debuff)    * TickValue(heavy_stagger_debuff) }
+}
+
+AddFunction StaggerTickDamage
+{
+	if DebuffPresent(light_stagger_debuff)		TickValue(light_stagger_debuff)
+	if DebuffPresent(moderate_stagger_debuff)	TickValue(moderate_stagger_debuff)
+	if DebuffPresent(heavy_stagger_debuff)		TickValue(heavy_stagger_debuff)
+}
+
+AddFunction BrewmasterFillerActions
+{
+	if TalentPoints(chi_wave_talent) Spell(chi_wave)
+	if TalentPoints(zen_sphere_talent) and BuffExpires(zen_sphere_buff) Spell(zen_sphere)
+	Spell(tiger_palm)
+}
+
+AddFunction BrewmasterDefaultActions
+{
+	if BuffRemains(shuffle_buff) <= 3 Spell(blackout_kick)
+	if MaxChi() - Chi() >= 2 Spell(keg_smash)
+	if MaxChi() - Chi() >= 1 and HealthPercent() < 35
+	{
+		if Glyph(glyph_of_targeted_expulsion) Spell(expel_harm_glyphed)
+		if Glyph(glyph_of_targeted_expulsion no) Spell(expel_harm)
+	}
+	if BuffExpires(power_guard_buff)
+	{
+		if Glyph(glyph_of_guard) and BuffRemains(guard_glyphed_buff) <= 2 and SpellCooldown(guard_glyphed) < GCD() Spell(tiger_palm)
+		if Glyph(glyph_of_guard no) and BuffRemains(guard_buff) <= 2 and SpellCooldown(guard) < GCD() Spell(tiger_palm)
+	}
+	if BuffExpires(tiger_power_buff) Spell(tiger_palm)
+}
+
+AddFunction BrewmasterSingleTargetActions
+{
+	if Chi() == MaxChi()
+	{
+		Spell(blackout_kick)
+	}
+	if TimeToMaxEnergy() < 2 and Energy() - 40 + SpellCooldown(keg_smash) * EnergyRegen() > 40
+	{
+		if SpellCooldown(keg_smash) > GCD()
+		{
+			# Only Jab or Expel Harm if we'll have enough energy to Keg Smash when it comes off cooldown.
+			if HealthPercent() < 80
+			{
+				if Glyph(glyph_of_targeted_expulsion) Spell(expel_harm_glyphed)
+				if Glyph(glyph_of_targeted_expulsion no) Spell(expel_harm)
+			}
+			Spell(jab)
+		}
+	}
+	if MaxChi() - Chi() < 2
+	{
+		Spell(blackout_kick)
+	}
+}
+
+AddFunction BrewmasterAoeActions
+{
+	if Chi() == MaxChi()
+	{
+		if BuffRemains(shuffle_buff) > 6 Spell(breath_of_fire)
+		Spell(blackout_kick)
+	}
+	if TimeToMaxEnergy() < 2 and Energy() - 40 + SpellCooldown(keg_smash) * EnergyRegen() > 40
+	{
+		# Only SCK/RJW if we'll have enough energy to Keg Smash when it comes off cooldown.
+		if TalentPoints(rushing_jade_wind_talent) and SpellCooldown(keg_smash) > GCD()
+		{
+			Spell(rushing_jade_wind)
+		}
+		if not TalentPoints(rushing_jade_wind_talent) and SpellCooldown(keg_smash) > 2
+		{
+			# The channel time of SCK is 2s, so only SCK if Keg Smash is on CD for at least 2s.
+			Spell(spinning_crane_kick)
+		}
+	}
+	if MaxChi() - Chi() < 2
+	{
+		if BuffRemains(shuffle_buff) > 6 Spell(breath_of_fire)
+		Spell(blackout_kick)
+	}
+}
+
+AddFunction BrewmasterShortCdActions
+{
+	# Cast Purifying Brew only if Heavy Stagger (urgent!) or if Shuffle uptime won't suffer.
+	# Avoid Purifying while Elusive Brew is up unless under Heavy Stagger.
+	if DebuffPresent(heavy_stagger_debuff) or { BuffExpires(elusive_brew_buff) and { BuffRemains(shuffle_buff) > 6 or Chi() > 2 } }
+	{
+		# Purify Stagger if it ticks for more than half of my remaining health (urgent!).
+		if StaggerTickDamage() / Health() > 0.5 Spell(purifying_brew)
+		# Purify Stagger > 40% of my health.
+		if StaggerDamageRemaining() / MaxHealth() > 0.40 Spell(purifying_brew)
+		# Purify Medium Stagger if below 70% health.
+		if DebuffPresent(moderate_stagger_debuff) and HealthPercent() < 70 Spell(purifying_brew)
+	}
+	if BuffPresent(purifier_buff) and DebuffPresent(stagger_debuff) Spell(purifying_brew)
+	if ArmorSetParts(T15_tank) < 2 and BuffStacks(elusive_brew_buff) > 10 Spell(elusive_brew_use)
+	if ArmorSetParts(T15_tank) >= 2 and BuffStacks(elusive_brew_buff) > 5
+	{
+		if BuffRemains(staggering_buff) < BuffStacks(elusive_brew_buff) Spell(elusive_brew_use)
+	}
+	if BuffPresent(power_guard_buff)
+	{
+		if Glyph(glyph_of_guard) and BuffExpires(guard_glyphed_buff) Spell(guard_glyphed)
+		if Glyph(glyph_of_guard no) and BuffExpires(guard_buff) Spell(guard)
+	}
+}
+
+AddFunction BrewmasterCdActions
+{
+	if TalentPoints(chi_burst_talent) Spell(chi_burst)
+	unless { target.Health() < Health() and BuffPresent(death_note_buff) Spell(touch_of_death) }
+		or { TalentPoints(chi_burst_talent) and Spell(chi_burst) }
+	{
+		if TalentPoints(invoke_xuen_talent) Spell(invoke_xuen)
+	}
+}
+
+AddFunction BrewmasterPrecombatActions
+{
+	if BuffExpires(str_agi_int any=1) Spell(legacy_of_the_emperor)
+	if not Stance(monk_stance_of_the_sturdy_ox) Spell(stance_of_the_sturdy_ox)
+	if DebuffPresent(light_stagger_debuff) or DebuffPresent(moderate_stagger_debuff) or DebuffPresent(heavy_stagger_debuff) Spell(purifying_brew)
+}
+
+### Brewmaster icons.
+
+AddIcon mastery=brewmaster help=cd size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(dampen_harm_talent) Spell(dampen_harm)
+	if TalentPoints(diffuse_magic_talent) Spell(diffuse_magic)
+}
+
+AddIcon mastery=brewmaster help=cd size=small checkboxon=opt_icons_left
+{
+	Spell(fortifying_brew)
+	Spell(symbiosis_survival_instincts)
+	UseRacialSurvivalActions()
+}
+
+# Defensive abilities
+AddIcon mastery=brewmaster help=cd
+{
+	BrewmasterShortCdActions()
+}
+
+AddIcon mastery=brewmaster help=main
+{
+	if InCombat(no) BrewmasterPrecombatActions()
+	BrewmasterDefaultActions()
+	BrewmasterSingleTargetActions()
+	BrewmasterFillerActions()
+}
+
+AddIcon mastery=brewmaster help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) BrewmasterPrecombatActions()
+	BrewmasterDefaultActions()
+	BrewmasterAoeActions()
+	BrewmasterFillerActions()
+}
+
+AddIcon mastery=brewmaster help=cd
+{
+	if IsFeared() or IsRooted() or IsStunned() Spell(nimble_brew)
+	if target.Health() < Health() and BuffPresent(death_note_buff) Spell(touch_of_death)
+	Interrupt()
+
+	BrewmasterCdActions()
+}
+
+AddIcon mastery=brewmaster help=cd size=small checkboxon=opt_icons_right
+{
+	if TotemExpires(statue) or BuffExpires(sanctuary_of_the_ox_buff) Spell(summon_black_ox_statue)
+}
+
+AddIcon mastery=brewmaster help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Mistweaver
+###
+
+AddCheckBox(opt_mistweaver_pool_chi "Pool Chi >= 2" mastery=mistweaver)
+AddFunction MistweaverChiPool
+{
+	if CheckBoxOn(opt_mistweaver_pool_chi) 2
+	0
+}
+
+AddFunction ManaTea
+{
+	if Glyph(glyph_of_mana_tea) Spell(mana_tea_glyphed)
+	if not Glyph(glyph_of_mana_tea) Spell(mana_tea)
+}
+
+AddFunction MistweaverAoeActions
+{
+	#rushing_jade_wind,if=talent.rushing_jade_wind.enabled
+	if TalentPoints(rushing_jade_wind_talent) Spell(rushing_jade_wind)
+	#zen_sphere,cycle_targets=1,if=talent.zen_sphere.enabled&!dot.zen_sphere.ticking
+	if TalentPoints(zen_sphere_talent) and BuffCount(zen_sphere_buff) < 1 Spell(zen_sphere)
+	#chi_burst,if=talent.chi_burst.enabled
+	if TalentPoints(chi_burst_talent) Spell(chi_burst)
+	#tiger_palm,if=buff.muscle_memory.up&!buff.tiger_power.up
+	if BuffPresent(muscle_memory_buff) and BuffExpires(tiger_power_buff) Spell(tiger_palm)
+	#blackout_kick,if=buff.muscle_memory.up&buff.tiger_power.up&chi>1
+	if BuffPresent(muscle_memory_buff) and BuffPresent(tiger_power_buff) and Chi() > MistweaverChiPool() + 1 Spell(blackout_kick)
+	#spinning_crane_kick,if=!talent.rushing_jade_wind.enabled
+	if not TalentPoints(rushing_jade_wind_talent) Spell(spinning_crane_kick)
+	#jab,if=talent.rushing_jade_wind.enabled
+	if Glyph(glyph_of_targeted_expulsion) Spell(expel_harm_glyphed)
+	if Glyph(glyph_of_targeted_expulsion no) Spell(expel_harm)
+	if TalentPoints(rushing_jade_wind_talent) Spell(jab)
+}
+
+AddFunction MistweaverSingleTargetActions
+{
+	#crackling_jade_lightning,if=buff.bloodlust.up&buff.lucidity.up
+	if BuffPresent(burst_haste any=1) and BuffPresent(lucidity_monk_buff) Spell(crackling_jade_lightning)
+	#tiger_palm,if=buff.muscle_memory.up&buff.lucidity.up
+	if BuffPresent(lucidity_monk_buff) and BuffPresent(muscle_memory_buff) Spell(tiger_palm)
+	#jab,if=buff.lucidity.up
+	if BuffPresent(lucidity_monk_buff) Spell(jab)
+	#tiger_palm,if=buff.muscle_memory.up&!buff.tiger_power.up
+	if BuffPresent(muscle_memory_buff) and BuffExpires(tiger_power_buff) Spell(tiger_palm)
+	#blackout_kick,if=buff.muscle_memory.up&buff.tiger_power.up&chi>1
+	if BuffPresent(muscle_memory_buff) and BuffPresent(tiger_power_buff) and Chi() > MistweaverChiPool() + 1 Spell(blackout_kick)
+	#tiger_palm,if=buff.muscle_memory.up&buff.tiger_power.up
+	if BuffPresent(muscle_memory_buff) and BuffPresent(tiger_power_buff) and Chi() > MistweaverChiPool() Spell(tiger_palm)
+	#chi_wave,if=talent.chi_wave.enabled
+	if TalentPoints(chi_wave_talent) Spell(chi_wave)
+	#zen_sphere,cycle_targets=1,if=talent.zen_sphere.enabled&!dot.zen_sphere.ticking
+	if TalentPoints(zen_sphere_talent) and BuffCount(zen_sphere_buff) < 1 Spell(zen_sphere)
+	#jab
+	if Glyph(glyph_of_targeted_expulsion) Spell(expel_harm_glyphed)
+	if Glyph(glyph_of_targeted_expulsion no) Spell(expel_harm)
+	Spell(jab)
+}
+
+AddFunction MistweaverDefaultCdActions
+{
+	#chi_brew,if=talent.chi_brew.enabled&chi=0
+	if TalentPoints(chi_brew_talent) and Chi() == 0 Spell(chi_brew)
+	#mana_tea,if=buff.mana_tea.react>=2&mana.pct<=25
+	if BuffStacks(mana_tea_buff) >= 2 and ManaPercent() <= 25 ManaTea()
+	#jade_serpent_potion,if=buff.bloodlust.react|target.time_to_die<=60
+	if BuffPresent(burst_haste any=1) and target.TimeToDie() <= 60 UsePotionIntellect()
+	#use_item
+	Item(HandsSlot usable=1)
+	#invoke_xuen,if=talent.invoke_xuen.enabled
+	if TalentPoints(invoke_xuen_talent) Spell(invoke_xuen)
+}
+
+AddFunction MistweaverPrecombatActions
+{
+	if BuffExpires(str_agi_int any=1) Spell(legacy_of_the_emperor)
+}
+
+### Mistweaver icons.
+
+AddIcon mastery=mistweaver help=cd size=small checkboxon=opt_icons_right
+{
+	if TotemExpires(statue) Spell(summon_jade_serpent_statue)
+}
+
+AddIcon mastery=mistweaver help=cd size=small checkboxon=opt_icons_left
+{
+	if BuffCount(renewing_mist_buff) > 5 Spell(thunder_focus_tea)
+	Spell(revival)
+}
+
+AddIcon mastery=mistweaver help=shortcd
+{
+	unless Stance(monk_stance_of_the_wise_serpent) Spell(stance_of_the_wise_serpent)
+
+	if BuffStacks(vital_mists_buff) == 5
+	{
+		if Glyph(glyph_of_surging_mist) Spell(surging_mist_glyphed)
+		if Glyph(glyph_of_surging_mist no) Spell(surging_mist)
+	}
+	Spell(renewing_mist)
+	if TalentPoints(chi_burst_talent) Spell(chi_burst)
+	if TalentPoints(zen_sphere_talent) and BuffCount(zen_sphere_buff) < 1 Spell(zen_sphere)
+}
+
+AddIcon mastery=mistweaver help=main
+{
+	if InCombat(no) MistweaverPrecombatActions()
+	MistweaverSingleTargetActions()
+}
+
+AddIcon mastery=mistweaver help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) MistweaverPrecombatActions()
+	MistweaverAoeActions()
+}
+
+AddIcon mastery=mistweaver help=cd
+{
+	if IsFeared() or IsRooted() or IsStunned() Spell(nimble_brew)
+	if target.Health() < Health() and BuffPresent(death_note) Spell(touch_of_death)
+	Interrupt()
+
+	if Spell(thunder_focus_tea) and Chi() >=3 Spell(uplift)
+	if not Spell(thunder_focus_tea) and Chi() >=2 Spell(uplift)
+
+	MistweaverDefaultCdActions()
+}
+
+AddIcon mastery=mistweaver help=mana size=small checkboxon=opt_icons_left
+{
+	if ManaPercent() < 100
+	{
+		if BuffStacks(mana_tea_buff) == 20 or ManaPercent() < 75 or ManaPercent() < 100 - BuffStacks(mana_tea_buff) * 4 ManaTea()
+	}
+}
+
+AddIcon mastery=mistweaver help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Windwalker
+###
+# Based on SimulationCraft profile "Monk_Windwalker_1h_T16H".
+#	class=monk
+#	spec=windwalker
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#fb!002221
+
+AddFunction WindwalkerAoeActions
+{
+	#rushing_jade_wind,if=talent.rushing_jade_wind.enabled
+	if TalentPoints(rushing_jade_wind_talent) Spell(rushing_jade_wind)
+	#zen_sphere,cycle_targets=1,if=talent.zen_sphere.enabled&!dot.zen_sphere.ticking
+	if TalentPoints(zen_sphere_talent) and not BuffPresent(zen_sphere_buff) Spell(zen_sphere)
+	#chi_wave,if=talent.chi_wave.enabled
+	if TalentPoints(chi_wave_talent) Spell(chi_wave)
+	#chi_burst,if=talent.chi_burst.enabled
+	if TalentPoints(chi_burst_talent) Spell(chi_burst)
+	#rising_sun_kick,if=chi=chi.max
+	if Chi() == MaxChi() Spell(rising_sun_kick)
+	#spinning_crane_kick,if=!talent.rushing_jade_wind.enabled
+	if not TalentPoints(rushing_jade_wind_talent) Spell(spinning_crane_kick)
+}
+
+AddFunction WindwalkerSingleTargetActions
+{
+	#rising_sun_kick
+	Spell(rising_sun_kick)
+	#chi_wave,if=talent.chi_wave.enabled&energy.time_to_max>2
+	if TalentPoints(chi_wave_talent) and TimeToMaxEnergy() > 2 Spell(chi_wave)
+	#zen_sphere,cycle_targets=1,if=talent.zen_sphere.enabled&energy.time_to_max>2&!dot.zen_sphere.ticking
+	if TalentPoints(zen_sphere_talent) and TimeToMaxEnergy() > 2 and not BuffPresent(zen_sphere_buff) Spell(zen_sphere)
+	#blackout_kick,if=buff.combo_breaker_bok.react
+	if BuffPresent(combo_breaker_bok_buff) Spell(blackout_kick)
+	#tiger_palm,if=buff.combo_breaker_tp.react&(buff.combo_breaker_tp.remains<=2|energy.time_to_max>=2)
+	if BuffPresent(combo_breaker_tp_buff) and { BuffRemains(combo_breaker_tp_buff) <= 2 or TimeToMaxEnergy() >= 2 } Spell(tiger_palm)
+	#jab,if=chi.max-chi>=2
+	if MaxChi() - Chi() >= 2 Spell(jab)
+	#blackout_kick,if=energy+energy.regen*cooldown.rising_sun_kick.remains>=40
+	if Energy() + EnergyRegen() * SpellCooldown(rising_sun_kick) >= 40 Spell(blackout_kick)
+}
+
+AddFunction WindwalkerSingleTargetShortCdActions
+{
+	unless Spell(rising_sun_kick)
+	{
+		#fists_of_fury,if=buff.energizing_brew.down&energy.time_to_max>4&buff.tiger_power.remains>4
+		if BuffExpires(energizing_brew_buff) and TimeToMaxEnergy() > 4 and BuffRemains(tiger_power_buff) > 4 Spell(fists_of_fury)
+		#chi_burst,if=talent.chi_burst.enabled&energy.time_to_max>2
+		if TalentPoints(chi_burst_talent) and TimeToMaxEnergy() > 2 Spell(chi_burst)
+	}
+}
+
+AddFunction WindwalkerDefaultActions
+{
+	#auto_attack
+	#chi_sphere,if=talent.power_strikes.enabled&buff.chi_sphere.react&chi<4
+	#chi_brew,if=talent.chi_brew.enabled&chi<=2&(trinket.proc.agility.react|(charges=1&recharge_time<=10)|charges=2|target.time_to_die<charges*10)
+	if TalentPoints(chi_brew_talent) and Chi() <= 2 and { BuffPresent(trinket_proc_agility_buff) or { Charges(chi_brew) == 1 and SpellChargeCooldown(chi_brew) <= 10 } or Charges(chi_brew) == 2 or target.TimeToDie() < Charges(chi_brew) * 10 } Spell(chi_brew)
+	#tiger_palm,if=buff.tiger_power.remains<=3
+	if BuffRemains(tiger_power_buff) <= 3 Spell(tiger_palm)
+	#energizing_brew,if=energy.time_to_max>5
+	if TimeToMaxEnergy() > 5 Spell(energizing_brew)
+	#rising_sun_kick,if=debuff.rising_sun_kick.down
+	if target.DebuffExpires(rising_sun_kick_debuff) Spell(rising_sun_kick)
+	#tiger_palm,if=buff.tiger_power.down&debuff.rising_sun_kick.remains>1&energy.time_to_max>1
+	if BuffExpires(tiger_power_buff) and target.DebuffRemains(rising_sun_kick_debuff) > 1 and TimeToMaxEnergy() > 1 Spell(tiger_palm)
+	#run_action_list,name=aoe,if=active_enemies>=3
+	#if Enemies() >= 3 WindwalkerAoeActions()
+	#run_action_list,name=single_target,if=active_enemies<3
+	#if Enemies() < 3 WindwalkerSingleTargetActions()
+}
+
+AddFunction WindwalkerDefaultShortCdActions
+{
+	unless { BuffRemains(tiger_power_buff) <= 3 and Spell(tiger_palm) }
+	{
+		#tigereye_brew,if=buff.tigereye_brew_use.down&buff.tigereye_brew.stack=20
+		if BuffExpires(tigereye_brew_use_buff) and BuffStacks(tigereye_brew_buff) == 20 Spell(tigereye_brew)
+		#tigereye_brew,if=buff.tigereye_brew_use.down&trinket.proc.agility.react
+		if BuffExpires(tigereye_brew_use_buff) and BuffPresent(trinket_proc_agility_buff) Spell(tigereye_brew)
+		#tigereye_brew,if=buff.tigereye_brew_use.down&chi>=2&(trinket.proc.agility.react|trinket.proc.strength.react|buff.tigereye_brew.stack>=15|target.time_to_die<40)&debuff.rising_sun_kick.up&buff.tiger_power.up
+		if BuffExpires(tigereye_brew_use_buff) and Chi() >= 2 and { BuffPresent(trinket_proc_agility_buff) or BuffPresent(trinket_proc_strength_buff) or BuffStacks(tigereye_brew_buff) >= 15 or target.TimeToDie() < 40 } and target.DebuffPresent(rising_sun_kick_debuff) and BuffPresent(tiger_power_buff) Spell(tigereye_brew)
+	}
+}
+
+AddFunction WindwalkerDefaultCdActions
+{
+	#virmens_bite_potion,if=buff.bloodlust.react|target.time_to_die<=60
+	if BuffPresent(burst_haste any=1) or target.TimeToDie() <= 60 UsePotionAgility()
+	#use_item,name=gloves_of_the_golden_protector
+	UseItemActions()
+	#berserking
+	UseRacialActions()
+	unless { BuffRemains(tiger_power_buff) <= 3 and Spell(tiger_palm) }
+		or { target.DebuffExpires(rising_sun_kick_debuff) and Spell(rising_sun_kick) }
+		or { BuffExpires(tiger_power_buff) and target.DebuffRemains(rising_sun_kick_debuff) > 1 and TimeToMaxEnergy() > 1 and Spell(tiger_palm) }
+	{
+		#invoke_xuen,if=talent.invoke_xuen.enabled
+		if TalentPoints(invoke_xuen_talent) Spell(invoke_xuen)
+	}
+}
+
+AddFunction WindwalkerPrecombatActions
+{
+	#flask,type=spring_blossoms
+	#food,type=sea_mist_rice_noodles
+	#stance,choose=fierce_tiger
+	if not Stance(monk_stance_of_the_fierce_tiger) Spell(stance_of_the_fierce_tiger)
+	#snapshot_stats
+	#virmens_bite_potion
+	UsePotionAgility()
+}
+
+AddFunction WindwalkerPrecombatCdActions
+{
+	#virmens_bite_potion
+	UsePotionAgility()
+}
+
+### Windwalker icons.
+
+AddIcon mastery=windwalker help=cd size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(dampen_harm_talent) Spell(dampen_harm)
+	if TalentPoints(diffuse_magic_talent) Spell(diffuse_magic)
+}
+
+AddIcon mastery=windwalker help=cd size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(chi_burst_talent) Spell(chi_burst)
+	if TalentPoints(chi_wave_talent) Spell(chi_wave)
+	if TalentPoints(zen_sphere_talent) and BuffExpires(zen_sphere_buff) Spell(zen_sphere)
+}
+
+AddIcon mastery=windwalker help=shortcd
+{
+	WindwalkerDefaultShortCdActions()
+	WindwalkerSingleTargetShortCdActions()
+}
+
+AddIcon mastery=windwalker help=main
+{
+	if InCombat(no) WindwalkerPrecombatActions()
+	WindwalkerDefaultActions()
+	WindwalkerSingleTargetActions()
+}
+
+AddIcon mastery=windwalker help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) WindwalkerPrecombatActions()
+	WindwalkerDefaultActions()
+	WindwalkerAoeActions()
+}
+
+AddIcon mastery=windwalker help=cd
+{
+	if InCombat(no) WindwalkerPrecombatCdActions()
+
+	if IsFeared() or IsRooted() or IsStunned() Spell(nimble_brew)
+	if target.Health() < Health() and BuffPresent(death_note_buff) Spell(touch_of_death)
+	Interrupt()
+	UseRacialInterruptActions()
+
+	WindwalkerDefaultCdActions()
+}
+
+AddIcon mastery=windwalker help=cd size=small checkboxon=opt_icons_right
+{
+	Spell(zen_meditation)
+}
+
+AddIcon mastery=windwalker help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+]]
+
+	OvaleScripts:RegisterScript("MONK", name, desc, code)
+end
diff --git a/scripts/ovale_monk_spells.lua b/scripts/ovale_monk_spells.lua
new file mode 100644
index 0000000..1a923e9
--- /dev/null
+++ b/scripts/ovale_monk_spells.lua
@@ -0,0 +1,224 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "ovale_monk_spells"
+	local desc = "[5.4.7] Ovale: Monk spells"
+	local code = [[
+# Monk spells and functions.
+#	Last updated: 2014-04-16
+
+Define(blackout_kick 100784)
+	SpellInfo(blackout_kick chi=2)
+	SpellInfo(blackout_kick buff_chi_none=combo_breaker_bok_buff mastery=windwalker)
+	SpellInfo(blackout_kick buff_chi=focus_of_xuen_buff buff_chi_amount=-1 mastery=windwalker)
+	SpellAddBuff(blackout_kick combo_breaker_bok_buff=0 mastery=windwalker)
+	SpellAddBuff(blackout_kick muscle_memory_buff=0 if_spell=muscle_memory)
+	SpellAddBuff(blackout_kick serpents_zeal_buff=1 if_spell=teachings_of_the_monastery)
+	SpellAddBuff(blackout_kick shuffle_buff=1 if_spell=brewmaster_training)
+Define(breath_of_fire 115181)
+	SpellInfo(breath_of_fire chi=2)
+Define(brewmaster_training 117967)
+Define(chi_brew 115399)
+	SpellInfo(chi_brew cd=45 chi=-2)
+Define(chi_brew_talent 9)
+Define(chi_burst 123986)
+	SpellInfo(chi_burst cd=30)
+Define(chi_burst_talent 6)
+Define(chi_wave 115098)
+	SpellInfo(chi_wave cd=15)
+Define(chi_wave_talent 4)
+Define(combo_breaker_bok_buff 116768)
+	SpellInfo(combo_breaker_bok_buff duration=15)
+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)
+	SpellAddBuff(crackling_jade_lightning power_strikes_buff=0 talent=power_strikes_talent)
+Define(dampen_harm 122278)
+	SpellInfo(dampen_harm cd=90)
+Define(dampen_harm_talent 14)
+Define(death_note_buff 121125)
+Define(diffuse_magic 122783)
+	SpellInfo(diffuse_magic cd=90)
+Define(diffuse_magic_talent 15)
+Define(elusive_brew_buff 128939)
+	SpellInfo(elusive_brew_buff duration=30)
+Define(elusive_brew_use 115308)
+	SpellInfo(elusive_brew_use cd=9)
+	SpellAddBuff(elusive_brew_use elusive_brew_buff=0)
+Define(energizing_brew 115288)
+	SpellInfo(energizing_brew cd=60)
+	SpellAddBuff(energizing_brew energizing_brew_buff=1)
+Define(energizing_brew_buff 115288)
+	SpellInfo(energizing_brew_buff duration=6 tick=1)
+	SpellInfo(energizing_brew_buff addduration=5 itemset=T14_melee itemcount=4)
+Define(expel_harm 115072)
+	SpellInfo(expel_harm cd=15 chi=-1)
+	SpellInfo(expel_harm chi=-2 if_stance=monk_stance_of_the_fierce_tiger)
+	SpellAddBuff(expel_harm power_strikes_buff=0 talent=power_strikes_talent)
+Define(expel_harm_glyphed 147489)
+	SpellInfo(expel_harm_glyphed cd=15 chi=-1)
+	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 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)
+	SpellInfo(focus_of_xuen_buff duration=10)
+Define(fortifying_brew 115203)
+	SpellInfo(fortifying_brew cd=180)
+#Define(fortifying_brew_glyphed 120954)
+Define(glyph_of_guard 123401)
+Define(glyph_of_mana_tea 123763)
+Define(glyph_of_surging_mist 120483)
+Define(glyph_of_touch_of_death 123391)
+Define(guard 115295)
+	SpellInfo(guard cd=30 chi=2)
+	SpellAddBuff(guard guard_buff=1 power_guard_buff=0)
+Define(guard_buff 115295)
+	SpellInfo(guard_buff duration=30)
+Define(guard_glyphed 123402)
+	SpellInfo(guard_glyphed cd=30 chi=2)
+	SpellAddBuff(guard_glyphed guard_glyphed_buff=1 power_guard_buff=0)
+Define(guard_glyphed_buff 123402)
+	SpellInfo(guard_glyphed duration=30)
+Define(heavy_stagger_debuff 124273)
+	SpellInfo(heavy_stagger_debuff duration=10 tick=1)
+Define(invoke_xuen 123904)
+	SpellInfo(invoke_xuen cd=180)
+Define(invoke_xuen_talent 17)
+Define(jab 100780)
+	SpellInfo(jab chi=-2 texture=ability_monk_jab)
+	SpellInfo(jab chi=-1 if_stance=monk_stance_of_the_sturdy_ox)
+	SpellInfo(jab chi=-1 if_stance=monk_stance_of_the_wise_serpent)
+	SpellInfo(jab buff_chi=power_strikes_buff talent=power_strikes_talent)
+	SpellAddBuff(jab power_strikes_buff=0 talent=power_strikes_talent)
+Define(keg_smash 121253)
+	SpellInfo(keg_smash cd=8 chi=-2)
+Define(legacy_of_the_emperor 115921)
+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)
+Define(mana_tea_buff 115867)
+	SpellInfo(mana_tea_buff duration=120)
+Define(mana_tea_glyphed 123761)
+	SpellInfo(mana_tea_glyphed cd=10 texture=inv_misc_herb_jadetealeaf)
+	SpellAddBuff(mana_tea_glyphed mana_tea_buff=-2)
+Define(moderate_stagger_debuff 124274)
+	SpellInfo(moderate_stagger_debuff duration=10 tick=1)
+Define(muscle_memory 139598)
+Define(muscle_memory_buff 139597)
+	SpellInfo(muscle_memory_buff duration=15)
+Define(nimble_brew 137562)
+	SpellInfo(nimble_brew cd=120)
+Define(paralysis 115078)
+	SpellInfo(paralysis cd=15)
+Define(power_guard_buff 118636)
+	SpellInfo(power_guard_buff duration=30)
+Define(power_strikes_buff 129914)
+Define(power_strikes_talent 7)
+Define(purifier_buff 138237) # tier15_4pc_tank bonus
+	SpellInfo(purifier_buff duration=15)
+Define(purifying_brew 119582)
+	SpellInfo(purifying_brew cd=1 chi=1)
+	SpellAddDebuff(purifying_brew heavy_stagger_debuff=0 light_stagger_debuff=0 moderate_stagger_debuff=0)
+Define(renewing_mist 115151)
+	SpellInfo(renewing_mist cd=8 chi=-1)
+	SpellAddTargetBuff(renewing_mist renewing_mist_buff=1)
+Define(renewing_mist_buff 119611)
+	SpellInfo(renewing_mist_buff duration=18 haste=spell tick=2)
+Define(revival 115310)
+	SpellInfo(revival cd=180)
+Define(rising_sun_kick 107428)
+	SpellInfo(rising_sun_kick cd=8 chi=2)
+	SpellInfo(rising_sun_kick buff_chi=focus_of_xuen_buff buff_chi_amount=-1)
+	SpellAddTargetDebuff(rising_sun_kick rising_sun_kick_debuff=1)
+Define(rising_sun_kick_debuff 130320)
+	SpellInfo(rising_sun_kick_debuff duration=15)
+Define(rushing_jade_wind 116847)
+	SpellInfo(rushing_jade_wind cd=6 cd_haste=melee)
+Define(rushing_jade_wind_talent 16)
+Define(sanctuary_of_the_ox_buff 126119)
+Define(serpents_zeal_buff 127722)
+	SpellInfo(serpents_zeal_buff duration=30 tick=3)
+Define(shuffle_buff 115307)
+	SpellInfo(shuffle_buff duration=6)
+Define(spear_hand_strike 116705)
+	SpellInfo(spear_hand_strike cd=10)
+Define(spinning_crane_kick 101546)
+	SpellInfo(spinning_crane_kick duration=2 haste=melee tick=0.75)
+Define(stance_of_the_fierce_tiger 103985)
+Define(stance_of_the_sturdy_ox 115069)
+Define(stance_of_the_wise_serpent 115070)
+Define(summon_black_ox_statue 115315)
+	SpellInfo(summon_black_ox_statue cd=30)
+Define(summon_jade_serpent_statue 115313)
+	SpellInfo(summon_jade_serpent_statue cd=30)
+Define(surging_mist 116694)
+	SpellInfo(surging_mist chi=-1)
+	SpellAddBuff(surging_mist thunder_focus_tea_buff=0 if_spell=thunder_focus_tea)
+	SpellAddBuff(surging_mist vital_mists_buff=0 if_spell=teachings_of_the_monastery)
+Define(surging_mist_glyphed 123273)
+	SpellInfo(surging_mist_glyphed chi=-1)
+	SpellAddBuff(surging_mist_glyphed thunder_focus_tea_buff=0 if_spell=thunder_focus_tea)
+	SpellAddBuff(surging_mist_glyphed vital_mists_buff=0 if_spell=teachings_of_the_monastery)
+Define(symbiosis_survival_instincts 113306)
+	SpellInfo(symbiosis_survival_instincts cd=180 chi=2)
+Define(teachings_of_the_monastery 116645)
+Define(thunder_focus_tea 116680)
+	SpellInfo(thunder_focus_tea cd=45 chi=1)
+	SpellInfo(thunder_focus_tea addcd=-5 itemset=T15_heal itemcount=4)
+	SpellAddBuff(thunder_focus_tea thunder_focus_tea_buff=1)
+Define(thunder_focus_tea_buff 116680)
+	SpellInfo(thunder_focus_tea duration=30)
+Define(tiger_palm 100787)
+	SpellInfo(tiger_palm chi=1)
+	SpellInfo(tiger_palm buff_chi_none=combo_break_tp mastery=windwalker)
+	SpellInfo(tiger_palm chi=0 if_spell=brewmaster_training)
+	SpellAddBuff(tiger_palm tiger_power_buff=1)
+	SpellAddBuff(tiger_palm combo_break_tp_buff=0 mastery=windwalker)
+	SpellAddBuff(tiger_palm muscle_memory_buff=0 if_spell=muscle_memory)
+	SpellAddBuff(tiger_palm power_guard_buff=1 if_spell=brewmaster_training)
+	SpellAddBuff(tiger_palm vital_mists_buff=1 if_spell=teachings_of_the_monastery)
+Define(tiger_power_buff 125359)
+	SpellInfo(tiger_power_buff duration=20)
+Define(tigereye_brew 116740)
+	SpellInfo(tigereye_brew cd=5)
+	SpellAddBuff(tigereye_brew tigereye_brew_buff=-10 tigereye_brew_use_buff=1)
+Define(tigereye_brew_buff 125195)
+	SpellInfo(tigereye_brew_buff duration=120)
+Define(tigereye_brew_use_buff 116740)
+	SpellInfo(tigereye_brew_use_buff duration=15)
+Define(touch_of_death 115080)
+	SpellInfo(touch_of_death cd=90 chi=3)
+	SpellInfo(touch_of_death addcd=120 chi=-1 glyph=glyph_of_touch_of_death) # XXX
+Define(uplift 116670)
+	SpellInfo(uplift chi=2)
+	SpellAddBuff(uplift thunder_focus_tea_buff=0 if_spell=thunder_focus_tea)
+Define(vital_mists_buff 118674)
+	SpellInfo(vital_mists_buff duration=30)
+Define(zen_meditation 115176)
+	SpellInfo(zen_meditation cd=180)
+Define(zen_sphere 124081)
+	SpellInfo(zen_sphere cd=10)
+	SpellAddTargetBuff(zen_sphere zen_sphere_buff=1)
+Define(zen_sphere_buff 124081)
+	SpellInfo(zen_sphere_buff duration=16 haste=spell tick=2)
+Define(zen_sphere_talent 5)
+
+AddFunction Interrupt
+{
+	if target.IsFriend(no) and target.IsInterruptible()
+	{
+		if target.InRange(spear_hand_strike) Spell(spear_hand_strike)
+		if target.Classification(worldboss no) and target.InRange(paralysis) Spell(paralysis)
+	}
+}
+]]
+
+	OvaleScripts:RegisterScript("MONK", name, desc, code, "include")
+end
diff --git a/scripts/ovale_paladin.lua b/scripts/ovale_paladin.lua
new file mode 100644
index 0000000..ee9ce0d
--- /dev/null
+++ b/scripts/ovale_paladin.lua
@@ -0,0 +1,488 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "Ovale"
+	local desc = "[5.4] Ovale: Holy, Protection, Retribution"
+	local code = [[
+# Ovale paladin script based on SimulationCraft.
+#	Last updated: 2014-04-19
+
+Include(ovale_items)
+Include(ovale_racials)
+Include(ovale_paladin_spells)
+
+AddCheckBox(opt_aoe L(AOE) default)
+AddCheckBox(opt_icons_left "Left icons")
+AddCheckBox(opt_icons_right "Right icons")
+
+###
+### Holy
+###
+# Rotation from Icy Veins, "Holy Paladin Healing Guide (WoW MoP 5.4)"
+#	http://www.icy-veins.com/holy-paladin-wow-pve-healing-guide
+
+AddFunction HolySingleTargetActions
+{
+	if BuffCount(beacon_of_light_buff) == 0 Spell(beacon_of_light)
+	if TalentPoints(sacred_shield_talent) and BuffCount(sacred_shield_holy_buff) == 0 Spell(sacred_shield_holy)
+	if HolyPower() == MaxHolyPower()
+	{
+		if TalentPoints(eternal_flame_talent) Spell(eternal_flame)
+		Spell(word_of_glory)
+	}
+	if target.IsFriend(no) and target.InRange(crusader_strike) Spell(crusader_strike)
+	Spell(holy_shock)
+	Spell(divine_light)
+}
+
+AddFunction HolyAoeActions
+{
+	if BuffCount(beacon_of_light_buff) == 0 Spell(beacon_of_light)
+	if TalentPoints(sacred_shield_talent) and BuffCount(sacred_shield_holy_buff) == 0 Spell(sacred_shield_holy)
+	if HolyPower() == MaxHolyPower()
+	{
+		if TalentPoints(eternal_flame_talent) Spell(eternal_flame)
+		Spell(light_of_dawn)
+	}
+	if target.IsFriend(no) and target.InRange(crusader_strike) Spell(crusader_strike)
+	Spell(holy_shock)
+	Spell(holy_radiance)
+}
+
+AddFunction HolySelflessHealerAoeActions()
+{
+	if BuffCount(beacon_of_light_buff) == 0 Spell(beacon_of_light)
+	if HolyPower() == MaxHolyPower() Spell(light_of_dawn)
+	if target.IsFriend(no) and target.InRange(judgment) Spell(judgment)
+	if BuffPresent(selfless_healer_buff) Spell(holy_radiance)
+	Spell(holy_shock)
+}
+
+AddFunction HolyPrecombatActions
+{
+	if not BuffPresent(str_agi_int any=1) Spell(blessing_of_kings)
+	if not BuffPresent(mastery any=1) and not BuffPresent(str_agi_int) Spell(blessing_of_might)
+	if not Stance(paladin_seal_of_insight) Spell(seal_of_insight)
+}
+
+### Holy Icons
+
+# Damage reduction cooldowns.
+AddIcon mastery=1 help=cd size=small checkboxon=opt_icons_left
+{
+	Spell(divine_protection)
+	Spell(devotion_aura)
+	UseRacialSurvivalActions()
+}
+
+AddIcon mastery=1 help=cd size=small checkboxon=opt_icons_left
+{
+	if ManaPercent() <98 Spell(arcane_torrent_mana)
+	if ManaPercent() <88 Spell(divine_plea)
+	# Show "dash" icon if not in melee range.
+	if target.IsFriend(no) and not target.InRange(crusader_strike) Texture(ability_druid_dash)
+}
+
+AddIcon mastery=1 help=shortcd
+{
+	if TalentPoints(holy_prism_talent) Spell(holy_prism)
+	if TalentPoints(lights_hammer_talent) Spell(lights_hammer)
+	if TalentPoints(execution_sentence_talent) Spell(execution_sentence)
+}
+
+AddIcon mastery=1 help=main
+{
+	HolyPrecombatActions()
+	HolySingleTargetActions()
+}
+
+AddIcon mastery=1 help=aoe checkboxon=opt_aoe
+{
+	HolyPrecombatActions()
+	if TalentPoints(selfless_healer_talent) HolySelflessHealerAoeActions()
+	if not TalentPoints(selfless_healer_talent) HolyAoeActions()
+}
+
+AddIcon mastery=1 help=cd
+{
+	Interrupt()
+	if IsRooted() Spell(hand_of_freedom)
+	if TalentPoints(holy_avenger_talent) Spell(holy_avenger)
+	Spell(avenging_wrath)
+	Spell(divine_favor)
+	Spell(guardian_of_ancient_kings_heal)
+}
+
+AddIcon mastery=1 help=cd size=small checkboxon=opt_icons_right
+{
+	if BuffPresent(righteous_fury) Texture(spell_holy_sealoffury)
+}
+
+AddIcon mastery=1 help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Protection
+###
+# Based on SimulationCraft profile "Paladin_Protection_T16H".
+#	class=paladin
+#	spec=protection
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#bZ!201121
+#	glyphs=focused_shield/alabaster_shield/divine_protection
+
+AddFunction ProtectionDefaultActions
+{
+	#auto_attack
+	#judgment,if=talent.sanctified_wrath.enabled&buff.avenging_wrath.react
+	#wait,sec=cooldown.judgment.remains,if=talent.sanctified_wrath.enabled&cooldown.judgment.remains>0&cooldown.judgment.remains<=0.5
+	if TalentPoints(sanctified_wrath_talent) and BuffPresent(avenging_wrath_buff) Spell(judgment wait=0.5)
+	#crusader_strike
+	#wait,sec=cooldown.crusader_strike.remains,if=cooldown.crusader_strike.remains>0&cooldown.crusader_strike.remains<=0.5
+	Spell(crusader_strike wait=0.5)
+	#judgment
+	#wait,sec=cooldown.judgment.remains,if=cooldown.judgment.remains>0&cooldown.judgment.remains<=0.5&(cooldown.crusader_strike.remains-cooldown.judgment.remains)>=0.5
+	Spell(judgment wait=0.5)
+	#avengers_shield
+	Spell(avengers_shield)
+	#sacred_shield,if=talent.sacred_shield.enabled&target.dot.sacred_shield.remains<5
+	if TalentPoints(sacred_shield_talent) and target.BuffRemains(sacred_shield_buff) < 5 Spell(sacred_shield)
+	#holy_wrath
+	Spell(holy_wrath)
+	#hammer_of_wrath
+	Spell(hammer_of_wrath usable=1)
+	#holy_prism,if=talent.holy_prism.enabled
+	if TalentPoints(holy_prism_talent) Spell(holy_prism)
+	#sacred_shield,if=talent.sacred_shield.enabled
+	if TalentPoints(sacred_shield_talent) Spell(sacred_shield)
+}
+
+AddFunction ProtectionDefaultShortCdActions
+{
+	#eternal_flame,if=talent.eternal_flame.enabled&(buff.eternal_flame.remains<2&buff.bastion_of_glory.react>2&(holy_power>=3|buff.divine_purpose.react|buff.bastion_of_power.react))
+	if TalentPoints(eternal_flame_talent) and { BuffRemains(eternal_flame_buff) < 2 and BuffStacks(bastion_of_glory_buff) > 2 and { HolyPower() >= 3 or BuffPresent(divine_purpose_buff) or BuffPresent(bastion_of_power_buff) } } Spell(eternal_flame)
+	#eternal_flame,if=talent.eternal_flame.enabled&(buff.bastion_of_power.react&buff.bastion_of_glory.react>=5)
+	if TalentPoints(eternal_flame_talent) and { BuffPresent(bastion_of_power_buff) and BuffStacks(bastion_of_glory_buff) >= 5 } Spell(eternal_flame)
+	#shield_of_the_righteous,if=holy_power>=5|buff.divine_purpose.react|incoming_damage_1500ms>=health.max*0.3
+	if HolyPower() >= MaxHolyPower() or BuffPresent(divine_purpose_buff) or IncomingDamage(1.500) >= MaxHealth() * 0.3 Spell(shield_of_the_righteous)
+
+	unless { TalentPoints(sanctified_wrath_talent) and BuffPresent(avenging_wrath_buff) and Spell(judgment) }
+		or Spell(crusader_strike)
+		or Spell(judgment)
+		or Spell(avengers_shield)
+		or { TalentPoints(sacred_shield_talent) and target.BuffRemains(sacred_shield_buff) < 5 and Spell(sacred_shield) }
+		or Spell(holy_wrath)
+	{
+		#execution_sentence,if=talent.execution_sentence.enabled
+		if TalentPoints(execution_sentence_talent) Spell(execution_sentence)
+		#lights_hammer,if=talent.lights_hammer.enabled
+		if TalentPoints(lights_hammer_talent) Spell(lights_hammer)
+
+		unless Spell(hammer_of_wrath usable=1)
+		{
+			#consecration,if=target.debuff.flying.down&!ticking
+			if target.True(not flying_debuff) and not target.DebuffPresent(consecration_debuff)
+			{
+				if Glyph(glyph_of_consecration) Spell(consecration_glyphed)
+				if Glyph(glyph_of_consecration no) Spell(consecration)
+			}
+		}
+	}
+}
+
+AddFunction ProtectionDefaultCdActions
+{
+	Interrupt()
+	UseRacialInterruptActions()
+	if IsRooted() Spell(hand_of_freedom)
+
+	#blood_fury
+	#avenging_wrath
+	Spell(avenging_wrath)
+	#holy_avenger,if=talent.holy_avenger.enabled
+	if TalentPoints(holy_avenger_talent) Spell(holy_avenger)
+}
+
+AddFunction ProtectionPrecombatActions
+{
+	#flask,type=earth
+	#food,type=chun_tian_spring_rolls
+	#blessing_of_kings,if=(!aura.str_agi_int.up)&(aura.mastery.up)
+	if not BuffPresent(str_agi_int any=1) Spell(blessing_of_kings)
+	#blessing_of_might,if=!aura.mastery.up
+	if not BuffPresent(mastery any=1) and not BuffPresent(str_agi_int) Spell(blessing_of_might)
+	#seal_of_insight
+	if not Stance(paladin_seal_of_insight) Spell(seal_of_insight)
+	#sacred_shield,if=talent.sacred_shield.enabled
+	if TalentPoints(sacred_shield_talent) Spell(sacred_shield)
+	#snapshot_stats
+}
+
+### Protection Icons
+
+AddIcon mastery=protection help=cd size=small checkboxon=opt_icons_left
+{
+	Spell(divine_protection)
+	Spell(ardent_defender)
+	Spell(guardian_of_ancient_kings_tank)
+	Spell(devotion_aura)
+	UseRacialSurvivalActions()
+}
+
+AddIcon mastery=protection help=cd size=small checkboxon=opt_icons_left
+{
+	if DebuffExpires(forbearance_debuff)
+	{
+		Spell(lay_on_hands)
+		Spell(hand_of_protection)
+		Spell(divine_shield)
+	}
+}
+
+AddIcon mastery=protection help=shortcd
+{
+	if BuffExpires(righteous_fury) Spell(righteous_fury)
+	ProtectionDefaultShortCdActions()
+}
+
+AddIcon mastery=protection help=main
+{
+	if InCombat(no) ProtectionPrecombatActions()
+	ProtectionDefaultActions()
+}
+
+AddIcon mastery=protection help=opt_aoe
+{
+	if InCombat(no) ProtectionPrecombatActions()
+
+	# HotR > AS > Cons > J > HW
+	Spell(hammer_of_the_righteous)
+	Spell(judgment)
+	Spell(avengers_shield)
+	if Glyph(glyph_of_consecration) Spell(consecration_glyphed)
+	if Glyph(glyph_of_consecration no) Spell(consecration)
+	Spell(judgment)
+	Spell(holy_wrath)
+}
+
+AddIcon mastery=protection help=cd
+{
+	Interrupt()
+	if IsRooted() Spell(hand_of_freedom)
+	ProtectionDefaultCdActions()
+}
+
+# Righteous Fury indicator.
+AddIcon mastery=protection help=cd size=small checkboxon=opt_icons_right
+{
+	if BuffPresent(righteous_fury) Texture(spell_holy_sealoffury)
+}
+
+AddIcon mastery=protection help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Retribution
+###
+# Based on SimulationCraft profile "Paladin_Retribution_T16H".
+#	class=paladin
+#	spec=retribution
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#bb!110112
+#	glyphs=double_jeopardy/mass_exorcism
+
+AddFunction RetributionDefaultActions
+{
+	#auto_attack
+	#inquisition,if=(buff.inquisition.down|buff.inquisition.remains<=2)&(holy_power>=3|target.time_to_die<holy_power*20|buff.divine_purpose.react)
+	if { BuffExpires(inquisition_buff) or BuffRemains(inquisition_buff) <= 2 } and { HolyPower() >= 3 or target.TimeToDie() < HolyPower() * 20 or BuffPresent(divine_purpose_buff) } Spell(inquisition)
+	#divine_storm,if=buff.divine_crusader.react&holy_power=5
+	if BuffPresent(divine_crusader_buff) and HolyPower() == MaxHolyPower() Spell(divine_storm)
+	#templars_verdict,if=holy_power=5|buff.holy_avenger.up&holy_power>=3
+	if HolyPower() == MaxHolyPower() or BuffPresent(holy_avenger_buff) and HolyPower() >= 3 Spell(templars_verdict)
+	#templars_verdict,if=buff.divine_purpose.react&buff.divine_purpose.remains<4
+	if BuffPresent(divine_purpose_buff) and BuffRemains(divine_purpose_buff) < 4 Spell(templars_verdict)
+	#hammer_of_wrath
+	#wait,sec=cooldown.hammer_of_wrath.remains,if=cooldown.hammer_of_wrath.remains>0&cooldown.hammer_of_wrath.remains<=0.2
+	Spell(hammer_of_wrath usable=1 wait=0.2)
+	#divine_storm,if=buff.divine_crusader.react&buff.avenging_wrath.up
+	if BuffPresent(divine_crusader_buff) and BuffPresent(avenging_wrath_buff) Spell(divine_storm)
+	#templars_verdict,if=buff.avenging_wrath.up
+	if BuffPresent(avenging_wrath_buff) Spell(templars_verdict)
+	#crusader_strike
+	#wait,sec=cooldown.crusader_strike.remains,if=cooldown.crusader_strike.remains>0&cooldown.crusader_strike.remains<=0.2
+	Spell(crusader_strike wait=0.2)
+	#judgment
+	#wait,sec=cooldown.judgment.remains,if=cooldown.judgment.remains>0&cooldown.judgment.remains<=0.2
+	Spell(judgment wait=0.2)
+	#divine_storm,if=buff.divine_crusader.react
+	if BuffPresent(divine_crusader_buff) Spell(divine_storm)
+	#templars_verdict,if=buff.divine_purpose.react
+	if BuffPresent(divine_purpose_buff) Spell(templars_verdict)
+	#exorcism
+	#wait,sec=cooldown.exorcism.remains,if=cooldown.exorcism.remains>0&cooldown.exorcism.remains<=0.2
+	if Glyph(glyph_of_mass_exorcism no) Spell(exorcism wait=0.2)
+	if Glyph(glyph_of_mass_exorcism) Spell(exorcism_glyphed wait=0.2)
+	#templars_verdict,if=buff.tier15_4pc_melee.up&active_enemies<4
+	if BuffPresent(tier15_4pc_melee_buff) Spell(templars_verdict)
+	#templars_verdict,if=buff.inquisition.remains>4
+	if BuffRemains(inquisition_buff) > 4 Spell(templars_verdict)
+	#holy_prism,if=talent.holy_prism.enabled
+	if TalentPoints(holy_prism_talent) Spell(holy_prism)
+}
+
+AddFunction RetributionDefaultAoeActions
+{
+	#auto_attack
+	#inquisition,if=(buff.inquisition.down|buff.inquisition.remains<=2)&(holy_power>=3|target.time_to_die<holy_power*20|buff.divine_purpose.react)
+	if { BuffExpires(inquisition_buff) or BuffRemains(inquisition_buff) <= 2 } and { HolyPower() >= 3 or target.TimeToDie() < HolyPower() * 20 or BuffPresent(divine_purpose_buff) } Spell(inquisition)
+	#divine_storm,if=active_enemies>=2&(holy_power=5|buff.divine_purpose.react|(buff.holy_avenger.up&holy_power>=3))
+	if HolyPower() == MaxHolyPower() or BuffPresent(divine_purpose_buff) or { BuffPresent(holy_avenger_buff) and HolyPower() >= 3 } Spell(divine_storm)
+	#divine_storm,if=buff.divine_crusader.react&holy_power=5
+	if BuffPresent(divine_crusader_buff) and HolyPower() == MaxHolyPower() Spell(divine_storm)
+	#templars_verdict,if=holy_power=5|buff.holy_avenger.up&holy_power>=3
+	if HolyPower() == MaxHolyPower() or BuffPresent(holy_avenger_buff) and HolyPower() >= 3 Spell(templars_verdict)
+	#templars_verdict,if=buff.divine_purpose.react&buff.divine_purpose.remains<4
+	if BuffPresent(divine_purpose_buff) and BuffRemains(divine_purpose_buff) < 4 Spell(templars_verdict)
+	#hammer_of_wrath
+	#wait,sec=cooldown.hammer_of_wrath.remains,if=cooldown.hammer_of_wrath.remains>0&cooldown.hammer_of_wrath.remains<=0.2
+	Spell(hammer_of_wrath usable=1 wait=0.2)
+	#divine_storm,if=buff.divine_crusader.react&buff.avenging_wrath.up
+	if BuffPresent(divine_crusader_buff) and BuffPresent(avenging_wrath_buff) Spell(divine_storm)
+	#templars_verdict,if=buff.avenging_wrath.up
+	if BuffPresent(avenging_wrath_buff) Spell(templars_verdict)
+	#hammer_of_the_righteous,if=active_enemies>=4
+	Spell(hammer_of_the_righteous)
+	#exorcism,if=active_enemies>=2&active_enemies<=4&set_bonus.tier15_2pc_melee&glyph.mass_exorcism.enabled
+	if ArmorSetBonus(T15_melee 2) and Glyph(glyph_of_mass_exorcism) Spell(exorcism_glyphed)
+	#judgment
+	#wait,sec=cooldown.judgment.remains,if=cooldown.judgment.remains>0&cooldown.judgment.remains<=0.2
+	Spell(judgment wait=0.2)
+	#divine_storm,if=buff.divine_crusader.react
+	if BuffPresent(divine_crusader_buff) Spell(divine_storm)
+	#templars_verdict,if=buff.divine_purpose.react
+	if BuffPresent(divine_purpose_buff) Spell(templars_verdict)
+	#exorcism
+	#wait,sec=cooldown.exorcism.remains,if=cooldown.exorcism.remains>0&cooldown.exorcism.remains<=0.2
+	if Glyph(glyph_of_mass_exorcism no) Spell(exorcism wait=0.2)
+	if Glyph(glyph_of_mass_exorcism) Spell(exorcism_glyphed wait=0.2)
+	#divine_storm,if=active_enemies>=2&buff.inquisition.remains>4
+	if BuffRemains(inquisition_buff) > 4 Spell(divine_storm)
+	#holy_prism,if=talent.holy_prism.enabled
+	if TalentPoints(holy_prism_talent) Spell(holy_prism)
+}
+
+AddFunction RetributionDefaultShortCdActions
+{
+	unless { BuffExpires(inquisition_buff) or BuffRemains(inquisition_buff) <= 2 } and { HolyPower() >= 3 or target.TimeToDie() < HolyPower() * 20 or BuffPresent(divine_purpose_buff) }
+	{
+		#avenging_wrath,if=buff.inquisition.up
+		if BuffPresent(inquisition_buff) Spell(avenging_wrath)
+		#execution_sentence,if=talent.execution_sentence.enabled&(buff.inquisition.up&(buff.ancient_power.down|buff.ancient_power.stack=12))
+		if TalentPoints(execution_sentence_talent) and { BuffPresent(inquisition_buff) and { BuffExpires(ancient_power_buff) or BuffStacks(ancient_power_buff) == 12 } } Spell(execution_sentence)
+		#lights_hammer,if=talent.lights_hammer.enabled&(buff.inquisition.up&(buff.ancient_power.down|buff.ancient_power.stack=12))
+		if TalentPoints(lights_hammer_talent) and { BuffPresent(inquisition_buff) and { BuffExpires(ancient_power_buff) or BuffStacks(ancient_power_buff) == 12 } } Spell(lights_hammer)
+	}
+}
+
+AddFunction RetributionDefaultCdActions
+{
+	#rebuke
+	Interrupt()
+	#mogu_power_potion,if=(buff.bloodlust.react|(buff.ancient_power.up&buff.avenging_wrath.up)|target.time_to_die<=40)
+	if { BuffPresent(burst_haste any=1) or { BuffPresent(ancient_power_buff) and BuffPresent(avenging_wrath_buff) } or target.TimeToDie() <= 40 } UsePotionStrength()
+
+	unless { BuffExpires(inquisition_buff) or BuffRemains(inquisition_buff) <= 2 } and { HolyPower() >= 3 or target.TimeToDie() < HolyPower() * 20 or BuffPresent(divine_purpose_buff) }
+	{
+		#guardian_of_ancient_kings,if=buff.inquisition.up
+		if BuffPresent(inquisition_buff) Spell(guardian_of_ancient_kings_melee)
+		#holy_avenger,if=talent.holy_avenger.enabled&(buff.inquisition.up&holy_power<=2)
+		if TalentPoints(holy_avenger_talent) and { BuffPresent(inquisition_buff) and HolyPower() <= 2 } Spell(holy_avenger)
+		#use_item,name=gauntlets_of_winged_triumph,if=buff.inquisition.up&(buff.ancient_power.down|buff.ancient_power.stack=12)
+		if BuffPresent(inquisition_buff) and { BuffExpires(ancient_power_buff) or BuffStacks(ancient_power_buff) == 12 } UseItemActions()
+		#blood_fury
+		UseRacialActions()
+	}
+}
+
+AddFunction RetributionPrecombatActions
+{
+	#flask,type=winters_bite
+	#food,type=black_pepper_ribs_and_shrimp
+	#blessing_of_kings,if=!aura.str_agi_int.up
+	#blessing_of_might,if=!aura.mastery.up
+	if not BuffPresent(str_agi_int any=1)
+	{
+		Spell(blessing_of_kings)
+		if not BuffPresent(mastery any=1) Spell(blessing_of_might)
+	}
+	#seal_of_truth,if=active_enemies<4
+	if not Stance(paladin_seal_of_truth) Spell(seal_of_truth)
+	#snapshot_stats
+}
+
+AddFunction RetributionPrecombatCdActions
+{
+	#mogu_power_potion
+	UsePotionStrength()
+}
+
+### Retribution Icons
+
+AddIcon mastery=retribution help=cd size=small checkboxon=opt_icons_left
+{
+	if IsRooted()
+	{
+		Spell(hand_of_freedom)
+		Spell(emancipate)
+	}
+}
+
+AddIcon mastery=retribution help=cd size=small checkboxon=opt_icons_left
+{
+	Spell(lay_on_hands)
+	Spell(hand_of_protection)
+	if DebuffExpires(forbearance_debuff) Spell(divine_shield)
+}
+
+AddIcon mastery=retribution help=shortcd
+{
+	RetributionDefaultShortCdActions()
+}
+
+AddIcon mastery=retribution help=main
+{
+	RetributionPrecombatActions()
+	RetributionDefaultActions()
+}
+
+AddIcon mastery=retribution help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) RetributionPrecombatActions()
+	RetributionDefaultAoeActions()
+}
+
+AddIcon mastery=retribution help=cd
+{
+	if InCombat(no) RetributionPrecombatCdActions()
+	RetributionDefaultCdActions()
+}
+
+AddIcon mastery=retribution help=cd size=small checkboxon=opt_icons_right
+{
+	#seal_of_righteousness,if=active_enemies>=4
+	if Enemies() >= 4 and not Stance(paladin_seal_of_righteousness) Spell(seal_of_righteousness)
+	if BuffPresent(righteous_fury) Texture(spell_holy_sealoffury)
+}
+
+AddIcon mastery=retribution help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+]]
+
+	OvaleScripts:RegisterScript("PALADIN", name, desc, code)
+end
diff --git a/scripts/ovale_paladin_spells.lua b/scripts/ovale_paladin_spells.lua
new file mode 100644
index 0000000..0051e92
--- /dev/null
+++ b/scripts/ovale_paladin_spells.lua
@@ -0,0 +1,235 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "ovale_paladin_spells"
+	local desc = "[5.4.7] Ovale: Paladin spells"
+	local code = [[
+Define(ancient_power_buff 86700)
+	SpellInfo(ancient_power_buff duration=30)
+Define(ardent_defender 31850)
+	SpellInfo(ardent_defender cd=180)
+	SpellInfo(ardent_defender addcd=-60 itemset=T14_tank itemcount=2)
+Define(avengers_shield 31935)
+	SpellInfo(avengers_shield holy=0 buff_holy=grand_crusader_buff cd=15)
+	SpellInfo(avengers_shield cd_haste=melee if_spell=sanctity_of_battle)
+	SpellAddBuff(avengers_shield grand_crusader_buff=0)
+Define(avenging_wrath 31884)
+	SpellInfo(avenging_wrath cd=180)
+	SpellInfo(avenging_wrath addcd=-65 itemset=T14_melee itemcount=4)
+	SpellAddBuff(avenging_wrath avenging_wrath_buff=1)
+Define(avenging_wrath_buff 31884)
+	SpellInfo(avenging_wrath_buff duration=20)
+	SpellInfo(avenging_wrath_buff addduration=10 talent=sanctified_wrath_talent)
+Define(bastion_of_glory_buff 114637)
+	SpellInfo(bastion_of_glory_buff duration=20)
+Define(bastion_of_power_buff 144569)
+	SpellInfo(bastion_of_power_buff duration=20)
+Define(beacon_of_light 53563)
+	SpellInfo(beacon_of_light cd=3)
+	SpellInfo(beacon_of_light gcd=0 glyph=glyph_of_beacon_of_light)
+	SpellAddTargetBuff(beacon_of_light beacon_of_light_buff=1)
+Define(beacon_of_light_buff 53563)
+Define(blessing_of_kings 20217)
+Define(blessing_of_might 19740)
+Define(blinding_light 115750)
+	SpellInfo(blinding_light cd=120)
+Define(consecration 26573)
+	SpellInfo(consecration cd=9)
+	SpellInfo(consecration cd_haste=melee haste=melee if_spell=sanctity_of_battle)
+Define(consecration_debuff 26573)
+	SpellInfo(consecration_debuff duration=9 tick=1)
+	SpellInfo(consecration_debuff haste=melee if_spell=sanctity_of_battle)
+Define(consecration_glyphed 116467)
+Define(crusader_strike 35395)
+	SpellInfo(crusader_strike holy=-1 cd=4.5)
+	SpellInfo(crusader_strike cd_haste=melee if_spell=sanctity_of_battle)
+	SpellAddTargetDebuff(crusader_strike weakened_blows=1 mastery=protection)
+Define(daybreak 88821)
+Define(daybreak_buff 88819)
+	SpellInfo(daybreak_buff duration=10)
+Define(devotion_aura 31821)
+	SpellInfo(devotion_aura cd=180)
+	SpellInfo(devotion_aura addcd=-60 glyph=glyph_of_devotion_aura)
+Define(divine_crusader_buff 144595)
+	SpellInfo(divine_crusader_buff duration=12)
+Define(divine_favor 31842)
+	SpellInfo(divine_favor cd=180)
+Define(divine_light 82326)
+Define(divine_plea 54428)
+	SpellInfo(divine_plea cd=120)
+	SpellInfo(divine_plea cd=60 glyph=glyph_of_divine_plea)
+Define(divine_protection 498)
+	SpellInfo(divine_protection cd=60)
+	SpellInfo(divine_protection cd=30 talent=unbreakable_spirit_talent)
+Define(divine_purpose_buff 90174)
+	SpellInfo(divine_purpose_buff duration=8)
+Define(divine_purpose_talent 15)
+Define(divine_shield 642)
+	SpellInfo(divine_shield cd=300)
+	SpellInfo(divine_shield cd=150 talent=unbreakable_spirit_talent)
+	SpellAddDebuff(divine_shield forbearance_debuff=1)
+Define(divine_storm 53385)
+	SpellInfo(divine_storm holy=3)
+	SpellInfo(divine_storm buff_holy_none=divine_crusader_buff itemset=T16_melee itemcount=2)
+	SpellAddBuff(divine_storm divine_crusader_buff=0 itemset=T16_melee itemcount=2)
+	SpellAddBuff(divine_storm divine_purpose_buff=0 talent=divine_purpose_talent)
+Define(emancipate 121783)
+Define(eternal_flame 114163)
+	SpellInfo(eternal_flame holy=finisher max_holy=3)
+	SpellInfo(eternal_flame buff_holy_none=divine_purpose_buff talent=divine_purpose_talent)
+	SpellAddBuff(eternal_flame bastion_of_glory_buff=0 if_spell=shield_of_the_righteous)
+	SpellAddBuff(eternal_flame divine_purpose_buff=0 talent=divine_purpose_talent)
+	SpellAddTargetBuff(eternal_flame eternal_flame_buff=1)
+Define(eternal_flame_buff 114163)
+	SpellInfo(eternal_flame_buff duration=30 haste=spell tick=3)
+Define(eternal_flame_talent 8)
+Define(execution_sentence 114157)
+	SpellInfo(execution_sentence cd=60)
+Define(execution_sentence_talent 18)
+Define(exorcism 879)
+	SpellInfo(exorcism holy=-1 cd=15)
+	SpellInfo(exorcism cd_haste=melee if_spell=sanctity_of_battle mastery=retribution)
+Define(exorcism_glyphed 122032)
+	SpellInfo(exorcism_glyphed holy=-1 cd=15)
+	SpellInfo(exorcism_glyphed cd_haste=melee if_spell=sanctity_of_battle mastery=retribution)
+Define(fist_of_justice 105593)
+	SpellInfo(fist_of_justice cd=30)
+Define(fist_of_justice_talent 4)
+Define(forbearance_debuff 25771)
+	SpellInfo(forbearance_debuff duration=60)
+Define(glyph_of_beacon_of_light 63218)
+Define(glyph_of_consecration 54928)
+Define(glyph_of_devotion_aura 146955)
+Define(glyph_of_divine_plea 63223)
+Define(glyph_of_divinity 54939)
+Define(glyph_of_mass_exorcism 122028)
+Define(grand_crusader_buff 85416)
+	SpellInfo(grand_crusader_buff duration=6)
+Define(guardian_of_ancient_kings_heal 86669)
+	SpellInfo(guardian_of_ancient_kings_heal cd=180)
+Define(guardian_of_ancient_kings_tank 86659)
+	SpellInfo(guardian_of_ancient_kings_tank cd=180)
+Define(guardian_of_ancient_kings_melee 86698)
+	SpellInfo(guardian_of_ancient_kings_melee cd=180)
+Define(hammer_of_justice 853)
+	SpellInfo(hammer_of_justice cd=60)
+Define(hammer_of_the_righteous 53595)
+	SpellInfo(hammer_of_the_righteous holy=-1 cd=4.5)
+	SpellInfo(hammer_of_the_righteous cd_haste=melee if_spell=sanctity_of_battle)
+Define(hammer_of_wrath 24275)
+	SpellInfo(hammer_of_wrath cd=6)
+	SpellInfo(hammer_of_wrath cd_haste=melee if_spell=sanctity_of_battle)
+	SpellInfo(hammer_of_wrath holy=-1 mastery=retribution)
+Define(hand_of_freedom 1044)
+	SpellInfo(hand_of_freedom cd=25)
+Define(hand_of_protection 1022)
+	SpellInfo(hand_of_protection cd=300)
+	SpellAddTargetDebuff(hand_of_protection forbearance_debuff=1)
+Define(holy_avenger 105809)
+	SpellInfo(holy_avenger cd=120)
+Define(holy_avenger_buff 105809)
+	SpellInfo(holy_avenger_buff duration=18)
+Define(holy_avenger_talent 13)
+Define(holy_prism 114165)
+	SpellInfo(holy_prism cd=20)
+Define(holy_prism_talent 16)
+Define(holy_radiance 82327)
+	SpellInfo(holy_radiance holy=-1)
+	SpellAddBuff(holy_radiance daybreak_buff=1 if_spell=daybreak)
+	SpellAddBuff(holy_radiance selfless_healer_buff=0 mastery=holy talent=selfless_healer_talent)
+Define(holy_shock 20473)
+	SpellInfo(holy_shock cd=6 holy=-1)
+	SpellInfo(holy_shock cd=5 itemset=T14_heal itemcount=4)
+	SpellInfo(holy_shock cd_haste=melee if_spell=sanctity_of_battle)
+	SpellAddBuff(holy_shock daybreak_buff=-1 if_spell=daybreak)
+Define(holy_wrath 119072)
+	SpellInfo(holy_wrath cd=9)
+	SpellInfo(holy_wrath cd_haste=melee if_spell=sanctity_of_battle)
+Define(inquisition 84963)
+	SpellInfo(inquisition holy=finisher max_holy=3)
+	SpellInfo(inquisition buff_holy_none=divine_purpose_buff talent=divine_purpose_talent)
+	SpellAddBuff(inquisition inquisition_buff=1)
+	SpellAddBuff(inquisition divine_purpose_buff=0 talent=divine_purpose_talent)
+Define(inquisition_buff 84963)
+	SpellInfo(inquisition_buff duration=20)
+Define(judgment 20271)
+	SpellInfo(judgment cd=6)
+	SpellInfo(judgment cd_haste=melee if_spell=sanctity_of_battle)
+	SpellInfo(judgment holy=-1 mastery=holy talent=selfless_healer_talent)
+	SpellInfo(judgment holy=-1 if_spell=judgments_of_the_bold)
+	SpellInfo(judgment holy=-1 if_spell=judgments_of_the_wise)
+	SpellInfo(judgment holy=-1 buff_holy=avenging_wrath_buff if_spell=judgments_of_the_wise talent=sanctified_wrath_talent)
+	SpellAddBuff(judgment selfless_healer_buff=1 mastery=holy talent=selfless_healer_talent)
+Define(judgments_of_the_bold 111529)
+Define(judgments_of_the_wise 105424)
+Define(lay_on_hands 633)
+	SpellInfo(lay_on_hands cd=600)
+	SpellInfo(lay_on_hands cd=720 glyph=glyph_of_divinity)
+	SpellInfo(lay_on_hands cd=300 talent=unbreakable_spirit_talent)
+	SpellInfo(lay_on_hands cd=360 glyph=glyph_of_divinity talent=unbreakable_spirit_talent)
+	SpellAddTargetDebuff(lay_on_hands forbearance_debuff=1)
+Define(light_of_dawn 85222)
+	SpellInfo(light_of_dawn holy=finisher max_holy=3)
+	SpellInfo(light_of_dawn buff_holy_none=divine_purpose_buff talent=divine_purpose_talent)
+	SpellAddBuff(light_of_dawn divine_purpose_buff=0 talent=divine_purpose_talent)
+Define(lights_hammer 114158)
+	SpellInfo(lights_hammer cd=60)
+Define(lights_hammer_talent 17)
+Define(rebuke 96231)
+	SpellInfo(rebuke cd=15)
+Define(righteous_fury 25780)
+Define(sacred_shield 20925)
+	SpellInfo(sacred_shield cd=6)
+	SpellAddBuff(sacred_shield sacred_shield_buff=1)
+Define(sacred_shield_buff 20925)
+	SpellInfo(sacred_shield duration=30 haste=spell tick=6)
+Define(sacred_shield_holy 148039)
+	SpellAddTargetBuff(sacred_shield_holy sacred_shield_holy_buff=1)
+Define(sacred_shield_holy_buff 148039)
+	SpellInfo(sacred_shield_holy duration=30 haste=spell tick=6)
+Define(sacred_shield_talent 9)
+Define(sanctified_wrath_talent 14)
+Define(sanctity_of_battle 25956)
+Define(seal_of_insight 20165)
+Define(seal_of_righteousness 20154)
+Define(seal_of_truth 31801)
+Define(selfless_healer_buff 114250)
+	SpellInfo(selfless_healer_buff duration=15)
+Define(selfless_healer_talent 7)
+Define(shield_of_the_righteous 53600)
+	SpellInfo(shield_of_the_righteous cd=1.5 holy=3)
+	SpellInfo(shield_of_the_righteous cd_haste=melee haste=melee if_spell=sanctity_of_battle)
+	SpellInfo(shield_of_the_righteous buff_holy_none=divine_purpose_buff talent=divine_purpose_talent)
+	SpellAddBuff(shield_of_the_righteous bastion_of_glory_buff=1)
+	SpellAddBuff(shield_of_the_righteous divine_purpose_buff=0 talent=divine_purpose_talent)
+Define(templars_verdict 85256)
+	SpellInfo(templars_verdict holy=3)
+	SpellInfo(templars_verdict buff_holy_none=divine_purpose_buff talent=divine_purpose_talent)
+	SpellAddBuff(templars_verdict divine_purpose_buff=0 talent=divine_purpose_talent)
+	SpellAddBuff(templars_verdict tier15_4pc_melee_buff=0 itemset=T15_melee itemcount=4)
+Define(tier15_4pc_melee_buff 138169)
+Define(unbreakable_spirit_talent 11)
+Define(word_of_glory 85673)
+	SpellInfo(word_of_glory holy=finisher max_holy=3)
+	SpellInfo(word_of_glory buff_holy_none=divine_purpose_buff talent=divine_purpose_talent)
+	SpellAddBuff(word_of_glory bastion_of_glory_buff=0 if_spell=shield_of_the_righteous)
+	SpellAddBuff(word_of_glory divine_purpose_buff=0 talent=divine_purpose_talent)
+
+AddFunction Interrupt
+{
+	if not target.IsFriend() and target.IsInterruptible()
+	{
+		if target.InRange(rebuke) Spell(rebuke)
+		if target.Classification(worldboss no)
+		{
+			if TalentPoints(fist_of_justice_talent) and target.InRange(fist_of_justice) Spell(fist_of_justice)
+			if not TalentPoints(fist_of_justice_talent) and target.InRange(hammer_of_justice) Spell(hammer_of_justice)
+			#Spell(blinding_light)
+		}
+	}
+}
+]]
+
+	OvaleScripts:RegisterScript("PALADIN", name, desc, code, "include")
+end
diff --git a/scripts/ovale_racials.lua b/scripts/ovale_racials.lua
new file mode 100644
index 0000000..cacd12c
--- /dev/null
+++ b/scripts/ovale_racials.lua
@@ -0,0 +1,69 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "ovale_racials"
+	local desc = "[5.4.7] Ovale: Racial spells"
+	local code = [[
+# Racials
+Define(arcane_torrent_chi 129597)
+	SpellInfo(arcane_torrent_chi cd=120 chi=1)
+Define(arcane_torrent_energy 25046)
+	SpellInfo(arcane_torrent_energy cd=120 energy=-15)
+Define(arcane_torrent_focus 80483)
+	SpellInfo(arcane_torrent_focus cd=120 focus=-15)
+Define(arcane_torrent_mana 28730)
+	SpellInfo(arcane_torrent_mana cd=120)
+Define(arcane_torrent_rage 69179)
+	SpellInfo(arcane_torrent_rage cd=120 rage=-15)
+Define(arcane_torrent_runicpower 50613)
+	SpellInfo(arcane_torrent_runicpower cd=120 runicpower=-15)
+Define(berserking 26297)
+	SpellInfo(berserking cd=180)
+	SpellAddBuff(berserking berserking_buff=1)
+Define(berserking_buff 26297)
+	SpellInfo(berserking_buff duration=10)
+Define(blood_fury 20572)
+	SpellInfo(blood_fury cd=120)
+	SpellAddBuff(blood_fury blood_fury_buff=1)
+Define(blood_fury_buff 20572)
+	SpellInfo(blood_fury_buff duration=15)
+Define(quaking_palm 107079)
+	SpellInfo(quaking_palm cd=120)
+Define(stoneform 20594)
+	SpellInfo(stoneform cd=120)
+	SpellAddBuff(stoneform stoneform_buff=1)
+Define(stoneform_buff 20594)
+	SpellInfo(stoneform_buff duration=8)
+
+AddFunction UseRacialActions
+{
+	Spell(berserking)
+	Spell(blood_fury)
+}
+
+AddFunction UseRacialInterruptActions
+{
+	if target.IsFriend(no) and target.IsInterruptible()
+	{
+		if target.Classification(worldboss no)
+		{
+			Spell(arcane_torrent_chi)
+			Spell(arcane_torrent_energy)
+			Spell(arcane_torrent_focus)
+			Spell(arcane_torrent_mana)
+			Spell(arcane_torrent_rage)
+			Spell(arcane_torrent_runicpower)
+			if target.InRange(quaking_palm) Spell(quaking_palm)
+		}
+	}
+}
+
+AddFunction UseRacialSurvivalActions
+{
+	Spell(stoneform)
+}
+]]
+
+	OvaleScripts:RegisterScript(nil, name, desc, code, "include")
+end
diff --git a/scripts/ovale_shaman.lua b/scripts/ovale_shaman.lua
new file mode 100644
index 0000000..8801bf3
--- /dev/null
+++ b/scripts/ovale_shaman.lua
@@ -0,0 +1,557 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "Ovale"
+	local desc = "[5.4] Ovale: Elemental, Enhancement, Restoration"
+	local code = [[
+# Ovale shadow script based on SimulationCraft.
+#	Last updated: 2014-04-19
+
+Include(ovale_items)
+Include(ovale_racials)
+Include(ovale_shaman_spells)
+
+AddCheckBox(opt_aoe L(AOE) default)
+AddCheckBox(opt_icons_left "Left icons")
+AddCheckBox(opt_icons_right "Right icons")
+
+###
+### Elemental
+###
+# Based on SimulationCraft profile "Shaman_Elemental_T16H".
+#	class=shaman
+#	spec=elemental
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#Wa!...2.0
+#	glyphs=chain_lightning
+
+AddFunction ElementalAoeActions
+{
+	#lava_beam
+	Spell(lava_beam)
+	#magma_totem,if=active_enemies>2&!totem.fire.active
+	if Enemies() > 2 and not TotemPresent(fire) Spell(magma_totem)
+	#searing_totem,if=active_enemies<=2&!totem.fire.active
+	if Enemies() <= 2 and not TotemPresent(fire) Spell(searing_totem)
+	#lava_burst,if=active_enemies<3&dot.flame_shock.remains>cast_time&cooldown_react
+	if Enemies() < 3 and target.DebuffRemains(flame_shock_debuff) > CastTime(lava_burst) and True(lava_burst cooldown_react) Spell(lava_burst)
+	#flame_shock,cycle_targets=1,if=!ticking&active_enemies<3
+	if not target.DebuffPresent(flame_shock_debuff) and Enemies() < 3 Spell(flame_shock)
+	#earthquake,if=active_enemies>4
+	if Enemies() > 4 Spell(earthquake)
+	#thunderstorm,if=mana.pct_nonproc<80
+	if ManaPercent() < 80 Spell(thunderstorm)
+	#chain_lightning,if=mana.pct_nonproc>10
+	if ManaPercent() > 10 Spell(chain_lightning)
+	#lightning_bolt
+	Spell(lightning_bolt)
+}
+
+AddFunction ElementalSingleActions
+{
+	#unleash_elements,if=talent.unleashed_fury.enabled&!buff.ascendance.up
+	if TalentPoints(unleashed_fury_talent) and not BuffPresent(ascendance_caster_buff) Spell(unleash_elements)
+	#lava_burst,if=dot.flame_shock.remains>cast_time&(buff.ascendance.up|cooldown_react)
+	if target.DebuffRemains(flame_shock_debuff) > CastTime(lava_burst) and { BuffPresent(ascendance_caster_buff) or True(lava_burst cooldown_react) } Spell(lava_burst)
+	#flame_shock,if=ticks_remain<2
+	if target.TicksRemain(flame_shock_debuff) < 2 Spell(flame_shock)
+	#elemental_blast,if=talent.elemental_blast.enabled
+	if TalentPoints(elemental_blast_talent) Spell(elemental_blast)
+	#earth_shock,if=buff.lightning_shield.react=buff.lightning_shield.max_stack
+	if BuffStacks(lightning_shield_buff) == 7 Spell(earth_shock)
+	#earth_shock,if=buff.lightning_shield.react>3&dot.flame_shock.remains>cooldown&dot.flame_shock.remains<cooldown+action.flame_shock.tick_time
+	if BuffStacks(lightning_shield_buff) > 3 and target.DebuffRemains(flame_shock_debuff) > SpellCooldown(earth_shock) and target.DebuffRemains(flame_shock_debuff) < SpellCooldown(earth_shock) + target.TickTime(flame_shock_debuff) Spell(earth_shock)
+	#flame_shock,if=time>60&remains<=buff.ascendance.duration&cooldown.ascendance.remains+buff.ascendance.duration<duration
+	if TimeInCombat() > 60 and target.DebuffRemains(flame_shock_debuff) <= SpellData(ascendance_caster_buff duration) and SpellCooldown(ascendance_caster) + SpellData(ascendance_caster_buff duration) < SpellData(flame_shock_debuff duration) Spell(flame_shock)
+	#searing_totem,if=cooldown.fire_elemental_totem.remains>20&!totem.fire.active
+	#if SpellCooldown(fire_elemental_totem) > 20 and not TotemPresent(fire) Spell(searing_totem)
+	if not TotemPresent(fire) Spell(searing_totem)
+	#lightning_bolt
+	#Spell(lightning_bolt)
+}
+
+AddFunction ElementalSingleCdActions
+{
+	unless { TalentPoints(unleashed_fury_talent) and not BuffPresent(ascendance_caster_buff) and Spell(unleash_elements) }
+		or { target.DebuffRemains(flame_shock_debuff) > CastTime(lava_burst) and { BuffPresent(ascendance_caster_buff) or True(lava_burst cooldown_react) } and Spell(lava_burst) }
+		or { target.TicksRemain(flame_shock_debuff) < 2 and Spell(flame_shock) }
+		or { TalentPoints(elemental_blast_talent) and Spell(elemental_blast) }
+		or { BuffStacks(lightning_shield_buff) == 7 and Spell(earth_shock) }
+		or { BuffStacks(lightning_shield_buff) > 3 and target.DebuffRemains(flame_shock_debuff) > SpellCooldown(earth_shock) and target.DebuffRemains(flame_shock_debuff) < SpellCooldown(earth_shock) + target.TickTime(flame_shock_debuff) and Spell(earth_shock) }
+		or { TimeInCombat() > 60 and target.DebuffRemains(flame_shock_debuff) <= SpellData(ascendance_caster_buff duration) and SpellCooldown(ascendance_caster) + SpellData(ascendance_caster_buff duration) < SpellData(flame_shock_debuff duration) and Spell(flame_shock) }
+	{
+		#earth_elemental_totem,if=!active&cooldown.fire_elemental_totem.remains>=60
+		if not TotemPresent(earth totem=earth_elemental_totem) and SpellCooldown(fire_elemental_totem) >= 60 Spell(earth_elemental_totem)
+	}
+}
+
+AddFunction ElementalDefaultActions
+{
+	if not BuffPresent(lightning_shield_buff) Spell(lightning_shield)
+
+	#run_action_list,name=single,if=active_enemies=1
+	#if Enemies() == 1 ElementalSingleActions()
+	#run_action_list,name=aoe,if=active_enemies>1
+	#if Enemies() > 1 ElementalAoeActions()
+}
+
+AddFunction ElementalDefaultCdActions
+{
+	#wind_shear
+	Interrupt()
+	UseRacialInterruptActions()
+
+	unless not BuffPresent(lightning_shield_buff)
+	{
+		#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)
+		#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))))
+		if TalentPoints(elemental_mastery_talent) and { TimeInCombat() > 15 and { { not BuffPresent(burst_haste any=1) and TimeInCombat() < 120 } or { not BuffPresent(berserking_buff) and not BuffPresent(burst_haste any=1) and BuffPresent(ascendance_caster_buff) } or { TimeInCombat() >= 200 and { SpellCooldown(ascendance_caster) > 30 or Level() < 87 } } } } Spell(elemental_mastery)
+		#ancestral_swiftness,if=talent.ancestral_swiftness.enabled&!buff.ascendance.up
+		if TalentPoints(ancestral_swiftness_talent) and not BuffPresent(ascendance_caster_buff) Spell(ancestral_swiftness)
+		#fire_elemental_totem,if=!active
+		if not TotemPresent(fire totem=fire_elemental_totem) Spell(fire_elemental_totem)
+		#ascendance,if=active_enemies>1|(dot.flame_shock.remains>buff.ascendance.duration&(target.time_to_die<20|buff.bloodlust.up|time>=60)&cooldown.lava_burst.remains>0)
+		if Enemies() > 1 or { target.DebuffRemains(flame_shock_debuff) > SpellData(ascendance_caster_buff duration) and { target.TimeToDie() < 20 or BuffPresent(burst_haste any=1) or TimeInCombat() >= 60 } and SpellCooldown(lava_burst) > 0 } Spell(ascendance_caster)
+		#use_item,name=grips_of_tidal_force,if=((cooldown.ascendance.remains>10|level<87)&cooldown.fire_elemental_totem.remains>10)|buff.ascendance.up|buff.bloodlust.up|totem.fire_elemental_totem.active
+		if { { SpellCooldown(ascendance_caster) > 10 or Level() < 87 } and SpellCooldown(fire_elemental_totem) > 10 } or BuffPresent(ascendance_caster_buff) or BuffPresent(burst_haste any=1) or TotemPresent(fire totem=fire_elemental_totem) UseItemActions()
+	}
+}
+
+AddFunction ElementalPrecombatActions
+{
+	#flask,type=warm_sun
+	#food,type=mogu_fish_stew
+	#flametongue_weapon,weapon=main
+	if WeaponEnchantExpires(main) Spell(flametongue_weapon)
+	#lightning_shield,if=!buff.lightning_shield.up
+	if not BuffPresent(lightning_shield_buff) Spell(lightning_shield)
+	#snapshot_stats
+}
+
+AddFunction ElementalPrecombatCdActions
+{
+	#jade_serpent_potion
+	UsePotionIntellect()
+}
+
+### Elemental icons.
+
+AddIcon mastery=elemental help=cd size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(stone_bulwark_totem_talent) Spell(stone_bulwark_totem)
+	if TalentPoints(astral_shift_talent) Spell(astral_shift)
+	if TalentPoints(earthgrab_totem_talent) Spell(earthgrab_totem)
+	Spell(earthbind_totem)
+}
+
+AddIcon mastery=elemental help=buff size=small checkboxon=opt_icons_left
+{
+	if IsFeared() Spell(tremor_totem)
+	#if IsStunned() Spell(windwalk_totem)
+	if TalentPoints(conductivity_talent) Spell(healing_rain)
+	if TotemExpires(water)
+	{
+		if TalentPoints(healing_tide_totem) Spell(healing_tide_totem)
+		Spell(healing_stream_totem)
+	}
+	if TalentPoints(ancestral_guidance_talent) Spell(ancestral_guidance)
+}
+
+AddIcon mastery=elemental help=main
+{
+	ElementalPrecombatActions()
+	ElementalDefaultActions()
+	ElementalSingleActions()
+	#lightning_bolt
+	Spell(lightning_bolt)
+}
+
+AddIcon mastery=elemental help=main
+{
+	ElementalPrecombatActions()
+	ElementalDefaultActions()
+	ElementalSingleActions()
+}
+
+AddIcon mastery=elemental help=aoe checkboxon=aoe
+{
+	ElementalPrecombatActions()
+	ElementalDefaultActions()
+	ElementalAoeActions()
+}
+
+AddIcon mastery=elemental help=cd
+{
+	ElementalDefaultCdActions()
+	ElementalSingleCdActions()
+}
+
+AddIcon mastery=elemental help=cd size=small checkboxon=opt_icons_right
+{
+	#bloodlust,if=target.health.pct<25|time>5
+	if target.HealthPercent() < 25 or TimeInCombat() > 5 Bloodlust()
+	#stormlash_totem,if=!active&!buff.stormlash.up&(buff.bloodlust.up|time>=60)
+	if not TotemPresent(air totem=stormlash_totem) and not BuffPresent(stormlash_buff) and { BuffPresent(burst_haste any=1) or TimeInCombat() >= 60 } Spell(stormlash_totem)
+}
+
+AddIcon mastery=elemental help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Enhancement
+###
+# Based on SimulationCraft profile "Shaman_Enhancement_T16H".
+#	class=shaman
+#	spec=enhancement
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#WZ!...0.1
+#	glyphs=chain_lightning
+
+AddFunction EnhancementAoeActions
+{
+	#fire_nova,if=active_flame_shock>=4
+	if DebuffCount(flame_shock_debuff) >= 4 Spell(fire_nova)
+	#wait,sec=cooldown.fire_nova.remains,if=active_flame_shock>=4&cooldown.fire_nova.remains<0.67
+	if DebuffCount(flame_shock_debuff) >= 4 and SpellCooldown(fire_nova) < 0.67 wait Spell(fire_nova)
+	#magma_totem,if=active_enemies>5&!totem.fire.active
+	if Enemies() > 5 and not TotemPresent(fire) Spell(magma_totem)
+	#searing_totem,if=active_enemies<=5&!totem.fire.active
+	if Enemies() <= 5 and not TotemPresent(fire) Spell(searing_totem)
+	#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)
+	#chain_lightning,if=active_enemies>=2&buff.maelstrom_weapon.react>=3
+	if Enemies() >= 2 and BuffPresent(maelstrom_weapon_buff) >= 3 Spell(chain_lightning)
+	#unleash_elements
+	Spell(unleash_elements)
+	#flame_shock,cycle_targets=1,if=!ticking
+	if not target.DebuffPresent(flame_shock_debuff) Spell(flame_shock)
+	#stormblast
+	Spell(stormblast)
+	#fire_nova,if=active_flame_shock>=3
+	if DebuffCount(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)
+	#stormstrike
+	Spell(stormstrike)
+	#earth_shock,if=active_enemies<4
+	if Enemies() < 4 Spell(earth_shock)
+	#feral_spirit
+	Spell(feral_spirit)
+	#earth_elemental_totem,if=!active&cooldown.fire_elemental_totem.remains>=50
+	if not TotemPresent(earth totem=earth_elemental_totem) and SpellCooldown(fire_elemental_totem) >= 50 Spell(earth_elemental_totem)
+	#fire_nova,if=active_flame_shock>=1
+	if DebuffCount(flame_shock_debuff) >= 1 Spell(fire_nova)
+}
+
+AddFunction EnhancementSingleActions
+{
+	#searing_totem,if=!totem.fire.active
+	if not TotemPresent(fire) Spell(searing_totem)
+	#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)
+	#lightning_bolt,if=buff.maelstrom_weapon.react=5
+	if BuffPresent(maelstrom_weapon_buff) == 5 Spell(lightning_bolt)
+	#stormblast
+	Spell(stormblast)
+	#stormstrike
+	Spell(stormstrike)
+	#flame_shock,if=buff.unleash_flame.up&!ticking
+	if BuffPresent(unleash_flame_buff) and not target.DebuffPresent(flame_shock_debuff) Spell(flame_shock)
+	#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)
+	#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
+	Spell(unleash_elements)
+	#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)
+	#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)
+}
+
+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
+	{
+		#feral_spirit,if=set_bonus.tier15_4pc_melee=1
+		if ArmorSetBonus(T15_melee 4) == 1 Spell(feral_spirit)
+
+		unless Spell(stormblast)
+			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 { { 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) }
+		{
+			#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)
+
+			unless BuffPresent(ancestral_swiftness_buff)
+				or { { not Glyph(glyph_of_frost_shock) or ArmorSetBonus(T14_melee 4) == 1 } and Spell(earth_shock) }
+			{
+				#feral_spirit
+				Spell(feral_spirit)
+				#earth_elemental_totem,if=!active
+				if not TotemPresent(earth totem=earth_elemental_totem) Spell(earth_elemental_totem)
+			}
+		}
+	}
+}
+
+AddFunction EnhancementDefaultActions
+{
+	if not BuffPresent(lightning_shield_buff) Spell(lightning_shield)
+
+	#run_action_list,name=single,if=active_enemies=1
+	#if Enemies() == 1 EnhancementSingleActions()
+	#run_action_list,name=aoe,if=active_enemies>1
+	#if Enemies() > 1 EnhancementAoeActions()
+}
+
+AddFunction EnhancementDefaultCdActions
+{
+	#wind_shear
+	Interrupt()
+	UseRacialInterruptActions()
+
+	unless not BuffPresent(lightning_shield_buff)
+	{
+		#use_item,name=grips_of_celestial_harmony
+		UseItemActions()
+		#virmens_bite_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 } UsePotionAgility()
+		#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)
+		#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)
+		#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
+		if not TotemPresent(fire totem=fire_elemental_totem) Spell(fire_elemental_totem)
+		#ascendance,if=cooldown.strike.remains>=3
+		if SpellCooldown(strike) >= 3 Spell(ascendance_melee)
+		#lifeblood,if=(glyph.fire_elemental_totem.enabled&(pet.primal_fire_elemental.active|pet.greater_fire_elemental.active))|!glyph.fire_elemental_totem.enabled
+		#if { Glyph(glyph_of_fire_elemental_totem) and { TotemPresent(fire totem=fire_elemental_totem) or TotemPresent(fire totem=fire_elemental_totem) } } or not Glyph(glyph_of_fire_elemental_totem) Spell(lifeblood)
+	}
+}
+
+AddFunction EnhancementPrecombatActions
+{
+	#flask,type=spring_blossoms
+	#food,type=sea_mist_rice_noodles
+	#windfury_weapon,weapon=main
+	if WeaponEnchantExpires(main) Spell(windfury_weapon)
+	#flametongue_weapon,weapon=off
+	if WeaponEnchantExpires(off) Spell(flametongue_weapon)
+	#lightning_shield,if=!buff.lightning_shield.up
+	if not BuffPresent(lightning_shield_buff) Spell(lightning_shield)
+	#snapshot_stats
+}
+
+AddFunction EnhancementPrecombatCdActions
+{
+	#virmens_bite_potion
+	UsePotionAgility()
+}
+
+### Enhancement icons.
+
+AddIcon mastery=enhancement help=cd size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(stone_bulwark_totem_talent) Spell(stone_bulwark_totem)
+	if TalentPoints(astral_shift_talent) Spell(astral_shift)
+	if TalentPoints(earthgrab_totem_talent) Spell(earthgrab_totem)
+	Spell(earthbind_totem)
+}
+
+AddIcon mastery=enhancement help=buff size=small checkboxon=opt_icons_left
+{
+	if IsFeared() Spell(tremor_totem)
+	#if IsStunned() Spell(windwalk_totem)
+	if TalentPoints(conductivity_talent) Spell(healing_rain)
+	if TotemExpires(water)
+	{
+		if TalentPoints(healing_tide_totem) Spell(healing_tide_totem)
+		Spell(healing_stream_totem)
+	}
+	if TalentPoints(ancestral_guidance_talent) Spell(ancestral_guidance)
+}
+
+AddIcon mastery=enhancement help=main
+{
+	EnhancementPrecombatActions()
+	EnhancementDefaultActions()
+	EnhancementSingleActions()
+}
+
+AddIcon mastery=enhancement help=main
+{
+	EnhancementPrecombatActions()
+	EnhancementDefaultActions()
+	EnhancementSingleActions()
+}
+
+AddIcon mastery=enhancement help=aoe checkboxon=aoe
+{
+	EnhancementPrecombatActions()
+	EnhancementDefaultActions()
+	EnhancementAoeActions()
+}
+
+AddIcon mastery=enhancement help=cd
+{
+	EnhancementDefaultCdActions()
+	EnhancementSingleCdActions()
+}
+
+AddIcon mastery=enhancement help=cd size=small checkboxon=opt_icons_right
+{
+	#bloodlust,if=target.health.pct<25|time>5
+	if target.HealthPercent() < 25 or TimeInCombat() > 5 Spell(bloodlust)
+	#stormlash_totem,if=!active&!buff.stormlash.up&(buff.bloodlust.up|time>=60)
+	if not TotemPresent(air totem=stormlash_totem) and not BuffPresent(stormlash_buff) and { BuffPresent(burst_haste any=1) or TimeInCombat() >= 60 } Spell(stormlash_totem)
+}
+
+AddIcon mastery=enhancement help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+
+###
+### Restoration
+###
+# Information from Elitist Jerks, "[Resto] It's Raining Heals 5.4"
+#	http://forums.elitistjerks.com/page/articles.html/_/world-of-warcraft/shaman/resto-its-raining-heals-54-r89
+
+# Suggest using Totemic Recall to regain mana from casting Healing Stream Totem.
+AddCheckBox(opt_totemic_recall SpellName(totemic_recall) mastery=restoration)
+
+AddFunction RestorationMainActions
+{
+	if WeaponEnchantExpires(mainhand) Spell(earthliving_weapon)
+	if BuffExpires(water_shield_buff) Spell(water_shield)
+	if BuffCount(earth_shield_buff) == 0 Spell(earth_shield)
+	if CheckBoxOn(opt_totemic_recall)
+	{
+		# Suggest Totemic Recall to regain mana from Healing Stream Totem, but only if it won't
+		# recall other totems with very long CDs.
+		#
+		# Totemic Recall is suggested at 3s remaining on HST so that there is still time to cast
+		# it after the current spellcast and GCD.
+		#
+		if TotemPresent(water totem=healing_stream_totem) and TotemExpires(water 3)
+			and TotemExpires(fire) and TotemExpires(earth) and TotemExpires(air)
+		{
+			Spell(totemic_recall)
+		}
+	}
+	if TotemExpires(water) Spell(healing_stream_totem)
+	if Glyph(glyph_of_riptide no) Spell(riptide)
+}
+
+AddFunction RestorationAoeActions
+{
+	if WeaponEnchantExpires(mainhand) Spell(earthliving_weapon)
+	if TotemExpires(water) Spell(healing_stream_totem)
+	Spell(healing_rain)
+	Spell(chain_heal)
+}
+
+AddFunction RestorationShortCdActions
+{
+	if TalentPoints(primal_elementalist_talent) and pet.Present()
+	{
+		if TotemPresent(fire totem=fire_elemental_totem) and BuffExpires(pet_empower any=1) Spell(pet_empower)
+		if TotemPresent(earth totem=earth_elemental_totem) and BuffExpires(pet_reinforce any=1) Spell(pet_reinforce)
+	}
+	Spell(unleash_elements)
+}
+
+### Restoration icons.
+
+AddIcon mastery=restoration help=cd size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(stone_bulwark_totem_talent) Spell(stone_bulwark_totem)
+	if TalentPoints(astral_shift_talent) Spell(astral_shift)
+	if TalentPoints(earthgrab_totem_talent) Spell(earthgrab_totem)
+	Spell(earthbind_totem)
+}
+
+AddIcon mastery=restoration help=buff size=small checkboxon=opt_icons_left
+{
+	if IsFeared() Spell(tremor_totem)
+	#if IsStunned() Spell(windwalk_totem)
+	if TotemExpires(water)
+	{
+		if ManaPercent(less 80) Spell(mana_tide_totem)
+		Spell(healing_stream_totem)
+		if TalentPoints(healing_tide_totem) Spell(healing_tide_totem)
+	}
+	if TalentPoints(ancestral_guidance_talent) Spell(ancestral_guidance)
+	Spell(spirit_link_totem)
+}
+
+AddIcon mastery=restoration help=shortcd
+{
+	RestorationShortCdActions()
+}
+
+AddIcon mastery=restoration help=main
+{
+	RestorationMainActions()
+}
+
+AddIcon mastery=restoration help=aoe checkboxon=aoe
+{
+	RestorationAoeActions()
+}
+
+AddIcon mastery=restoration help=cd
+{
+	Interrupt()
+	if Speed(more 0) Spell(spiritwalkers_grace)
+	Spell(ascendance_heal)
+	Spell(fire_elemental_totem)
+	Spell(earth_elemental_totem)
+}
+
+AddIcon mastery=restoration help=cd size=small checkboxon=opt_icons_right
+{
+	if BuffExpires(stormlash_totem_buff any=1) and {BuffPresent(burst_haste any=1) or TimeInCombat() >60} Spell(stormlash_totem)
+	if BuffExpires(burst_haste any=1) Bloodlust()
+}
+
+AddIcon mastery=restoration help=cd size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}
+]]
+
+	OvaleScripts:RegisterScript("SHAMAN", name, desc, code)
+end
diff --git a/scripts/ovale_shaman_spells.lua b/scripts/ovale_shaman_spells.lua
new file mode 100644
index 0000000..f7011fd
--- /dev/null
+++ b/scripts/ovale_shaman_spells.lua
@@ -0,0 +1,212 @@
+local _, Ovale = ...
+local OvaleScripts = Ovale.OvaleScripts
+
+do
+	local name = "ovale_shaman_spells"
+	local desc = "[5.4.7] Ovale: Shaman spells"
+	local code = [[
+# Shaman spells and functions.
+#	Last updated: 2014-04-19
+
+Define(ancestral_guidance 108281)
+	SpellInfo(ancestral_guidance cd=120)
+Define(ancestral_guidance_talent 14)
+Define(ancestral_swiftness 16188)
+	SpellInfo(ancestral_swiftness cd=90)
+	SpellAddBuff(ancestral_swiftness ancestral_swiftness_buff=1)
+Define(ancestral_swiftness_buff 16188)
+Define(ancestral_swiftness_talent 11)
+Define(ascendance_caster 114050)
+	SpellInfo(ascendance_caster cd=180)
+	SpellAddBuff(ascendance_caster ascendance_caster_buff=1)
+Define(ascendance_caster_buff 114050)
+	SpellInfo(ascendance_caster_buff duration=15)
+Define(ascendance_heal 114052)
+	SpellInfo(ascendance_heal cd=180)
+	SpellAddBuff(ascendance_heal ascendance_heal_buff=1)
+Define(ascendance_heal_buff 114052)
+	SpellInfo(ascendance_heal_buff duration=15)
+Define(ascendance_melee 114051)
+	SpellInfo(ascendance_melee cd=180)
+	SpellAddBuff(ascendance_melee ascendance_melee_buff=1)
+Define(ascendance_melee_buff 114051)
+	SpellInfo(ascendance_melee_buff duration=15)
+Define(astral_shift 108271)
+	SpellInfo(astral_shift cd=90)
+Define(astral_shift_talent 3)
+Define(bloodlust 2825)
+	SpellInfo(bloodlust cd=300)
+Define(call_of_the_elements 108285)
+	SpellInfo(call_of_the_elements cd=180)
+Define(call_of_the_elements_talent 7)
+Define(chain_heal 1064)
+	SpellInfo(chain_heal cd=2 glyph=glyph_of_chaining)
+	SpellAddBuff(chain_heal ancestral_swiftness_buff=0 if_talent=ancestral_swiftness_talent)
+Define(chain_lightning 421)
+	SpellInfo(chain_lightning cd=3)
+	SpellInfo(chain_lightning cd=0 mastery=elemental)
+	SpellAddBuff(chain_lightning ancestral_swiftness_buff=0 if_talent=ancestral_swiftness_talent)
+Define(earth_elemental_totem 2062)
+	SpellInfo(earth_elemental_totem cd=300)
+Define(earth_shield 974)
+	SpellAddTargetBuff(earth_shield earth_shield_buff=1)
+Define(earth_shield_buff 974)
+	SpellInfo(earth_shield_buff duration=600)
+Define(earth_shock 8042)
+	SpellInfo(earth_shock cd=6 sharedcd=shock)
+	SpellInfo(earth_shock addcd=-1 mastery=elemental)
+Define(earthbind_totem 2484)
+	SpellInfo(earthbind_totem cd=30)
+Define(earthgrab_totem 51485)
+	SpellInfo(earthgrab_totem cd=30)
+Define(earthgrab_totem_talent 5)
+Define(earthliving_weapon 51730)
+Define(earthquake 61882)
+	SpellInfo(earthquake cd=10)
+Define(elemental_blast 117014)
+	SpellInfo(elemental_blast cd=12)
+Define(elemental_blast_talent 18)
+Define(elemental_mastery 16166)
+	SpellInfo(elemental_mastery cd=90)
+	SpellAddBuff(elemental_mastery elemental_mastery_buff=1)
+Define(elemental_mastery_buff 16166)
+	SpellInfo(elemental_mastery_buff duration=20)
+Define(elemental_mastery_talent 10)
+Define(feral_spirit 51533)
+	SpellInfo(feral_spirit cd=120)
+Define(fire_elemental_totem 2894)
+	SpellInfo(fire_elemental_totem cd=300)
+	SpellInfo(fire_elemental_totem cd=150 glyph=glyph_of_fire_elemental_totem)
+Define(fire_nova 1535)
+	SpellInfo(fire_nova cd=4)
+Define(flame_shock 8050)
+	SpellInfo(flame_shock cd=6 sharedcd=shock)
+	SpellInfo(flame_shock addcd=-1 mastery=elemental)
+	SpellAddBuff(flame_shock unleash_flame_buff=0 if_spell=unleash_elements)
+	SpellAddTargetDebuff(flame_shock flame_shock_debuff=1)
+Define(flame_shock_debuff 8050)
+	SpellInfo(flame_shock_debuff duration=30 haste=spell tick=3)
+Define(flametongue_weapon 8024)
+Define(frost_shock 8050)
+	SpellInfo(frost_shock cd=6 sharedcd=shock)
+	SpellInfo(frost_shock addcd=-2 glyph=glyph_of_frost_shock)
+Define(glyph_of_chaining 55452)
+Define(glyph_of_fire_elemental_totem 55455)
+Define(glyph_of_frost_shock 55443)
+Define(glyph_of_riptide 63273)
+Define(glyph_of_spirit_walk 55454)
+Define(glyph_of_thunder 63270)
+Define(glyph_of_wind_shear 55451)
+Define(greater_healing_wave 77472)
+	SpellAddBuff(greater_healing_wave ancestral_swiftness_buff=0 if_talent=ancestral_swiftness_talent)
+Define(healing_rain 73920)
+	SpellInfo(healing_rain cd=10)
+	SpellAddBuff(healing_rain ancestral_swiftness_buff=0 if_talent=ancestral_swiftness_talent)
+Define(healing_stream_totem 5394)
+	SpellInfo(healing_stream_totem cd=30)
+Define(healing_surge 8004)
+	SpellAddBuff(healing_surge ancestral_swiftness_buff=0 if_talent=ancestral_swiftness_talent)
+Define(healing_tide_totem 108280)
+	SpellInfo(healing_tide_totem cd=180)
+Define(healing_wave 331)
+	SpellAddBuff(healing_wave ancestral_swiftness_buff=0 if_talent=ancestral_swiftness_talent)
+Define(heroism 32182)
+	SpellInfo(heroism duration=40)
+Define(lava_beam 114074)
+Define(lava_burst 51505)
+	SpellInfo(lava_burst buffnocd=ascendance_caster_buff cd=8)
+	SpellAddBuff(lava_burst lava_surge_buff=0)
+Define(lava_lash 60103)
+	SpellInfo(lava_lash cd=10)
+Define(lava_surge_buff 77762)
+	SpellInfo(lava_surge_buff duration=6)
+Define(lightning_bolt 403)
+	SpellAddBuff(lightning_bolt ancestral_swiftness_buff=0 if_talent=ancestral_swiftness_talent))
+Define(lightning_shield 324)
+	SpellAddBuff(lightning_shield lightning_shield_buff=1)
+Define(lightning_shield_buff 324)
+	SpellInfo(lightning_shield duration=3600)
+Define(maelstrom_weapon_buff 53817)
+	SpellInfo(maelstrom_weapon_buff duration=30)
+Define(magma_totem 8187)
+Define(mana_tide_totem 16190)
+	SpellInfo(mana_tide_totem cd=180)
+Define(primal_elementalist_talent 17)
+Define(riptide 61295)
+	SpellInfo(riptide cd=6)
+	SpellInfo(riptide cd=0 glyph=glyph_of_riptide)
+	SpellAddTargetBuff(riptide riptide_buff=1)
+Define(riptide_buff 61295)
+	SpellInfo(riptide_buff duration=18 haste=spell tick=3)
+Define(searing_totem 3599)
+Define(shamanistic_rage 30823)
+	SpellInfo(shamanistic_rage cd=60)
+Define(spirit_link_totem 98008)
+	SpellInfo(spirit_link_totem cd=180)
+Define(spirit_walk 58875)
+	SpellInfo(spirit_walk cd=60)
+	SpellInfo(spirit_walk addcd=-15 glyph=glyph_of_spirit_walk)
+Define(spiritwalkers_grace 79206)
+	SpellInfo(spiritwalkers_grace cd=120)
+Define(stone_bulwark_totem 108270)
+	SpellInfo(stone_bulwark_totem cd=10)
+Define(stone_bulwark_totem_talent 2)
+Define(stormblast 115356)
+	SpellInfo(stormblast cd=8 sharedcd=strike)
+Define(stormlash_buff 120676)
+	SpellInfo(stormlash_buff duration=10)
+Define(stormlash_totem 120668)
+	SpellInfo(stormlash_totem cd=300)
+	SpellAddBuff(stormlash_totem stormlash_buff=1)
+Define(stormstrike 17364)
+	SpellInfo(stormstrike cd=8 sharedcd=strike)
+Define(thunderstorm 51490)
+	SpellInfo(thunderstorm cd=45)
+	SpellInfo(thunderstorm addcd=-10 glyph=glyph_of_thunder)
+Define(totemic_recall 36936)
+Define(tremor_totem 8143)
+	SpellInfo(tremor_totem cd=60)
+Define(unleash_elements 73680)
+	SpellInfo(unleash_elements cd=15)
+Define(unleash_flame_buff 73683)
+	SpellInfo(unleash_flame_buff duration=8)
+Define(unleashed_fury_talent 16)
+Define(water_shield 52127)
+	SpellAddBuff(water_shield water_shield_buff=1)
+Define(water_shield_buff 52127)
+	SpellInfo(water_shield duration=3600)
+Define(wind_shear 57994)
+	SpellInfo(wind_shear cd=12)
+	SpellInfo(wind_shear addcd=3 glyph=glyph_of_wind_shear)
+Define(windfury_weapon 8232)
+Define(windwalk_totem 108273)
+	SpellInfo(windwalk_totem cd=60)
+Define(windwalk_totem_talent 6)
+
+# Pet spells (Primal Elementalist Talent)
+Define(pet_empower 118350)
+	SpellAddBuff(pet_empower pet_empower_buff=1)
+Define(pet_empower_buff 118350)
+	SpellInfo(pet_empower_buff duration=60)
+Define(pet_reinforce 118347)
+	SpellAddBuff(pet_reinforce pet_reinforce_buff=1)
+Define(pet_reinforce_buff 118347)
+	SpellInfo(pet_reinforce_buff duration=60)
+
+AddFunction Bloodlust
+{
+	if DebuffExpires(burst_haste_debuff any=1)
+	{
+		Spell(bloodlust)
+		Spell(heroism)
+	}
+}
+
+AddFunction Interrupt
+{
+	if target.IsFriend(no) and target.IsInterruptible() Spell(wind_shear)
+}
+]]
+
+	OvaleScripts:RegisterScript("SHAMAN", name, desc, code, "include")
+end