Merge branch 'dev' into main
This commit is contained in:
commit
a1edf476d5
@ -194,7 +194,9 @@ def chat_message(sid, msg):
|
||||
# ses.game.add_player(Player(f'AI_{random.randint(0,1000)}', 'bot', sio, bot=True))
|
||||
sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'Only 1 bot at the time'})
|
||||
else:
|
||||
bot = Player(f'AI_{random.randint(0,1000)}', 'bot', sio, bot=True)
|
||||
bot = Player(f'AI_{random.randint(0,10)}', 'bot', sio, bot=True)
|
||||
while any([p for p in ses.game.players if p.name == bot.name]):
|
||||
bot = Player(f'AI_{random.randint(0,10)}', 'bot', sio, bot=True)
|
||||
ses.game.add_player(bot)
|
||||
bot.bot_spin()
|
||||
elif '/removebot' in msg and not ses.game.started:
|
||||
|
@ -39,6 +39,7 @@ class Game:
|
||||
self.did_resuscitate_deadman = False
|
||||
self.is_handling_death = False
|
||||
self.pending_winners = []
|
||||
self.noStar = False # no Sheriff, because there are only three players
|
||||
|
||||
|
||||
def notify_room(self, sid=None):
|
||||
@ -124,6 +125,8 @@ class Game:
|
||||
print('GAME IS STARING')
|
||||
if self.started:
|
||||
return
|
||||
if len(self.players) == 3:
|
||||
self.noStar = True
|
||||
self.players_map = {c.name: i for i, c in enumerate(self.players)}
|
||||
self.sio.emit('chat_message', room=self.name, data=f'_starting')
|
||||
self.sio.emit('start', room=self.name)
|
||||
@ -318,7 +321,7 @@ class Game:
|
||||
print(f'{self.players[self.turn]} is dead, next turn')
|
||||
return self.next_turn()
|
||||
self.player_bangs = 0
|
||||
if isinstance(self.players[self.turn].role, roles.Sheriff):
|
||||
if isinstance(self.players[self.turn].role, roles.Sheriff) or (self.noStar and isinstance(self.players[self.turn].role, roles.Vice)):
|
||||
self.deck.flip_event()
|
||||
if len(self.deck.event_cards) > 0 and self.deck.event_cards[0] != None:
|
||||
print(f'flip new event {self.deck.event_cards[0].name}')
|
||||
@ -534,6 +537,7 @@ class Game:
|
||||
self.players = [p for p in self.players if not p.is_bot]
|
||||
print(self.players)
|
||||
self.started = False
|
||||
self.noStar = False
|
||||
self.is_handling_death = False
|
||||
self.waiting_for = 0
|
||||
self.incremental_turn = 0
|
||||
|
@ -172,7 +172,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
inviteLink() {
|
||||
return `${window.location.origin}/game?code=${this.lobbyName}${this.password?`&pwd=${this.password}`:''}`
|
||||
return `${window.location.origin}/game?code=${encodeURIComponent(this.lobbyName)}${this.password?`&pwd=${this.password}`:''}`
|
||||
},
|
||||
isThereAnyBot() {
|
||||
return this.players.filter(x => x.is_bot).length > 0;
|
||||
|
Loading…
Reference in New Issue
Block a user