wip-rewrite dead logic
This commit is contained in:
		
							parent
							
								
									57b9520eed
								
							
						
					
					
						commit
						7da9e47696
					
				| @ -67,6 +67,12 @@ class IDalton(CardEvent): | |||||||
|         self.desc = "Chi ha carte blu in gioco ne scarta 1 a sua scelta" |         self.desc = "Chi ha carte blu in gioco ne scarta 1 a sua scelta" | ||||||
|         self.desc_eng = "" |         self.desc_eng = "" | ||||||
| 
 | 
 | ||||||
|  | class CittaFantasma(CardEvent): | ||||||
|  |     def __init__(self): | ||||||
|  |         super().__init__("Città Fantasma", "👻") | ||||||
|  |         self.desc = "Tutti i giocatori morti tornano in vita al proprio turno, non possono morire e pescano 3 carte invece che 2. Quando terminano il turno tornano morti." | ||||||
|  |         self.desc_eng = "" | ||||||
|  | 
 | ||||||
| class MezzogiornoDiFuoco(CardEvent): | class MezzogiornoDiFuoco(CardEvent): | ||||||
|     def __init__(self): |     def __init__(self): | ||||||
|         super().__init__("Mezzogiorno di Fuoco", "🔥") |         super().__init__("Mezzogiorno di Fuoco", "🔥") | ||||||
| @ -77,7 +83,7 @@ def get_all_events(): | |||||||
|     cards = [ |     cards = [ | ||||||
|        Benedizione(), |        Benedizione(), | ||||||
|        Maledizione(), |        Maledizione(), | ||||||
|     #    CittaFantasma(), |        CittaFantasma(), | ||||||
|        CorsaAllOro(), |        CorsaAllOro(), | ||||||
|        IDalton(), |        IDalton(), | ||||||
|        IlDottore(), |        IlDottore(), | ||||||
|  | |||||||
| @ -151,7 +151,7 @@ class Game: | |||||||
|         attacker.notify_self() |         attacker.notify_self() | ||||||
|         self.waiting_for = 0 |         self.waiting_for = 0 | ||||||
|         self.readyCount = 0 |         self.readyCount = 0 | ||||||
|         for p in self.players: |         for p in self.get_alive_players(): | ||||||
|             if p != attacker: |             if p != attacker: | ||||||
|                 if p.get_banged(attacker=attacker): |                 if p.get_banged(attacker=attacker): | ||||||
|                     self.waiting_for += 1 |                     self.waiting_for += 1 | ||||||
| @ -165,7 +165,7 @@ class Game: | |||||||
|         attacker.notify_self() |         attacker.notify_self() | ||||||
|         self.waiting_for = 0 |         self.waiting_for = 0 | ||||||
|         self.readyCount = 0 |         self.readyCount = 0 | ||||||
|         for p in self.players: |         for p in self.get_alive_players(): | ||||||
|             if p != attacker: |             if p != attacker: | ||||||
|                 if p.get_indians(attacker=attacker): |                 if p.get_indians(attacker=attacker): | ||||||
|                     self.waiting_for += 1 |                     self.waiting_for += 1 | ||||||
| @ -199,24 +199,26 @@ class Game: | |||||||
|             self.get_player_named(target_username).notify_self() |             self.get_player_named(target_username).notify_self() | ||||||
| 
 | 
 | ||||||
|     def emporio(self): |     def emporio(self): | ||||||
|         self.available_cards = [self.deck.draw(True) for i in range(len([p for p in self.players if p.lives > 0]))] |         pls = self.get_alive_players() | ||||||
|         self.players[self.turn].pending_action = pl.PendingAction.CHOOSE |         self.available_cards = [self.deck.draw(True) for i in range(len(pls))] | ||||||
|         self.players[self.turn].choose_text = 'choose_card_to_get' |         pls[self.turn].pending_action = pl.PendingAction.CHOOSE | ||||||
|         self.players[self.turn].available_cards = self.available_cards |         pls[self.turn].choose_text = 'choose_card_to_get' | ||||||
|         self.players[self.turn].notify_self() |         pls[self.turn].available_cards = self.available_cards | ||||||
|  |         pls[self.turn].notify_self() | ||||||
| 
 | 
 | ||||||
|     def respond_emporio(self, player, i): |     def respond_emporio(self, player, i): | ||||||
|         player.hand.append(self.available_cards.pop(i)) |         player.hand.append(self.available_cards.pop(i)) | ||||||
|         player.available_cards = [] |         player.available_cards = [] | ||||||
|         player.pending_action = pl.PendingAction.WAIT |         player.pending_action = pl.PendingAction.WAIT | ||||||
|         player.notify_self() |         player.notify_self() | ||||||
|         nextPlayer = self.players[(self.turn + (len(self.players)-len(self.available_cards))) % len(self.players)] |         pls = self.get_alive_players() | ||||||
|  |         nextPlayer = pls[(pls.index(self.players[self.turn])+(len(pls)-len(self.available_cards))) % len(pls)] | ||||||
|         if nextPlayer == self.players[self.turn]: |         if nextPlayer == self.players[self.turn]: | ||||||
|             self.players[self.turn].pending_action = pl.PendingAction.PLAY |             self.players[self.turn].pending_action = pl.PendingAction.PLAY | ||||||
|             self.players[self.turn].notify_self() |             self.players[self.turn].notify_self() | ||||||
|         else: |         else: | ||||||
|             nextPlayer.pending_action = pl.PendingAction.CHOOSE |             nextPlayer.pending_action = pl.PendingAction.CHOOSE | ||||||
|             self.players[self.turn].choose_text = 'choose_card_to_get' |             nextPlayer.choose_text = 'choose_card_to_get' | ||||||
|             nextPlayer.available_cards = self.available_cards |             nextPlayer.available_cards = self.available_cards | ||||||
|             nextPlayer.notify_self() |             nextPlayer.notify_self() | ||||||
| 
 | 
 | ||||||
| @ -260,11 +262,14 @@ class Game: | |||||||
|                 self.players[self.turn].notify_self() |                 self.players[self.turn].notify_self() | ||||||
| 
 | 
 | ||||||
|     def next_player(self): |     def next_player(self): | ||||||
|  |         pls = self.get_alive_players() | ||||||
|         if self.check_event(ceh.CorsaAllOro): |         if self.check_event(ceh.CorsaAllOro): | ||||||
|             return self.players[(self.turn - 1) % len(self.players)] |             return pls[(pls.index(self.players[self.turn]) - 1) % len(pls)] | ||||||
|         return self.players[(self.turn + 1) % len(self.players)] |         return pls[(pls.index(self.players[self.turn]) + 1) % len(pls)] | ||||||
| 
 | 
 | ||||||
|     def play_turn(self): |     def play_turn(self): | ||||||
|  |         if self.players[self.turn].lives <= 0: | ||||||
|  |             return self.next_turn() | ||||||
|         self.player_bangs = 0 |         self.player_bangs = 0 | ||||||
|         if isinstance(self.players[self.turn].role, roles.Sheriff): |         if isinstance(self.players[self.turn].role, roles.Sheriff): | ||||||
|             self.deck.flip_event() |             self.deck.flip_event() | ||||||
| @ -313,11 +318,12 @@ class Game: | |||||||
| 
 | 
 | ||||||
|     def next_turn(self): |     def next_turn(self): | ||||||
|         if self.shutting_down: return |         if self.shutting_down: return | ||||||
|         if len(self.players) > 0: |         pls = self.get_alive_players() | ||||||
|  |         if len(pls) > 0: | ||||||
|             if self.check_event(ceh.CorsaAllOro): |             if self.check_event(ceh.CorsaAllOro): | ||||||
|                 self.turn = (self.turn - 1) % len(self.players) |                 self.turn = (pls.index(self.players[self.turn]) - 1) % len(pls) | ||||||
|             else: |             else: | ||||||
|                 self.turn = (self.turn + 1) % len(self.players) |                 self.turn = (pls.index(self.players[self.turn]) + 1) % len(pls) | ||||||
|             self.play_turn() |             self.play_turn() | ||||||
| 
 | 
 | ||||||
|     def notify_event_card(self): |     def notify_event_card(self): | ||||||
| @ -336,15 +342,16 @@ class Game: | |||||||
| 
 | 
 | ||||||
|     def handle_disconnect(self, player: pl.Player): |     def handle_disconnect(self, player: pl.Player): | ||||||
|         print(f'player {player.name} left the game {self.name}') |         print(f'player {player.name} left the game {self.name}') | ||||||
|         if player in self.players: |         # if player in self.players: | ||||||
|         if self.disconnect_bot and self.started: |         if self.disconnect_bot and self.started: | ||||||
|             player.is_bot = True |             player.is_bot = True | ||||||
|             eventlet.sleep(15) # he may reconnect |             eventlet.sleep(15) # he may reconnect | ||||||
|             player.notify_self() |             player.notify_self() | ||||||
|         else: |         else: | ||||||
|             self.player_death(player=player, disconnected=True) |             self.player_death(player=player, disconnected=True) | ||||||
|         else: |         # else: | ||||||
|             self.dead_players.remove(player) |         #     player.lives = 0 | ||||||
|  |             # self.players.remove(player) | ||||||
|         if len([p for p in self.players if not p.is_bot])+len([p for p in self.dead_players if not p.is_bot]) == 0: |         if len([p for p in self.players if not p.is_bot])+len([p for p in self.dead_players if not p.is_bot]) == 0: | ||||||
|             print(f'no players left in game {self.name}') |             print(f'no players left in game {self.name}') | ||||||
|             self.shutting_down = True |             self.shutting_down = True | ||||||
| @ -372,13 +379,16 @@ class Game: | |||||||
|         if (self.waiting_for > 0): |         if (self.waiting_for > 0): | ||||||
|             self.responders_did_respond_resume_turn() |             self.responders_did_respond_resume_turn() | ||||||
| 
 | 
 | ||||||
|         if not player in self.players: return |         if player.is_dead: return | ||||||
|         index = self.players.index(player) |         # if not player in self.players: return | ||||||
|         died_in_his_turn = self.started and index == self.turn |         # index = self.players.index(player) | ||||||
|         if self.started and index <= self.turn: |         # died_in_his_turn = self.started and index == self.turn | ||||||
|             self.turn -= 1 |         # if self.started and index <= self.turn: | ||||||
|  |         #     self.turn -= 1 | ||||||
|  |         player.lives = 0 | ||||||
| 
 | 
 | ||||||
|         corpse = self.players.pop(index) |         # corpse = self.players.pop(index) | ||||||
|  |         corpse = player | ||||||
|         if not disconnected: |         if not disconnected: | ||||||
|             self.dead_players.append(corpse) |             self.dead_players.append(corpse) | ||||||
|         self.notify_room() |         self.notify_room() | ||||||
| @ -388,23 +398,23 @@ class Game: | |||||||
|         for p in self.players: |         for p in self.players: | ||||||
|             if not p.is_bot: |             if not p.is_bot: | ||||||
|                 p.notify_self() |                 p.notify_self() | ||||||
|         self.players_map = {c.name: i for i, c in enumerate(self.players)} |         # self.players_map = {c.name: i for i, c in enumerate(self.players)} | ||||||
|         if self.started: |         if self.started: | ||||||
|             print('Check win status') |             print('Check win status') | ||||||
|             attacker_role = None |             attacker_role = None | ||||||
|             if player.attacker and player.attacker in self.players: |             if player.attacker and player.attacker in self.players: | ||||||
|                 attacker_role = player.attacker.role |                 attacker_role = player.attacker.role | ||||||
|             winners = [p for p in self.players if p.role != None and p.role.on_player_death(self.players, initial_players=self.initial_players, dead_role=player.role, attacker_role=attacker_role)] |             winners = [p for p in self.players if p.role != None and p.role.on_player_death(self.get_alive_players(), initial_players=self.initial_players, dead_role=player.role, attacker_role=attacker_role)] | ||||||
|             if len(winners) > 0: |             if len(winners) > 0: | ||||||
|                 print('WE HAVE A WINNER') |                 print('WE HAVE A WINNER') | ||||||
|                 for p in self.players: |                 for p in self.get_alive_players(): | ||||||
|                     p.win_status = p in winners |                     p.win_status = p in winners | ||||||
|                     self.sio.emit('chat_message', room=self.name, data=f'_won|{p.name}') |                     self.sio.emit('chat_message', room=self.name, data=f'_won|{p.name}') | ||||||
|                     p.notify_self() |                     p.notify_self() | ||||||
|                 eventlet.sleep(5.0) |                 eventlet.sleep(5.0) | ||||||
|                 return self.reset() |                 return self.reset() | ||||||
| 
 | 
 | ||||||
|             vulture = [p for p in self.players if p.character.check(self, characters.VultureSam)] |             vulture = [p for p in self.get_alive_players() if p.character.check(self, characters.VultureSam)] | ||||||
|             if len(vulture) == 0: |             if len(vulture) == 0: | ||||||
|                 for i in range(len(player.hand)): |                 for i in range(len(player.hand)): | ||||||
|                     self.deck.scrap(player.hand.pop(), True) |                     self.deck.scrap(player.hand.pop(), True) | ||||||
| @ -425,21 +435,21 @@ class Game: | |||||||
|                 vulture[0].notify_self() |                 vulture[0].notify_self() | ||||||
| 
 | 
 | ||||||
|             #se Vulture Sam è uno sceriffo e ha appena ucciso il suo Vice, deve scartare le carte che ha pescato con la sua abilità |             #se Vulture Sam è uno sceriffo e ha appena ucciso il suo Vice, deve scartare le carte che ha pescato con la sua abilità | ||||||
|             if player.attacker and player.attacker in self.players and isinstance(player.attacker.role, roles.Sheriff) and isinstance(player.role, roles.Vice): |             if player.attacker and player.attacker in self.get_alive_players() and isinstance(player.attacker.role, roles.Sheriff) and isinstance(player.role, roles.Vice): | ||||||
|                 for i in range(len(player.attacker.hand)): |                 for i in range(len(player.attacker.hand)): | ||||||
|                     self.deck.scrap(player.attacker.hand.pop(), True) |                     self.deck.scrap(player.attacker.hand.pop(), True) | ||||||
|                 player.attacker.notify_self() |                 player.attacker.notify_self() | ||||||
| 
 | 
 | ||||||
|             greg = [p for p in self.players if p.character.check(self, chd.GregDigger)] |             greg = [p for p in self.get_alive_players() if p.character.check(self, chd.GregDigger)] | ||||||
|             if len(greg) > 0: |             if len(greg) > 0: | ||||||
|                 greg[0].lives = min(greg[0].lives+2, greg[0].max_lives) |                 greg[0].lives = min(greg[0].lives+2, greg[0].max_lives) | ||||||
|             herb = [p for p in self.players if p.character.check(self, chd.HerbHunter)] |             herb = [p for p in self.get_alive_players() if p.character.check(self, chd.HerbHunter)] | ||||||
|             if len(herb) > 0: |             if len(herb) > 0: | ||||||
|                 herb[0].hand.append(self.deck.draw(True)) |                 herb[0].hand.append(self.deck.draw(True)) | ||||||
|                 herb[0].hand.append(self.deck.draw(True)) |                 herb[0].hand.append(self.deck.draw(True)) | ||||||
|                 herb[0].notify_self() |                 herb[0].notify_self() | ||||||
|          |          | ||||||
|         if died_in_his_turn: |         if corpse.is_my_turn: | ||||||
|             self.next_turn() |             self.next_turn() | ||||||
| 
 | 
 | ||||||
|     def reset(self): |     def reset(self): | ||||||
| @ -461,17 +471,22 @@ class Game: | |||||||
|         return isinstance(self.deck.event_cards[0], ev) |         return isinstance(self.deck.event_cards[0], ev) | ||||||
| 
 | 
 | ||||||
|     def get_visible_players(self, player: pl.Player): |     def get_visible_players(self, player: pl.Player): | ||||||
|         i = self.players.index(player) |         pls = self.get_alive_players() | ||||||
|  |         if len(pls) == 0: return [] | ||||||
|  |         i = pls.index(player) | ||||||
|         sight = player.get_sight() |         sight = player.get_sight() | ||||||
|         mindist = 99 if not self.check_event(ce.Agguato) else 1 |         mindist = 99 if not self.check_event(ce.Agguato) else 1 | ||||||
|         return [{ |         return [{ | ||||||
|             'name': self.players[j].name, |             'name': pls[j].name, | ||||||
|             'dist': min([abs(i - j), (i+ abs(j-len(self.players))), (j+ abs(i-len(self.players))), mindist]) + self.players[j].get_visibility() - (player.get_sight(countWeapon=False)-1), |             'dist': min([abs(i - j), (i+ abs(j-len(pls))), (j+ abs(i-len(pls))), mindist]) + pls[j].get_visibility() - (player.get_sight(countWeapon=False)-1), | ||||||
|             'lives': self.players[j].lives, |             'lives': pls[j].lives, | ||||||
|             'max_lives': self.players[j].max_lives, |             'max_lives': pls[j].max_lives, | ||||||
|             'is_sheriff': isinstance(self.players[j].role, roles.Sheriff), |             'is_sheriff': isinstance(pls[j].role, roles.Sheriff), | ||||||
|             'cards': len(self.players[j].hand)+len(self.players[j].equipment) |             'cards': len(pls[j].hand)+len(pls[j].equipment) | ||||||
|         } for j in range(len(self.players)) if i != j] |         } for j in range(len(pls)) if i != j] | ||||||
|  | 
 | ||||||
|  |     def get_alive_players(self): | ||||||
|  |         return [p for p in self.players if p.lives > 0] | ||||||
| 
 | 
 | ||||||
|     def notify_all(self): |     def notify_all(self): | ||||||
|         if self.started: |         if self.started: | ||||||
| @ -487,5 +502,5 @@ class Game: | |||||||
|                 'character': p.character.__dict__ if p.character else None, |                 'character': p.character.__dict__ if p.character else None, | ||||||
|                 'real_character': p.real_character.__dict__ if p.real_character else None, |                 'real_character': p.real_character.__dict__ if p.real_character else None, | ||||||
|                 'icon': p.role.icon if self.initial_players == 3 and p.role else '🤠' |                 'icon': p.role.icon if self.initial_players == 3 and p.role else '🤠' | ||||||
|             } for p in self.players] |             } for p in self.get_alive_players()] | ||||||
|             self.sio.emit('players_update', room=self.name, data=data) |             self.sio.emit('players_update', room=self.name, data=data) | ||||||
|  | |||||||
| @ -328,12 +328,12 @@ class Player: | |||||||
|                 self.sio.emit('chat_message', room=self.game.name, data=f'_special_bart_cassidy|{self.name}') |                 self.sio.emit('chat_message', room=self.game.name, data=f'_special_bart_cassidy|{self.name}') | ||||||
|             if self.lives <= 0: |             if self.lives <= 0: | ||||||
|                 return self.notify_self() |                 return self.notify_self() | ||||||
|         if self.game.check_event(ce.FratelliDiSangue) and self.lives > 1 and not self.is_giving_life and len([p for p in self.game.players if p != self and p.lives < p.max_lives]): |         if self.game.check_event(ce.FratelliDiSangue) and self.lives > 1 and not self.is_giving_life and len([p for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives]): | ||||||
|             self.available_cards = [{ |             self.available_cards = [{ | ||||||
|                 'name': p.name, |                 'name': p.name, | ||||||
|                 'icon': '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', |                 'icon': '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', | ||||||
|                 'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)) |                 'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)) | ||||||
|             } for p in self.game.players if p != self and p.lives < p.max_lives] |             } for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives] | ||||||
|             self.available_cards.append({'icon': '❌'}) |             self.available_cards.append({'icon': '❌'}) | ||||||
|             self.choose_text = 'choose_fratelli_di_sangue' |             self.choose_text = 'choose_fratelli_di_sangue' | ||||||
|             self.pending_action = PendingAction.CHOOSE |             self.pending_action = PendingAction.CHOOSE | ||||||
| @ -344,7 +344,7 @@ class Player: | |||||||
|         else: |         else: | ||||||
|             self.is_giving_life = False |             self.is_giving_life = False | ||||||
|             if isinstance(self.real_character, chd.VeraCuster): |             if isinstance(self.real_character, chd.VeraCuster): | ||||||
|                 self.set_available_character([p.character for p in self.game.players if p != self]) |                 self.set_available_character([p.character for p in self.game.get_alive_players() if p != self]) | ||||||
|             else: |             else: | ||||||
|                 self.pending_action = PendingAction.DRAW |                 self.pending_action = PendingAction.DRAW | ||||||
|         self.notify_self() |         self.notify_self() | ||||||
| @ -365,7 +365,7 @@ class Player: | |||||||
|             self.available_cards = [{ |             self.available_cards = [{ | ||||||
|                 'name': p.name, |                 'name': p.name, | ||||||
|                 'icon': '⭐️' if isinstance(p.role, r.Sheriff) else '🤠' |                 'icon': '⭐️' if isinstance(p.role, r.Sheriff) else '🤠' | ||||||
|             } for p in self.game.players if len(p.equipment) > 0 and p != self] |             } for p in self.game.get_alive_players() if len(p.equipment) > 0 and p != self] | ||||||
|             self.available_cards.append({'icon': '❌'}) |             self.available_cards.append({'icon': '❌'}) | ||||||
|             self.choose_text = 'choose_rimbalzo_player' |             self.choose_text = 'choose_rimbalzo_player' | ||||||
|             self.pending_action = PendingAction.CHOOSE |             self.pending_action = PendingAction.CHOOSE | ||||||
| @ -415,7 +415,7 @@ class Player: | |||||||
|                     card: cs.Card = self.game.deck.draw() |                     card: cs.Card = self.game.deck.draw() | ||||||
|                     self.hand.append(card) |                     self.hand.append(card) | ||||||
|                     if i == 1 and self.character.check(self.game, chars.BlackJack) or self.game.check_event(ce.LeggeDelWest): |                     if i == 1 and self.character.check(self.game, chars.BlackJack) or self.game.check_event(ce.LeggeDelWest): | ||||||
|                         for p in self.game.players: |                         for p in self.game.get_alive_players(): | ||||||
|                             if p != self: |                             if p != self: | ||||||
|                                 p.notify_card(self, card, 'blackjack_special' if self.character.check(self.game, chars.BlackJack) else 'foc.leggedelwest') |                                 p.notify_card(self, card, 'blackjack_special' if self.character.check(self.game, chars.BlackJack) else 'foc.leggedelwest') | ||||||
|                         if card.check_suit(self.game, [cs.Suit.HEARTS, cs.Suit.DIAMONDS]) and self.character.check(self.game, chars.BlackJack): |                         if card.check_suit(self.game, [cs.Suit.HEARTS, cs.Suit.DIAMONDS]) and self.character.check(self.game, chars.BlackJack): | ||||||
| @ -479,7 +479,7 @@ class Player: | |||||||
|                 self.notify_self() |                 self.notify_self() | ||||||
|                 return |                 return | ||||||
|             if isinstance(self.real_character, chd.VeraCuster): |             if isinstance(self.real_character, chd.VeraCuster): | ||||||
|                 self.set_available_character([p.character for p in self.game.players if p != self]) |                 self.set_available_character([p.character for p in self.game.get_alive_players() if p != self]) | ||||||
|             else: |             else: | ||||||
|                 self.pending_action = PendingAction.DRAW |                 self.pending_action = PendingAction.DRAW | ||||||
|             self.notify_self() |             self.notify_self() | ||||||
| @ -560,7 +560,7 @@ class Player: | |||||||
|                 self.hand.append(card) |                 self.hand.append(card) | ||||||
|             else: |             else: | ||||||
|                 self.game.deck.scrap(card, True) |                 self.game.deck.scrap(card, True) | ||||||
|             if self.event_type != 'rissa' or (self.event_type == 'rissa' and self.target_p == [p.name for p in self.game.players if p != self and (len(p.hand)+len(p.equipment)) > 0][-1]): |             if self.event_type != 'rissa' or (self.event_type == 'rissa' and self.target_p == [p.name for p in self.game.get_alive_players() if p != self and (len(p.hand)+len(p.equipment)) > 0][-1]): | ||||||
|                 self.event_type = '' |                 self.event_type = '' | ||||||
|                 self.target_p = '' |                 self.target_p = '' | ||||||
|                 self.choose_action = '' |                 self.choose_action = '' | ||||||
| @ -757,7 +757,7 @@ class Player: | |||||||
|                 print('has mancato') |                 print('has mancato') | ||||||
|                 self.pending_action = PendingAction.RESPOND |                 self.pending_action = PendingAction.RESPOND | ||||||
|                 self.expected_response = self.game.deck.mancato_cards.copy() |                 self.expected_response = self.game.deck.mancato_cards.copy() | ||||||
|                 if self.attacker and self.attacker in self.game.players and isinstance(self.attacker.character, chd.BelleStar) or self.game.check_event(ce.Lazo): |                 if self.attacker and self.attacker in self.game.get_alive_players() and isinstance(self.attacker.character, chd.BelleStar) or self.game.check_event(ce.Lazo): | ||||||
|                     self.expected_response = self.game.deck.mancato_cards_not_green |                     self.expected_response = self.game.deck.mancato_cards_not_green | ||||||
|                 elif self.character.check(self.game, chars.CalamityJanet) and cs.Bang(0, 0).name not in self.expected_response: |                 elif self.character.check(self.game, chars.CalamityJanet) and cs.Bang(0, 0).name not in self.expected_response: | ||||||
|                     self.expected_response.append(cs.Bang(0, 0).name) |                     self.expected_response.append(cs.Bang(0, 0).name) | ||||||
| @ -813,7 +813,7 @@ class Player: | |||||||
|             return True |             return True | ||||||
| 
 | 
 | ||||||
