Beispiel #1
0
bool MoveTurretOrShoot( Tank * pEnemy, Tank & self, World & world, model::Move& move, double offset )
{
	double angle_to_enemy = self.GetTurretAngleTo(*pEnemy);

    if (angle_to_enemy + offset > ( MIN_ANGLE) ) 
	{	
		move.set_turret_turn(1.0);  
    } 
	else if (angle_to_enemy + offset < ( -MIN_ANGLE ) ) 
	{
		move.set_turret_turn(-1.0);
	} 
	else 
	{
		//vector<Tank> t = world.tanks();

		//if ( ! EnemyBlocked(pEnemy, self, t) ) /* decide to shoot here, path may block */
		//{
			/* burst if we almoust alone */

			if ( EnemyIsWalkingDead( pEnemy ) || self.premium_shell_count() > 3 )
			{
				move.set_fire_type(PREMIUM_PREFERRED);
			}
			else
			{
				move.set_fire_type(REGULAR_FIRE);
			}

			return true;
		//}
	}

	return false;
}
Beispiel #2
0
void Action::applyAction(model::Move &move)
{
    if (left < 100)
        move.set_left_track_power(left);
    if (right < 100)
        move.set_right_track_power(right);
    if (turretRotate < 100)
        move.set_turret_turn(turretRotate);
    if (fireType != model::UNKNOWN_FIRE)
        move.set_fire_type(fireType);
}