The rocket doesn't require sun's gravity, it has to overcome earth's gravity and then its own mission. A gravity assists around a planet changes the velocity of a rocket (relative to the Sun) by entering and leaving the gravitational field of a planet. The rocket speed increases as it approaches the planet and decreases while escaping its gravitational pull (which is approximately the same). Because the planet orbits the sun, the rocket sometimes is affected by this motion during the maneuver. To increase speed, the rocket flies with the movement of the planet (taking a small amount of the planet's orbital energy); to decrease speed, the rockets fly against the movement of the planet.