Exemple #1
0
double absorb_t::calculate_direct_damage()
{
  double dmg = sim -> range( base_dd_min, base_dd_max );

  if ( round_base_dmg ) dmg = floor( dmg + 0.5 );

  if ( dmg == 0 && weapon_multiplier == 0 && direct_power_mod == 0 ) return 0;

  double base_direct_dmg = dmg;

  dmg += base_dd_adder + player_dd_adder + target_dd_adder;

  dmg += direct_power_mod * total_power();
  dmg *= total_dd_multiplier();

  double init_direct_dmg = dmg;

  if ( ! sim -> average_range ) dmg = floor( dmg + sim -> real() );

  if ( sim -> debug )
  {
    log_t::output( sim, "%s heal for %s: dd=%.0f i_dd=%.0f b_dd=%.0f mod=%.2f power=%.0f b_mult=%.2f p_mult=%.2f t_mult=%.2f",
                   player -> name(), name(), dmg, init_direct_dmg, base_direct_dmg, direct_power_mod,
                   total_power(), base_multiplier * base_dd_multiplier, player_multiplier, target_multiplier );
  }

  return dmg;
}
double action_t::calculate_direct_damage()
{
  direct_dmg = resisted_dmg = blocked_dmg = 0;

  double base_direct_dmg = sim -> range( base_dd_min, base_dd_max );

  if ( base_direct_dmg == 0 ) return 0;
  
  direct_dmg  = base_direct_dmg + base_dd_adder + player_dd_adder + target_dd_adder;
  if ( weapon_multiplier > 0 )
  {
    // x% weapon damage + Y
    // e.g. Obliterate, Shred, Backstab
    direct_dmg += calculate_weapon_damage();
    direct_dmg *= weapon_multiplier;
    
    // OH penalty
    if ( weapon && weapon -> slot == SLOT_OFF_HAND )
      direct_dmg *= 0.5;
  }
  direct_dmg += direct_power_mod * total_power();
  direct_dmg *= total_dd_multiplier();

  double init_direct_dmg = direct_dmg;

  if ( result == RESULT_GLANCE )
  {
    double delta_skill = ( sim -> target -> level - player -> level ) * 5.0;

    if ( delta_skill < 0.0 )
      delta_skill = 0.0;

    double max_glance = 1.3 - 0.03 * delta_skill;

    if ( max_glance > 0.99 ) 
      max_glance = 0.99;
    else if ( max_glance < 0.2 )
      max_glance = 0.20;

    double min_glance = 1.4 - 0.05 * delta_skill;

    if ( min_glance > 0.91 )
      min_glance = 0.91;
    else if ( min_glance < 0.01 )
      min_glance = 0.01;

    if ( min_glance > max_glance )
    {
      double temp = min_glance;
      min_glance = max_glance;
      max_glance = temp;
    }

    direct_dmg *= sim -> range( min_glance, max_glance ); // 0.75 against +3 targets.
  }
  else if ( result == RESULT_CRIT )
  {
    direct_dmg *= 1.0 + total_crit_bonus();
  }

  if ( ! binary )
  {
    resisted_dmg = resistance() * direct_dmg;
    direct_dmg -= resisted_dmg;
  }

  if ( result == RESULT_BLOCK )
  {
    blocked_dmg = sim -> target -> block_value;
    direct_dmg -= blocked_dmg;
    if ( direct_dmg < 0 ) direct_dmg = 0;
  }

  if ( sim -> debug )
  {
    log_t::output( sim, "%s dmg for %s: dd=%.0f i_dd=%.0f b_dd=%.0f mod=%.2f power=%.0f b_mult=%.2f p_mult=%.2f t_mult=%.2f",
                   player -> name(), name(), direct_dmg, init_direct_dmg, base_direct_dmg, direct_power_mod,
                   total_power(), base_multiplier * base_dd_multiplier, player_multiplier, target_multiplier );
  }

  return direct_dmg;
}