Storycraft: when picking a new random player in the middle of a game, avoid picking the same person as the last turn
This commit is contained in:
parent
b133b37d61
commit
7ae2a75732
|
@ -616,10 +616,14 @@ class Storycraft(Module):
|
|||
random_player = players[random.randint(1,len(players))-1]
|
||||
return self._assign_game_to_player(game_id, random_player.id)
|
||||
elif count_by_latest_player >= game.lines_per_turn and len(lines) < game.game_length:
|
||||
# player has reached the max, get a random player to assign
|
||||
# player has reached the max, get a random different player to assign
|
||||
players = self._get_player_list_for_game(game.id)
|
||||
random_player = players[random.randint(1,len(players))-1]
|
||||
return self._assign_game_to_player(game_id, random_player.id)
|
||||
random_player_id = latest_player_id
|
||||
if len(players) > 1:
|
||||
while random_player_id == latest_player_id:
|
||||
random_player = players[random.randint(1,len(players))-1]
|
||||
random_player_id = random_player.id
|
||||
return self._assign_game_to_player(game_id, random_player_id)
|
||||
elif count_by_latest_player >= game.lines_per_turn and len(lines) >= game.game_length:
|
||||
# end of game
|
||||
return self._end_game(game_id)
|
||||
|
|
Loading…
Reference in New Issue