I think this is a film I'm thinking of because I can't think of what else it can be.
Basically there are the heroes fighting a lot of bad guys, and they realise they need to kill the leader for all the rest to be destroyed. I'm not sure what the enemy is but it could robots, aliens, mythical creatures, I don't know. It might not even be the leader thst needs to be destroyed, it might be the 'heart' or something.
It's not Game of Thrones because that's what reminded me in the first place, and I can very nearly visualise it. Google hasn't helped.
It's one of those annoying memories that is just out of reach. Any help would be appreciated.