Skip to content

Commit

Permalink
Merge branch 'main' into cornguilds
Browse files Browse the repository at this point in the history
  • Loading branch information
dwagon committed Apr 17, 2024
2 parents e8375b5 + 6f375f6 commit 603c70c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions dominion/cards/Card_Farm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python
"""https://wiki.dominionstrategy.com/index.php/Farm"""
import unittest
from dominion import Card, Game, Piles, Player, Phase


###############################################################################
class Card_Farm(Card.Card):
def __init__(self) -> None:
Card.Card.__init__(self)
self.cardtype = [Card.CardType.ACTION, Card.CardType.VICTORY]
self.base = Card.CardExpansion.INTRIGUE
self.name = "Farm"
self.coin = 2
self.victory = 2
self.cost = 6

def dynamic_description(self, player: Player.Player) -> str:
if player.phase == Phase.BUY:
return "+2 coin; 2 VPs"
return "+2 coin"


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

def test_play(self) -> None:
"""Play a Farm"""
self.plr.play_card(self.card)
self.assertEqual(self.plr.coins.get(), 2)

def test_score(self) -> None:
"""Score the Farm"""
sc = self.plr.get_score_details()
self.assertEqual(sc["Farm"], 2)


###############################################################################
if __name__ == "__main__": # pragma: no cover
unittest.main()

# EOF

0 comments on commit 603c70c

Please sign in to comment.