Attempted to fix end-of-battle bug. Still not fixed but battle code is a bit better