Merge pull request #9 from albertoxamin/dev

add wait to death notification
This commit is contained in:
Alberto Xamin 2020-12-05 10:15:38 +01:00 committed by GitHub
commit e0954b53b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -47,7 +47,7 @@ class RagTime(Panico):
def __init__(self, suit, number): def __init__(self, suit, number):
Card.__init__(self, suit, 'Rag Time', number) Card.__init__(self, suit, 'Rag Time', number)
self.icon = '🎹' self.icon = '🎹'
self.desc = "Ruba 1 carta dalla mano di un giocatore a prescindere dalla distanza" self.desc = "Ruba 1 carta da un giocatore a prescindere dalla distanza"
self.desc_eng = "Steal a card from another player at any distance" self.desc_eng = "Steal a card from another player at any distance"
self.need_target = True self.need_target = True
self.need_with = True self.need_with = True
@ -287,7 +287,8 @@ class Conestoga(Panico):
def __init__(self, suit, number): def __init__(self, suit, number):
Card.__init__(self, suit, 'Conestoga', number) Card.__init__(self, suit, 'Conestoga', number)
self.icon = '🏕' self.icon = '🏕'
self.desc = "Ruba 1 carta dalla mano di un giocatore a prescindere dalla distanza" self.desc = "Ruba 1 carta da un giocatore a prescindere dalla distanza"
self.desc_eng = "Steal a card from another player at any distance"
self.need_target = True self.need_target = True
self.usable_next_turn = True self.usable_next_turn = True
self.can_be_used_now = False self.can_be_used_now = False

View File

@ -139,10 +139,7 @@ class Player:
ser['attacker'] = self.attacker.name ser['attacker'] = self.attacker.name
ser['sight'] = self.get_sight() ser['sight'] = self.get_sight()
ser['lives'] = max(ser['lives'], 0) ser['lives'] = max(ser['lives'], 0)
self.sio.emit('self', room=self.sid, data=json.dumps(
ser, default=lambda o: o.__dict__))
self.sio.emit('self_vis', room=self.sid, data=json.dumps(
self.game.get_visible_players(self), default=lambda o: o.__dict__))
if self.lives <= 0 and self.max_lives > 0: if self.lives <= 0 and self.max_lives > 0:
print('dying, attacker', self.attacker) print('dying, attacker', self.attacker)
if isinstance(self.character, chars.SidKetchum) and len(self.hand) > 1: if isinstance(self.character, chars.SidKetchum) and len(self.hand) > 1:
@ -151,7 +148,14 @@ class Player:
randrange(0, len(self.hand)))) randrange(0, len(self.hand))))
self.game.deck.scrap(self.hand.pop( self.game.deck.scrap(self.hand.pop(
randrange(0, len(self.hand)))) randrange(0, len(self.hand))))
if self.lives <= 0 and self.max_lives > 0:
self.pending_action = PendingAction.WAIT
self.game.player_death(self) self.game.player_death(self)
else:
self.sio.emit('self_vis', room=self.sid, data=json.dumps(
self.game.get_visible_players(self), default=lambda o: o.__dict__))
self.sio.emit('self', room=self.sid, data=json.dumps(
ser, default=lambda o: o.__dict__))
self.game.notify_all() self.game.notify_all()
def play_turn(self): def play_turn(self):