|     def heal_if_needed(self): |     def heal_if_needed(self): | ||||||
|         while self.lives <= 0 and len(self.game.players) > 2 and len([c for c in self.hand if isinstance(c, cs.Birra)]) > 0: |         while self.lives <= 0 and len(self.game.get_alive_players()) > 2 and len([c for c in self.hand if isinstance(c, cs.Birra)]) > 0: | ||||||
|             for i in range(len(self.hand)): |             for i in range(len(self.hand)): | ||||||
|                 if isinstance(self.hand[i], cs.Birra): |                 if isinstance(self.hand[i], cs.Birra): | ||||||
|                     if self.character.check(self.game, chd.MollyStark) and not self.is_my_turn: |                     if self.character.check(self.game, chd.MollyStark) and not self.is_my_turn: | ||||||
| @ -831,7 +831,7 @@ class Player: | |||||||
|                 self.sio.emit('chat_message', room=self.game.name, |                 self.sio.emit('chat_message', room=self.game.name, | ||||||
|                                 data=f'_special_bart_cassidy|{self.name}') |                                 data=f'_special_bart_cassidy|{self.name}') | ||||||
|                 self.hand.append(self.game.deck.draw(True)) |                 self.hand.append(self.game.deck.draw(True)) | ||||||
|             elif self.character.check(self.game, chars.ElGringo) and self.attacker and self.attacker in self.game.players and len(self.attacker.hand) > 0: |             elif self.character.check(self.game, chars.ElGringo) and self.attacker and self.attacker in self.game.get_alive_players() and len(self.attacker.hand) > 0: | ||||||
|                 self.hand.append(self.attacker.hand.pop( |                 self.hand.append(self.attacker.hand.pop( | ||||||
|                     randrange(0, len(self.attacker.hand)))) |                     randrange(0, len(self.attacker.hand)))) | ||||||
|                 self.sio.emit('chat_message', room=self.game.name, |                 self.sio.emit('chat_message', room=self.game.name, | ||||||
| @ -885,7 +885,7 @@ class Player: | |||||||
|                     self.hand.append(self.game.deck.draw(True)) |                     self.hand.append(self.game.deck.draw(True)) | ||||||
|                 self.molly_discarded_cards = 0 |                 self.molly_discarded_cards = 0 | ||||||
|                 self.notify_self() |                 self.notify_self() | ||||||
|             elif self.attacker and self.attacker in self.game.players and isinstance(self.attacker.character, chd.MollyStark) and self.is_my_turn: |             elif self.attacker and self.attacker in self.game.get_alive_players() and isinstance(self.attacker.character, chd.MollyStark) and self.is_my_turn: | ||||||
|                 for i in range(self.attacker.molly_discarded_cards): |                 for i in range(self.attacker.molly_discarded_cards): | ||||||
|                     self.attacker.hand.append(self.attacker.game.deck.draw(True)) |                     self.attacker.hand.append(self.attacker.game.deck.draw(True)) | ||||||
|                 self.attacker.molly_discarded_cards = 0 |                 self.attacker.molly_discarded_cards = 0 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Alberto Xamin
						Alberto Xamin