Skip to content

Commit

Permalink
Fix Silver Mine causing test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dwagon committed Oct 27, 2023
1 parent b0cc38f commit 7738989
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions dominion/cards/Card_Camel_Train.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
""" http://wiki.dominionstrategy.com/index.php/Camel_Train """

import unittest
from dominion import Card, Game, Piles, Player
from dominion import Card, Game, Piles, Player, Phase


###############################################################################
class Card_Camel_Train(Card.Card):
def __init__(self):
def __init__(self) -> None:
Card.Card.__init__(self)
self.cardtype = Card.CardType.ACTION
self.base = Card.CardExpansion.MENAGERIE
self.name = "Camel Train"
self.cost = 3

def desc(self, player):
if player.phase == Player.Phase.BUY:
def desc(self, player: "Player.Player") -> str:
if player.phase == Phase.BUY:
return """Exile a non-Victory card from the Supply. When you gain this, Exile a Gold from the Supply."""
return "Exile a non-Victory card from the Supply."

def special(self, game, player):
def special(self, game: "Game.Game", player: "Player.Player") -> None:
options = []
for name, pile in game.get_card_piles():
if pile.is_empty():
Expand All @@ -34,25 +34,27 @@ def special(self, game, player):
if to_exile := player.plr_choose_options("Pick a card to Exile", *options):
player.exile_card(to_exile)

def hook_gain_this_card(self, game, player):
def hook_gain_this_card(self, game: "Game.Game", player: "Player.Player") -> None:
player.exile_card("Gold")


###############################################################################
class TestCamelTrain(unittest.TestCase):
def setUp(self):
self.g = Game.TestGame(numplayers=1, initcards=["Camel Train"])
def setUp(self) -> None:
self.g = Game.TestGame(
numplayers=1, initcards=["Camel Train"], badcards=["Silver Mine"]
)
self.g.start_game()
self.plr = self.g.player_list()[0]
self.card = self.g.get_card_from_pile("Camel Train")
self.plr.add_card(self.card, Piles.HAND)

def test_play(self):
def test_play(self) -> None:
self.plr.test_input = ["Exile Silver"]
self.plr.play_card(self.card)
self.assertIn("Silver", self.plr.piles[Piles.EXILE])

def test_gain(self):
def test_gain(self) -> None:
self.plr.gain_card("Camel Train")
self.assertIn("Gold", self.plr.piles[Piles.EXILE])

Expand Down

0 comments on commit 7738989

Please sign in to comment.