public void onScannedRobot(ScannedRobotEvent e) {
        if(target != null && getGunHeat() > 0) {
            if(e.getDistance() >= targetDistance) {
                return;
            }
        }
        target = e.getName();
        targetDistance = e.getDistance();

        // Calculate exact location of the robot
        double absoluteBearing = getHeading() + e.getBearing();
        double bearingFromGun = normalRelativeAngleDegrees(absoluteBearing - getGunHeading());
        
        if(bearingFromGun > 0) {
            turnGunRight(Math.abs(bearingFromGun));
        } else {
            turnGunLeft(Math.abs(bearingFromGun));
        }

        if(getOthers() > 2) {
            if(getEnergy() < 50) {
                fire(1);
            } else {
                fire(3);
            }
        } else {
            if(getEnergy() < 50) {
                fire(1);
            } else {
                fire(3);
            }
        }

        target = null;
    }