diff --git a/engine/class_modules/sc_mage.cpp b/engine/class_modules/sc_mage.cpp index 5c9b3263a24..0c93b1d7fb1 100644 --- a/engine/class_modules/sc_mage.cpp +++ b/engine/class_modules/sc_mage.cpp @@ -452,6 +452,7 @@ struct mage_t final : public player_t bool trigger_overpowered_missiles; bool heat_shimmer; bool gained_initial_clearcasting; // Used to prevent queueing Arcane Missiles immediately after gaining the first stack Clearclasting. + timespan_t last_random_clearcasting; // Brainstorm cannot be triggered twice if a singular spell/action triggers Clearcasting twice. bool eureka; bool thermal_void_active; int glorious_incandescence_snapshot; @@ -904,7 +905,7 @@ struct mage_t final : public player_t void trigger_arcane_charge( int stacks = 1 ); bool trigger_brain_freeze( double chance, proc_t* source, timespan_t delay = 0_ms ); bool trigger_crowd_control( const action_state_t* s, spell_mechanic type ); - bool trigger_clearcasting( double chance = 1.0, timespan_t delay = 0_ms, bool allow_predict = true ); + bool trigger_clearcasting( double chance = 1.0, bool allow_predict = true, bool has_double_proc_delay = false ); bool trigger_fof( double chance, proc_t* source, int stacks = 1 ); void trigger_mana_cascade(); void trigger_merged_buff( buff_t* buff, bool trigger ); @@ -1888,8 +1889,11 @@ struct mage_spell_t : public spell_t if ( proc_chance == 1.0 || !background ) { - if ( p()->trigger_clearcasting( proc_chance, 100_ms, !background ) ) + if ( p()->trigger_clearcasting( proc_chance, !background ) ) + { + p()->state.last_random_clearcasting = sim->current_time(); p()->state.clearcasting_blp_count = 0; + } } } @@ -2803,7 +2807,7 @@ struct arcane_barrage_t final : public arcane_mage_spell_t int salvo = p()->buffs.arcane_salvo->check(); if ( p()->buffs.arcane_soul->check() ) { - p()->trigger_clearcasting(); + p()->trigger_clearcasting( 1.0, true, true ); p()->trigger_arcane_charge( arcane_soul_charges ); p()->trigger_arcane_salvo( arcane_soul_salvo, as( p()->buffs.arcane_soul->data().effectN( 2 ).base_value() ) ); } @@ -7181,7 +7185,7 @@ void mage_t::trigger_splinter( player_t* target, int count ) } } -bool mage_t::trigger_clearcasting( double chance, timespan_t delay, bool allow_predict ) +bool mage_t::trigger_clearcasting( double chance, bool allow_predict, bool has_double_proc_delay ) { if ( specialization() != MAGE_ARCANE ) return false; @@ -7195,6 +7199,11 @@ bool mage_t::trigger_clearcasting( double chance, timespan_t delay, bool allow_p state.gained_initial_clearcasting = true; make_event( *sim, 50_ms, [ this ] { state.gained_initial_clearcasting = false; } ); } + + timespan_t delay = 0_ms; + if ( has_double_proc_delay && state.last_random_clearcasting == sim->current_time() ) + delay = 100_ms; + // TODO: had_clearcasting may be inaccurate; unlike previously, there's no methods to delay a CC trigger w/o CC. Revisit later. if ( delay > 0_ms && had_clearcasting ) make_event( *sim, delay, [ this ] { buffs.clearcasting->trigger(); } ); else @@ -7202,8 +7211,20 @@ bool mage_t::trigger_clearcasting( double chance, timespan_t delay, bool allow_p if ( chance >= 1.0 && allow_predict ) buffs.clearcasting->predict(); - // TODO: double check timing - buffs.brainstorm->trigger(); + // Due to Brainstorm being async in sims, its trigger will be scheduled w/ make_event ~30ms later, whereas CC is instantaneous. + // In-game, Blast (triggering CC + BS) into a queued Barrage will lead to CC + BS to be applied AFTER the Barrage. + // However, in sims, CC will be active prior to the Barrage. + // If Clearcasting would directly grant Intellect: in sims, the queued Barrage would benefit from Clearcasting; in game, the Barrage wouldn't. + if ( talents.brainstorm.ok() ) + { + // TODO: we don't know what happens if a single spell triggers two (or more) separate sources of guaranteed Clearcastings. + // Since there's no such thing in-game yet, we can't know with certainty whether brainstorm will trigger once or twice. + if ( !has_double_proc_delay || state.last_random_clearcasting != sim->current_time() ) + buffs.brainstorm->trigger(); + else + sim->print_debug("Gaining Clearcasting in {}_s; Brainstorm won't be triggered due to double proc delay.", delay ); + } + trigger_splinter( target, as( talents.shifting_shards->effectN( 1 ).base_value() ) ); if ( rng().roll( talents.overpowered_missiles->effectN( 1 ).percent() ) )