fix prigione

This commit is contained in:
Alberto Xamin 2020-11-21 16:01:22 +01:00
parent 3b9e16f1c1
commit 5068eafe5b
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
2 changed files with 12 additions and 4 deletions

View File

@ -96,7 +96,10 @@ class Game:
if self.players[self.players_map[target_username]].get_banged():
attacker.pending_action = players.PendingAction.WAIT
attacker.notify_self()
def get_player_named(self, name:str):
return self.players[self.players_map[name]]
def responders_did_respond(self):
self.players[self.turn].pending_action = players.PendingAction.PLAY
self.players[self.turn].notify_self()

View File

@ -134,7 +134,9 @@ class Player:
if picked.suit != cards.Suit.HEARTS and pickable_cards == 0:
self.game.deck.scrap(self.equipment.pop(i))
self.end_turn(forced=True)
return
else:
self.game.deck.scrap(self.equipment.pop(i))
break
break
self.pending_action = PendingAction.DRAW
@ -166,9 +168,9 @@ class Player:
return
card: cards.Card = self.hand.pop(hand_index)
print(self.name, 'is playing ', card, ' against:', againts)
if isinstance(card, cards.Prigione) and isinstance(self.game.players_map[againts].role, roles.Sheriff):
self.game.players_map[againts].equipment.append(card)
self.game.players_map[againts].notify_self()
if isinstance(card, cards.Prigione) and not isinstance(self.game.get_player_named(againts).role, roles.Sheriff):
self.game.get_player_named(againts).equipment.append(card)
self.game.get_player_named(againts).notify_self()
elif card.is_equipment and card.name not in [c.name for c in self.equipment]:
if card.is_weapon:
has_weapon = False
@ -201,6 +203,9 @@ class Player:
if isinstance(card, cards.Emporio):
pass
if isinstance(card, cards.Gatling):
for p in self.game.players:
if p != self:
self.game.attack(self, p)
pass
if isinstance(card, cards.Indiani):
pass