diff --git a/backend/__init__.py b/backend/__init__.py index 84d24f3..1b16036 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -228,6 +228,13 @@ 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: + 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'}) + chs = ses.game.deck.event_cards + ses.game.deck.event_cards.insert(int(cmd[1]), [c for c in chs if c!=None and c.name == ' '.join(cmd[2:])][0]) + ses.game.notify_event_card() elif '/removecard' in msg: sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and removed a card'}) cmd = msg.split() diff --git a/backend/bang/game.py b/backend/bang/game.py index 6fc0d27..e26673e 100644 --- a/backend/bang/game.py +++ b/backend/bang/game.py @@ -264,7 +264,12 @@ class Game: if self.readyCount == self.waiting_for: self.waiting_for = 0 self.readyCount = 0 - self.players[self.turn].pending_action = pl.PendingAction.PLAY + if self.dalton_on: + self.dalton_on = False + print(f'notifying {self.players[self.turn].name} about his turn') + self.players[self.turn].play_turn() + else: + self.players[self.turn].pending_action = pl.PendingAction.PLAY self.players[self.turn].notify_self() def next_player(self): diff --git a/backend/bang/players.py b/backend/bang/players.py index d975467..10070e9 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -254,7 +254,7 @@ class Player: for c in need_target: _range = self.get_sight() if c.name == 'Bang!' or c.name == "Pepperbox" else c.range others = [p for p in self.game.get_visible_players(self) if _range >= p['dist'] and not (isinstance(self.role, r.Vice) and p['is_sheriff']) and p['lives'] > 0 and not ((isinstance(c, cs.CatBalou) or isinstance(c, cs.Panico)) and p['cards'] == 0) and not (p['is_sheriff'] and isinstance(c, cs.Prigione))] - if len(others) == 0: + if len(others) == 0 or c not in self.hand: continue target = others[randrange(0, len(others))] if target['is_sheriff'] and isinstance(self.role, r.Renegade): @@ -751,7 +751,7 @@ class Player: if self.equipment[i].can_be_used_now: print('usable', self.equipment[i]) if not self.game.is_competitive and len([c for c in self.equipment if isinstance(c, cs.Barile)]) == 0 and not self.character.check(self.game, chars.Jourdonnais)\ - and len([c for c in self.hand if isinstance(c, cs.Mancato) or (self.character.check(self.game, chars.CalamityJanet) and isinstance(c, cs.Bang)) or self.character.check(self.game, chd.ElenaFuente)]) == 0\ + and len([c for c in self.hand if (isinstance(c, cs.Mancato) and c.can_be_used_now) or (self.character.check(self.game, chars.CalamityJanet) and isinstance(c, cs.Bang)) or self.character.check(self.game, chd.ElenaFuente)]) == 0\ and len([c for c in self.equipment if c.can_be_used_now and isinstance(c, cs.Mancato)]) == 0: print('Cant defend') if not no_dmg: