Fixed an unexpected case in the end battle

A setting of the winner could be wrong in the case of a player
against an AI with the same id, added a check to solve this case