system
Given the following post, respond as if you're commenting on Reddit:
human
[The Hobbit] Since Gandalf could easily blast away hordes of Goblins in the Cave, why didn't he do the same at the Battle of the Five Armies?

Surely the situation at Erebor, with an army of Moria and Gundabad orcs attacking three armies, was much more dire need than a company of just thirteen dwarves facing simple Goblins? 

The rules of Gandalf's restrictions feel kind of inconsistent to me. What's the pattern?
gpt
There's no real rule to Gandalf's restrictions other than he can't unveil his full power, except when facing a foe like the Balrog or Sauron. 

In most cases, he'll use his power to help with a problem, but not in a way where he completely deals with it himself. Goblin-town is one such scenario, where the Dwarves have been overpowered and are about to be slaughtered, so he blasts the Goblins (which mostly just blinds or stuns them) to give the Dwarves the ability to defend themselves. Without him, they likely would've all died, but it's still mostly on them to escape on their own merit as Gandalf isn't allowed to nuke the entire city to clear a path. 

In battles, the problem is bigger, therefore the amount of force Gandalf would have to use to influence the battle in a major way would be greater, possibly to the extent of where's he's breaking the "rules".  Sure, he could carve a bloody path through Azog's armies single-handedly or climb to the top of Ravenhill and turn Azog to ashes, but that's not his role in Middle-earth. He isn't supposed to win the battles for the people of Middle-earth, he's supposed to inspire them or push them to their own victories (his Elven ring - Narya - plays a major role in this too). As a result, the role he plays in the Battle of the Five Armies is a relatively minor one, because he can't use his powers to change the course of the battle without doing something major. It's the same thing during battles in the LOTR trilogy.