Esempio n. 1
0
void heal_t::tick( dot_t* d )
{
  if ( sim -> debug )
    log_t::output( sim, "%s ticks (%d of %d)", name(), d -> current_tick, d -> num_ticks );

  result = RESULT_HIT;

  player_tick();

  target_debuff( heal_target[0], HEAL_OVER_TIME );

  if ( tick_may_crit )
  {
    if ( rng[ RESULT_CRIT ] -> roll( crit_chance( 0 ) ) )
    {
      result = RESULT_CRIT;
    }
  }

  tick_dmg = calculate_tick_damage();

  assess_damage( heal_target[0], tick_dmg, HEAL_OVER_TIME, result );

  if ( callbacks ) action_callback_t::trigger( player -> tick_callbacks[ result ], this );

  stats -> add_tick( d -> time_to_tick );
}
Esempio n. 2
0
void action_t::execute()
{
  if ( sim -> log && ! dual ) 
  {
    log_t::output( sim, "%s performs %s (%.0f)", player -> name(), name(), 
                   player -> resource_current[ player -> primary_resource() ] );
  }

  if ( observer ) *observer = 0;

  player_buff();

  target_debuff( DMG_DIRECT );

  calculate_result();

  consume_resource();

  if ( result_is_hit() )
  {
    calculate_direct_damage();

    if ( direct_dmg > 0 )
    {
      assess_damage( direct_dmg, DMG_DIRECT );
    }
    if ( num_ticks > 0 )
    {
      if ( dot_behavior == DOT_REFRESH )
      {
        current_tick = 0;
        if ( ! ticking ) schedule_tick();
      }
      else
      {
        if ( ticking ) cancel();
        snapshot_haste = haste();
        schedule_tick();
      }
    }
  }
  else
  {
    if ( sim -> log )
    {
      log_t::output( sim, "%s avoids %s (%s)", sim -> target -> name(), name(), util_t::result_type_string( result ) );
      log_t::miss_event( this );
    }
  }

  update_ready();

  if ( ! dual ) update_stats( DMG_DIRECT );

  schedule_travel();

  if ( repeating && ! proc ) schedule_execute();

  if ( harmful ) player -> in_combat = true;
}
Esempio n. 3
0
void heal_t::execute()
{
  if ( ! initialized )
  {
    sim -> errorf( "action_t::execute: action %s from player %s is not initialized.\n", name(), player -> name() );
    assert( 0 );
  }

  if ( sim -> log && ! dual )
  {
    log_t::output( sim, "%s performs %s (%.0f)", player -> name(), name(),
                   player -> resource_current[ player -> primary_resource() ] );
  }

  player_buff();

  total_heal = 0;

  for ( unsigned int i = 0; i < heal_target.size(); i++ )
  {
    target_debuff( heal_target[ i ], HEAL_DIRECT );

    calculate_result();

    direct_dmg = calculate_direct_damage();

    schedule_travel( heal_target[ i ] );
  }

  consume_resource();

  update_ready();

  if ( ! dual ) stats -> add_execute( time_to_execute );

  if ( harmful ) player -> in_combat = true;

  if ( repeating && ! proc ) schedule_execute();


  // Add options found in spell_t::execute()
  if ( player -> last_foreground_action == this )
    player -> debuffs.casting -> expire();

  if ( harmful && callbacks )
  {
    if ( result != RESULT_NONE )
    {
      action_callback_t::trigger( player -> heal_callbacks[ result ], this );
    }
    if ( ! background ) // OnSpellCast
    {
      action_callback_t::trigger( player -> heal_callbacks[ RESULT_NONE ], this );
    }
  }
}
Esempio n. 4
0
void action_t::tick()
{
  if ( sim -> debug ) log_t::output( sim, "%s ticks (%d of %d)", name(), current_tick, num_ticks );

  result = RESULT_HIT;

  // Older tests indicated that crit debuffs are calculated at the time of the cast, not the ticks.
  // It's possible that this has now changed, but would require testing to be certain.
  double save_target_crit = target_crit;

  target_debuff( DMG_OVER_TIME );

  target_crit = save_target_crit;

  if ( tick_may_crit )
  {
    int delta_level = sim -> target -> level - player -> level;
    
    if ( rng[ RESULT_CRIT ] -> roll( crit_chance( delta_level ) ) )
    {
      result = RESULT_CRIT;
      action_callback_t::trigger( player -> spell_result_callbacks[ RESULT_CRIT ], this );
      if ( channeled )
      {
        action_callback_t::trigger( player -> spell_direct_result_callbacks[ RESULT_CRIT ], this );
      }
    }
  }

  calculate_tick_damage();

  assess_damage( tick_dmg, DMG_OVER_TIME );

  action_callback_t::trigger( player -> tick_callbacks, this );

  update_stats( DMG_OVER_TIME );
}