/
sc_unique_gear_x7.cpp
3633 lines (2987 loc) · 116 KB
/
sc_unique_gear_x7.cpp
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
// ==========================================================================
// Dedmonwakeen's Raid DPS/TPS Simulator.
// Send questions to natehieter@gmail.com
// ==========================================================================
#include "simulationcraft.hpp"
using namespace unique_gear;
/**
* Forward declarations so we can reorganize the file a bit more sanely.
*/
namespace consumable
{
void potion_of_the_old_war( special_effect_t& );
void potion_of_deadly_grace( special_effect_t& );
void hearty_feast( special_effect_t& );
void lavish_suramar_feast( special_effect_t& );
void pepper_breath( special_effect_t& );
}
namespace enchants
{
void mark_of_the_hidden_satyr( special_effect_t& );
void mark_of_the_distant_army( special_effect_t& );
void mark_of_the_ancient_priestess( special_effect_t& ); // NYI
}
namespace item
{
// 7.0 Dungeon
void chaos_talisman( special_effect_t& );
void corrupted_starlight( special_effect_t& );
void elementium_bomb_squirrel( special_effect_t& );
void faulty_countermeasures( special_effect_t& );
void figurehead_of_the_naglfar( special_effect_t& );
void giant_ornamental_pearl( special_effect_t& );
void horn_of_valor( special_effect_t& );
void impact_tremor( special_effect_t& );
void memento_of_angerboda( special_effect_t& );
void moonlit_prism( special_effect_t& );
void obelisk_of_the_void( special_effect_t& );
void portable_manacracker( special_effect_t& );
void shivermaws_jawbone( special_effect_t& );
void spiked_counterweight( special_effect_t& );
void stabilized_energy_pendant( special_effect_t& );
void stormsinger_fulmination_charge( special_effect_t& );
void terrorbound_nexus( special_effect_t& );
void tiny_oozeling_in_a_jar( special_effect_t& );
void tirathons_betrayal( special_effect_t& );
void windscar_whetstone( special_effect_t& );
void jeweled_signet_of_melandrus( special_effect_t& );
void caged_horror( special_effect_t& );
void tempered_egg_of_serpentrix( special_effect_t& );
void gnawed_thumb_ring( special_effect_t& );
// 7.1 Dungeon
void arans_relaxing_ruby( special_effect_t& );
void ring_of_collapsing_futures( special_effect_t& );
void mrrgrias_favor( special_effect_t& );
void toe_knees_promise( special_effect_t& );
void deteriorated_construct_core( special_effect_t& );
void eye_of_command( special_effect_t& );
void bloodstained_hankerchief( special_effect_t& );
// 7.0 Misc
void darkmoon_deck( special_effect_t& );
void infernal_alchemist_stone( special_effect_t& ); // WIP
void sixfeather_fan( special_effect_t& );
void eyasus_mulligan( special_effect_t& );
void marfisis_giant_censer( special_effect_t& );
void devilsaurs_bite( special_effect_t& );
// 7.0 Raid
void bloodthirsty_instinct( special_effect_t& );
void natures_call( special_effect_t& );
void ravaged_seed_pod( special_effect_t& );
void spontaneous_appendages( special_effect_t& );
void twisting_wind( special_effect_t& );
void unstable_horrorslime( special_effect_t& );
void wriggling_sinew( special_effect_t& );
void bough_of_corruption( special_effect_t& );
void ursocs_rending_paw( special_effect_t& );
// 7.1.5 Raid
void draught_of_souls( special_effect_t& );
void convergence_of_fates( special_effect_t& );
void entwined_elemental_foci( special_effect_t& );
// Legendary
void aggramars_stride( special_effect_t& );
void kiljadens_burning_wish( special_effect_t& );
/* NYI ================================================================
Nighthold ---------------------------------
Everything
Healer trinkets / other rubbish -----------
cocoon_of_enforced_solitude
goblet_of_nightmarish_ichor
grotesque_statuette
horn_of_cenarius
phantasmal_echo
vial_of_nightmare_fog
heightened_senses
*/
}
namespace util
{
// Return the Karazhan Chest empowerment multiplier (as 1.0 + multiplier) for trinkets, or 1.0 if
// the chest is not found on the actor.
double composite_karazhan_empower_multiplier( const player_t* player )
{
auto it = range::find_if( player -> items, []( const item_t& item ) {
return item.name_str == "robes_of_the_ancient_chronicle" ||
item.name_str == "harness_of_smoldering_betrayal" ||
item.name_str == "hauberk_of_warped_intuition" ||
item.name_str == "chestplate_of_impenetrable_darkness";
} );
if ( it != player -> items.end() )
{
return 1.0 + player -> find_spell( 231626 ) -> effectN( 1 ).percent();
}
return 1.0;
}
}
namespace set_bonus
{
// 7.0 Dungeon
void march_of_the_legion( special_effect_t& ); // NYI
void journey_through_time( special_effect_t& ); // NYI
// Generic passive stat aura adder for set bonuses
void passive_stat_aura( special_effect_t& );
// Simple callback creator for set bonuses
void simple_callback( special_effect_t& );
}
// TODO: Ratings
void set_bonus::passive_stat_aura( special_effect_t& effect )
{
const spell_data_t* spell = effect.player -> find_spell( effect.spell_id );
stat_e stat = STAT_NONE;
// Sanity check for stat-giving aura, either stats or aura type 465 ("bonus armor")
if ( spell -> effectN( 1 ).subtype() != A_MOD_STAT || spell -> effectN( 1 ).subtype() == A_465 )
{
effect.type = SPECIAL_EFFECT_NONE;
return;
}
if ( spell -> effectN( 1 ).subtype() == A_MOD_STAT )
{
if ( spell -> effectN( 1 ).misc_value1() >= 0 )
{
stat = static_cast< stat_e >( spell -> effectN( 1 ).misc_value1() + 1 );
}
else if ( spell -> effectN( 1 ).misc_value1() == -1 )
{
stat = STAT_ALL;
}
}
else
{
stat = STAT_BONUS_ARMOR;
}
double amount = util::round( spell -> effectN( 1 ).average( effect.player, std::min( MAX_LEVEL, effect.player -> level() ) ) );
effect.player -> passive.add_stat( stat, amount );
}
void set_bonus::simple_callback( special_effect_t& effect )
{ new dbc_proc_callback_t( effect.player, effect ); }
// Mark of the Distant Army =================================================
struct mark_of_the_distant_army_t : public proc_spell_t
{
mark_of_the_distant_army_t( player_t* p ) :
proc_spell_t( "mark_of_the_distant_army",
p, p -> find_spell( 191380 ), nullptr )
{
may_crit = tick_may_crit = false;
}
// Hack to force defender to mitigate the damage with armor.
void assess_damage( dmg_e, action_state_t* s ) override
{ proc_spell_t::assess_damage( DMG_DIRECT, s ); }
};
void enchants::mark_of_the_distant_army( special_effect_t& effect )
{
effect.execute_action = effect.player -> find_action( "mark_of_the_distant_army" );
if ( ! effect.execute_action )
{
effect.execute_action = effect.player -> create_proc_action( "mark_of_the_distant_army", effect );
}
if ( ! effect.execute_action )
{
action_t* a = new mark_of_the_distant_army_t( effect.player );
effect.execute_action = a;
}
effect.proc_flags_ = PF_ALL_DAMAGE | PF_PERIODIC; // DBC says procs off heals. Let's not.
new dbc_proc_callback_t( effect.item, effect );
}
// Mark of the Hidden Satyr =================================================
void enchants::mark_of_the_hidden_satyr( special_effect_t& effect )
{
effect.execute_action = effect.player -> find_action( "mark_of_the_hidden_satyr" );
if ( ! effect.execute_action )
{
effect.execute_action = effect.player -> create_proc_action( "mark_of_the_hidden_satyr", effect );
}
if ( ! effect.execute_action )
{
action_t* a = new proc_spell_t( "mark_of_the_hidden_satyr",
effect.player, effect.player -> find_spell( 191259 ), nullptr );
effect.execute_action = a;
}
effect.proc_flags_ = PF_ALL_DAMAGE | PF_PERIODIC; // DBC says procs off heals. Let's not.
new dbc_proc_callback_t( effect.item, effect );
}
// Aran's Relaxing Ruby ============================================================
struct flame_wreath_t : public spell_t
{
flame_wreath_t( const special_effect_t& effect ) :
spell_t( "flame_wreath", effect.player, effect.player -> find_spell( 230257 ) )
{
background = may_crit = true;
callbacks = false;
item = effect.item;
school = SCHOOL_FIRE;
base_dd_min = base_dd_max = effect.driver() -> effectN( 1 ).average( effect.item );
for ( const auto& item : effect.player -> items )
{
if ( item.name_str == "robes_of_the_ancient_chronicle" ||
item.name_str == "harness_of_smoldering_betrayal" ||
item.name_str == "hauberk_of_warped_intuition" ||
item.name_str == "chestplate_of_impenetrable_darkness" )
//FIXME: Don't hardcode the 30% damage bonus
base_dd_min = base_dd_max = effect.driver() -> effectN( 1 ).average( effect.item ) * 1.3;
}
aoe = -1;
}
};
void item::arans_relaxing_ruby( special_effect_t& effect )
{
action_t* action = effect.player -> find_action( "flame_wreath" ) ;
if ( ! action )
{
action = effect.player -> create_proc_action( "flame_wreath", effect );
}
// Adjust frost base RPPM: https://www.altered-time.com/forum/viewtopic.php?f=2&t=3416
if ( effect.player -> specialization() == MAGE_FROST )
{
effect.ppm_ = -1.35;
}
if ( ! action )
{
action = new flame_wreath_t( effect );
}
effect.execute_action = action;
effect.proc_flags2_ = PF2_ALL_HIT;
new dbc_proc_callback_t( effect.player, effect );
}
void item::ring_of_collapsing_futures( special_effect_t& effect )
{
struct collapse_t: public proc_spell_t {
collapse_t( const special_effect_t& effect ):
proc_spell_t( "collapse", effect.player,
effect.player -> find_spell( effect.spell_id ),
effect.item )
{
base_dd_min = base_dd_max = effect.player ->find_spell( effect.spell_id ) -> effectN( 1 ).base_value(); // Does not scale with ilevel, apparently.
}
};
struct apply_debuff_t: public action_t
{
special_effect_t effect_;
cooldown_t* base_cd;
action_t* collapse;
apply_debuff_t( special_effect_t& effect ):
action_t( ACTION_OTHER, "apply_temptation", effect.player, spell_data_t::nil() ),
effect_( effect ), base_cd( effect.player -> get_cooldown( effect.cooldown_name() ) ),
collapse( nullptr )
{
background = quiet = true;
callbacks = false;
collapse = effect.player -> find_action( "collapse" );
cooldown = base_cd;
if ( !collapse ) {
collapse = effect.player -> create_proc_action( "collapse", effect );
}
if ( !collapse ) {
collapse = new collapse_t( effect );
}
}
// Suppress assertion
result_e calculate_result( action_state_t* ) const override
{ return RESULT_NONE; }
void execute() override
{
action_t::execute();
collapse -> target = target;
collapse -> schedule_execute();
if ( rng().roll( effect_.custom_buff -> stack_value() ) )
{
base_cd -> adjust( timespan_t::from_minutes( 5 ) ); // Ouch.
}
effect_.custom_buff -> trigger( 1 );
}
};
effect.custom_buff = effect.player -> buffs.temptation;
effect.execute_action = new apply_debuff_t( effect );
effect.buff_disabled = true; // Buff application is handled inside apply_debuff_t, and this will prevent use_item
// from putting the item on cooldown but not using the action.
}
// Giant Ornamental Pearl ===================================================
struct gaseous_bubble_t : public absorb_buff_t
{
action_t* explosion;
gaseous_bubble_t( special_effect_t& effect, action_t* a ) :
absorb_buff_t( absorb_buff_creator_t( effect.player, "gaseous_bubble", effect.driver(), effect.item ) ),
explosion( a )
{
// Set correct damage amount for explosion.
a -> base_dd_min = effect.driver() -> effectN( 2 ).min( effect.item );
a -> base_dd_max = effect.driver() -> effectN( 2 ).max( effect.item );
}
void expire_override( int stacks, timespan_t remaining ) override
{
absorb_buff_t::expire_override( stacks, remaining );
explosion -> schedule_execute();
}
};
void item::giant_ornamental_pearl( special_effect_t& effect )
{
effect.trigger_spell_id = 214972;
effect.custom_buff = new gaseous_bubble_t( effect, effect.create_action() );
// Reset trigger_spell_id so it does not create an execute action.
effect.trigger_spell_id = 0;
}
// Gnawed Thumb Ring =======================================================
void item::gnawed_thumb_ring( special_effect_t& effect )
{
effect.custom_buff = buff_creator_t( effect.player, "taste_of_mana", effect.player -> find_spell( 228461 ), effect.item )
.add_invalidate( CACHE_PLAYER_DAMAGE_MULTIPLIER )
.default_value( effect.player -> find_spell( 228461 ) -> effectN( 1 ).percent() );
effect.player -> buffs.taste_of_mana = effect.custom_buff;
}
// Deteriorated Construct Core ==============================================
struct volatile_energy_t : public spell_t
{
volatile_energy_t( const special_effect_t& effect ) :
spell_t( "volatile_energy", effect.player, effect.player -> find_spell( 230241 ) )
{
background = may_crit = true;
callbacks = false;
item = effect.item;
base_dd_min = base_dd_max = effect.driver() -> effectN( 1 ).average( effect.item ) *
util::composite_karazhan_empower_multiplier( effect.player );
aoe = -1;
}
};
void item::deteriorated_construct_core( special_effect_t& effect )
{
action_t* action = effect.player -> find_action( "volatile_energy" );
if ( ! action )
{
action = effect.player -> create_proc_action( "volatile_energy", effect );
}
if ( ! action )
{
action = new volatile_energy_t( effect );
}
effect.execute_action = action;
effect.proc_flags2_= PF2_ALL_HIT;
new dbc_proc_callback_t( effect.player, effect );
}
// Eye of Command ===========================================================
struct eye_of_command_cb_t : public dbc_proc_callback_t
{
player_t* current_target;
buff_t* buff;
eye_of_command_cb_t( const special_effect_t& effect, buff_t* b ) :
dbc_proc_callback_t( effect.item, effect ),
current_target( nullptr ), buff( b )
{ }
void execute( action_t* /* a */, action_state_t* state ) override
{
if ( current_target != state -> target )
{
if ( current_target != nullptr && listener -> sim -> debug )
{
listener -> sim -> out_debug.printf( "%s eye_of_command target reset, old=%s new=%s",
listener -> name(), current_target -> name(), state -> target -> name() );
}
buff -> expire();
current_target = state -> target;
}
buff -> trigger();
}
};
// TODO: Autoattacks don't really change targets currently in simc, so this code is for future
// reference.
// TODO: For PTR purposes is CR_MULTIPLIER_TRINKET correct, or should it be CR_MULTIPLIER_ARMOR?
void item::eye_of_command( special_effect_t& effect )
{
auto amount = effect.trigger() -> effectN( 1 ).average( effect.item ) *
effect.player -> dbc.combat_rating_multiplier( effect.item -> item_level(), CR_MULTIPLIER_TRINKET ) *
util::composite_karazhan_empower_multiplier( effect.player );
stat_buff_t* b = debug_cast<stat_buff_t*>( buff_t::find( effect.player, "legions_gaze" ) );
if ( ! b )
{
b = stat_buff_creator_t( effect.player, "legions_gaze", effect.trigger(), effect.item )
.add_stat( STAT_CRIT_RATING, amount );
}
effect.custom_buff = b;
new eye_of_command_cb_t( effect, b );
}
// Bloodstained Hankerchief =================================================
// Note, custom implementations are going to have to apply the empower multiplier independent of
// this function.
void item::bloodstained_hankerchief( special_effect_t& effect )
{
action_t* a = effect.player -> find_action( "cruel_garrote" );
if ( ! a )
{
a = effect.player -> create_proc_action( "cruel_garrote", effect );
}
if ( ! a )
{
a = effect.create_action();
a -> base_td *= util::composite_karazhan_empower_multiplier( effect.player );
}
effect.execute_action = a;
}
// Impact Tremor ============================================================
void item::impact_tremor( special_effect_t& effect )
{
// Use automagic action creation
effect.trigger_spell_id = effect.trigger() -> effectN( 1 ).trigger() -> id();
action_t* stampede = effect.create_action();
effect.trigger_spell_id = 0;
effect.custom_buff = buff_creator_t( effect.player, "devilsaurs_stampede", effect.driver() -> effectN( 1 ).trigger(), effect.item )
.tick_zero( true )
.tick_callback( [ stampede ]( buff_t*, int, const timespan_t& ) {
stampede -> schedule_execute();
} );
// Disable automatic creation of a trigger spell.
effect.action_disabled = true;
new dbc_proc_callback_t( effect.item, effect );
}
// Mrrgria's Favor ==========================================================
struct thunder_ritual_impact_t : public spell_t
{
//TODO: Are these multipliers multiplicative with one another or should they be added together then applied?
// Right now we assume they are independant multipliers.
// Note: Mrrgria's Favor and Toe Knee's Promise interact to buff eachother by 30% when the other is present.
// However, their cooldowns are not equal, so we cannot simply treat this as a 30% permanant modifier.
// Instead, if we are modeling having the trinkets paired, we give mrrgria's favor an ICD event that does
// not effect ready() state, but instead controls the application of the 30% multiplier.
bool pair_multiplied;
double chest_multiplier;
bool pair_buffed;
cooldown_t* pair_icd;
thunder_ritual_impact_t( const special_effect_t& effect ) :
spell_t( "thunder_ritual_damage", effect.player, effect.driver() -> effectN( 1 ).trigger() ),
pair_multiplied( false ),
chest_multiplier( util::composite_karazhan_empower_multiplier( effect.player ) ),
pair_buffed( false )
{
background = may_crit = true;
callbacks = false;
pair_icd = effect.player -> get_cooldown( "paired_trinket_icd" );
pair_icd -> duration = timespan_t::from_seconds( 60.0 );
if ( player -> karazhan_trinkets_paired )
{
pair_multiplied = true;
}
base_dd_min = base_dd_max = data().effectN( 1 ).average( effect.item ) * chest_multiplier;
}
virtual void execute() override
{
// Reset pair checking
pair_buffed = false;
if( pair_multiplied == true && pair_icd -> up() )
{
pair_buffed = true;
pair_icd -> start();
}
spell_t::execute();
}
double action_multiplier() const override
{
double am = spell_t::action_multiplier();
if ( pair_buffed )
{
am *= 1.3;
}
return am;
}
};
struct thunder_ritual_t : public debuff_t
{
action_t* damage_event;
thunder_ritual_t( const actor_pair_t& p, const special_effect_t& source_effect ) :
debuff_t( buff_creator_t( p, "thunder_ritual", source_effect.driver() -> effectN( 1 ).trigger(), source_effect.item )
.duration( timespan_t::from_seconds( 3.0 ) ) ),
damage_event( source -> find_action( "thunder_ritual_damage" ) )
{}
void expire_override( int expiration_stacks, timespan_t remaining_duration ) override
{
debuff_t::expire_override( expiration_stacks, remaining_duration );
damage_event -> target = player;
damage_event -> execute();
}
};
struct thunder_ritual_driver_t : public proc_spell_t
{
thunder_ritual_driver_t( special_effect_t& effect ) :
proc_spell_t( "thunder_ritual_driver", effect.player, effect.driver() -> effectN( 1 ).trigger(), effect.item )
{
harmful = false;
base_dd_min = base_dd_max = 0;
}
void impact( action_state_t* s ) override
{
proc_spell_t::impact( s );
if ( result_is_hit( s -> result ) )
{
player -> get_target_data( s -> target ) -> debuff.thunder_ritual -> trigger();
}
}
};
struct mrrgrias_favor_constructor_t : public item_targetdata_initializer_t
{
mrrgrias_favor_constructor_t( unsigned iid, const std::vector< slot_e >& s ) :
item_targetdata_initializer_t( iid, s )
{ }
void operator()( actor_target_data_t* td ) const override
{
const special_effect_t* effect = find_effect( td -> source );
if( effect == 0 )
{
td -> debuff.thunder_ritual = buff_creator_t( *td, "thunder_ritual" );
}
else
{
assert( ! td -> debuff.thunder_ritual );
td -> debuff.thunder_ritual = new thunder_ritual_t( *td, *effect );
td -> debuff.thunder_ritual -> reset();
}
}
};
void item::mrrgrias_favor( special_effect_t& effect )
{
effect.execute_action = new thunder_ritual_driver_t( effect );
effect.execute_action -> add_child( new thunder_ritual_impact_t( effect ) );
}
// Toe Knee's Promise ======================================================
struct flame_gale_pulse_t : spell_t
{
//TODO: Are these multipliers multiplicative with one another or should they be added together then applied?
// Right now we assume they are independant multipliers.
double chest_multiplier;
double paired_multiplier;
flame_gale_pulse_t( special_effect_t& effect ) :
spell_t( "flame_gale_pulse", effect.player, effect.player -> find_spell( 230213 ) ),
chest_multiplier( util::composite_karazhan_empower_multiplier( effect.player ) ),
paired_multiplier( 1.0 )
{
background = true;
callbacks = false;
school = SCHOOL_FIRE;
aoe = -1;
if ( player -> karazhan_trinkets_paired )
paired_multiplier += 0.3;
base_dd_min = base_dd_max = data().effectN( 2 ).average( effect.item ) * paired_multiplier * chest_multiplier;
}
};
struct flame_gale_driver_t : spell_t
{
flame_gale_pulse_t* flame_pulse;
flame_gale_driver_t( special_effect_t& effect ) :
spell_t( "flame_gale_driver", effect.player, effect.player -> find_spell( 230213 ) ),
flame_pulse( new flame_gale_pulse_t( effect ) )
{
background = true;
}
virtual void impact( action_state_t* s )
{
spell_t::impact( s );
make_event<ground_aoe_event_t>( *sim, player, ground_aoe_params_t()
.pulse_time( timespan_t::from_seconds( 1.0 ) )
.target( execute_state -> target )
.duration( timespan_t::from_seconds( 8.0 ) )
.action( flame_pulse ) );
}
};
void item::toe_knees_promise( special_effect_t& effect )
{
effect.execute_action = new flame_gale_driver_t( effect );
}
// Memento of Angerboda =====================================================
struct memento_callback_t : public dbc_proc_callback_t
{
std::vector<buff_t*> buffs;
memento_callback_t( const special_effect_t& effect, std::vector<buff_t*> b ) :
dbc_proc_callback_t( effect.item, effect ), buffs( b )
{}
void execute( action_t* /* a */, action_state_t* /* call_data */ ) override
{
// Memento prefers to proc inactive buffs over active ones.
// Make a vector with only the inactive buffs.
std::vector<buff_t*> inactive_buffs;
for ( unsigned i = 0; i < buffs.size(); i++ )
{
if ( ! buffs[ i ] -> check() )
{
inactive_buffs.push_back( buffs[ i ] );
}
}
// If the vector is empty, we can roll any of the buffs.
if ( inactive_buffs.empty() )
{
inactive_buffs = buffs;
}
// Roll it!
int roll = ( int ) ( listener -> sim -> rng().real() * inactive_buffs.size() );
inactive_buffs[ roll ] -> trigger();
}
};
void item::memento_of_angerboda( special_effect_t& effect )
{
double rating_amount = item_database::apply_combat_rating_multiplier( *effect.item,
effect.driver() -> effectN( 2 ).average( effect.item ) );
std::vector<buff_t*> buffs;
buffs.push_back( stat_buff_creator_t( effect.player, "howl_of_ingvar", effect.player -> find_spell( 214802 ) )
.activated( false )
.add_stat( STAT_CRIT_RATING, rating_amount ) );
buffs.push_back( stat_buff_creator_t( effect.player, "wail_of_svala", effect.player -> find_spell( 214803 ) )
.activated( false )
.add_stat( STAT_HASTE_RATING, rating_amount ) );
buffs.push_back( stat_buff_creator_t( effect.player, "dirge_of_angerboda", effect.player -> find_spell( 214807 ) )
.activated( false )
.add_stat( STAT_MASTERY_RATING, rating_amount ) );
new memento_callback_t( effect, buffs );
}
// Obelisk of the Void ======================================================
void item::obelisk_of_the_void( special_effect_t& effect )
{
effect.custom_buff = stat_buff_creator_t( effect.player, "collapsing_shadow", effect.player -> find_spell( 215476 ), effect.item )
.add_stat( effect.player -> convert_hybrid_stat( STAT_AGI_INT ), effect.driver() -> effectN( 2 ).average( effect.item ) );
}
// Shivermaws Jawbone =======================================================
struct ice_bomb_t : public proc_spell_t
{
buff_t* buff;
ice_bomb_t( special_effect_t& effect ) :
proc_spell_t( "ice_bomb", effect.player, effect.driver(), effect.item )
{
buff = stat_buff_creator_t( effect.player, "frigid_armor", effect.player -> find_spell( 214589 ), effect.item );
}
void execute() override
{
proc_spell_t::execute();
buff -> trigger( num_targets_hit );
}
};
void item::shivermaws_jawbone( special_effect_t& effect )
{
effect.execute_action = new ice_bomb_t( effect );
}
// Spiked Counterweight =====================================================
struct haymaker_damage_t : public proc_spell_t
{
haymaker_damage_t( const special_effect_t& effect ) :
proc_spell_t( "brutal_haymaker_vulnerability", effect.player, effect.driver() -> effectN( 2 ).trigger(), effect.item )
{
may_crit = may_miss = false;
dot_duration = timespan_t::zero();
}
void init() override
{
proc_spell_t::init();
snapshot_flags = update_flags = 0;
}
};
struct haymaker_driver_t : public dbc_proc_callback_t
{
struct haymaker_event_t;
debuff_t* debuff;
const special_effect_t& effect;
double multiplier;
haymaker_event_t* accumulator;
haymaker_damage_t* action;
struct haymaker_event_t : public event_t
{
haymaker_damage_t* action;
haymaker_driver_t* callback;
debuff_t* debuff;
double damage;
haymaker_event_t( haymaker_driver_t* cb, haymaker_damage_t* a, debuff_t* d ) :
event_t( *a -> player, a -> data().effectN( 1 ).period() ), action( a ), callback( cb ), debuff( d ), damage( 0 )
{
}
const char* name() const override
{ return "brutal_haymaker_damage"; }
void execute() override
{
if ( damage > 0 )
{
action -> target = debuff -> player;
damage = std::min( damage, debuff -> current_value );
action -> base_dd_min = action -> base_dd_max = damage;
action -> schedule_execute();
// 2016-10-11 - Damage increases from target multiplier debuffs do not count towards the damage cap.
damage /= action -> player -> composite_player_target_multiplier( action -> target, SCHOOL_PHYSICAL );
debuff -> current_value -= damage;
}
if ( debuff -> current_value > 0 && debuff -> check() )
callback -> accumulator = make_event<haymaker_event_t>( *action -> player -> sim, callback, action, debuff );
else
{
callback -> accumulator = nullptr;
debuff -> expire();
}
}
};
haymaker_driver_t( const special_effect_t& e, double m ) :
dbc_proc_callback_t( e.player, e ), debuff(nullptr), effect( e ), multiplier( m ), accumulator(nullptr),
action( debug_cast<haymaker_damage_t*>( e.player -> find_action( "brutal_haymaker_vulnerability" ) ) )
{}
void activate() override
{
dbc_proc_callback_t::activate();
accumulator = make_event<haymaker_event_t>( *effect.player -> sim, this, action, debuff );
}
void execute( action_t* /* a */, action_state_t* trigger_state ) override
{
if ( trigger_state -> result_amount <= 0 )
return;
actor_target_data_t* td = effect.player -> get_target_data( trigger_state -> target );
if ( td && td -> debuff.brutal_haymaker -> check() )
accumulator -> damage += trigger_state -> result_amount * multiplier;
}
};
struct spiked_counterweight_constructor_t : public item_targetdata_initializer_t
{
spiked_counterweight_constructor_t( unsigned iid, const std::vector< slot_e >& s ) :
item_targetdata_initializer_t( iid, s )
{}
void operator()( actor_target_data_t* td ) const override
{
const special_effect_t* effect = find_effect( td -> source );
if ( effect == 0 )
{
td -> debuff.brutal_haymaker = buff_creator_t( *td, "brutal_haymaker" );
}
else
{
assert( ! td -> debuff.brutal_haymaker );
// Vulnerability: Deal x% of the damage dealt to the debuffed target, up to the limit.
// Create effect for the callback.
special_effect_t* effect2 = new special_effect_t( effect -> item );
effect2 -> source = SPECIAL_EFFECT_SOURCE_ITEM;
effect2 -> name_str = "brutal_haymaker_accumulator";
effect2 -> proc_chance_ = 1.0;
effect2 -> proc_flags_ = PF_ALL_DAMAGE | PF_PERIODIC;
effect2 -> proc_flags2_ = PF2_ALL_HIT | PF2_PERIODIC_DAMAGE;
effect -> player -> special_effects.push_back( effect2 );
// Create callback. We'll enable this callback whenever the debuff is active.
haymaker_driver_t* callback =
new haymaker_driver_t( *effect2, effect -> trigger() -> effectN( 2 ).percent() );
callback -> initialize();
callback -> deactivate();
// Create debuff with stack callback.
td -> debuff.brutal_haymaker = buff_creator_t( *td, "brutal_haymaker", effect -> trigger() )
.stack_change_callback( [ callback ]( buff_t*, int old, int new_ )
{
if ( old == 0 ) {
assert( ! callback -> active );
callback -> activate();
} else if ( new_ == 0 )
callback -> deactivate();
} )
.default_value( effect -> driver() -> effectN( 1 ).trigger() -> effectN( 3 ).average( effect -> item ) );
td -> debuff.brutal_haymaker -> reset();
// Set pointer to debuff so the callback can do its thing.
callback -> debuff = td -> debuff.brutal_haymaker;
}
}
};
struct brutal_haymaker_initial_t : public proc_spell_t
{
brutal_haymaker_initial_t( special_effect_t& effect ) :
proc_spell_t( "brutal_haymaker", effect.player, effect.driver() -> effectN( 1 ).trigger(), effect.item )
{}
void impact( action_state_t* s ) override
{
proc_spell_t::impact( s );
if ( result_is_hit( s -> result ) )
{
player -> get_target_data( s -> target ) -> debuff.brutal_haymaker -> trigger();
}
}
};
void item::spiked_counterweight( special_effect_t& effect )
{
effect.execute_action = new brutal_haymaker_initial_t( effect );
effect.execute_action -> add_child( new haymaker_damage_t( effect ) );
new dbc_proc_callback_t( effect.item, effect );
}
// Windscar Whetstone =======================================================
void item::windscar_whetstone( special_effect_t& effect )
{
action_t* maelstrom = effect.create_action();
maelstrom -> cooldown -> duration = timespan_t::zero(); // damage spell has erroneous cooldown
effect.custom_buff = buff_creator_t( effect.player, "slicing_maelstrom", effect.driver(), effect.item )
.tick_zero( true )
.tick_callback( [ maelstrom ]( buff_t*, int, const timespan_t& ) {
maelstrom -> schedule_execute();
} );
// Disable automatic creation of a trigger spell.
effect.trigger_spell_id = 1;
}
// Tirathon's Betrayal ======================================================
struct darkstrikes_absorb_t : public absorb_t
{
darkstrikes_absorb_t( const special_effect_t& effect ) :
absorb_t( "darkstrikes_absorb", effect.player, effect.player -> find_spell( 215659 ) )
{
background = true;
callbacks = false;
item = effect.item;
target = effect.player;
// Set correct absorb amount.
parse_effect_data( data().effectN( 2 ) );
}
};
struct darkstrikes_t : public proc_spell_t
{
action_t* absorb;
darkstrikes_t( const special_effect_t& effect ) :
proc_spell_t( "darkstrikes", effect.player, effect.player -> find_spell( 215659 ), effect.item )
{
// Set correct damage amount (can accidentally pick up absorb amount instead).