add wild-west-show endgame

This commit is contained in:
Alberto Xamin 2023-03-05 17:46:26 +00:00
parent 9f5d037437
commit 47a099d624
No known key found for this signature in database
GPG Key ID: 5ABFCD8A22EA6F5D
3 changed files with 13 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class Deck:
print(f'Deck initialized with {len(self.cards)} cards')
def flip_event(self):
if len(self.event_cards) > 0 and not (isinstance(self.event_cards[0], ce.PerUnPugnoDiCarte) or isinstance(self.event_cards[0], ceh.MezzogiornoDiFuoco)):
if len(self.event_cards) > 0 and not (isinstance(self.event_cards[0], ce.PerUnPugnoDiCarte) or isinstance(self.event_cards[0], ceh.MezzogiornoDiFuoco) or isinstance(self.event_cards[0], cew.WildWestShow)):
self.event_cards.append(self.event_cards.pop(0))
self.game.notify_event_card()
self.game.notify_all()

View File

@ -649,6 +649,9 @@ class Game:
if self.waiting_for != 0:
return
self.dalton_on = False
elif self.check_event(cew.WildWestShow):
for p in self.players:
p.set_role(roles.Renegade())
if self.check_event(ce.PerUnPugnoDiCarte) and len(self.players[self.turn].hand) > 0:
self.player_bangs = len(self.players[self.turn].hand)

View File

@ -3,6 +3,7 @@ from tests import started_game, set_events, current_player, next_player, current
from bang.expansions.wild_west_show.card_events import *
from bang.cards import Card, Suit
import bang.roles as roles
# test Camposanto
@ -73,4 +74,11 @@ def test_miss_suzanna():
# test Sacagaway
# test WildWestShow
# test WildWestShow
def test_miss_suzanna():
g = started_game(['wild_west_show'], 8)
set_events(g, [None, WildWestShow()])
for i in range(len(g.players)):
current_player_with_cards(g, []).end_turn()
for p in g.players:
assert isinstance(p.role, roles.Renegade)