Ejemplo n.º 1
0
void dot_t::schedule_tick()
{
  if ( sim.debug )
    sim.out_debug.printf( "%s schedules tick for %s on %s", source -> name(), name(), target -> name() );

  if ( current_tick == 0 )
  {
    if ( current_action -> tick_zero )
    {
      time_to_tick = timespan_t::zero();
      current_action -> tick( this );
      if ( current_tick == num_ticks )
      {
        last_tick();
        return;
      }
    }
  }

  time_to_tick = current_action -> tick_time( state -> haste );

  tick_event = new ( sim ) dot_tick_event_t( this, time_to_tick );

  ticking = true;

  if ( current_action -> channeled )
  {
    // FIXME: Find some way to make this more realistic - the actor shouldn't have to recast quite this early
    // Response: "Have to"?  It might be good to recast early - since the GCD will end sooner. Depends on the situation. -ersimont
    expr_t* expr = current_action -> early_chain_if_expr;
    if ( ( ( current_action -> chain && current_tick + 1 == num_ticks )
           || ( current_tick > 0
                && expr
                && expr -> success()
                && current_action -> player -> gcd_ready <= sim.current_time ) )
         && current_action -> ready()
         && !is_higher_priority_action_available() )
    {
      // FIXME: We can probably use "source" instead of "action->player"

      current_action -> player -> channeling = 0;
      current_action -> player -> gcd_ready = sim.current_time + current_action -> gcd();
      current_action -> execute();
      if ( current_action -> result_is_hit( current_action -> execute_state -> result ) )
      {
        current_action -> player -> channeling = current_action;
      }
      else
      {
        cancel();
        current_action -> player -> schedule_ready();
      }
    }
    else
    {
      current_action -> player -> channeling = current_action;
    }
  }
}
Ejemplo n.º 2
0
void dot_t::schedule_tick()
{
  if ( sim.debug )
    sim.out_debug.printf( "%s schedules tick for %s on %s", source -> name(), name(), target -> name() );

  time_to_tick = current_action -> tick_time( state -> haste );
  assert( time_to_tick > timespan_t::zero() && "A Dot needs a positive tick time!" );

  // Recalculate num_ticks:
  num_ticks = current_tick + as<int>(std::ceil( remains() / time_to_tick ));
  // NOTE: Last tick factor has to be computed after time_to_tick is set (and after the dot has an
  // end event).
  last_tick_factor = current_action -> last_tick_factor( this, time_to_tick, remains() );

  tick_event = new ( sim ) dot_tick_event_t( this, time_to_tick );

  if ( current_action -> channeled )
  {
    // FIXME: Find some way to make this more realistic - the actor shouldn't have to recast quite this early
    // Response: "Have to"?  It might be good to recast early - since the GCD will end sooner. Depends on the situation. -ersimont
    expr_t* expr = current_action -> early_chain_if_expr;
    if ( ( ( current_action -> chain && current_tick + 1 == num_ticks )
           || ( current_tick > 0
                && expr
                && expr -> success()
                && current_action -> player -> gcd_ready <= sim.current_time() ) )
         && current_action -> ready()
         && !is_higher_priority_action_available() )
    {
      // FIXME: We can probably use "source" instead of "action->player"

      current_action -> player -> channeling = 0;
      current_action -> player -> gcd_ready = sim.current_time() + current_action -> gcd();
      current_action -> execute();
      if ( current_action -> result_is_hit( current_action -> execute_state -> result ) )
      {
        current_action -> player -> channeling = current_action;
      }
      else
        cancel();
    }
    else
    {
      current_action -> player -> channeling = current_action;
    }
  }
}