calculate attack time and defend time