Beispiel #1
0
void MelnormeTrader::calculate()
{
	STACKTRACE;
	Ship::calculate();
	if (weaponObject) {
		if (!weaponObject->exists()) weaponObject = NULL;
		if (fire_weapon) recharge_step += frame_time; else weaponObject = NULL;
	}
}
Beispiel #2
0
void TeronDroneLaser::calculate()
{
	STACKTRACE;
	if ( collecting ) {
		if ( !collecting->exists() ) {
			if ( ship ) {
				//ship->fuel_sap -= drone->asteroid_value;
				//ship->handle_damage( ship );
				ship->handle_fuel_sap(this, -drone->asteroid_value);
			} else {
				drone->resource += drone->asteroid_value;
			}
		}
		collecting = NULL;
	}
	Laser::calculate();
}
Beispiel #3
0
void TeronBuilder::calculate()
{
	STACKTRACE;
	if ( selection_sprite_step < 0 ) {
		selection_sprite_step += TERON_SELECTION_ANIM_RATE;
		selection_sprite_index++;
		if ( selection_sprite_index == data->TERON_SELECTION_SPRITE->frames() )
			selection_sprite_index = 0;
	}else selection_sprite_step -= frame_time;
	if ( collecting ) {
		if ( !collecting->exists() ) {
			//fuel_sap -= asteroid_value;
			//handle_damage( this );
			handle_fuel_sap(this, -asteroid_value);
		}
		collecting = NULL;
	} else {
		if ( collect_step <= 0 && collectRange ) {
			Query q;
			for( q.begin( this, bit(LAYER_CBODIES), collectRange ); q.currento; q.next() ) {
				if ( q.currento->isAsteroid() ) {
					collecting = q.currento;
					game->add( new Laser( this, trajectory_angle( collecting ),
						pallete_color[TERON_COLLECT_BEAM_COLOR], distance( collecting ),
						TERON_COLLECT_BEAM_DAMAGE, time_ratio, this, 0, false ));
					collect_step = TERON_BUILDER_COLLECT_RATE;
					break;
				}
			}
			q.end();
		} else {
			collect_step -= frame_time;
		}
	}
	if ( !(current_drone && current_drone->exists()) )
		current_drone = NULL;
	Ship::calculate();
}