-
Notifications
You must be signed in to change notification settings - Fork 679
/
sc_mage.cpp
executable file
·9646 lines (7951 loc) · 306 KB
/
sc_mage.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 DPS-DPM Simulator.
// Send questions to natehieter@gmail.com
// ==========================================================================
#include "simulationcraft.hpp"
namespace { // UNNAMED NAMESPACE
// ==========================================================================
// Mage
// ==========================================================================
// Forward declarations
struct mage_t;
namespace buffs {
struct touch_of_the_magi_t;
struct arcane_missiles_t;
}
namespace pets {
namespace water_elemental {
struct water_elemental_pet_t;
}
}
struct state_switch_t
{
private:
bool state;
timespan_t last_enable;
timespan_t last_disable;
public:
state_switch_t()
{
reset();
}
bool enable( timespan_t now )
{
if ( last_enable == now )
{
return false;
}
state = true;
last_enable = now;
return true;
}
bool disable( timespan_t now )
{
if ( last_disable == now )
{
return false;
}
state = false;
last_disable = now;
return true;
}
bool on()
{
return state;
}
timespan_t duration( timespan_t now )
{
if ( !state )
{
return timespan_t::zero();
}
return now - last_enable;
}
void reset()
{
state = false;
last_enable = timespan_t::min();
last_disable = timespan_t::min();
}
};
/// Icicle container object, contains a timestamp and its corresponding icicle data!
struct icicle_tuple_t
{
timespan_t timestamp;
double damage;
};
struct mage_td_t : public actor_target_data_t
{
struct dots_t
{
dot_t* blast_furnace;
dot_t* conflagration_dot;
dot_t* ignite;
dot_t* living_bomb;
dot_t* mark_of_aluneth;
dot_t* nether_tempest;
} dots;
struct debuffs_t
{
buff_t* erosion;
buff_t* slow;
buffs::touch_of_the_magi_t* touch_of_the_magi;
buff_t* frost_bomb;
buff_t* water_jet;
buff_t* winters_chill;
buff_t* frozen;
} debuffs;
mage_td_t( player_t* target, mage_t* mage );
};
struct buff_stack_benefit_t
{
const buff_t* buff;
std::vector<benefit_t*> buff_stack_benefit;
buff_stack_benefit_t( const buff_t* _buff,
const std::string& prefix ) :
buff( _buff ),
buff_stack_benefit()
{
for ( int i = 0; i <= buff -> max_stack(); i++ )
{
buff_stack_benefit.push_back( buff -> player ->
get_benefit( prefix + " " +
buff -> data().name_cstr() + " " +
util::to_string( i ) ) );
}
}
void update()
{
for ( std::size_t i = 0; i < buff_stack_benefit.size(); ++i )
{
buff_stack_benefit[ i ] -> update( i == as<unsigned>( buff -> check() ) );
}
}
};
struct cooldown_reduction_data_t
{
const cooldown_t* cd;
luxurious_sample_data_t* effective;
luxurious_sample_data_t* wasted;
cooldown_reduction_data_t( const cooldown_t* cooldown, const std::string& name ) :
cd( cooldown )
{
player_t* p = cd -> player;
effective = p -> get_sample_data( name + " effective cooldown reduction" );
wasted = p -> get_sample_data( name + " wasted cooldown reduction" );
}
void add( timespan_t reduction )
{
assert( effective );
assert( wasted );
timespan_t remaining = timespan_t::zero();
if ( cd -> charges > 1 )
{
if ( cd -> recharge_event )
{
remaining = cd -> current_charge_remains() +
( cd -> charges - cd -> current_charge - 1 ) * cd -> duration;
}
}
else
{
remaining = cd -> remains();
}
double reduction_sec = -reduction.total_seconds();
double remaining_sec = remaining.total_seconds();
double effective_sec = std::min( reduction_sec, remaining_sec );
effective -> add( effective_sec );
double wasted_sec = reduction_sec - effective_sec;
wasted -> add( wasted_sec );
}
};
struct cooldown_waste_data_t : private noncopyable
{
const cooldown_t* cd;
double buffer;
extended_sample_data_t normal;
extended_sample_data_t cumulative;
cooldown_waste_data_t( const cooldown_t* cooldown, bool simple = true ) :
cd( cooldown ),
buffer( 0.0 ),
normal( cd -> name_str + " cooldown waste", simple ),
cumulative( cd -> name_str + " cooldown cumulative waste", simple )
{ }
bool may_add( timespan_t cd_override = timespan_t::min() ) const
{
return ( cd -> duration > timespan_t::zero() || cd_override > timespan_t::zero() )
&& ( ( cd -> charges == 1 && cd -> up() ) || ( cd -> charges >= 2 && cd -> current_charge == cd -> charges ) );
}
void add( timespan_t cd_override = timespan_t::min(), timespan_t time_to_execute = timespan_t::zero() )
{
if ( may_add( cd_override ) )
{
double wasted = ( cd -> sim.current_time() - cd -> last_charged ).total_seconds();
if ( cd -> charges == 1 )
{
// Waste caused by execute time is unavoidable for single charge spells,
// don't count it.
wasted -= time_to_execute.total_seconds();
}
normal.add( wasted );
buffer += wasted;
}
}
bool active() const
{
return normal.count() > 0 && cumulative.sum() > 0;
}
void merge( const cooldown_waste_data_t& other )
{
normal.merge( other.normal );
cumulative.merge( other.cumulative );
}
void analyze()
{
normal.analyze();
cumulative.analyze();
}
void datacollection_begin()
{
buffer = 0.0;
}
void datacollection_end()
{
if ( may_add() )
buffer += ( cd -> sim.current_time() - cd -> last_charged ).total_seconds();
cumulative.add( buffer );
buffer = 0.0;
}
};
struct proc_source_t : private noncopyable
{
const std::string name_str;
auto_dispose<std::vector<proc_t*> > procs;
proc_source_t( sim_t& sim, const std::string& name, size_t count ) :
name_str( name )
{
for ( size_t i = 0; i < count; i++ )
{
procs.push_back( new proc_t( sim, name_str + " " + util::to_string( i ) ) );
}
}
void occur( size_t index )
{
assert( index < procs.size() );
procs[ index ] -> occur();
}
const proc_t& get( size_t index ) const
{
assert( index < procs.size() );
return *procs[ index ];
}
bool active() const
{
return range::find_if( procs, [] ( proc_t* p ) { return p -> count.sum() > 0.0; } ) != procs.end();
}
void reset()
{
range::for_each( procs, std::mem_fn( &proc_t::reset ) );
}
void merge( const proc_source_t& other )
{
for ( size_t i = 0; i < procs.size(); i++ )
{
procs[ i ] -> merge( *other.procs[ i ] );
}
}
void datacollection_begin()
{
range::for_each( procs, std::mem_fn( &proc_t::datacollection_begin ) );
}
void datacollection_end()
{
range::for_each( procs, std::mem_fn( &proc_t::datacollection_end ) );
}
};
struct mage_t : public player_t
{
public:
// Icicles
std::vector<icicle_tuple_t> icicles;
action_t* icicle;
event_t* icicle_event;
// Ignite
action_t* ignite;
event_t* ignite_spread_event;
// Active
player_t* last_bomb_target;
// State switches for rotation selection
state_switch_t burn_phase;
// Ground AoE tracking
std::map<std::string, timespan_t> ground_aoe_expiration;
// Miscellaneous
double distance_from_rune;
double global_cinder_count;
timespan_t firestarter_time;
int blessing_of_wisdom_count;
bool allow_shimmer_lance;
// Data collection
auto_dispose<std::vector<cooldown_waste_data_t*> > cooldown_waste_data_list;
auto_dispose<std::vector<proc_source_t*> > proc_source_list;
// Cached actions
struct actions_t
{
action_t* arcane_assault;
action_t* frost_bomb_explosion;
action_t* legendary_arcane_orb;
action_t* legendary_meteor;
action_t* legendary_comet_storm;
action_t* touch_of_the_magi_explosion;
action_t* unstable_magic_explosion;
} action;
// Benefits
struct benefits_t
{
struct arcane_charge_benefits_t
{
buff_stack_benefit_t* arcane_barrage;
buff_stack_benefit_t* arcane_blast;
buff_stack_benefit_t* arcane_explosion;
buff_stack_benefit_t* arcane_missiles;
buff_stack_benefit_t* nether_tempest;
} arcane_charge;
buff_stack_benefit_t* chain_reaction;
buff_stack_benefit_t* magtheridons_might;
buff_stack_benefit_t* ray_of_frost;
buff_stack_benefit_t* zannesu_journey;
} benefits;
// Buffs
struct buffs_t
{
// Arcane
buff_t* arcane_charge;
buff_t* arcane_familiar;
buffs::arcane_missiles_t* arcane_missiles;
buff_t* arcane_power;
buff_t* chrono_shift;
buff_t* crackling_energy; // T20 2pc Arcane
buff_t* presence_of_mind;
buff_t* expanding_mind; // T21 2pc Arcane
buff_t* quick_thinker; // T21 4pc Arcane
// Fire
buff_t* combustion;
buff_t* contained_infernal_core; // 7.2.5 legendary shoulder, tracking buff
buff_t* critical_massive; // T20 4pc Fire
buff_t* enhanced_pyrotechnics;
buff_t* erupting_infernal_core; // 7.2.5 legendary shoulder, primed buff
buff_t* frenetic_speed;
buff_t* heating_up;
buff_t* hot_streak;
buff_t* ignition; // T20 2pc Fire
buff_t* pyretic_incantation;
buff_t* scorched_earth;
buff_t* streaking; // T19 4pc Fire
buff_t* inferno; // T21 4pc Fire
// Frost
buff_t* brain_freeze;
buff_t* fingers_of_frost;
buff_t* frozen_mass; // T20 2pc Frost
buff_t* icicles; // Buff to track icicles - doesn't always line up with icicle count though!
buff_t* icy_veins;
buff_t* rage_of_the_frost_wyrm; // 7.2.5 legendary head, primed buff
buff_t* shattered_fragments_of_sindragosa; // 7.2.5 legendary head, tracking buff
buff_t* arctic_blast; // T21 4pc Frost
// Talents
buff_t* bone_chilling;
buff_t* ice_floes;
buff_t* incanters_flow;
buff_t* ray_of_frost;
buff_t* rune_of_power;
// Artifact
buff_t* chain_reaction;
buff_t* chilled_to_the_core;
buff_t* freezing_rain;
buff_t* rule_of_threes;
buff_t* time_and_space;
buff_t* warmth_of_the_phoenix;
// Legendary
buff_t* cord_of_infinity;
buff_t* kaelthas_ultimate_ability;
buff_t* lady_vashjs_grasp;
buff_t* magtheridons_might;
buff_t* rhonins_assaulting_armwraps;
buff_t* zannesu_journey;
haste_buff_t* sephuzs_secret;
// Miscellaneous Buffs
buff_t* greater_blessing_of_widsom;
buff_t* t19_oh_buff;
buff_t* shimmer;
} buffs;
// Cooldowns
struct cooldowns_t
{
cooldown_t* combustion;
cooldown_t* cone_of_cold;
cooldown_t* evocation;
cooldown_t* frost_nova;
cooldown_t* frozen_orb;
cooldown_t* icy_veins;
cooldown_t* phoenixs_flames;
cooldown_t* presence_of_mind;
cooldown_t* ray_of_frost;
cooldown_t* time_warp;
} cooldowns;
// Gains
struct gains_t
{
gain_t* aluneths_avarice;
gain_t* greater_blessing_of_wisdom;
gain_t* evocation;
gain_t* mystic_kilt_of_the_rune_master;
} gains;
// Pets
struct pets_t
{
pets::water_elemental::water_elemental_pet_t* water_elemental;
std::vector<pet_t*> mirror_images;
pets_t() : water_elemental( nullptr )
{ }
} pets;
// Procs
struct procs_t
{
proc_t* heating_up_generated; // Crits without HU/HS
proc_t* heating_up_removed; // Non-crits with HU >200ms after application
proc_t* heating_up_ib_converted; // IBs used on HU
proc_t* hot_streak; // Total HS generated
proc_t* hot_streak_pyromaniac; // Total HS from Pyromaniac
proc_t* hot_streak_spell; // HU/HS spell impacts
proc_t* hot_streak_spell_crit; // HU/HS spell crits
proc_t* hot_streak_spell_crit_wasted; // HU/HS spell crits with HS
proc_t* ignite_applied; // Direct ignite applications
proc_t* ignite_spread; // Spread events
proc_t* ignite_new_spread; // Spread to new target
proc_t* ignite_overwrite; // Spread to target with existing ignite
proc_t* controlled_burn; // Tracking Controlled Burn talent
proc_t* brain_freeze_flurry;
proc_t* fingers_of_frost_wasted;
} procs;
// Sample data
struct sample_data_t
{
cooldown_reduction_data_t* blizzard;
cooldown_reduction_data_t* frozen_veins;
cooldown_reduction_data_t* t20_4pc;
luxurious_sample_data_t* glacial_spike_base;
luxurious_sample_data_t* glacial_spike_icicles;
extended_sample_data_t* icy_veins_duration;
extended_sample_data_t* burn_duration_history;
extended_sample_data_t* burn_initial_mana;
} sample_data;
// Specializations
struct specializations_t
{
// Arcane
const spell_data_t* arcane_barrage_2;
const spell_data_t* arcane_charge;
const spell_data_t* arcane_mage;
const spell_data_t* evocation_2;
const spell_data_t* savant;
// Fire
const spell_data_t* critical_mass;
const spell_data_t* critical_mass_2;
const spell_data_t* enhanced_pyrotechnics;
const spell_data_t* fire_blast_2;
const spell_data_t* fire_blast_3;
const spell_data_t* fire_mage;
const spell_data_t* hot_streak;
const spell_data_t* ignite;
// Frost
const spell_data_t* brain_freeze;
const spell_data_t* brain_freeze_2;
const spell_data_t* blizzard_2;
const spell_data_t* fingers_of_frost;
const spell_data_t* frost_mage;
const spell_data_t* icicles;
const spell_data_t* icicles_driver;
const spell_data_t* shatter;
const spell_data_t* shatter_2;
} spec;
// State
struct state_t
{
bool brain_freeze_active;
bool fingers_of_frost_active;
bool ignition_active;
int flurry_bolt_count;
int arcane_missile_refresh;
} state;
// Talents
struct talents_list_t
{
// Tier 15
const spell_data_t* arcane_familiar;
const spell_data_t* amplification;
const spell_data_t* words_of_power;
const spell_data_t* pyromaniac;
const spell_data_t* conflagration;
const spell_data_t* firestarter;
const spell_data_t* ray_of_frost;
const spell_data_t* lonely_winter;
const spell_data_t* bone_chilling;
// Tier 30
const spell_data_t* shimmer;
const spell_data_t* slipstream;
const spell_data_t* blast_wave;
const spell_data_t* ice_floes;
const spell_data_t* mana_shield; // NYI
const spell_data_t* blazing_soul; // NYI
const spell_data_t* glacial_insulation; // NYI
// Tier 45
const spell_data_t* mirror_image;
const spell_data_t* rune_of_power;
const spell_data_t* incanters_flow;
// Tier 60
const spell_data_t* supernova;
const spell_data_t* charged_up;
const spell_data_t* resonance;
const spell_data_t* alexstraszas_fury;
const spell_data_t* flame_on;
const spell_data_t* controlled_burn;
const spell_data_t* ice_nova;
const spell_data_t* frozen_touch;
const spell_data_t* splitting_ice;
// Tier 75
const spell_data_t* chrono_shift;
const spell_data_t* frenetic_speed;
const spell_data_t* frigid_winds; // NYI
const spell_data_t* ring_of_frost; // NYI
const spell_data_t* ice_ward;
// Tier 90
const spell_data_t* nether_tempest;
const spell_data_t* living_bomb;
const spell_data_t* frost_bomb;
const spell_data_t* unstable_magic;
const spell_data_t* erosion;
const spell_data_t* flame_patch;
const spell_data_t* arctic_gale;
// Tier 100
const spell_data_t* overpowered;
const spell_data_t* temporal_flux;
const spell_data_t* arcane_orb;
const spell_data_t* kindling;
const spell_data_t* cinderstorm;
const spell_data_t* meteor;
const spell_data_t* thermal_void;
const spell_data_t* glacial_spike;
const spell_data_t* comet_storm;
} talents;
struct uptimes_t {
uptime_t* burn_phase;
uptime_t* conserve_phase;
} uptime;
// Artifact
struct artifact_spell_data_t
{
// Arcane
artifact_power_t aegwynns_intensity;
artifact_power_t aluneths_avarice;
artifact_power_t time_and_space;
artifact_power_t arcane_rebound;
artifact_power_t ancient_power;
artifact_power_t scorched_earth;
artifact_power_t everywhere_at_once; //NYI
artifact_power_t arcane_purification;
artifact_power_t aegwynns_imperative;
artifact_power_t aegwynns_ascendance;
artifact_power_t aegwynns_wrath;
artifact_power_t crackling_energy;
artifact_power_t blasting_rod;
artifact_power_t ethereal_sensitivity;
artifact_power_t aegwynns_fury;
artifact_power_t mana_shield; // NYI
artifact_power_t mark_of_aluneth;
artifact_power_t might_of_the_guardians;
artifact_power_t rule_of_threes;
artifact_power_t slooow_down; // NYI
artifact_power_t torrential_barrage;
artifact_power_t touch_of_the_magi;
artifact_power_t intensity_of_the_tirisgarde;
// Fire
artifact_power_t aftershocks;
artifact_power_t everburning_consumption;
artifact_power_t blue_flame_special;
artifact_power_t molten_skin; //NYI
artifact_power_t phoenix_reborn;
artifact_power_t great_balls_of_fire;
artifact_power_t cauterizing_blink; //NYI
artifact_power_t fire_at_will;
artifact_power_t preignited;
artifact_power_t warmth_of_the_phoenix;
artifact_power_t strafing_run;
artifact_power_t pyroclasmic_paranoia;
artifact_power_t reignition_overdrive;
artifact_power_t pyretic_incantation;
artifact_power_t phoenixs_flames;
artifact_power_t burning_gaze;
artifact_power_t big_mouth;
artifact_power_t blast_furnace;
artifact_power_t wings_of_flame;
artifact_power_t empowered_spellblade;
artifact_power_t instability_of_the_tirisgarde;
// Frost
artifact_power_t ebonbolt;
artifact_power_t jouster; // NYI
artifact_power_t let_it_go;
artifact_power_t frozen_veins;
artifact_power_t the_storm_rages;
artifact_power_t black_ice;
artifact_power_t shield_of_alodi; //NYI
artifact_power_t icy_caress;
artifact_power_t ice_nine;
artifact_power_t chain_reaction;
artifact_power_t clarity_of_thought;
artifact_power_t its_cold_outside;
artifact_power_t shattering_bolts;
artifact_power_t orbital_strike;
artifact_power_t icy_hand;
artifact_power_t ice_age;
artifact_power_t chilled_to_the_core;
artifact_power_t spellborne;
artifact_power_t obsidian_lance;
artifact_power_t freezing_rain;
artifact_power_t glacial_eruption;
artifact_power_t frigidity_of_the_tirisgarde;
} artifact;
public:
mage_t( sim_t* sim, const std::string& name, race_e r = RACE_NIGHT_ELF );
~mage_t();
// Character Definition
virtual std::string get_special_use_items( const std::string& item = std::string(), bool specials = false );
virtual void init_spells() override;
virtual void init_base_stats() override;
virtual void create_buffs() override;
virtual void create_options() override;
virtual void init_gains() override;
virtual void init_procs() override;
virtual void init_benefits() override;
virtual void init_uptimes() override;
virtual void init_assessors() override;
virtual void invalidate_cache( cache_e c ) override;
virtual void init_resources( bool force ) override;
virtual void recalculate_resource_max( resource_e rt ) override;
virtual void reset() override;
virtual expr_t* create_expression( action_t*, const std::string& name ) override;
virtual action_t* create_action( const std::string& name, const std::string& options ) override;
virtual bool create_actions() override;
virtual void create_pets() override;
virtual resource_e primary_resource() const override { return RESOURCE_MANA; }
virtual role_e primary_role() const override { return ROLE_SPELL; }
virtual stat_e convert_hybrid_stat( stat_e s ) const override;
virtual stat_e primary_stat() const override { return STAT_INTELLECT; }
virtual double mana_regen_per_second() const override;
virtual double composite_player_multiplier( school_e school ) const override;
virtual double composite_player_critical_damage_multiplier( const action_state_t* ) const override;
virtual double composite_player_pet_damage_multiplier( const action_state_t* ) const override;
virtual double composite_spell_crit_chance() const override;
virtual double composite_spell_crit_rating() const override;
virtual double composite_spell_haste() const override;
virtual double composite_mastery_rating() const override;
virtual double composite_attribute_multiplier( attribute_e ) const override;
virtual double matching_gear_multiplier( attribute_e attr ) const override;
virtual void update_movement( timespan_t duration ) override;
virtual void stun() override;
virtual double temporary_movement_modifier() const override;
virtual double passive_movement_modifier() const override;
virtual void arise() override;
virtual void combat_begin() override;
virtual void combat_end() override;
virtual std::string create_profile( save_e ) override;
virtual void copy_from( player_t* ) override;
virtual void merge( player_t& ) override;
virtual void analyze( sim_t& ) override;
virtual void datacollection_begin() override;
virtual void datacollection_end() override;
target_specific_t<mage_td_t> target_data;
virtual mage_td_t* get_target_data( player_t* target ) const override
{
mage_td_t*& td = target_data[ target ];
if ( ! td )
{
td = new mage_td_t( target, const_cast<mage_t*>(this) );
}
return td;
}
cooldown_waste_data_t* get_cooldown_waste_data( cooldown_t* cd )
{
for ( auto cdw : cooldown_waste_data_list )
{
if ( cdw -> cd -> name_str == cd -> name_str )
return cdw;
}
auto cdw = new cooldown_waste_data_t( cd );
cooldown_waste_data_list.push_back( cdw );
return cdw;
}
proc_source_t* get_proc_source( const std::string& name, size_t count )
{
for ( auto ps : proc_source_list )
{
if ( ps -> name_str == name )
{
return ps;
}
}
auto ps = new proc_source_t( *sim, name, count );
proc_source_list.push_back( ps );
return ps;
}
// Public mage functions:
double get_icicle();
void trigger_icicle( const action_state_t* trigger_state, bool chain = false, player_t* chain_target = nullptr );
bool apply_crowd_control( const action_state_t* state, spell_mechanic type );
void apl_precombat();
void apl_arcane();
void apl_fire();
void apl_frost();
void apl_default();
virtual void init_action_list() override;
std::string default_potion() const override;
std::string default_flask() const override;
std::string default_food() const override;
std::string default_rune() const override;
};
namespace pets
{
struct mage_pet_t : public pet_t
{
mage_pet_t( sim_t* sim, mage_t* owner, std::string pet_name,
bool guardian = false, bool dynamic = false )
: pet_t( sim, owner, pet_name, guardian, dynamic )
{ }
const mage_t* o() const
{
return static_cast<mage_t*>( owner );
}
mage_t* o()
{
return static_cast<mage_t*>( owner );
}
};
struct mage_pet_spell_t : public spell_t
{
mage_pet_spell_t( const std::string& n, mage_pet_t* p, const spell_data_t* s )
: spell_t( n, p, s )
{
may_crit = tick_may_crit = true;
}
mage_t* o()
{
return static_cast<mage_pet_t*>( player ) -> o();
}
const mage_t* o() const
{
return static_cast<mage_pet_t*>( player ) -> o();
}
};
namespace water_elemental
{
// ==========================================================================
// Pet Water Elemental
// ==========================================================================
struct water_elemental_pet_t : public mage_pet_t
{
water_elemental_pet_t( sim_t* sim, mage_t* owner )
: mage_pet_t( sim, owner, "water_elemental" )
{
owner_coeff.sp_from_sp = 0.75;
}
virtual void init_action_list() override
{
clear_action_priority_lists();
auto default_list = get_action_priority_list( "default" );
default_list -> add_action( this, find_pet_spell( "Water Jet" ), "Water Jet" );
default_list -> add_action( this, find_pet_spell( "Waterbolt" ), "Waterbolt" );
// Default
use_default_action_list = true;
mage_pet_t::init_action_list();
}
virtual action_t* create_action( const std::string& name,
const std::string& options_str ) override;
};
struct water_elemental_spell_t : public mage_pet_spell_t
{
water_elemental_spell_t( const std::string& n, mage_pet_t* p, const spell_data_t* s )
: mage_pet_spell_t( n, p, s )
{
base_multiplier *= 1.0 + o() -> spec.frost_mage -> effectN( 1 ).percent();
}
virtual double action_multiplier() const override
{
double am = mage_pet_spell_t::action_multiplier();
if ( o() -> spec.icicles -> ok() )
{
am *= 1.0 + o() -> cache.mastery_value();
}
return am;
}
};
struct waterbolt_t : public water_elemental_spell_t
{
waterbolt_t( water_elemental_pet_t* p, const std::string& options_str )
: water_elemental_spell_t( "waterbolt", p, p -> find_pet_spell( "Waterbolt" ) )
{
parse_options( options_str );
trigger_gcd = timespan_t::zero();
base_multiplier *= 1.0 + o() -> artifact.its_cold_outside.data().effectN( 3 ).percent();
}
virtual timespan_t execute_time() const override
{
timespan_t cast_time = water_elemental_spell_t::execute_time();
// For some reason welly seems to have a cap'd rate of cast of
// 1.5/second. Instead of modeling this as a cooldown/GCD (like it is in game)
// we model it as a capped cast time, with 1.5 being the lowest it can go.
return std::max( cast_time, timespan_t::from_seconds( 1.5 ) );
}
};
struct freeze_t : public water_elemental_spell_t
{
proc_t* proc_fof;
freeze_t( water_elemental_pet_t* p ) :
water_elemental_spell_t( "freeze", p, p -> find_pet_spell( "Freeze" ) )
{
background = true;
aoe = -1;
internal_cooldown = p -> get_cooldown( "wj_freeze" );
internal_cooldown -> duration = data().category_cooldown();
}
virtual bool init_finished() override
{
proc_fof = o() -> get_proc( std::string( "Fingers of Frost from " ) + data().name_cstr() );
return water_elemental_spell_t::init_finished();
}
virtual void impact( action_state_t* s ) override
{
water_elemental_spell_t::impact( s );
bool success = o() -> apply_crowd_control( s, MECHANIC_ROOT );
if ( success )
{
o() -> buffs.fingers_of_frost -> trigger();
o() -> buffs.fingers_of_frost -> predict();
proc_fof -> occur();
}
}
};
struct water_jet_t : public water_elemental_spell_t
{
// queued water jet spell, auto cast water jet spell
bool queued;
bool autocast;
water_jet_t( water_elemental_pet_t* p, const std::string& options_str )
: water_elemental_spell_t( "water_jet", p, p -> find_pet_spell( "Water Jet" ) ),
queued( false ),
autocast( true )
{
parse_options( options_str );
channeled = tick_zero = true;
internal_cooldown = p -> get_cooldown( "wj_freeze" );
internal_cooldown -> duration = data().category_cooldown();
}
virtual void execute() override
{
// If this is a queued execute, disable queued status
if ( ! autocast && queued )
queued = false;
// Don't execute Water Jet if Water Elemental used Freeze
// during the cast
if ( internal_cooldown -> up() )