Esempio n. 1
0
def manageCharacter(character: "Character"):
    options = ["Quit", character]
    screen = Screen()
    screen.setTitle(f'Manage {character.name}')

    if True:  # needs to check it items available
        options.append("Equipped items")

    for item in character.equippedItems:
        screen.addBodyRow(str(item))
        options.append(item)

    # todo: add option to change passives
    # todo: add option to change actives

    options.reverse()

    for option in options:
        screen.addOption(option)

    customize = screen.displayAndChoose("What do you want to customize?")
    if customize != "Quit":
        if customize == "Equipped items":
            raise Exception(
                "todo move item choosing to user instead of character")
        else:
            customize.customizeMenu()
Esempio n. 2
0
    def chooseAction(self):
        screen = Screen()
        options = [
            "explore", "view character info", "customize character",
            "list passives", "list items", "exit"
        ]
        for option in options:
            screen.addOption(option)

        choice = screen.displayAndChoose("What do you wish to do?")
        if choice == "explore":
            chooseUserAreaAction(self.user, self.currentArea)
        elif choice == "view character info":
            screen = Screen()
            screen.setTitle(self.user.name)
            screen.addBodyRows(self.user.getDisplayData())
            screen.display()
        elif choice == "customize character":
            self.user.manage()
        elif choice == "list passives":
            screen = Screen()
            for passive in getPassiveAbilityList():
                screen.addBodyRow(passive.description)
            screen.display()
        elif choice == "list items":
            screen = Screen()
            for item in getItemList():
                screen.addBodyRow(str(item))
            screen.display()
        elif choice == "exit":
            self.exit = True
        else:
            raise Exception(
                "Unsupported choice in game.py Game.chooseAction: '{0}''".
                format(choice))
Esempio n. 3
0
 def newUserMenu(self):
     name = input("What do you want your character\'s name to be? ")
     screen = Screen()
     screen.setTitle("New User")
     screen.addBodyRow(
         "Each character has elemental powers, what element do you want yours to control?"
     )
     for element in ELEMENTS:
         screen.addOption(element)
     element = screen.displayAndChoose("Choose an element: ")
     result = self.createUser(name, element)
     if result == 'User added successfully!':
         self.loginUser(name)
     else:
         self.newUserMenu()
Esempio n. 4
0
def chooseUserAreaAction(user: "******", area: "Area"):
    screen = Screen()
    screen.setTitle(area.name)
    screen.addBodyRow(area.getDisplayData())

    options = []
    for level in area.levels:
        options.append(level)
    options.append("quit")

    for option in options:
        screen.addOption(option)

    choice = screen.displayAndChoose("Choose a level to play:")

    if choice is not "quit":
        playLevel(choice, user)
Esempio n. 5
0
    def manage(self):
        """
        Displays the team management menu
        """

        screen = Screen()
        screen.setTitle(f'Manage {self.name}')
        options = ["Exit"]
        for member in self.team.members:
            screen.addBodyRow(member.getDisplayData())
            options.insert(0, member)

        for option in options:
            screen.addOption(option)

        managing = screen.displayAndChoose("Who do you wish to manage?")

        if managing is not "Exit":
            manageCharacter(managing)