Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions engine/class_modules/sc_mage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -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<int>( p()->buffs.arcane_soul->data().effectN( 2 ).base_value() ) );
}
Expand Down Expand Up @@ -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;
Expand All @@ -7195,15 +7199,32 @@ 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
buffs.clearcasting->trigger();
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<int>( talents.shifting_shards->effectN( 1 ).base_value() ) );

if ( rng().roll( talents.overpowered_missiles->effectN( 1 ).percent() ) )
Expand Down
Loading