def playIO(self): """Asks the user about which card they wish to play.""" choice = DuchIO.ask("\nYour hand:\n" + str(self._hand) + "\nEnter the number of the card you want to play" + "\n(or c to cancel)\n", DuchIO.prepareOptions(self._hand.getCards()) + "c") return choice
def overflowIO(self): """Asks the user about which card they wish to get rid of since their hand is full.""" choice = DuchIO.ask("\nYour hand:\n" + str(self._hand) + "\nYour hand is too full" + "\nEnter the number of a card to destroy so you can continue", DuchIO.prepareOptions(self._hand.getCards())) return choice
def battleIO(self, opponent): """Asks the user about which of their cards and their opponents cards they want to battle.""" atk_card_pos = DuchIO.ask("\nYour Field:\n" + str(self._field) + "\nEnter the number of the card you want " + "to attack with:\n(or 'c' to cancel)\n", DuchIO.prepareOptions(self._field.getCards()) + "c") if atk_card_pos != "c": def_card_pos = DuchIO.ask("\nYour Opponent's Field:\n" + str(opponent.getField()) + "\nEnter the number of the card you want " + "to attack:\n(or 'c' to cancel)\n", DuchIO.prepareOptions(opponent.getField().getCards()) + "c") return atk_card_pos, def_card_pos return "c", "c"
def royalIO(self, rank): """Asks the user about which of their cards in their grave they want to revive, rescue or reset. 'rank' must be an integer between 11 and 13 inclusive.""" player = self._players[self._turnPlayer] # Determine action depending on rank if rank == 11: action = "revive" elif rank == 12: action = "rescue" else: action = "reset" choice = DuchIO.ask("\nYour Grave:\n" + str(player.getGrave()) + "\nEnter the number of the card you wish to " + action + "\n", DuchIO.prepareOptions(player.getGrave().getCards())) return int(choice) - 1
def tributeIO(self): """Asks the user about which card they wish to tribute. Will ask if they want to tribute from the hand if their deck is empty.""" choice = "" if self._deck.isEmpty(): choice = DuchIO.ask("\nWould you like to tribute from the hand? (y/n)\n", "yn") if choice == "y": source = self._hand label = "\nYour hand:" else: source = self._field label = "\nYour field:" choice = DuchIO.ask(label + str(source) + "\nEnter the number of the card you want to tribute" + "\n(or 'c' to cancel)\n", DuchIO.prepareOptions(source.getCards()) + "c") return choice, source