-
Notifications
You must be signed in to change notification settings - Fork 761
Expand file tree
/
Copy pathsc_warlock_pets.cpp
More file actions
2762 lines (2147 loc) · 76.7 KB
/
sc_warlock_pets.cpp
File metadata and controls
2762 lines (2147 loc) · 76.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "simulationcraft.hpp"
#include "sc_warlock_pets.hpp"
#include "sc_warlock.hpp"
namespace warlock
{
warlock_pet_t::warlock_pet_t( warlock_t* owner, util::string_view pet_name, pet_e pt, bool guardian )
: pet_t( owner->sim, owner, pet_name, pt, guardian ),
affected_by(),
triggers(),
special_action( nullptr ),
melee_attack( nullptr ),
summon_stats( nullptr ),
buffs()
{
owner_coeff.ap_from_sp = 0.5;
owner_coeff.sp_from_sp = 1.0;
owner_coeff.health = 0.5;
affected_by.demonic_brutality = owner->talents.demonic_brutality.ok();
triggers.hellbent_commander = owner->talents.hellbent_commander.ok();
register_on_arise_callback( this, [ owner ]() { owner->n_active_pets++; } );
register_on_demise_callback( this, [ owner ]( const player_t* ) { owner->n_active_pets--; } );
}
warlock_t* warlock_pet_t::o()
{ return static_cast<warlock_t*>( owner ); }
const warlock_t* warlock_pet_t::o() const
{ return static_cast<warlock_t*>( owner ); }
void warlock_pet_t::create_buffs()
{
pet_t::create_buffs();
// Demonology
buffs.imp_gang_boss = make_buff( this, "imp_gang_boss", o()->talents.imp_gang_boss_buff )
->set_default_value_from_effect( 2 );
buffs.unstable_soul = make_buff( this, "unstable_soul", o()->talents.unstable_soul_buff )
->set_default_value_from_effect( 1 );
buffs.ferocity_of_fharg = make_buff( this, "ferocity_of_fharg", o()->talents.ferocity_of_fharg_buff );
buffs.demonic_power = make_buff( this, "demonic_power", o()->talents.demonic_power_buff )
->set_default_value_from_effect( 1 );
buffs.grimoire_of_service = make_buff( this, "grimoire_of_service", o()->talents.grimoire_of_service_buff )
->set_default_value_from_effect( 1 );
// Destruction
buffs.embers = make_buff( this, "embers", o()->talents.embers )
->set_tick_callback( [ this ]( buff_t*, int, timespan_t ) {
o()->resource_gain( RESOURCE_SOUL_SHARD, o()->talents.burning_ember->effectN( 1 ).base_value() / 10.0, o()->gains.infernal );
} );
// All Specs
// To avoid clogging the buff reports, we silence the pet movement statistics since Implosion uses them regularly
// and there are a LOT of Wild Imps. We can instead lump them into a single tracking buff on the owner.
player_t::buffs.movement->quiet = true;
assert( player_t::buffs.movement->stack_change_callback.empty() );
player_t::buffs.movement->set_stack_change_callback( [ this ]( buff_t*, int prev, int cur )
{
if ( cur > prev )
o()->buffs.pet_movement->trigger();
else if ( cur < prev )
o()->buffs.pet_movement->decrement();
} );
// These buffs are needed for operational purposes but serve little to no reporting purpose
buffs.imp_gang_boss->quiet = true;
buffs.unstable_soul->quiet = true;
buffs.ferocity_of_fharg->quiet = true;
buffs.grimoire_of_service->quiet = true;
buffs.embers->quiet = true;
}
void warlock_pet_t::init_base_stats()
{
pet_t::init_base_stats();
resources.base[ RESOURCE_ENERGY ] = 200;
resources.base_regen_per_second[ RESOURCE_ENERGY ] = 10;
base.spell_power_per_intellect = 1.0;
intellect_per_owner = 0;
stamina_per_owner = 0;
main_hand_weapon.type = WEAPON_BEAST;
main_hand_weapon.swing_time = 2_s;
}
void warlock_pet_t::init_action_list()
{
if ( special_action )
{
if ( type == PLAYER_PET )
special_action->background = true;
else
special_action->action_list = get_action_priority_list( "default" );
}
pet_t::init_action_list();
if ( summon_stats )
for ( size_t i = 0; i < action_list.size(); ++i )
summon_stats->add_child( action_list[ i ]->stats );
}
void warlock_pet_t::schedule_ready( timespan_t delta_time, bool waiting )
{
dot_t* d;
if ( melee_attack && !melee_attack->execute_event &&
( melee_on_summon || !debug_cast<pets::warlock_pet_melee_t*>( melee_attack )->first ) &&
!( special_action && ( d = special_action->get_dot() ) && d->is_ticking() ) )
{
melee_attack->schedule_execute();
}
pet_t::schedule_ready( delta_time, waiting );
}
// Stuff that are updated at the heartbeat update interval
void warlock_pet_t::heartbeat_update_event()
{
};
/*
Felguard had a Haste scaling energy bug that was supposedly fixed once already. Real fix apparently went live
2019-03-12. Preserving code from resource regen override for now in case of future issues. if ( !o()->dbc.ptr && ( pet_type == PET_FELGUARD ||
pet_type == PET_SERVICE_FELGUARD ) ) reg /= cache.spell_haste();
*/
double warlock_pet_t::composite_melee_haste() const
{
double m = pet_t::composite_melee_haste();
if ( buffs.ferocity_of_fharg->check() )
m *= 1.0 + buffs.ferocity_of_fharg->data().effectN( 1 ).percent();
return m;
}
double warlock_pet_t::composite_melee_auto_attack_speed() const
{
double m = pet_t::composite_melee_auto_attack_speed();
if ( buffs.ferocity_of_fharg->check() )
m /= 1.0 + buffs.ferocity_of_fharg->data().effectN( 1 ).percent();
return m;
}
double warlock_pet_t::composite_melee_crit_chance() const
{
double m = pet_t::composite_melee_crit_chance();
if ( is_main_pet )
m *= 1.0 + o()->talents.improved_demonic_tactics->effectN( 1 ).percent();
return m;
}
double warlock_pet_t::composite_spell_crit_chance() const
{
double m = pet_t::composite_spell_crit_chance();
if ( is_main_pet )
m *= 1.0 + o()->talents.improved_demonic_tactics->effectN( 1 ).percent();
return m;
}
double warlock_pet_t::composite_player_critical_damage_multiplier( const action_state_t* s, school_e school ) const
{
double m = pet_t::composite_player_critical_damage_multiplier( s, school );
if ( affected_by.demonic_brutality )
{
// Currently bugged and giving 260% crit damage instead of 230%. Preserving the
// option to use the intended value for now in case of future issues.
if ( !o()->bugs )
m += o()->talents.demonic_brutality->effectN( 2 ).percent() * 0.5;
else
m += o()->talents.demonic_brutality->effectN( 2 ).percent();
}
return m;
}
void warlock_pet_t::arise()
{
if ( melee_attack && melee_on_summon )
melee_attack->reset();
pet_t::arise();
if ( triggers.hellbent_commander )
{
o()->buffs.hellbent_commander->trigger();
assert( ( bugs || o()->buffs.hellbent_commander->check() == o()->active_demon_count( !bugs ) ) && "Incorrent Demon Count for Hellbent Commander" );
}
}
void warlock_pet_t::demise()
{
if ( !current.sleeping )
{
if ( triggers.hellbent_commander )
{
o()->buffs.hellbent_commander->decrement();
}
}
pet_t::demise();
if ( melee_attack )
melee_attack->reset();
assert( ( bugs || !o()->talents.hellbent_commander.ok() || o()->buffs.hellbent_commander->check() == o()->active_demon_count( !bugs ) ) && "Incorrent Demon Count for Hellbent Commander" );
}
// TODO: Add all pet spells to base warlock data
warlock_pet_td_t::warlock_pet_td_t( player_t* target, warlock_pet_t& p ) :
actor_target_data_t( target, &p ), pet( p )
{
debuffs.whiplash = make_buff( *this, "whiplash", pet.o()->find_spell( 6360 ) )
->set_default_value( pet.o()->find_spell( 6360 )->effectN( 2 ).percent() )
->set_max_stack( pet.o()->find_spell( 6360 )->max_stacks() - 1 ); // Data erroneously has 11 as the maximum stack
}
namespace pets
{
warlock_simple_pet_t::warlock_simple_pet_t( warlock_t* owner, util::string_view pet_name, pet_e pt )
: warlock_pet_t( owner, pet_name, pt, true ), special_ability( nullptr )
{ resource_regeneration = regen_type::DISABLED; }
timespan_t warlock_simple_pet_t::available() const
{
if ( !special_ability || !special_ability->cooldown )
return warlock_pet_t::available();
timespan_t cd_remains = special_ability->cooldown->ready - sim->current_time();
if ( cd_remains <= 1_ms )
return warlock_pet_t::available();
return cd_remains;
}
namespace base
{
/// Felhunter Begin
felhunter_pet_t::felhunter_pet_t( warlock_t* owner, util::string_view name )
: warlock_pet_t( owner, name, PET_FELHUNTER, false )
{
npc_id = owner->find_spell( 691 )->effectN( 1 ).misc_value1();
action_list_str = "travel/shadow_bite";
is_main_pet = true;
}
struct spell_lock_t : public warlock_pet_spell_t
{
spell_lock_t( warlock_pet_t* p, util::string_view options_str )
: warlock_pet_spell_t( "Spell Lock", p, p->find_spell( 19647 ) )
{
parse_options( options_str );
may_miss = may_block = may_dodge = may_parry = false;
ignore_false_positive = is_interrupt = true;
}
};
void felhunter_pet_t::init_base_stats()
{
warlock_pet_t::init_base_stats();
owner_coeff.ap_from_sp = 0.575;
owner_coeff.sp_from_sp = 1.15;
melee_attack = new warlock_pet_melee_t( this );
special_action = new spell_lock_t( this, "" );
}
action_t* felhunter_pet_t::create_action( util::string_view name, util::string_view options_str )
{
if ( name == "shadow_bite" )
return new warlock_pet_melee_attack_t( this, "Shadow Bite" );
if ( name == "spell_lock" )
return new spell_lock_t( this, options_str );
return warlock_pet_t::create_action( name, options_str );
}
/// Felhunter End
/// Imp Begin
imp_pet_t::imp_pet_t( warlock_t* owner, util::string_view name )
: warlock_pet_t( owner, name, PET_IMP, false ), firebolt_cost( find_spell( 3110 )->cost( POWER_ENERGY ) )
{
npc_id = owner->find_spell( 688 )->effectN( 1 ).misc_value1();
action_list_str = "firebolt";
owner_coeff.ap_from_sp = 0.625;
owner_coeff.sp_from_sp = 1.25;
owner_coeff.health = 0.45;
is_main_pet = true;
}
action_t* imp_pet_t::create_action( util::string_view name, util::string_view options_str )
{
if ( name == "firebolt" )
return new warlock_pet_spell_t( "Firebolt", this, this->find_spell( 3110 ) );
return warlock_pet_t::create_action( name, options_str );
}
timespan_t imp_pet_t::available() const
{
double deficit = resources.current[ RESOURCE_ENERGY ] - firebolt_cost;
if ( deficit >= 0 )
return warlock_pet_t::available();
double time_to_threshold = std::fabs( deficit ) / resource_regen_per_second( RESOURCE_ENERGY );
// Fuzz regen by making the pet wait a bit extra if it's just below the resource threshold
if ( time_to_threshold < 0.001 )
return warlock_pet_t::available();
return timespan_t::from_seconds( time_to_threshold );
}
/// Imp End
/// Sayaad Begin
sayaad_pet_t::sayaad_pet_t( warlock_t* owner, util::string_view name )
: warlock_pet_t( owner, name, PET_SAYAAD, false )
{
npc_id = owner->find_spell( 366222 )->effectN( 1 ).misc_value1();
action_list_str = "travel/whiplash/lash_of_pain";
is_main_pet = true;
}
void sayaad_pet_t::init_base_stats()
{
warlock_pet_t::init_base_stats();
owner_coeff.ap_from_sp = 0.575;
owner_coeff.sp_from_sp = 1.15;
main_hand_weapon.swing_time = 3_s;
melee_attack = new warlock_pet_melee_t( this );
}
struct whiplash_t : public warlock_pet_spell_t
{
whiplash_t( warlock_pet_t* p ) : warlock_pet_spell_t( p, "Whiplash" )
{ }
void impact( action_state_t* s ) override
{
warlock_pet_spell_t::impact( s );
pet_td( s->target )->debuffs.whiplash->trigger();
}
};
double sayaad_pet_t::composite_player_target_multiplier( player_t* target, school_e school ) const
{
double m = warlock_pet_t::composite_player_target_multiplier( target, school );
m *= 1.0 + get_target_data( target )->debuffs.whiplash->check_stack_value();
return m;
}
action_t* sayaad_pet_t::create_action( util::string_view name, util::string_view options_str )
{
if ( name == "lash_of_pain" )
return new warlock_pet_spell_t( this, "Lash of Pain" );
if ( name == "whiplash" )
return new whiplash_t( this );
return warlock_pet_t::create_action( name, options_str );
}
/// Sayaad End
/// Voidwalker Begin
voidwalker_pet_t::voidwalker_pet_t( warlock_t* owner, util::string_view name )
: warlock_pet_t( owner, name, PET_VOIDWALKER, false )
{
npc_id = owner->find_spell( 697 )->effectN( 1 ).misc_value1();
action_list_str = "travel/consuming_shadows";
is_main_pet = true;
}
struct consuming_shadows_t : public warlock_pet_spell_t
{
consuming_shadows_t( warlock_pet_t* p )
: warlock_pet_spell_t( p, "Consuming Shadows" )
{
aoe = -1;
may_crit = false;
}
};
void voidwalker_pet_t::init_base_stats()
{
warlock_pet_t::init_base_stats();
owner_coeff.ap_from_sp = 0.575;
owner_coeff.sp_from_sp = 1.15;
owner_coeff.health = 0.7;
melee_attack = new warlock_pet_melee_t( this );
}
action_t* voidwalker_pet_t::create_action( util::string_view name, util::string_view options_str )
{
if ( name == "consuming_shadows" )
return new consuming_shadows_t( this );
return warlock_pet_t::create_action( name, options_str );
}
/// Voidwalker End
} // namespace base
namespace demonology
{
/// Felguard Begin
felguard_pet_t::felguard_pet_t( warlock_t* owner, util::string_view name )
: warlock_pet_t( owner, name, PET_FELGUARD, false ),
min_energy_threshold( find_spell( 89751 )->cost( POWER_ENERGY ) ),
max_energy_threshold( 100 )
{
npc_id = owner->talents.summon_felguard->effectN( 1 ).misc_value1();
action_list_str = "travel";
if ( !owner->disable_auto_felstorm )
action_list_str += "/felstorm";
action_list_str += "/legion_strike,if=energy>=" + util::to_string( max_energy_threshold );
felstorm_cd = get_cooldown( "felstorm" );
is_main_pet = true;
}
struct felguard_melee_t : public warlock_pet_melee_t
{
felguard_melee_t( warlock_pet_t* p, double wm, const char* name = "melee" ) :
warlock_pet_melee_t ( p, wm, name )
{ }
};
struct axe_toss_t : public warlock_pet_spell_t
{
axe_toss_t( warlock_pet_t* p, util::string_view options_str )
: warlock_pet_spell_t( "Axe Toss", p, p->find_spell( 89766 ) )
{
parse_options( options_str );
may_miss = may_block = may_dodge = may_parry = false;
ignore_false_positive = is_interrupt = true;
usable_while_casting = true;
}
};
struct legion_strike_t : public warlock_pet_melee_attack_t
{
legion_strike_t( warlock_pet_t* p, util::string_view options_str )
: warlock_pet_melee_attack_t( p, "Legion Strike" )
{
parse_options( options_str );
aoe = -1;
weapon = &( p->main_hand_weapon );
}
};
struct felstorm_t : public warlock_pet_melee_attack_t
{
struct felstorm_tick_t : public warlock_pet_melee_attack_t
{
felstorm_tick_t( warlock_pet_t* p, const spell_data_t *s )
: warlock_pet_melee_attack_t( "Felstorm (tick)", p, s )
{
aoe = -1;
reduced_aoe_targets = data().effectN( 3 ).base_value();
background = true;
weapon = &( p->main_hand_weapon );
}
};
felstorm_t( warlock_pet_t* p, util::string_view options_str, const std::string n = "Felstorm" )
: warlock_pet_melee_attack_t( n, p, p->find_spell( 89751 ) )
{
parse_options( options_str );
tick_zero = true;
hasted_ticks = true;
may_miss = false;
may_crit = false;
channeled = true;
dynamic_tick_action = true;
tick_action = new felstorm_tick_t( p, p->find_spell( 89753 ) );
}
// NOTE: Although Felstorm is a "melee" attack, its duration/ticks depend on the pet's 'spell_cast_speed'
double composite_haste() const override
{ return action_t::composite_haste() * player->cache.spell_cast_speed(); }
timespan_t composite_dot_duration( const action_state_t* s ) const override
{ return s->action->tick_time( s ) * data().duration().total_seconds(); }
void execute() override
{
warlock_pet_melee_attack_t::execute();
p()->melee_attack->cancel();
}
};
timespan_t felguard_pet_t::available() const
{
double energy_threshold = max_energy_threshold;
double time_to_felstorm = ( felstorm_cd->ready - sim->current_time() ).total_seconds();
double time_to_threshold = 0;
double time_to_next_event = 0;
if ( time_to_felstorm <= 0 )
energy_threshold = min_energy_threshold;
double deficit = resources.current[ RESOURCE_ENERGY ] - energy_threshold;
// Not enough energy, figure out how many milliseconds it'll take to get
if ( deficit < 0 )
time_to_threshold = util::ceil( std::fabs( deficit ) / resource_regen_per_second( RESOURCE_ENERGY ), 3 );
// Fuzz regen by making the pet wait a bit extra if it's just below the resource threshold
if ( time_to_threshold < 0.001 )
return warlock_pet_t::available();
// Next event is either going to be the time to felstorm, or the time to gain enough energy for a
// threshold value
if ( time_to_felstorm <= 0 )
time_to_next_event = time_to_threshold;
else
time_to_next_event = std::min( time_to_felstorm, time_to_threshold );
if ( sim->debug )
{
sim->out_debug.print( "{} waiting, deficit={}, threshold={}, t_threshold={}, t_felstorm={} t_wait={}", name(),
deficit, energy_threshold, time_to_threshold, time_to_felstorm, time_to_next_event );
}
if ( time_to_next_event < 0.001 )
return warlock_pet_t::available();
else
return timespan_t::from_seconds( time_to_next_event );
}
void felguard_pet_t::init_base_stats()
{
warlock_pet_t::init_base_stats();
// Felguard is the only warlock pet type to use an actual weapon.
main_hand_weapon.type = WEAPON_AXE_2H;
melee_attack = new felguard_melee_t( this, 1.0, "melee" );
// 2026-02-17: Validated coefficients
owner_coeff.ap_from_sp = 1.5201;
owner_coeff.sp_from_sp = 1.4519; // not validated
owner_coeff.health = 0.75;
melee_attack->base_dd_multiplier *= 1.44;
special_action = new axe_toss_t( this, "" );
}
action_t* felguard_pet_t::create_action( util::string_view name, util::string_view options_str )
{
if ( name == "legion_strike" )
return new legion_strike_t( this, options_str );
if ( name == "felstorm" )
return new felstorm_t( this, options_str );
if ( name == "axe_toss" )
return new axe_toss_t( this, options_str );
return warlock_pet_t::create_action( name, options_str );
}
/// Felguard End
/// Wild Imp Begin
wild_imp_pet_t::wild_imp_pet_t( warlock_t* owner )
: warlock_pet_t( owner, "wild_imp", PET_WILD_IMP, true ), firebolt( nullptr ), is_hog_imp( true ), power_siphon( false ), imploded( false )
{
npc_id = owner->warlock_base.wild_imp->effectN( 1 ).misc_value1();
// Manually handle the Wild Imps contribution to Hellbent Commander to replicate its bugged behavior
triggers.hellbent_commander &= !bugs;
resource_regeneration = regen_type::DISABLED;
owner_coeff.health = 0.15;
}
struct fel_firebolt_t : public warlock_pet_spell_t
{
fel_firebolt_t* twin = nullptr;
const bool is_twin;
fel_firebolt_t( warlock_pet_t* p, bool _is_twin = false )
: warlock_pet_spell_t( "fel_firebolt", p, p->find_spell( 104318 ) ),
is_twin( _is_twin )
{
aoe = 0;
if ( !is_twin )
{
repeating = true;
if ( p->o()->talents.infernal_rapidity.ok() )
twin = new fel_firebolt_t( p, true );
}
else
{
background = dual = proc = true;
base_costs[ RESOURCE_ENERGY ] = 0;
base_dd_multiplier *= p->o()->talents.infernal_rapidity->effectN( 2 ).percent();
}
}
void schedule_execute( action_state_t* execute_state ) override
{
// We may not be able to execute anything, so reset executing here before we are going to
// schedule anything else.
if ( !is_twin )
{
player->executing = nullptr;
if ( player->buffs.movement->check() || player->buffs.stunned->check() )
return;
}
warlock_pet_spell_t::schedule_execute( execute_state );
}
int n_targets() const override
{
if ( p()->buffs.unstable_soul->check() )
{
assert( warlock_pet_spell_t::n_targets() == 0 );
return as<int>( p()->o()->talents.unstable_soul_buff->effectN( 2 ).base_value() ) + 1;
}
else
{
return warlock_pet_spell_t::n_targets();
}
}
void execute() override
{
warlock_pet_spell_t::execute();
if ( ( twin != nullptr ) && p()->o()->flat_rng.infernal_rapidity->trigger() )
{
p()->o()->procs.infernal_rapidity->occur();
twin->execute_on_target( target );
}
}
void consume_resource() override
{
warlock_pet_spell_t::consume_resource();
// Imp dies if it cannot cast
if ( player->resources.current[ RESOURCE_ENERGY ] < cost() )
make_event( sim, 0_ms, [ this ]() { player->cast_pet()->dismiss(); } );
}
};
void wild_imp_pet_t::create_actions()
{
warlock_pet_t::create_actions();
firebolt = new fel_firebolt_t( this );
}
void wild_imp_pet_t::init_base_stats()
{
warlock_pet_t::init_base_stats();
resources.base[ RESOURCE_ENERGY ] = 100;
resources.base_regen_per_second[ RESOURCE_ENERGY ] = 0;
}
void wild_imp_pet_t::reschedule_firebolt()
{
if ( executing || is_sleeping() || player_t::buffs.movement->check() || player_t::buffs.stunned->check() )
return;
timespan_t gcd_adjust = gcd_ready - sim->current_time();
if ( gcd_adjust > 0_ms )
{
make_event( sim, gcd_adjust, [ this ]() {
firebolt->set_target( o()->target );
firebolt->schedule_execute();
} );
}
else
{
firebolt->set_target( o()->target );
firebolt->schedule_execute();
}
}
void wild_imp_pet_t::schedule_ready( timespan_t /* delta_time */, bool /* waiting */ )
{ reschedule_firebolt(); }
void wild_imp_pet_t::finish_moving()
{
warlock_pet_t::finish_moving();
reschedule_firebolt();
}
void wild_imp_pet_t::arise()
{
warlock_pet_t::arise();
is_hog_imp = ( duration == o()->warlock_base.wild_imp->duration() ); // TODO: Only valid because duration diff, look for a safer way
power_siphon = false;
imploded = false;
o()->buffs.wild_imps->trigger();
if ( o()->talents.summon_demonic_tyrant.ok() )
{
for ( auto t : o()->warlock_pet_list.demonic_tyrants )
{
if ( t->is_active() )
t->buffs.demonic_power->trigger();
}
}
// Manual handling of Hellbent Commander buff for Wild Imps
if ( bugs && o()->talents.hellbent_commander.ok() )
o()->buffs.hellbent_commander->trigger();
// Start casting fel firebolts
firebolt->set_target( o()->target );
firebolt->schedule_execute();
}
void wild_imp_pet_t::demise()
{
if ( !current.sleeping )
{
o()->buffs.wild_imps->decrement();
buffs.imp_gang_boss->expire();
buffs.unstable_soul->expire();
if ( o()->talents.summon_demonic_tyrant.ok() )
{
for ( auto t : o()->warlock_pet_list.demonic_tyrants )
{
if ( t->is_active() )
t->buffs.demonic_power->decrement();
}
}
if ( !power_siphon )
{
// NOTE: 2026-03-06 It has been tested that Demoniac (Wild Imps) follows a Flat % chance model for each imp
double core_chance = o()->talents.demonic_core_spell->effectN( 1 ).percent();
if ( imploded )
{
core_chance += o()->hero.sataiels_volition->effectN( 3 ).percent();
}
else
{
// NOTE: 2026-03-06 If a Wild Imp demise normally (by not being imploded), its actual Demoniac chance to generate a
// demonic core is about 5x lower than indicated in the spell data (in our tests it is about ~2% instead of 10%).
if ( o()->bugs )
core_chance *= 0.2;
}
if ( !o()->talents.demoniac.ok() )
core_chance = 0.0;
bool success = o()->buffs.demonic_core->trigger( 1, buff_t::DEFAULT_VALUE(), core_chance );
if ( success )
o()->procs.demonic_core_imps->occur();
}
// Manual handling of Hellbent Commander buff for Wild Imps
// NOTE (2026-03-08): Wild Imps are currently bugged when updating Hellbent Commander stacks on demise:
// If imploded, imps summoned via HoG decrease one stack each, while those summoned via Inner Demons,
// Spiteful Reconstitution, or To Hell and Back do not decrease any stacks.
// If the imps demise normally or are sacrificed with Power Siphon, HoG imps decrease two stacks each,
// while all other imps decrease one stack each.
// Hellbent Commander's stacks are updated to their correct value on each heartbeat update.
if ( bugs && o()->talents.hellbent_commander.ok() )
{
if ( imploded )
{
if ( is_hog_imp )
o()->buffs.hellbent_commander->decrement();
}
else
{
if ( is_hog_imp )
o()->buffs.hellbent_commander->decrement( 2 );
else
o()->buffs.hellbent_commander->decrement();
}
}
if ( expiration )
event_t::cancel( expiration );
}
warlock_pet_t::demise();
}
double wild_imp_pet_t::composite_player_multiplier( school_e school ) const
{
double m = warlock_pet_t::composite_player_multiplier( school );
m *= 1.0 + buffs.imp_gang_boss->check_value();
m *= 1.0 + buffs.unstable_soul->check_value();
return m;
}
/// Wild Imp End
/// Dreadstalker Begin
dreadstalker_t::dreadstalker_t( warlock_t* owner ) : warlock_pet_t( owner, "dreadstalker", PET_DREADSTALKER, true )
{
npc_id = owner->talents.call_dreadstalkers_2->effectN( 1 ).misc_value1();
action_list_str = "leap/travel/dreadbite";
resource_regeneration = regen_type::DISABLED;
// 2026-02-17: Validated coefficient
owner_coeff.ap_from_sp = 0.825;
owner_coeff.health = 0.4;
melee_on_summon = false;
server_action_delay = 0_ms; // Will be set when spawning Dreadstalkers to ensure pets are synced on delay
}
dreadstalker_t::dreadstalker_t( warlock_t* owner, util::string_view pet_name, pet_e pet_type )
: warlock_pet_t( owner, pet_name, pet_type, true )
{
npc_id = owner->talents.call_dreadstalkers_2->effectN( 1 ).misc_value1();
action_list_str = "leap/travel/dreadbite";
resource_regeneration = regen_type::DISABLED;
// 2026-02-17: Validated coefficient
owner_coeff.ap_from_sp = 0.825;
owner_coeff.health = 0.4;
}
struct dreadbite_t : public warlock_pet_melee_attack_t
{
dreadbite_t( warlock_pet_t* p ) : warlock_pet_melee_attack_t( "Dreadbite", p, p->find_spell( 271971 ) )
{
weapon = &( p->main_hand_weapon );
if ( p->o()->talents.dreadlash.ok() )
{
aoe = -1;
reduced_aoe_targets = 5; // TOCHECK regularly: 2025-08-27
radius = 8.0;
base_dd_multiplier *= 1.0 + p->o()->talents.dreadlash->effectN( 1 ).percent();
}
}
bool ready() override
{
if ( debug_cast< dreadstalker_t* >( p() )->dreadbite_executes <= 0 )
return false;
return warlock_pet_melee_attack_t::ready();
}
void execute() override
{
warlock_pet_melee_attack_t::execute();
debug_cast< dreadstalker_t* >( p() )->dreadbite_executes--;
}
void impact( action_state_t* s ) override
{
warlock_pet_melee_attack_t::impact( s );
if ( p()->o()->talents.blighted_maw.ok() && result_is_hit( s->result ) )
{
auto amount = s->result_amount;
amount *= p()->o()->talents.blighted_maw->effectN( 1 ).percent();
p()->o()->proc_actions.blighted_maw->execute_on_target( s->target, amount );
}
}
};
// Carnivorous Stalkers talent handling requires special version of melee attack
struct dreadstalker_melee_t : warlock_pet_melee_t
{
dreadstalker_melee_t( warlock_pet_t* p, double wm, const char* name = "melee" ) :
warlock_pet_melee_t ( p, wm, name )
{ }
void execute() override
{
warlock_pet_melee_t::execute();
if ( p()->o()->talents.carnivorous_stalkers.ok() && p()->o()->flat_rng.carnivorous_stalkers->trigger() )
{
debug_cast<dreadstalker_t*>( p() )->dreadbite_executes++;
p()->o()->procs.carnivorous_stalkers->occur();
if ( p()->readying )
{
event_t::cancel( p()->readying );
p()->schedule_ready();
}
}
}
};
void dreadstalker_t::queue_dreadbite()
{
dreadbite_executes++;
if ( !readying && !channeling && !executing )
schedule_ready();
if ( readying )
{
event_t::cancel( readying );
schedule_ready();
}
}
struct dreadstalker_leap_t : warlock_pet_t::travel_t
{
dreadstalker_leap_t( dreadstalker_t* p ) : warlock_pet_t::travel_t( p, "leap" )
{
speed = 33.17; // This speed value will be updated in the 'schedule_execute', since leap speed have some variation with distance
}
void schedule_execute( action_state_t* s ) override
{
debug_cast<warlock_pet_t*>( player )->melee_attack->cancel();
// The dreadstalkers' travel speed is not constant, since it has a certain acceleration
// The average speed for various distances is extracted from the ingame behavior and the rest is interpolated, thus obtaining a lookup table
// 2025-04-06: lookup_table for speeds in [5-40]yd TO 1yd range (there should be no distance values outside this range, but we will handle them just in case)
const size_t distance_st = static_cast<size_t>( player->current.distance + 0.5 );
const std::array<double, 36> lookup_table_speed = {