Example #1
0
    def opponentIO(self):
        """Asks the user about which opponent they wish to do battle with."""

        opponents, options = self.getOpponents()
        choice = DuchIO.ask(opponents + "\nEnter the number of the player you wish to battle with\n",
                            options + "c")
        return choice
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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"
Example #5
0
    def menuIO(self):
        """Asks the user what they want to do during their go."""

        choice = DuchIO.ask(str(self)
                            + "\nEnter:\n"
                            + "\t1 - Tribute\n"
                            + "\t2 - Play\n"
                            + "\t3 - Battle\n"
                            + "\t4 - View other fields\n"
                            + "\tq - End your go\n",
                            "1234q", "\nPlease enter a valid option.\n")
        return choice
Example #6
0
    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
Example #7
0
    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