changed logic of caluculate opponent id