Esempio n. 1
0
    def box(self, txt):
        """Center text and display border around it."""
        in_width = width - 2  # inside width
        tpl = border.vertical + '%s' + border.vertical

        topline = border.tl + border.horiz * in_width + border.tr
        btmline = border.bl + border.horiz * in_width + border.br
        padline = tpl % (space * in_width)

        wrapped = [line for line in wrap(txt, width - 10)]
        wrapped = [tpl % l.center(in_width) for l in wrapped]
        lines = [topline, padline] + wrapped + [padline, btmline]

        print(nl.join(space + l for l in lines))
Esempio n. 2
0
    def box(self, txt):
        """Center text and display border around it."""
        in_width = width - 2    # inside width
        tpl      = border.vertical + '%s' + border.vertical

        topline  = border.tl + border.horiz * in_width + border.tr
        btmline  = border.bl + border.horiz * in_width + border.br
        padline  = tpl % (space * in_width)

        wrapped  = [line for line in wrap(txt, width - 10)]
        wrapped  = [tpl % l.center(in_width) for l in wrapped]
        lines    = [topline, padline] + wrapped + [padline, btmline]

        print( nl.join(space+l for l in lines) )
Esempio n. 3
0
File: adv.py Progetto: Voder/PBE
    def move(self, ndir):
        if not self.dir.doors[ndir]:
            print(Msg.bump_wall)
            return

        M = [Msg.ent_room]    # messages for the player
        self.dir.update(ndir)
        newloc    = board.nextloc(self, self.dir.absdir)
        self.room = Room(newloc) if board.empty(newloc) else board[newloc]

        board.move(self, newloc)
        self.dir.update_doors()
        self.roomview(M)

        if self.room.shaky_floor and any(i.anvil for i in self.items):
            self.next_level(M)

        print(nl.join(M))
Esempio n. 4
0
    def move(self, ndir):
        if not self.dir.doors[ndir]:
            print(Msg.bump_wall)
            return

        M = [Msg.ent_room]  # messages for the player
        self.dir.update(ndir)
        newloc = board.nextloc(self, self.dir.absdir)
        self.room = Room(newloc) if board.empty(newloc) else board[newloc]

        board.move(self, newloc)
        self.dir.update_doors()
        self.roomview(M)

        if self.room.shaky_floor and any(i.anvil for i in self.items):
            self.next_level(M)

        print(nl.join(M))
Esempio n. 5
0
    def get_badges(self, level):
        level = iround(level*badge_modifier)
        lines = self.advanced_badges(level) + [ self.basic_badges(level) ]
        lines = [space.join(line) for line in lines]

        return nl.join(l.center(16) for l in lines if l)
Esempio n. 6
0
File: adv.py Progetto: Voder/PBE
 def look(self):
     print(nl*5)
     print(nl.join(self.roomview()))
Esempio n. 7
0
 def look(self):
     print(nl * 5)
     print(nl.join(self.roomview()))