# Ensure weapon enchant is applied if you've selected Improved Flametongue Weapon.
actions.precombat+=/flametongue_weapon,if=talent.improved_flametongue_weapon.enabled
actions.precombat+=/thunderstrike_ward
actions.precombat+=/skyfury
actions.precombat+=/potion
actions.precombat+=/stormkeeper
actions.precombat+=/lightning_shield
actions.precombat+=/variable,name=mael_cap,value=100+50*talent.swelling_maelstrom.rank+25*talent.primordial_capacity.rank,op=set
# Enable more movement.
actions+=/spiritwalkers_grace,moving=1,if=movement.distance>6
# Interrupt of casts.
actions+=/wind_shear
actions+=/blood_fury,if=!talent.ascendance.enabled|buff.ascendance.up|cooldown.ascendance.remains>50
actions+=/berserking,if=!talent.ascendance.enabled|buff.ascendance.up
actions+=/fireblood,if=!talent.ascendance.enabled|buff.ascendance.up|cooldown.ascendance.remains>50
actions+=/ancestral_call,if=!talent.ascendance.enabled|buff.ascendance.up|cooldown.ascendance.remains>50
actions+=/use_items
actions+=/lightning_shield,if=buff.lightning_shield.down
actions+=/natures_swiftness
actions+=/ancestral_swiftness
actions+=/potion
actions+=/run_action_list,name=aoe,strict=1,if=spell_targets.chain_lightning>2
actions+=/run_action_list,name=single_target
# Keep your cooldowns rolling.
actions.aoe+=/fire_elemental,if=!buff.fire_elemental.up
# Keep your cooldowns rolling.
actions.aoe+=/storm_elemental,if=!buff.storm_elemental.up
# Keep your cooldowns rolling.
actions.aoe+=/stormkeeper,if=!buff.stormkeeper.up
# Reset LMT CD as early as possible.
actions.aoe+=/totemic_recall,if=cooldown.liquid_magma_totem.remains>25
# Keep your cooldowns rolling.
actions.aoe+=/liquid_magma_totem,if=totem.liquid_magma_totem.down
# Spread Flame Shock using Surge of Power.
actions.aoe+=/primordial_wave,cycle_targets=1,if=buff.surge_of_power.up
# Spread Flame Shock using Surge of Power.
actions.aoe+=/primordial_wave,cycle_targets=1,if=talent.deeply_rooted_elements.enabled&!talent.surge_of_power.enabled
# Spread Flame Shock using Surge of Power.
actions.aoe+=/primordial_wave,cycle_targets=1,if=talent.master_of_the_elements.enabled&!talent.lightning_rod.enabled
# Spread Flame Shock using Surge of Power on up to 4 for Lightning builds.
actions.aoe+=/flame_shock,cycle_targets=1,if=refreshable&buff.surge_of_power.up&talent.lightning_rod.enabled&dot.flame_shock.remains<target.time_to_die-16&active_enemies<5
# Spread Flame Shock using Surge of Power up to 6.
actions.aoe+=/flame_shock,cycle_targets=1,if=refreshable&buff.surge_of_power.up&(!talent.lightning_rod.enabled|talent.skybreakers_fiery_demise.enabled)&dot.flame_shock.remains<target.time_to_die-5&active_dot.flame_shock<6
# Spread Flame Shock against low target counts if Master of the Elements was selected up to 6.
actions.aoe+=/flame_shock,cycle_targets=1,if=refreshable&talent.master_of_the_elements.enabled&!talent.lightning_rod.enabled&!talent.surge_of_power.enabled&dot.flame_shock.remains<target.time_to_die-5&active_dot.flame_shock<6
# Spread Flame Shock to gamble on Deeply Rooted Element procs up to 6.
actions.aoe+=/flame_shock,cycle_targets=1,if=refreshable&talent.deeply_rooted_elements.enabled&!talent.surge_of_power.enabled&dot.flame_shock.remains<target.time_to_die-5&active_dot.flame_shock<6
# Refresh Flame Shock using Surge of Power up to 6.
actions.aoe+=/flame_shock,cycle_targets=1,if=refreshable&buff.surge_of_power.up&(!talent.lightning_rod.enabled|talent.skybreakers_fiery_demise.enabled)&dot.flame_shock.remains<target.time_to_die-5&dot.flame_shock.remains>0
# Refresh Flame Shock against low target counts if Master of the Elements was selected up to 6.
actions.aoe+=/flame_shock,cycle_targets=1,if=refreshable&talent.master_of_the_elements.enabled&!talent.lightning_rod.enabled&!talent.surge_of_power.enabled&dot.flame_shock.remains<target.time_to_die-5&dot.flame_shock.remains>0
# Refresh Flame Shock to gamble on Deeply Rooted Element procs up to 6.
actions.aoe+=/flame_shock,cycle_targets=1,if=refreshable&talent.deeply_rooted_elements.enabled&!talent.surge_of_power.enabled&dot.flame_shock.remains<target.time_to_die-5&dot.flame_shock.remains>0
# JUST DO IT! https://i.kym-cdn.com/entries/icons/mobile/000/018/147/Shia_LaBeouf__Just_Do_It__Motivational_Speech_(Original_Video_by_LaBeouf__R%C3%B6nkk%C3%B6___Turner)_0-4_screenshot.jpg
actions.aoe+=/ascendance
# {T31 fire} Lava burst is top prio on 3 targets.
actions.aoe+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains&active_enemies=3&(!talent.lightning_rod.enabled&set_bonus.tier31_4pc)
# {T31 fire} Earthquake is still good with Mote and either 10 Magma Chamber stacks on 6+ targets or 9+ targets.
actions.aoe+=/earthquake,if=buff.master_of_the_elements.up&(buff.magma_chamber.stack=10&active_enemies>=6|talent.splintered_elements.enabled&active_enemies>=9|talent.mountains_will_fall.enabled&active_enemies>=9)&(!talent.lightning_rod.enabled&set_bonus.tier31_4pc)
# {T31 fire} Stormkeeper is strong and should be used.
actions.aoe+=/lava_beam,if=buff.stormkeeper.up&(buff.surge_of_power.up&active_enemies>=6|buff.master_of_the_elements.up&(active_enemies<6|!talent.surge_of_power.enabled))&(!talent.lightning_rod.enabled&set_bonus.tier31_4pc)
# {T31 fire} Stormkeeper is strong and should be used.
actions.aoe+=/chain_lightning,if=buff.stormkeeper.up&(buff.surge_of_power.up&active_enemies>=6|buff.master_of_the_elements.up&(active_enemies<6|!talent.surge_of_power.enabled))&(!talent.lightning_rod.enabled&set_bonus.tier31_4pc)
# {T31 fire} Lava Surge is strong.
actions.aoe+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains&cooldown_react&buff.lava_surge.up&(!talent.lightning_rod.enabled&set_bonus.tier31_4pc)
# Cast Lava Burst to buff your immediately follow-up Earthquake with Master of the Elements.
actions.aoe+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains&cooldown_react&buff.lava_surge.up&talent.master_of_the_elements.enabled&!buff.master_of_the_elements.up&(maelstrom>=52-5*talent.eye_of_the_storm.enabled-2*talent.flow_of_power.enabled)&(!talent.echoes_of_great_sundering.enabled&!talent.lightning_rod.enabled|buff.echoes_of_great_sundering_es.up|buff.echoes_of_great_sundering_eb.up)&(!buff.ascendance.up&active_enemies>3|active_enemies=3)
# Use the talents you selected.
actions.aoe+=/earthquake,if=!talent.echoes_of_great_sundering.enabled&active_enemies>3&(spell_targets.chain_lightning>3|spell_targets.lava_beam>3)
# Use the talents you selected.
actions.aoe+=/earthquake,if=!talent.echoes_of_great_sundering.enabled&!talent.elemental_blast.enabled&active_enemies=3&(spell_targets.chain_lightning=3|spell_targets.lava_beam=3)
# Use the talents you selected.
actions.aoe+=/earthquake,if=buff.echoes_of_great_sundering_es.up|buff.echoes_of_great_sundering_eb.up
# Use the talents you selected. Spread Lightning Rod to as many targets as possible.
actions.aoe+=/elemental_blast,cycle_targets=1,if=talent.echoes_of_great_sundering.enabled
# Use the talents you selected.
actions.aoe+=/elemental_blast,if=talent.echoes_of_great_sundering.enabled
# Elemental Blast is stronger than Earthquake against 3 targets.
actions.aoe+=/elemental_blast,if=active_enemies=3&!talent.echoes_of_great_sundering.enabled
# Use the talents you selected. Spread Lightning Rod to as many targets as possible.
actions.aoe+=/earth_shock,cycle_targets=1,if=talent.echoes_of_great_sundering.enabled
# Use the talents you selected.
actions.aoe+=/earth_shock,if=talent.echoes_of_great_sundering.enabled
# Buff Stormkeeper with Master of the elements on 3-4 targets.
actions.aoe+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains&talent.master_of_the_elements.enabled&!buff.master_of_the_elements.up&(buff.stormkeeper.up|t30_2pc_timer.next_tick<3&set_bonus.tier30_2pc)&(maelstrom<60-5*talent.eye_of_the_storm.enabled-2*talent.flow_of_power.enabled-10)&active_enemies<5
# Stormkeeper is strong and should be used.
actions.aoe+=/lava_beam,if=buff.stormkeeper.up
# Stormkeeper is strong and should be used.
actions.aoe+=/chain_lightning,if=buff.stormkeeper.up
# Power of the Maelstrom is strong and should be used.
actions.aoe+=/lava_beam,if=buff.power_of_the_maelstrom.up&buff.ascendance.remains>cast_time
# Power of the Maelstrom is strong and should be used.
actions.aoe+=/chain_lightning,if=buff.power_of_the_maelstrom.up
# Against 6 targets or more Surge of Power should be used with Lava Beam rather than Lava Burst.
actions.aoe+=/lava_beam,if=active_enemies>=6&buff.surge_of_power.up&buff.ascendance.remains>cast_time
# Against 6 targets or more Surge of Power should be used with Chain Lightning rather than Lava Burst.
actions.aoe+=/chain_lightning,if=active_enemies>=6&buff.surge_of_power.up
# Consume Master of the Elements with Lava Beam.
actions.aoe+=/lava_beam,if=buff.master_of_the_elements.up&buff.ascendance.remains>cast_time
# Proc Master of the Elements against 3 targets.
actions.aoe+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains&active_enemies=3&talent.master_of_the_elements.enabled
# Gamble away for Deeply Rooted Elements procs whenever Lava Surge makes Lava Burst more efficient.
actions.aoe+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains&buff.lava_surge.up&talent.deeply_rooted_elements.enabled
# {PH} Icefury line to proc EoGS with Fusion of Elements.
actions.aoe+=/icefury,if=talent.fusion_of_elements.enabled&talent.echoes_of_great_sundering.enabled
#
actions.aoe+=/lava_beam,if=buff.ascendance.remains>cast_time
actions.aoe+=/chain_lightning
actions.aoe+=/flame_shock,moving=1,cycle_targets=1,if=refreshable
actions.aoe+=/frost_shock,moving=1
# Keep your cooldowns rolling.
actions.single_target+=/fire_elemental,if=!buff.fire_elemental.up
# Keep your cooldowns rolling.
actions.single_target+=/storm_elemental,if=!buff.storm_elemental.up
# {Fire} Keep your cooldowns rolling.
actions.single_target+=/liquid_magma_totem,if=!buff.ascendance.up&talent.fire_elemental.enabled
# Use Primordial Wave as much as possible. Try to not waste SoP on it in st.
actions.single_target+=/primordial_wave,cycle_targets=1,if=(!buff.surge_of_power.up&spell_targets.chain_lightning=1)|active_dot.flame_shock=0|talent.fire_elemental.enabled&(talent.skybreakers_fiery_demise.enabled|talent.deeply_rooted_elements.enabled)|(buff.surge_of_power.up|!talent.surge_of_power.enabled)&spell_targets.chain_lightning>1
# Manually refresh Flame shock if better options are not available.
actions.single_target+=/flame_shock,cycle_targets=1,if=active_enemies=1&(dot.flame_shock.remains<2|active_dot.flame_shock=0)&(dot.flame_shock.remains<cooldown.primordial_wave.remains|!talent.primordial_wave.enabled)&(dot.flame_shock.remains<cooldown.liquid_magma_totem.remains|!talent.liquid_magma_totem.enabled)&!buff.surge_of_power.up&talent.fire_elemental.enabled
# Use Flame shock without Surge of Power if you can't spread it with SoP because it is going to be used on Stormkeeper or Surge of Power is not talented.
actions.single_target+=/flame_shock,cycle_targets=1,if=active_dot.flame_shock=0&active_enemies>1&(spell_targets.chain_lightning>1|spell_targets.lava_beam>1)&(talent.deeply_rooted_elements.enabled|talent.ascendance.enabled|talent.primordial_wave.enabled|talent.searing_flames.enabled|talent.magma_chamber.enabled)&(!buff.master_of_the_elements.up&(buff.stormkeeper.up|cooldown.stormkeeper.remains=0)|!talent.surge_of_power.enabled)
# Spread Flame Shock to multiple targets only if talents were selected that benefit from it.
actions.single_target+=/flame_shock,cycle_targets=1,if=spell_targets.chain_lightning>1&refreshable&(talent.deeply_rooted_elements.enabled|talent.ascendance.enabled|talent.primordial_wave.enabled|talent.searing_flames.enabled|talent.magma_chamber.enabled)&(buff.surge_of_power.up&!buff.stormkeeper.up&!cooldown.stormkeeper.remains=0|!talent.surge_of_power.enabled)
# Just use Stormkeeper.
actions.single_target+=/stormkeeper,if=!buff.ascendance.up&!buff.stormkeeper.up
actions.single_target+=/tempest
# Stormkeeper is strong and should be used.
actions.single_target+=/lightning_bolt,if=buff.stormkeeper.up&buff.surge_of_power.up
# Buff stormkeeper with MotE when not using Surge.
actions.single_target+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains>2&buff.stormkeeper.up&!buff.master_of_the_elements.up&!talent.surge_of_power.enabled&talent.master_of_the_elements.enabled
# Stormkeeper is strong and should be used.
actions.single_target+=/lava_beam,if=spell_targets.lava_beam>1&buff.stormkeeper.up&!talent.surge_of_power.enabled
# Stormkeeper is strong and should be used.
actions.single_target+=/chain_lightning,if=spell_targets.chain_lightning>1&buff.stormkeeper.up&!talent.surge_of_power.enabled
# Stormkeeper is strong and should be used.
actions.single_target+=/lightning_bolt,if=buff.stormkeeper.up&!talent.surge_of_power.enabled&(buff.master_of_the_elements.up|!talent.master_of_the_elements.enabled)
# Surge of Power is strong and should be used.
actions.single_target+=/lightning_bolt,if=buff.surge_of_power.up&!buff.ascendance.up&talent.echo_chamber.enabled
actions.single_target+=/ascendance,if=cooldown.lava_burst.charges_fractional<1.0
actions.single_target+=/lava_beam,if=spell_targets.lava_beam>1&buff.power_of_the_maelstrom.up&buff.ascendance.remains>cast_time&!set_bonus.tier31_4pc
# {Fire} Lava Surge is neat. Utilize it.
actions.single_target+=/lava_burst,if=cooldown_react&buff.lava_surge.up&(talent.deeply_rooted_elements.enabled|!talent.master_of_the_elements.enabled)
# Spend if you have MotE buff and: not in Ascendance OR Ascendance gona last so long you will need to spend anyway OR nature fusion buff up OR close to maelstrom cap.
actions.single_target+=/earthquake,if=buff.master_of_the_elements.up&(buff.echoes_of_great_sundering_es.up|buff.echoes_of_great_sundering_eb.up)&(buff.fusion_of_elements_nature.up|maelstrom>variable.mael_cap-15|buff.ascendance.remains>9|!buff.ascendance.up)
# Spend if you have MotE buff and: not in Ascendance OR Ascendance gona last so long you will need to spend anyway OR any fusion buff up OR close to maelstrom cap.
actions.single_target+=/elemental_blast,cycle_targets=1,if=buff.master_of_the_elements.up&(buff.fusion_of_elements_nature.up|buff.fusion_of_elements_fire.up|maelstrom>variable.mael_cap-15|buff.ascendance.remains>6|!buff.ascendance.up)
# Spend if you have MotE buff and: not in Ascendance OR Ascendance gona last so long you will need to spend anyway OR nature fusion buff up OR close to maelstrom cap.
actions.single_target+=/earth_shock,cycle_targets=1,if=buff.master_of_the_elements.up&(buff.fusion_of_elements_nature.up|maelstrom>variable.mael_cap-15|buff.ascendance.remains>9|!buff.ascendance.up)
# Don't waste Icefury stacks even during Ascendance.
actions.single_target+=/icefury,if=!(buff.fusion_of_elements_nature.up|buff.fusion_of_elements_fire.up)&buff.icefury.stack=2&(talent.fusion_of_elements.enabled|!buff.ascendance.up)
# Spam Lava burst in Ascendance.
actions.single_target+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains>2&buff.ascendance.up
# {Fire} Buff your next <anything> with MotE.
actions.single_target+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains>2&talent.master_of_the_elements.enabled&!buff.master_of_the_elements.up&talent.fire_elemental.enabled
# Buff your next Maelstrom Spender with MotE. Lightning delayed to get more value out of LR.
actions.single_target+=/lava_burst,if=talent.master_of_the_elements.enabled&!buff.master_of_the_elements.up&(maelstrom>=82-10*talent.eye_of_the_storm.enabled|maelstrom>=52-5*talent.eye_of_the_storm.enabled&(!talent.elemental_blast.enabled|buff.echoes_of_great_sundering_es.up|buff.echoes_of_great_sundering_eb.up|spell_targets.chain_lightning>1&!talent.echoes_of_great_sundering.enabled))&(debuff.lightning_rod.remains<2|!debuff.lightning_rod.up)
# Use the talents you selected. Overcap prevention line.
actions.single_target+=/earthquake,if=(buff.echoes_of_great_sundering_es.up|buff.echoes_of_great_sundering_eb.up)&(maelstrom>variable.mael_cap-20|!talent.master_of_the_elements.enabled&!talent.lightning_rod.enabled|buff.stormkeeper.up&talent.lightning_rod.enabled)
# Use Earthquake against two enemies unless you have to alternate because of Echoes of Great Sundering. Overcap prevention line.
actions.single_target+=/earthquake,if=spell_targets.chain_lightning>1&!talent.echoes_of_great_sundering.enabled&!talent.elemental_blast.enabled&(maelstrom>variable.mael_cap-20|!talent.master_of_the_elements.enabled&!talent.lightning_rod.enabled|buff.stormkeeper.up&talent.lightning_rod.enabled)
# Overcap prevention line.
actions.single_target+=/elemental_blast,cycle_targets=1,if=maelstrom>variable.mael_cap-20|!talent.master_of_the_elements.enabled&!talent.lightning_rod.enabled
# Overcap prevention line.
actions.single_target+=/earth_shock,cycle_targets=1,if=maelstrom>variable.mael_cap-20|!talent.master_of_the_elements.enabled&!talent.lightning_rod.enabled|(buff.stormkeeper.up&talent.lightning_rod.enabled)
actions.single_target+=/lightning_bolt,if=buff.surge_of_power.up
# Use Icefury if you won't overwrite Fusion of Elements buffs.
actions.single_target+=/icefury,if=!(buff.fusion_of_elements_nature.up|buff.fusion_of_elements_fire.up)
actions.single_target+=/frost_shock,if=buff.icefury_dmg.up
# Utilize the Power of the Maelstrom buff.
actions.single_target+=/chain_lightning,if=buff.power_of_the_maelstrom.up&spell_targets.chain_lightning>1
# Utilize the Power of the Maelstrom buff.
actions.single_target+=/lightning_bolt,if=buff.power_of_the_maelstrom.up
# Fish for DRE procs.
actions.single_target+=/lava_burst,cycle_targets=1,if=dot.flame_shock.remains>2&talent.deeply_rooted_elements.enabled
# Casting Chain Lightning at two targets is more efficient than Lightning Bolt.
actions.single_target+=/chain_lightning,if=spell_targets.chain_lightning>1
# Filler spell. Always available. Always the bottom line.
actions.single_target+=/lightning_bolt
actions.single_target+=/flame_shock,moving=1,cycle_targets=1,if=refreshable
actions.single_target+=/flame_shock,moving=1,if=movement.distance>6
# Frost Shock is our movement filler.
actions.single_target+=/frost_shock,moving=1