Implementing speed boosts in a flight game

I’m working on a flying game right now that uses a very simple state machine to track the player’s state and handle input. I have four states defined for ordinary flight at different speeds (Let’s call them normal, subsonic, sonic, and supersonic), each with their own camera behavior and handling characteristics, and each defined using subclasses and polymorphism. So far so good. Now I want to add in the ability to get short speed boosts when the player flies through a bonus ring or uses a boost item or something.

My first instinct was to just add another state for the boost that ramps up the speed over a few seconds and then returns to the proper flying state when finished. However, I want to have boosts from different sources behave differently: maybe one has a longer duration, or a different acceleration curve, or something. And they should stack with one another.

What would be a good way to implement this? I started with just adding more and more states, like BoostFlyingState, RingBoostFlyingState, BoostAndRingBoostFlyingState, etc etc, but this pattern seems like a bad idea for lots and lots of reasons.

Classes are there to solve problems. If a class isn’t the best solution, don’t use one.

But, why not have a class tempBoost with member vars ParticleTrail, timeLeft, boostAmount. Make some base gameObject with an array of tempBoostTypes (or child them all,) set for picking up a ring, a power cube, etc… . Each object has a link to the exact tempBoost it gives, or NULL for none.

If they stack, then the player never is a tempBoost. Instead they have their regular status, and a list (possibly empty) of all the tempBoosts that apply.