The combat engine was the first thing I wrote when I started what would become Archmage Rises. Inspired by this card from Hearthstone, I started rewriting combat to handle multiple opponents and multiple waves of opponents.
You can read more in the forum post:
Rewriting Combat for Multiple Opponents