2017-12-24 13:00:51 -06:00
|
|
|
from enum import Enum, auto
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Card:
|
|
|
|
|
class CardType(Enum):
|
2017-12-26 15:33:05 -06:00
|
|
|
Treasure = auto()
|
2017-12-24 13:00:51 -06:00
|
|
|
Action = auto()
|
2017-12-26 15:33:05 -06:00
|
|
|
Reaction = auto()
|
2017-12-24 13:00:51 -06:00
|
|
|
Attack = auto()
|
|
|
|
|
Victory = auto()
|
|
|
|
|
Curse = auto()
|
|
|
|
|
|
2017-12-27 02:12:43 -06:00
|
|
|
prevent_attack = False
|
|
|
|
|
|
2017-12-26 15:33:05 -06:00
|
|
|
def __init__(self, name, cost, cardtype, value, coin, action, buy, draw, owner):
|
2017-12-24 13:00:51 -06:00
|
|
|
self.__name = name
|
|
|
|
|
self.__cost = cost
|
|
|
|
|
self.__coin = coin
|
|
|
|
|
self.__type = cardtype
|
|
|
|
|
self.__action = action
|
|
|
|
|
self.__buy = buy
|
|
|
|
|
self.__draw = draw
|
|
|
|
|
self.__value = value
|
2017-12-26 15:33:05 -06:00
|
|
|
self.__owner = owner
|
2017-12-24 13:00:51 -06:00
|
|
|
|
2017-12-26 15:33:05 -06:00
|
|
|
def play(self):
|
|
|
|
|
self.__owner.add_actions(self.__action)
|
|
|
|
|
self.__owner.add_buys(self.__buy)
|
|
|
|
|
self.__owner.add_purchase_power(self.__coin)
|
|
|
|
|
self.__owner.draw_cards(self.__draw)
|
|
|
|
|
self.effect()
|
2017-12-24 13:00:51 -06:00
|
|
|
|
2017-12-26 15:33:05 -06:00
|
|
|
def effect(self):
|
2017-12-30 12:15:51 -06:00
|
|
|
# This is here so that 'special' card can override this function so that unique card effects can happen.
|
2017-12-24 13:00:51 -06:00
|
|
|
pass
|
|
|
|
|
|
2017-12-26 15:33:05 -06:00
|
|
|
def passive(self):
|
2017-12-30 12:15:51 -06:00
|
|
|
# This is here so that 'special' card can override this function so that unique card passives can happen.
|
2017-12-26 15:33:05 -06:00
|
|
|
pass
|
|
|
|
|
|
2017-12-24 13:00:51 -06:00
|
|
|
def get_name(self):
|
|
|
|
|
return self.__name
|
|
|
|
|
|
|
|
|
|
def get_type(self):
|
|
|
|
|
return self.__type
|
|
|
|
|
|
2017-12-26 15:33:05 -06:00
|
|
|
def get_cost(self):
|
|
|
|
|
return self.__cost
|
|
|
|
|
|
|
|
|
|
def set_owner(self, owner):
|
|
|
|
|
self.__owner = owner
|
|
|
|
|
|
|
|
|
|
def get_owner(self):
|
|
|
|
|
return self.__owner
|
|
|
|
|
|
2017-12-24 13:00:51 -06:00
|
|
|
def identify(self):
|
2017-12-28 18:24:07 -06:00
|
|
|
return self.__name + ", " + str(self.__type) + ", " + str(self.__cost)
|
|
|
|
|
|
|
|
|
|
def __get_index_not_self(self):
|
|
|
|
|
result = -1
|
|
|
|
|
for c in self._Card__owner.get_hand().get_supply():
|
|
|
|
|
if c != self:
|
2017-12-30 11:56:31 -06:00
|
|
|
result = self._Card__owner.get_hand().get_player_index()
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def __print_card_list(self, card, message):
|
|
|
|
|
print("\nPlayer " + str(self._Card__owner.get_player_index()) + " " + message)
|
|
|
|
|
|
|
|
|
|
counter = 0
|
|
|
|
|
for c in card:
|
|
|
|
|
print(str(counter) + ": " + c.identify())
|
2017-12-30 12:15:51 -06:00
|
|
|
counter += 1
|