Example #1
0
void dot_t::extend_duration( int extra_ticks, bool cap )
{
  if ( ! ticking )
    return;

  // Make sure this DoT is still ticking......
  assert( tick_event );

  if ( sim -> log )
    log_t::output( sim, "%s extends duration of %s on %s, adding %d tick(s), totalling %d ticks", action -> player -> name(), name(), player -> name(), extra_ticks, num_ticks + extra_ticks );

  if ( cap )
  {
    // Can't extend beyond initial duration.
    // Assuming this limit is based on current haste, not haste at previous application/extension/refresh.

    int max_extra_ticks = std::max( action -> hasted_num_ticks() - ticks(), 0 );

    extra_ticks = std::min( extra_ticks, max_extra_ticks );
  }

  action -> player_buff();

  added_ticks += extra_ticks;
  num_ticks += extra_ticks;
  recalculate_ready();
}
void dot_t::refresh_duration( uint32_t state_flags )
{
  if ( ! ticking )
    return;

  if ( state_flags == ( uint32_t ) - 1 ) state_flags = current_action -> snapshot_flags;

  // Make sure this DoT is still ticking......
  assert( tick_event );

  if ( sim.log )
    sim.out_log.printf( "%s refreshes duration of %s on %s", source -> name(), name(), target -> name() );

  assert( state );
  current_action -> snapshot_internal( state, state_flags, current_action -> type == ACTION_HEAL ? HEAL_OVER_TIME : DMG_OVER_TIME );

  current_tick = 0;
  added_ticks = 0;
  added_seconds = timespan_t::zero();

  num_ticks = current_action -> hasted_num_ticks( state -> haste );

  // tick zero dots tick when refreshed
  if ( current_action -> tick_zero )
  {
    current_action -> tick( this );
  }

  recalculate_ready();

  current_action -> stats -> add_refresh( state -> target );
}
void dot_t::extend_duration( int extra_ticks, bool cap, uint32_t state_flags )
{
  if ( ! ticking )
    return;

  if ( state_flags == ( uint32_t ) - 1 ) state_flags = current_action -> snapshot_flags;

  // Make sure this DoT is still ticking......
  assert( tick_event && "dot_t::extend_duration: ticking==true but tick_event=nullptr" );

  if ( sim.log )
    sim.out_log.printf( "%s extends duration of %s on %s, adding %d tick(s), totalling %d ticks, and snapshotting with %#.x",
                source -> name(), name(), target -> name(), extra_ticks, num_ticks + extra_ticks, state_flags );

  if ( cap )
  {
    // Can't extend beyond initial duration.
    // Assuming this limit is based on current haste, not haste at previous application/extension/refresh.

    int max_extra_ticks;
    max_extra_ticks = std::max( current_action -> hasted_num_ticks( state -> haste ) - ticks(), 0 );

    extra_ticks = std::min( extra_ticks, max_extra_ticks );
  }

  assert( state );
  current_action -> snapshot_internal( state, state_flags, current_action -> type == ACTION_HEAL ? HEAL_OVER_TIME : DMG_OVER_TIME );

  added_ticks += extra_ticks;
  num_ticks += extra_ticks;
  recalculate_ready();

  current_action -> stats -> add_refresh( state -> target );
}
void dot_t::extend_duration_seconds( timespan_t extra_seconds, uint32_t state_flags )
{
  if ( ! ticking )
    return;

  if ( state_flags == ( uint32_t ) - 1 ) state_flags = current_action -> snapshot_flags;

  // Make sure this DoT is still ticking......
  assert( tick_event );

  // Treat extra_ticks as 'seconds added' instead of 'ticks added'
  // Duration left needs to be calculated with old haste for tick_time()
  // First we need the number of ticks remaining after the next one =>
  // ( num_ticks - current_tick ) - 1
  int old_num_ticks = num_ticks;
  int old_remaining_ticks = old_num_ticks - current_tick - 1;
  double old_haste_factor = 1.0 / state -> haste;

  // Multiply with tick_time() for the duration left after the next tick
  timespan_t duration_left;

  duration_left = old_remaining_ticks * current_action -> tick_time( state -> haste );

  // Add the added seconds
  duration_left += extra_seconds;

  assert( state );
  current_action -> snapshot_internal( state, state_flags, current_action -> type == ACTION_HEAL ? HEAL_OVER_TIME : DMG_OVER_TIME );

  added_seconds += extra_seconds;

  int new_remaining_ticks;

  new_remaining_ticks = current_action -> hasted_num_ticks( state -> haste, duration_left );

  num_ticks += ( new_remaining_ticks - old_remaining_ticks );

  if ( sim.debug )
  {
    sim.out_debug.printf( "%s extends duration of %s on %s by %.1f second(s). h: %.2f => %.2f, num_t: %d => %d, rem_t: %d => %d",
                source -> name(), name(), target -> name(), extra_seconds.total_seconds(),
                old_haste_factor, ( 1.0 / state -> haste ),
                old_num_ticks, num_ticks,
                old_remaining_ticks, new_remaining_ticks );
  }
  else if ( sim.log )
  {
    sim.out_log.printf( "%s extends duration of %s on %s by %.1f second(s).",
                source -> name(), name(), target -> name(), extra_seconds.total_seconds() );
  }

  recalculate_ready();

  current_action -> stats -> add_refresh( state -> target );
}
Example #5
0
void dot_t::extend_duration_seconds( double extra_seconds )
{
  if ( ! ticking )
    return;

  // Make sure this DoT is still ticking......
  assert( tick_event );

  // Treat extra_ticks as 'seconds added' instead of 'ticks added'
  // Duration left needs to be calculated with old haste for tick_time()
  // First we need the number of ticks remaining after the next one =>
  // ( num_ticks - current_tick ) - 1
  int old_num_ticks = num_ticks;
  int old_remaining_ticks = old_num_ticks - current_tick - 1;
  double old_haste_factor = 1.0 / action -> player_haste;

  // Multiply with tick_time() for the duration left after the next tick
  double duration_left = old_remaining_ticks * action -> tick_time();

  // Add the added seconds
  duration_left += extra_seconds;

  action -> player_buff();

  added_seconds += extra_seconds;

  int new_remaining_ticks = action -> hasted_num_ticks( duration_left );
  num_ticks += ( new_remaining_ticks - old_remaining_ticks );

  if ( sim -> debug )
  {
    log_t::output( sim, "%s extends duration of %s on %s by %.1f second(s). h: %.2f => %.2f, num_t: %d => %d, rem_t: %d => %d",
                   action -> player -> name(), name(), player -> name(), extra_seconds,
                   old_haste_factor, ( 1.0 / action -> player_haste ),
                   old_num_ticks, num_ticks,
                   old_remaining_ticks, new_remaining_ticks );
  }
  else if ( sim -> log )
  {
    log_t::output( sim, "%s extends duration of %s on %s by %.1f second(s).", action -> player -> name(), name(), player -> name(), extra_seconds );
  }

  recalculate_ready();
}
Example #6
0
void dot_t::refresh_duration()
{
  if ( ! ticking )
    return;

  // Make sure this DoT is still ticking......
  assert( tick_event );

  if ( sim -> log )
    log_t::output( sim, "%s refreshes duration of %s on %s", action -> player -> name(), name(), player -> name() );

  action -> player_buff();

  current_tick = 0;
  added_ticks = 0;
  added_seconds = 0;
  num_ticks = action -> hasted_num_ticks();
  recalculate_ready();
}