don't notify role if people are winning

This commit is contained in:
Alberto Xamin 2023-01-24 21:48:01 +01:00
parent 18d46f3ffc
commit 1e5c645c5e
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2

View File

@ -743,8 +743,22 @@ class Game:
# self.dead_players.append(corpse)
self.notify_room()
G.sio.emit('chat_message', room=self.name, data=f'_died|{player.name}')
for p in self.players:
if not p.is_bot:
p.notify_self()
# self.players_map = {c.name: i for i, c in enumerate(self.players)}
if self.started:
G.sio.emit('chat_message', room=self.name, data=f'_died_role|{player.name}|{player.role.name}')
print(f'{self.name}: Check win status')
attacker_role = None
if player.attacker and player.attacker in self.players:
attacker_role = player.attacker.role
winners = [p for p in self.players if p.role is not None and p.role.on_player_death([p for p in self.get_alive_players() if not p.is_ghost], initial_players=self.initial_players, dead_role=player.role, attacker_role=attacker_role)]
if not self.attack_in_progress and len(winners) > 0 and not self.someone_won:
return self.announces_winners(winners)
elif len(winners) > 0 and not self.someone_won: # non tutti hanno risposto, ma ci sono vincitori.
self.pending_winners = winners
else:
if not isinstance(player.role, roles.Sheriff) and not self.initial_players == 3:
G.sio.emit('notify_dead_role', room=self.name, data={
'name': player.name,
@ -756,20 +770,6 @@ class Game:
'avatar': player.avatar,
'role': player.role.__dict__,
})
for p in self.players:
if not p.is_bot:
p.notify_self()
# self.players_map = {c.name: i for i, c in enumerate(self.players)}
if self.started:
print(f'{self.name}: Check win status')
attacker_role = None
if player.attacker and player.attacker in self.players:
attacker_role = player.attacker.role
winners = [p for p in self.players if p.role is not None and p.role.on_player_death([p for p in self.get_alive_players() if not p.is_ghost], initial_players=self.initial_players, dead_role=player.role, attacker_role=attacker_role)]
if not self.attack_in_progress and len(winners) > 0 and not self.someone_won:
return self.announces_winners(winners)
elif len(winners) > 0 and not self.someone_won: # non tutti hanno risposto, ma ci sono vincitori.
self.pending_winners = winners
for i in range(len(player.gold_rush_equipment)):
self.deck.shop_deck.append(player.gold_rush_equipment.pop()) # vulture sam doesnt get these cards