Implement death checks in battle engine

Downed units are removed from the fight; fight ends if all units on a
side are downed. Also fixed a few glitches.