fix dalton

This commit is contained in:
Alberto Xamin 2020-12-25 19:00:40 +01:00
parent 9777742e08
commit 9781770577
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
3 changed files with 15 additions and 3 deletions

View File

@ -228,6 +228,13 @@ def chat_message(sid, msg):
ses.character = [c for c in chs if c.name == ' '.join(cmd[1:])][0] ses.character = [c for c in chs if c.name == ' '.join(cmd[1:])][0]
ses.real_character = ses.character ses.real_character = ses.character
ses.notify_self() 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: 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'}) 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() cmd = msg.split()

View File

@ -264,6 +264,11 @@ class Game:
if self.readyCount == self.waiting_for: if self.readyCount == self.waiting_for:
self.waiting_for = 0 self.waiting_for = 0
self.readyCount = 0 self.readyCount = 0
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].pending_action = pl.PendingAction.PLAY
self.players[self.turn].notify_self() self.players[self.turn].notify_self()

View File

@ -254,7 +254,7 @@ class Player:
for c in need_target: for c in need_target:
_range = self.get_sight() if c.name == 'Bang!' or c.name == "Pepperbox" else c.range _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))] 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 continue
target = others[randrange(0, len(others))] target = others[randrange(0, len(others))]
if target['is_sheriff'] and isinstance(self.role, r.Renegade): if target['is_sheriff'] and isinstance(self.role, r.Renegade):
@ -751,7 +751,7 @@ class Player:
if self.equipment[i].can_be_used_now: if self.equipment[i].can_be_used_now:
print('usable', self.equipment[i]) 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)\ 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: and len([c for c in self.equipment if c.can_be_used_now and isinstance(c, cs.Mancato)]) == 0:
print('Cant defend') print('Cant defend')
if not no_dmg: if not no_dmg: