Skip to content

Commit 6c370ed

Browse files
committed
Update e2e tests to be smarter about ending turn when nothing is playable
1 parent 3f0925b commit 6c370ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_game.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def patched_input(*args, **kwargs):
6868

6969
# Handle combat
7070
if mygame.current_encounter:
71-
possible_cards = [idx+1 for idx,card in enumerate(player.hand) if card.energy_cost <= player.energy and card.type != CardType.STATUS]
71+
possible_cards = [idx+1 for idx,card in enumerate(player.hand) if card.energy_cost <= player.energy and card.playable]
7272
# Handle no energy
7373
if player.energy == 0 and player.in_combat:
7474
choice, reason = 'e', "No energy left"
@@ -78,6 +78,8 @@ def patched_input(*args, **kwargs):
7878
# Handle card selection
7979
elif len(possible_cards) > 0:
8080
choice, reason = str(random.choice(possible_cards)), "Card selection"
81+
elif len(possible_cards) == 0:
82+
choice, reason = 'e', "No cards to play"
8183

8284
# Default (all options)
8385
if choice is None:

0 commit comments

Comments
 (0)