But now there is no variance, only a percent bonus so to speak. If the party would normally get 1000 gold, assuming 25% variance, they should gain an amount between 750 - 1250. Your fix limits this to 1000 - 1250.

Then you must consider the amount of gold the party has before adding the variance to it. What if the party has max gold (9999999) before the battle, Phase 5 adds (I don't know...) 10000 gold, and after calculating variance the party should happen to get 7500 gold, you can't do a simple $game_party.gain_gold(-2500) because now the party *lost* money for winning.

I actually have the solution already, but I'll hide it for now unless someone requests it or someone else figures it out. It's very similar to what you have posted Drago.