add miss suzanna

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

View File

@ -619,7 +619,7 @@ class Game:
newroles = [p.role for p in pls]
random.shuffle(newroles)
for p in pls:
p.set_role(newroles.pop())
p.set_role(newroles.pop(random.randint(0, len(newroles)-1)))
if self.check_event(ce.DeadMan):
self.did_resuscitate_deadman = False
elif self.check_event(ce.RouletteRussa):

View File

@ -89,6 +89,7 @@ class Player:
self.is_bot = bot
self.discord_token = discord_token
self.discord_id = None
self.played_cards = 0
self.avatar = ''
if self.is_bot:
self.avatar = robot_pictures[randrange(len(robot_pictures))]
@ -440,6 +441,7 @@ class Player:
return self.end_turn(forced=True)
self.scrapped_cards = 0
self.setaccio_count = 0
self.played_cards = 0
self.can_play_ranch = True
self.is_playing_ranch = False
self.can_play_vendetta = can_play_vendetta
@ -762,6 +764,8 @@ class Player:
if not self.game.is_replay:
Metrics.send_metric('play_card', points=[1], tags=[f'success:{did_play_card}', f'card:{card.name}', f'bot:{self.is_bot}', f'exp:{card.expansion if "expansion" in card.__dict__ else "vanilla"}'])
print("did play card:", did_play_card)
if did_play_card:
self.played_cards += 1
self.notify_self()
if self.is_bot:
return did_play_card or card.is_equipment or (card.usable_next_turn and not card.can_be_used_now)
@ -1563,6 +1567,9 @@ class Player:
for i in range(len(self.equipment)):
self.game.deck.scrap(self.equipment.pop(), True)
self.is_my_turn = False
if self.played_cards < 3 and self.game.check_event(cew.MissSusanna):
self.lives -= 1
self.played_cards = 0
self.can_play_again_don_bell = True
self.committed_suit_manette = None
self.pending_action = PendingAction.WAIT

View File

@ -39,10 +39,10 @@ def test_darling_valentine():
# test HelenaZontero
def test_helena_zontero():
g = started_game(['wild_west_show'], 6)
g = started_game(['wild_west_show'], 8)
set_events(g, [None, HelenaZontero()])
roles = [p.role.name for p in g.players]
for i in range(5):
for i in range(len(g.players)-1):
current_player_with_cards(g, []).end_turn()
g.deck.cards = [Card(Suit.HEARTS, 'card', 0)]*5
current_player_with_cards(g, []).end_turn()
@ -52,6 +52,22 @@ def test_helena_zontero():
# test LadyRosaDelTexas
# test MissSusanna
def test_miss_suzanna():
g = started_game(['wild_west_show'], 4)
set_events(g, [MissSusanna()])
p = current_player_with_cards(g, [])
p.end_turn()
assert p.lives == 4 # sceriffo 5-1
p = current_player_with_cards(g, [Card(0,'card',0)]*4)
p.play_card(0)
p.play_card(0)
p.play_card(0)
p.end_turn()
assert p.lives == 4
p = current_player_with_cards(g, [])
p.end_turn()
assert p.lives == 3
# test RegolamentoDiConti