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;
}
Beispiel #2
0
void absorb_t::impact( player_t* t, int impact_result, double travel_dmg=0 )
{
  if ( travel_dmg > 0 )
  {
    assess_damage( t, travel_dmg, ABSORB, impact_result );
  }
}
Beispiel #3
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 );
}
Beispiel #4
0
void heal_t::impact( player_t* t, int impact_result, double travel_heal=0 )
{
  assess_damage( t, travel_heal, HEAL_DIRECT, impact_result );

  if ( num_ticks > 0 )
  {
    if ( dot_behavior != DOT_REFRESH ) dot -> cancel();
    dot -> action = this;
    dot -> num_ticks = hasted_num_ticks();
    dot -> current_tick = 0;
    dot -> added_ticks = 0;
    if ( dot -> ticking )
    {
      assert( dot -> tick_event );
      if ( ! channeled )
      {
        // Recasting a dot while it's still ticking gives it an extra tick in total
        dot -> num_ticks++;
      }
    }
    else
    {
      dot -> schedule_tick();
    }
    dot -> recalculate_ready();
    if ( sim -> debug )
      log_t::output( sim, "%s extends dot-ready to %.2f for %s (%s)",
                     player -> name(), dot -> ready, name(), dot -> name() );
  }
}
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 );
}
Beispiel #6
0
void absorb_t::impact( action_state_t* s )
{
  assess_damage( type == ACTION_HEAL ? HEAL_DIRECT : DMG_DIRECT, s );
}