damage calculate optimization