From 8119ff2e453650b041a35e57188ee6326bf7c3e1 Mon Sep 17 00:00:00 2001 From: Giulio Date: Mon, 24 May 2021 00:47:08 +0200 Subject: [PATCH] fix molly stark with Slab The Killer --- backend/__init__.py | 2 +- backend/bang/players.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index f3660bc..7eed5be 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -308,7 +308,7 @@ def chat_message(sid, msg): ses.character = [c for c in chs if c.name == ' '.join(cmd[1:])][0] ses.real_character = ses.character ses.notify_self() - elif '/setevent' in msg and ses.game and ses.game.deck: # /setevent (position) 0 (name) Peyote + elif '/setevent' in msg and ses.game and ses.game.deck: #add event before the position /setevent (position) 0 (name) Peyote cmd = msg.split() if len(cmd) >= 3: sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and changed event'}) diff --git a/backend/bang/players.py b/backend/bang/players.py index fda8050..ee2bdcb 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -882,8 +882,11 @@ class Player: ((hand_index < len(self.hand) and self.hand[hand_index].name in self.expected_response) or self.character.check(self.game, chd.ElenaFuente)) or (hand_index-len(self.hand) < len(self.equipment) and self.equipment[hand_index-len(self.hand)].name in self.expected_response)): card = self.hand.pop(hand_index) if hand_index < len(self.hand) else self.equipment.pop(hand_index-len(self.hand)) - if self.character.check(self.game, chd.MollyStark) and hand_index < len(self.hand)+1 and not self.is_my_turn and self.event_type != 'duel': - self.hand.append(self.game.deck.draw(True)) + if self.character.check(self.game, chd.MollyStark) and hand_index < len(self.hand) and not self.is_my_turn and self.event_type != 'duel': + if self.attacker.character.check(self.game, chars.SlabTheKiller) and isinstance(self.hand[hand_index], cs.Mancato): + self.molly_discarded_cards += 1 + else: + self.hand.append(self.game.deck.draw(True)) card.use_card(self) self.sio.emit('chat_message', room=self.game.name, data=f'_respond|{self.name}|{card.name}') self.game.deck.scrap(card, True) @@ -892,9 +895,14 @@ class Player: if self.mancato_needed <= 0: if self.event_type == 'duel': self.game.duel(self, self.attacker.name) - if self.character.check(self.game, chd.MollyStark) and hand_index < len(self.hand)+1 and not self.is_my_turn: + if self.character.check(self.game, chd.MollyStark) and hand_index < len(self.hand) and not self.is_my_turn: self.molly_discarded_cards += 1 else: + if self.character.check(self.game, chd.MollyStark) and not self.is_my_turn: + for i in range(self.molly_discarded_cards): + self.hand.append(self.game.deck.draw(True)) + self.molly_discarded_cards = 0 + self.notify_self() self.game.responders_did_respond_resume_turn(did_lose=False) self.event_type = '' else: @@ -906,7 +914,7 @@ class Player: self.hand.append(self.game.deck.draw(True)) self.molly_discarded_cards = 0 self.notify_self() - elif self.attacker and self.attacker in self.game.get_alive_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 self.attacker.character.check(self.game, chd.MollyStark) and self.is_my_turn: for i in range(self.attacker.molly_discarded_cards): self.attacker.hand.append(self.attacker.game.deck.draw(True)) self.attacker.molly_discarded_cards = 0