# Executed before combat begins. Accepts non-harmful actions only.
actions.precombat=summon_pet
actions.precombat+=/snapshot_stats
actions.precombat+=/use_item,name=algethar_puzzle_box
actions.precombat+=/potion,pre_pot_time=6,if=potion.liquid_luster

# Executed every time the actor is available.
actions=retarget,target_if=max:target.health,line_cd=5,if=fight_style.dungeonroute
actions+=/auto_shot
actions+=/call_action_list,name=cds
actions+=/call_action_list,name=trinkets
actions+=/call_action_list,name=drst,if=talent.black_arrow&(active_enemies<2|!talent.beast_cleave&active_enemies<3)
actions+=/call_action_list,name=drcleave,if=talent.black_arrow&(active_enemies>2|talent.beast_cleave&active_enemies>1)
actions+=/call_action_list,name=st,if=!talent.black_arrow&(active_enemies<2|!talent.beast_cleave&active_enemies<3)
actions+=/call_action_list,name=cleave,if=!talent.black_arrow&(active_enemies>2|talent.beast_cleave&active_enemies>1)

actions.cds=invoke_external_buff,name=power_infusion,if=buff.bestial_wrath.up|cooldown.bestial_wrath.remains<30|fight_remains<16
actions.cds+=/berserking,if=cooldown.bestial_wrath.ready|fight_remains<13
actions.cds+=/blood_fury,if=cooldown.bestial_wrath.ready|fight_remains<16
actions.cds+=/ancestral_call,if=cooldown.bestial_wrath.ready|fight_remains<16
actions.cds+=/fireblood,if=cooldown.bestial_wrath.ready|fight_remains<9
actions.cds+=/potion,if=cooldown.bestial_wrath.ready&!potion.liquid_luster|cooldown.bestial_wrath.remains<6&potion.liquid_luster|fight_remains<31

# Bestial Wrath spawns an Apex Pet which casts Bestial Wrath 1.5s after, but it does not get the Beast Cleave that was active prior to Bestial Wrath. Therefore, to ensure this hit cleaves, Wild Thrash needs to follow up Bestial Wrath.
actions.cleave=wild_thrash,if=talent.beast_cleave&(prev_gcd.1.bestial_wrath|!buff.beast_cleave.up)
actions.cleave+=/barbed_shot,target_if=min:dot.barbed_shot.remains|max_prio_damage,if=full_recharge_time<gcd
actions.cleave+=/bestial_wrath,if=buff.beast_cleave.remains&cooldown.wild_thrash.remains<gcd|!talent.beast_cleave|!talent.wild_thrash
actions.cleave+=/wild_thrash,if=!talent.beast_cleave
actions.cleave+=/kill_command,if=(buff.natures_ally.react|talent.master_handler&(active_enemies>3|howl_summon.ready)|!apex.3)&(buff.beast_cleave.remains>gcd*0.25|!talent.beast_cleave)
actions.cleave+=/cobra_shot,if=buff.cobra_fang.up&buff.beast_cleave.remains>gcd*0.25
actions.cleave+=/barbed_shot,target_if=min:dot.barbed_shot.remains|max_prio_damage,if=(buff.beast_cleave.remains>gcd*0.25|!talent.beast_cleave)
actions.cleave+=/cobra_shot,if=buff.beast_cleave.remains>gcd*0.25|!talent.beast_cleave

actions.drcleave=black_arrow,if=buff.beast_cleave.remains<gcd&cooldown.bestial_wrath.remains<gcd&active_enemies>2
actions.drcleave+=/bestial_wrath,if=buff.beast_cleave.remains|!talent.beast_cleave
actions.drcleave+=/wild_thrash,if=talent.beast_cleave&(prev_gcd.1.bestial_wrath|!buff.beast_cleave.up|cooldown.bestial_wrath.remains>buff.beast_cleave.remains)|!talent.beast_cleave
actions.drcleave+=/kill_command,if=cooldown.bestial_wrath.remains>full_recharge_time+gcd&buff.natures_ally.react|!apex.3
actions.drcleave+=/barbed_shot,target_if=min:dot.barbed_shot.remains|max_prio_damage,if=full_recharge_time<1*gcd
actions.drcleave+=/black_arrow,if=buff.withering_fire.up
actions.drcleave+=/wailing_arrow,if=buff.withering_fire.remains<execute_time+gcd|time_to_die.remains<execute_time+gcd
actions.drcleave+=/barbed_shot,target_if=min:dot.barbed_shot.remains|max_prio_damage
actions.drcleave+=/black_arrow
actions.drcleave+=/wailing_arrow
actions.drcleave+=/cobra_shot

actions.drst=barbed_shot,target_if=min:dot.barbed_shot.remains|max_prio_damage,if=(talent.bloody_frenzy&talent.snakeskin_quiver&talent.jagged_wounds)&cooldown.bestial_wrath.remains<2*gcd
actions.drst+=/bestial_wrath
actions.drst+=/black_arrow,if=buff.withering_fire.up&cooldown.kill_command.full_recharge_time>gcd
actions.drst+=/kill_command,if=cooldown.bestial_wrath.remains>full_recharge_time+gcd&buff.natures_ally.react|!apex.3
actions.drst+=/wailing_arrow,if=buff.withering_fire.remains<execute_time+2*gcd|time_to_die.remains<execute_time+gcd
actions.drst+=/cobra_shot,if=buff.cobra_fang.at_max_stacks
actions.drst+=/cobra_shot,if=talent.killer_cobra&buff.bestial_wrath.up&cooldown.barbed_shot.charges_fractional<1.4
actions.drst+=/black_arrow
actions.drst+=/barbed_shot,target_if=min:dot.barbed_shot.remains|max_prio_damage
actions.drst+=/cobra_shot,if=cooldown.bestial_wrath.remains>gcd

actions.st=barbed_shot,target_if=min:dot.barbed_shot.remains|max_prio_damage,if=cooldown.bestial_wrath.remains<gcd|full_recharge_time<gcd
actions.st+=/bestial_wrath
actions.st+=/wild_thrash,if=active_enemies>1
actions.st+=/barbed_shot,if=howl_summon.ready&!buff.natures_ally.react&cooldown.barbed_shot.charges_fractional>1.5
actions.st+=/kill_command,if=howl_summon.ready|(cooldown.bestial_wrath.remains>full_recharge_time&buff.natures_ally.react|!apex.3)&(buff.howl_of_the_pack_leader_cooldown.remains>4|cooldown.kill_command.charges_fractional>1.8)
actions.st+=/cobra_shot,if=buff.cobra_fang.at_max_stacks
actions.st+=/barbed_shot,if=(focus<75|full_recharge_time<gcd)&!talent.serpentine_strikes|talent.serpentine_strikes
actions.st+=/cobra_shot,if=cooldown.bestial_wrath.remains>gcd

actions.trinkets=use_item,name=voracious_heart_of_ulatek,if=cooldown.bestial_wrath.remains<6
actions.trinkets+=/use_items,check_existing=0,slots=trinket1:trinket2,if=this_trinket.has_use_buff&(cooldown.bestial_wrath.ready|cooldown.bestial_wrath.remains<this_trinket.proc.any_dps.duration-15)|fight_remains<21
actions.trinkets+=/use_items,check_existing=0,slots=trinket1:trinket2,if=this_trinket.has_use_damage&(!potion.liquid_luster|!equipped.font_of_venomous_rage|((buff.liquid_luster.up&buff.liquid_luster.remains<6)|(fight_remains<cooldown.potion.remains&!buff.liquid_luster.up)))|fight_remains<10
