2018-01-10 14:10:20 -05:00
|
|
|
from card.basic.card_action import Action
|
2017-12-27 02:12:43 -06:00
|
|
|
|
|
|
|
|
|
2018-01-10 14:10:20 -05:00
|
|
|
class Cellar(Action):
|
2017-12-27 02:12:43 -06:00
|
|
|
def effect(self):
|
|
|
|
|
hand_index = 0
|
|
|
|
|
cards_discarded = 0
|
|
|
|
|
have_not_run_yet = True
|
|
|
|
|
while self._Card__owner.get_hand().get_remaining() >= 0 and \
|
|
|
|
|
0 <= hand_index < self._Card__owner.get_hand().get_remaining() and \
|
|
|
|
|
(hand_index != self._Card__owner.get_hand().get_supply().index(self) or have_not_run_yet):
|
2017-12-30 22:33:43 -06:00
|
|
|
hand_index = self.__get_index("Player " + str(self._Card__owner.get_player_index()) + ", input the index "
|
|
|
|
|
"from your hand to discard that card and gain an action, or input an "
|
|
|
|
|
"impossible index to end discard selection: ")
|
2017-12-27 02:12:43 -06:00
|
|
|
|
|
|
|
|
if 0 <= hand_index < self._Card__owner.get_hand().get_remaining() and \
|
|
|
|
|
hand_index != self._Card__owner.get_hand().get_supply().index(self):
|
|
|
|
|
self._Card__owner.discard_from_hand(hand_index)
|
|
|
|
|
self._Card__owner.print_hand()
|
|
|
|
|
cards_discarded += 1
|
2017-12-28 18:24:07 -06:00
|
|
|
hand_index = self.__get_index_not_self()
|
2017-12-27 02:12:43 -06:00
|
|
|
have_not_run_yet = False
|
2017-12-30 11:56:31 -06:00
|
|
|
self._Card__owner.draw_cards(cards_discarded)
|
2017-12-27 02:12:43 -06:00
|
|
|
|
2017-12-30 22:33:43 -06:00
|
|
|
def __get_index(self, message):
|
2018-01-21 03:41:06 -05:00
|
|
|
return self.__Card_owner.take_input(message, int)
|
2017-12-28 18:24:07 -06:00
|
|
|
|