Example #1
0
void cooldown_t::reset( bool require_reaction )
{
    bool was_down = down();
    ready = ready_init();
    if ( last_start > sim.current_time() )
        last_start = timespan_t::zero();
    if ( charges == 1 )
        current_charge = charges;
    else if ( current_charge < charges )
        current_charge ++;
    if ( require_reaction && player )
    {
        if ( was_down )
            reset_react = sim.current_time() + player -> total_reaction_time();
    }
    else
    {
        reset_react = timespan_t::zero();
    }
    if ( current_charge == charges )
    {
        event_t::cancel( recharge_event );
        last_charged = sim.current_time();
    }
    event_t::cancel( ready_trigger_event );
    if ( player )
    {
        player -> trigger_ready();
    }
}
Example #2
0
void cooldown_t::reset_init()
{
    ready = ready_init();
    last_start = timespan_t::zero();
    last_charged = timespan_t::zero();
    reset_react = timespan_t::zero();

    current_charge = charges;

    recharge_event = nullptr;
    ready_trigger_event = nullptr;
}
cooldown_t::cooldown_t( const std::string& n, sim_t& s ) :
  sim( s ),
  player( nullptr ),
  name_str( n ),
  duration( timespan_t::zero() ),
  ready( ready_init() ),
  reset_react( timespan_t::zero() ),
  charges( 1 ),
  current_charge( 1 ),
  recharge_event( nullptr ),
  ready_trigger_event( nullptr ),
  last_start( timespan_t::zero() ),
  recharge_multiplier( 1.0 )
{}
void cooldown_t::reset( bool require_reaction )
{
  bool was_down = down();
  ready = ready_init();
  if ( last_start > sim.current_time )
    last_start = timespan_t::zero();
  current_charge = charges;
  if ( require_reaction && player )
  {
    if ( was_down )
      reset_react = sim.current_time + player -> total_reaction_time();
  }
  else
  {
    reset_react = timespan_t::zero();
  }
  core_event_t::cancel( recharge_event );
  core_event_t::cancel( ready_trigger_event );
}