battle detection logic