Exemplo n.º 1
0
Arquivo: msg.py Projeto: nrook/Spirit
    def getArray(self):
        """
        Return an array representing the last few messages, where "the last few
        messages" are the last dimensions[1] messages.
        """

        ret_array = arrays.empty_str_array(self.dimensions)
        lines_to_use = self.message_list[-self.dimensions[1] :]
        # lines_to_use.reverse()
        for i in range(len(lines_to_use)):
            arrays.print_str_to_end_of_line((0, i), lines_to_use[i], ret_array)

        return ret_array
Exemplo n.º 2
0
Arquivo: pc.py Projeto: nrook/Spirit
    def __init__(self, name, floor, char_level, cur_HP, max_HP, deck, conditions):
        """
        Initialize a Sidebar with the corresponding values.

        name - a string of the player's name.
        floor - an integer of the floor of the dungeon the player is on.
        char_level - an integer representing the player's character level.
        cur_HP - an integer; the player's current HP.
        max_HP - an integer; the player's maximum HP.
        deck - the deck containing the player's cards.
        conditions - a list (NOT A DICTIONARY) of the player's conditions.
        """

        self.__array = arrays.empty_str_array(config.STATUS_DIMENSIONS)
        arrays.print_str_to_end_of_line((1, 0), name, self.__array)
        arrays.print_str_to_end_of_line((1, 1), "Floor %d" % floor,
                                        self.__array)
        arrays.print_str_to_end_of_line((1, 2), "Level %d" % char_level,
                                        self.__array)
        arrays.print_str_to_end_of_line((1, 4), 
                                        "HP: %d(%d)" % (cur_HP, max_HP),
                                        self.__array)

        condition_names = ""
        for c in conditions:
            c_name = c.getDisplayName()
            if c_name != "":
                if condition_names == "":
                    condition_names = c_name
                else:
                    condition_names = " ".join((condition_names, c_name))
        arrays.print_str_to_end_of_line((1, 5), condition_names, self.__array)

        arrays.print_str_to_end_of_line((1, 7),
            "Deck(%d):" % len(deck.library), self.__array)
        for i in range(len(deck.hand)):
            arrays.print_str_to_end_of_line((1, 8 + i),
                "(%d) %s" % (i+1, deck.hand[i].monster_name), self.__array)
        return