Exemplo n.º 1
0
    def view( self ):
        map_width = max( self.explo.scene.width * 4, 240 )
        self.pic = image.Image( frame_width = map_width, frame_height = self.explo.scene.height * 4 + pygwrap.BIGFONT.get_height() )
        self.quill = image.Image( "sys_quill.png", 21, 18 )
        mmbits = image.Image( "sys_mapbits.png", 4, 4 )
        for x in range( self.explo.scene.width ):
            for y in range( self.explo.scene.height ):
                if self.explo.scene.map[x][y].visible:
                    t = 0
                    if self.explo.scene.map[x][y].wall:
                        t = 2
                    if self.explo.scene.map[x][y].blocks_walking():
                        t += 1
                    mmbits.render( self.pic.bitmap, (x*4,y*4), t )
        pygwrap.draw_text( self.pic.bitmap, pygwrap.BIGFONT, str(self.explo.scene),
          pygame.Rect(0,self.explo.scene.height*4+1, map_width, pygwrap.BIGFONT.get_height()),
          color=(71,35,0), justify=0, antialias=False )
        self.dest = self.pic.bitmap.get_rect( center=(self.explo.screen.get_width()//2-100, self.explo.screen.get_height()//2 ) )
        self.menu = rpgmenu.Menu(self.explo.screen,self.explo.screen.get_width()//2+215, self.explo.screen.get_height()//2-200, 150, 400, predraw=self.draw )

        pcpos = self.explo.camp.first_living_pc().pos
        self.menu.add_item( "Party", pcpos )
        for t in self.explo.scene.contents:
            if hasattr( t, "mini_map_label" ) and self.explo.scene.get_visible( *t.pos ):
                self.menu.add_item( t.mini_map_label, t.pos )
        self.menu.sort()
        self.menu.set_item_by_value( pcpos )
        if hasattr( self.explo.scene, "world_map_pos" ):
            self.menu.add_item( "[World Map]", 0 )

        pos = self.menu.query()
        if pos:
            self.explo.view.focus( self.explo.screen, *pos )
        elif pos is 0:
            WorldExplorer( self.explo )
Exemplo n.º 2
0
    def __call__(self, screen):
        self.explo.view(screen)
        pygwrap.default_border.render(screen, self.rect)
        pygwrap.draw_text(screen, pygwrap.SMALLFONT, str(self.chara),
                          self.rect)
        ap = min(self.chara.get_move() - self.comba.ap_spent[self.chara], 24)
        if self.hmap and self.comba.scene.on_the_map(
                *self.explo.view.mouse_tile):
            apr = ap - self.hmap.map[self.explo.view.mouse_tile[0]][
                self.explo.view.mouse_tile[1]]
        else:
            apr = ap

        if ap > 0:
            mydest = pygame.Rect(self.rect.x + 180, self.rect.y, 32, 32)
            pygwrap.draw_text(screen, pygwrap.ITALICFONT, "AP:", mydest)
            for t in range(1, (ap + 3) // 2):
                mydest.x = self.rect.x + 198 + t * 8
                if t <= (apr + 1) // 2:
                    if apr >= t * 2:
                        self.gems.render(screen, mydest, 1)
                    else:
                        self.gems.render(screen, mydest, 6)
                else:
                    self.gems.render(screen, mydest, 5)
Exemplo n.º 3
0
    def display_spell_info(self, screen, it):
        """Use the screen to display "it" in myrect."""
        y = self.rect.y
        pygwrap.draw_text(
            screen,
            pygwrap.BIGFONT,
            str(it),
            pygame.Rect(self.rect.x, y, self.rect.width, pygwrap.BIGFONT.get_linesize()),
            justify=0,
            color=(240, 240, 240),
        )
        y += pygwrap.BIGFONT.get_linesize()
        myrect = pygame.Rect(self.rect.x, y, self.rect.width, 16)
        pygwrap.draw_text(screen, pygwrap.SMALLFONT, "MP: {0}".format(it.mp_cost()), myrect, justify=1)
        # Display the spell colors. Start by listing the colors.
        gemlist = list()
        for k, v in it.gems.iteritems():
            gemlist += (k + 1,) * v
        for t in range(it.gems_needed()):
            if t < len(gemlist):
                sgcolor = gemlist[t]
            else:
                sgcolor = 0
            self.spell_gem_sprite.render(screen, (self.rect.x + t * 9, y), sgcolor)

        y += pygwrap.BIGFONT.get_linesize()

        if it.desc:
            myimg = pygwrap.render_text(pygwrap.SMALLFONT, it.desc, myrect.width, justify=-1)
            myrect = myimg.get_rect(topleft=(myrect.x, y))
            screen.blit(myimg, myrect)
    def view( self ):
        map_width = max( self.explo.scene.width * 4, 240 )
        self.pic = image.Image( frame_width = map_width, frame_height = self.explo.scene.height * 4 + pygwrap.BIGFONT.get_height() )
        self.quill = image.Image( "sys_quill.png", 21, 18 )
        mmbits = image.Image( "sys_mapbits.png", 4, 4 )
        for x in range( self.explo.scene.width ):
            for y in range( self.explo.scene.height ):
                if self.explo.scene.map[x][y].visible:
                    t = 0
                    if self.explo.scene.map[x][y].wall:
                        t = 2
                    if self.explo.scene.map[x][y].blocks_walking():
                        t += 1
                    mmbits.render( self.pic.bitmap, (x*4,y*4), t )
        pygwrap.draw_text( self.pic.bitmap, pygwrap.BIGFONT, str(self.explo.scene),
          pygame.Rect(0,self.explo.scene.height*4+1, map_width, pygwrap.BIGFONT.get_height()),
          color=(71,35,0), justify=0, antialias=False )
        self.dest = self.pic.bitmap.get_rect( center=(self.explo.screen.get_width()//2-100, self.explo.screen.get_height()//2 ) )
        self.menu = rpgmenu.Menu(self.explo.screen,self.explo.screen.get_width()//2+215, self.explo.screen.get_height()//2-200, 150, 400, predraw=self.draw )

        pcpos = self.explo.camp.first_living_pc().pos
        self.menu.add_item( "Party", pcpos )
        for t in self.explo.scene.contents:
            if hasattr( t, "mini_map_label" ) and self.explo.scene.get_visible( *t.pos ):
                self.menu.add_item( t.mini_map_label, t.pos )
        self.menu.sort()
        self.menu.set_item_by_value( pcpos )
        if hasattr( self.explo.scene, "world_map_pos" ):
            self.menu.add_item( "[World Map]", 0 )

        pos = self.menu.query()
        if pos:
            self.explo.view.focus( self.explo.screen, *pos )
        elif pos is 0:
            WorldExplorer( self.explo )
Exemplo n.º 5
0
    def __call__(self, screen):
        if self.predraw:
            self.predraw(screen)
        else:
            self.backdrop.tile(screen, (self.counter * 5, self.counter))
        if self.csheet:
            self.csheet.render(screen)
        if self.rect:
            pygwrap.default_border.render(screen, self.rect)
            if self.menu:
                # Display the item info in the upper display rect.
                it = self.menu.items[self.menu.selected_item].value
                if isinstance(it, Item):
                    display_item_info(screen, it, self.rect)
                elif isinstance(it, Spell):
                    self.display_spell_info(screen, it)

        if self.caption and self.caption_rect:
            pygwrap.default_border.render(screen, self.caption_rect)
            pygwrap.draw_text(screen,
                              pygwrap.BIGFONT,
                              self.caption,
                              self.caption_rect,
                              justify=0)
        self.counter += 4
Exemplo n.º 6
0
 def __call__( self , screen ):
     if self.levelmap != None:
         self.levelmap.render( screen , show_special = True )
     else:
         self.backdrop.tile( screen , ( self.counter * 5 , self.counter ) )
     pygwrap.draw_border( screen , self.rect )
     pygwrap.draw_text( screen , rpgmenu.MENUFONT , self.caption , self.rect , do_center = True )
     self.counter += 5
Exemplo n.º 7
0
 def __call__( self , screen ):
     self.backdrop.tile( screen , ( self.counter * 5 , self.counter ) )
     if self.charsheet:
         self.charsheet.render( screen )
     if self.rect:
         pygwrap.default_border.render( screen , self.rect )
     if self.caption and self.caption_rect:
         pygwrap.default_border.render( screen , self.caption_rect )
         pygwrap.draw_text( screen, pygwrap.BIGFONT, self.caption, self.caption_rect, justify = 0 )
     self.counter += 4
Exemplo n.º 8
0
 def __call__(self, screen):
     self.backdrop.tile(screen, (self.counter * 5, self.counter))
     if self.charsheet:
         self.charsheet.render(screen)
     if self.rect:
         pygwrap.default_border.render(screen, self.rect)
     if self.caption and self.caption_rect:
         pygwrap.default_border.render(screen, self.caption_rect)
         pygwrap.draw_text(screen,
                           pygwrap.BIGFONT,
                           self.caption,
                           self.caption_rect,
                           justify=0)
     self.counter += 4
Exemplo n.º 9
0
 def __call__( self , screen ):
     if self.predraw:
         self.predraw( screen )
     else:
         self.backdrop.tile( screen , ( self.counter * 5 , self.counter ) )
     if self.menu and self.charsheets:
         cs = self.charsheets.get( self.menu.items[ self.menu.selected_item ].value, None )
         if cs:
             cs.render( screen )
     if self.rect:
         pygwrap.default_border.render( screen , self.rect )
     if self.caption and self.caption_rect:
         pygwrap.default_border.render( screen , self.caption_rect )
         pygwrap.draw_text( screen, pygwrap.BIGFONT, self.caption, self.caption_rect, justify = 0 )
     self.counter += 4
Exemplo n.º 10
0
    def render(self,screen,show_special=False):
        self.backdrop.tile( screen , (self.off_x,self.off_y) )
        screen_area = screen.get_rect()
        for y in range(self.height):
            for x in range(self.width):
                if self.map[x][y] > -1:
                    dest = pygame.Rect( x*self.tile_size-self.off_x , y*self.tile_size-self.off_y , self.tile_size , self.tile_size )
                    if screen_area.colliderect( dest ):
                        self.sprite.render( screen , dest, self.map[x][y] )
                if show_special and ( self.pc_start_x == x ) and ( self.pc_start_y == y ):
                    dest = pygame.Rect( x*self.tile_size-self.off_x , y*self.tile_size-self.off_y , self.tile_size , self.tile_size )
                    if screen_area.colliderect( dest ):
                        pygwrap.draw_text( screen , pygwrap.SMALLFONT , "PC" , dest , do_center = True )

        for t in self.contents:
            t.render( screen , self , show_special )
Exemplo n.º 11
0
 def __init__(self,
              txt="???",
              pos=(0, 0),
              loop=16,
              color=(250, 250, 250),
              delay=1):
     super(Caption, self).__init__(sprite_name=None,
                                   pos=pos,
                                   loop=loop,
                                   y_off=-16,
                                   delay=delay)
     pygwrap.draw_text(self.sprite.bitmap,
                       pygwrap.ANIMFONT,
                       txt,
                       pygame.Rect(0, 0, 54, 20),
                       color=color,
                       justify=0)
Exemplo n.º 12
0
 def __call__(self, screen):
     if self.predraw:
         self.predraw(screen)
     else:
         self.backdrop.tile(screen, (self.counter * 5, self.counter))
     if self.menu and self.charsheets:
         cs = self.charsheets.get(
             self.menu.items[self.menu.selected_item].value, None)
         if cs:
             cs.render(screen)
     if self.rect:
         pygwrap.default_border.render(screen, self.rect)
     if self.caption and self.caption_rect:
         pygwrap.default_border.render(screen, self.caption_rect)
         pygwrap.draw_text(screen,
                           pygwrap.BIGFONT,
                           self.caption,
                           self.caption_rect,
                           justify=0)
     self.counter += 4
Exemplo n.º 13
0
    def __call__( self , screen ):
        if self.predraw:
            self.predraw( screen )
        else:
            self.backdrop.tile( screen , ( self.counter * 5 , self.counter ) )
        if self.csheet:
            self.csheet.render( screen )
        if self.rect:
            pygwrap.default_border.render( screen , self.rect )
            if self.menu:
                # Display the item info in the upper display rect.
                it = self.menu.items[ self.menu.selected_item ].value
                if isinstance( it, Item ):
                    display_item_info( screen, it, self.rect )
                elif isinstance( it, Spell ):
                    self.display_spell_info( screen, it )

        if self.caption and self.caption_rect:
            pygwrap.default_border.render( screen , self.caption_rect )
            pygwrap.draw_text( screen, pygwrap.BIGFONT, self.caption, self.caption_rect, justify = 0 )
        self.counter += 4
Exemplo n.º 14
0
    def select_area( self, origin, aoegen, caption = None ):
        # Start by determining the possible target tiles.
        legal_tiles = aoegen.get_targets( self.camp, origin )
        target = None
        aoe = set()

        # Keep processing until a target is selected.
        while not target:
            # Get input and process it.
            gdi = pygwrap.wait_event()

            if gdi.type == pygwrap.TIMEREVENT:
                # Set the mouse cursor on the map.
                self.view.overlays.clear()
                self.view.overlays[ origin ] = maps.OVERLAY_CURRENTCHARA
                self.view.overlays[ self.view.mouse_tile ] = maps.OVERLAY_CURSOR
                if self.view.mouse_tile in legal_tiles:
                    aoe = aoegen.get_area( self.camp, origin, self.view.mouse_tile )
                    for p in aoe:
                        self.view.overlays[ p ] = maps.OVERLAY_AOE

                self.view( self.screen )
                if caption:
                    pygwrap.default_border.render( self.screen, self.SELECT_AREA_CAPTION_ZONE )
                    pygwrap.draw_text( self.screen, pygwrap.SMALLFONT, caption, self.SELECT_AREA_CAPTION_ZONE )

                pygame.display.flip()
            elif gdi.type == pygame.KEYDOWN and gdi.key == pygame.K_F1:
                caption = "Record Anim"
                self.record_anim = True
            elif gdi.type == pygame.QUIT:
                self.no_quit = False
                break
            elif gdi.type == pygame.MOUSEBUTTONUP:
                if gdi.button == 1 and self.view.mouse_tile in legal_tiles:
                    target = self.view.mouse_tile
                else:
                    break
        self.view.overlays.clear()
        return target
Exemplo n.º 15
0
    def __call__( self , screen ):
        if self.predraw:
            self.predraw( screen )
        else:
            self.backdrop.tile( screen , ( self.counter * 5 , self.counter ) )
        if self.rect1:
            pygwrap.default_border.render( screen , self.rect1 )
            if self.pc:
                pygwrap.draw_text( screen, pygwrap.BIGFONT, str( self.pc ), self.rect1, justify=0, color=(240,240,240) )
                myrect = pygame.Rect( self.rect1.x, self.rect1.y + pygwrap.BIGFONT.get_linesize(), self.rect1.width, 32 )
                pygwrap.draw_text( screen, pygwrap.ITALICFONT, "carrying " + encumberance_desc( self.pc ), myrect, justify=0 )

        if self.rect2:
            pygwrap.default_border.render( screen , self.rect2 )
            if self.menu:
                # Display the item info in the upper display rect.
                it = self.menu.items[ self.menu.selected_item ].value
                if isinstance( it, Item ):
                    display_item_info( screen, it, self.rect2 )
        if self.caption and self.caption_rect:
            pygwrap.default_border.render( screen , self.caption_rect )
            pygwrap.draw_text( screen, pygwrap.BIGFONT, self.caption, self.caption_rect, justify = 0 )
        if self.off_menu:
            self.off_menu.render( do_extras=False )
        self.counter += 4
Exemplo n.º 16
0
    def select_area( self, origin, aoegen, caption = None ):
        # Start by determining the possible target tiles.
        legal_tiles = aoegen.get_targets( self.camp, origin )
        target = None
        aoe = set()

        # Keep processing until a target is selected.
        while not target:
            # Get input and process it.
            gdi = pygwrap.wait_event()

            if gdi.type == pygwrap.TIMEREVENT:
                # Set the mouse cursor on the map.
                self.view.overlays.clear()
                self.view.overlays[ origin ] = maps.OVERLAY_CURRENTCHARA
                self.view.overlays[ self.view.mouse_tile ] = maps.OVERLAY_CURSOR
                if self.view.mouse_tile in legal_tiles:
                    aoe = aoegen.get_area( self.camp, origin, self.view.mouse_tile )
                    for p in aoe:
                        self.view.overlays[ p ] = maps.OVERLAY_AOE

                self.view( self.screen )
                if caption:
                    pygwrap.default_border.render( self.screen, self.SELECT_AREA_CAPTION_ZONE )
                    pygwrap.draw_text( self.screen, pygwrap.SMALLFONT, caption, self.SELECT_AREA_CAPTION_ZONE )

                pygame.display.flip()
            elif gdi.type == pygame.KEYDOWN and gdi.key == pygame.K_F1:
                caption = "Record Anim"
                self.record_anim = True
            elif gdi.type == pygame.QUIT:
                self.no_quit = False
                break
            elif gdi.type == pygame.MOUSEBUTTONUP:
                if gdi.button == 1 and self.view.mouse_tile in legal_tiles:
                    target = self.view.mouse_tile
                else:
                    break
        self.view.overlays.clear()
        return target
Exemplo n.º 17
0
def display_item_info( screen, it, myrect ):
    """Use the screen to display "it" in myrect."""
    y = myrect.y
#    pygwrap.draw_text( screen, pygwrap.BIGFONT, str( it ), pygame.Rect( myrect.x, y, myrect.width, pygwrap.BIGFONT.get_linesize() ), justify = 0, color=(240,240,240) )
#    y += pygwrap.BIGFONT.get_linesize()

    myimg = pygwrap.render_text( pygwrap.BIGFONT, str( it ), myrect.width, justify=0, color=(240,240,240) )
    myrect = myimg.get_rect( topleft = ( myrect.x, y ) )
    screen.blit( myimg , myrect )
    y += myrect.height

    myrect = pygame.Rect( myrect.x, y, myrect.width, pygwrap.SMALLFONT.get_linesize() )
    if it.identified:
        pygwrap.draw_text( screen, pygwrap.SMALLFONT, str( it.cost() ) + " GP", myrect, justify = -1 )
    else:
        pygwrap.draw_text( screen, pygwrap.SMALLFONT, "? GP", myrect, justify = -1 )
    pygwrap.draw_text( screen, pygwrap.SMALLFONT, str( it.mass // 10 ) + "." + str( it.mass % 10 ) + "lbs", myrect, justify = 1 )
    y += pygwrap.BIGFONT.get_linesize()

    msg = it.desc()
    if msg:
        myimg = pygwrap.render_text(pygwrap.SMALLFONT, msg, myrect.width, justify = -1 )
        myrect = myimg.get_rect( topleft = ( myrect.x, y ) )
        screen.blit( myimg , myrect )
        y += myrect.height + 6

    msg = it.stat_desc()
    if msg and it.identified:
        myimg = pygwrap.render_text(pygwrap.ITALICFONT, msg, myrect.width, justify = 0 )
        myrect = myimg.get_rect( topleft = ( myrect.x, y ) )
        screen.blit( myimg , myrect )
Exemplo n.º 18
0
    def render(self, screen):
        pygwrap.default_border.render(screen, self)

        y = self.y + 6

        for pc in self.party:
            screen.blit(self.avatars[pc], (self.x - 20, y - 20))

            # Header info- name and level/gender/race/class
            pygwrap.draw_text(screen,
                              pygwrap.BIGFONT,
                              pc.name,
                              pygame.Rect(self.x + 64, y, self.width - 64,
                                          pygwrap.BIGFONT.get_linesize()),
                              justify=0,
                              color=(240, 240, 240))
            y += pygwrap.BIGFONT.get_linesize()
            pygwrap.draw_text(screen,
                              pygwrap.SMALLFONT,
                              pc.desc(),
                              pygame.Rect(self.x + 64, y, self.width - 64,
                                          pygwrap.SMALLFONT.get_linesize()),
                              justify=0)
            y += pygwrap.SMALLFONT.get_linesize()
            pygwrap.draw_text(screen,
                              pygwrap.SMALLFONT,
                              "XP: " + str(pc.xp) + "/" +
                              str(pc.xp_for_next_level()),
                              pygame.Rect(self.x + 64, y, self.width - 64,
                                          pygwrap.SMALLFONT.get_linesize()),
                              justify=0)
            y += 32
Exemplo n.º 19
0
    def __call__( self, screen ):
        self.explo.view( screen )
        pygwrap.default_border.render( screen, self.rect )
        pygwrap.draw_text( screen, pygwrap.SMALLFONT, str( self.chara ), self.rect )
        ap = min( self.chara.get_move() - self.comba.ap_spent[ self.chara ], 24 )
        if self.hmap and self.comba.scene.on_the_map( *self.explo.view.mouse_tile ):
            apr = ap - self.hmap.map[self.explo.view.mouse_tile[0]][self.explo.view.mouse_tile[1]]
        else:
            apr = ap

        if ap > 0:
            mydest = pygame.Rect( self.rect.x + 180, self.rect.y, 32, 32 )
            pygwrap.draw_text( screen, pygwrap.ITALICFONT, "AP:", mydest )
            for t in range( 1, (ap+3)//2 ):
                mydest.x = self.rect.x + 198 + t * 8
                if t <= ( apr + 1 ) //2:
                    if apr >= t * 2:
                        self.gems.render( screen, mydest, 1 )
                    else:
                        self.gems.render( screen, mydest, 6 )
                else:
                    self.gems.render( screen, mydest, 5 )
Exemplo n.º 20
0
    def display_spell_info(self, screen, it):
        """Use the screen to display "it" in myrect."""
        y = self.rect.y
        pygwrap.draw_text(screen,
                          pygwrap.BIGFONT,
                          str(it),
                          pygame.Rect(self.rect.x, y, self.rect.width,
                                      pygwrap.BIGFONT.get_linesize()),
                          justify=0,
                          color=(240, 240, 240))
        y += pygwrap.BIGFONT.get_linesize()
        myrect = pygame.Rect(self.rect.x, y, self.rect.width, 16)
        pygwrap.draw_text(screen,
                          pygwrap.SMALLFONT,
                          "MP: {0}".format(it.mp_cost()),
                          myrect,
                          justify=1)
        # Display the spell colors. Start by listing the colors.
        gemlist = list()
        for k, v in it.gems.iteritems():
            gemlist += (k + 1, ) * v
        for t in range(it.gems_needed()):
            if t < len(gemlist):
                sgcolor = gemlist[t]
            else:
                sgcolor = 0
            self.spell_gem_sprite.render(screen, (self.rect.x + t * 9, y),
                                         sgcolor)

        y += pygwrap.BIGFONT.get_linesize()

        if it.desc:
            myimg = pygwrap.render_text(pygwrap.SMALLFONT,
                                        it.desc,
                                        myrect.width,
                                        justify=-1)
            myrect = myimg.get_rect(topleft=(myrect.x, y))
            screen.blit(myimg, myrect)
Exemplo n.º 21
0
 def just_print(self,
                screen,
                x,
                y,
                text1,
                text2,
                width=120,
                color=pygwrap.TEXT_COLOR):
     """Do proper justification for stat line at x,y."""
     if text1:
         pygwrap.draw_text(screen,
                           pygwrap.SMALLFONT,
                           text1,
                           pygame.Rect(x, y, width, 20),
                           justify=-1,
                           color=color)
     if text2:
         pygwrap.draw_text(screen,
                           pygwrap.SMALLFONT,
                           text2,
                           pygame.Rect(x, y, width, 20),
                           justify=1,
                           color=color)
Exemplo n.º 22
0
def display_item_info(screen, it, myrect):
    """Use the screen to display "it" in myrect."""
    y = myrect.y
    #    pygwrap.draw_text( screen, pygwrap.BIGFONT, str( it ), pygame.Rect( myrect.x, y, myrect.width, pygwrap.BIGFONT.get_linesize() ), justify = 0, color=(240,240,240) )
    #    y += pygwrap.BIGFONT.get_linesize()

    myimg = pygwrap.render_text(pygwrap.BIGFONT,
                                str(it),
                                myrect.width,
                                justify=0,
                                color=(240, 240, 240))
    myrect = myimg.get_rect(topleft=(myrect.x, y))
    screen.blit(myimg, myrect)
    y += myrect.height

    myrect = pygame.Rect(myrect.x, y, myrect.width,
                         pygwrap.SMALLFONT.get_linesize())
    if it.identified:
        pygwrap.draw_text(screen,
                          pygwrap.SMALLFONT,
                          str(it.cost()) + " GP",
                          myrect,
                          justify=-1)
    else:
        pygwrap.draw_text(screen,
                          pygwrap.SMALLFONT,
                          "? GP",
                          myrect,
                          justify=-1)
    pygwrap.draw_text(screen,
                      pygwrap.SMALLFONT,
                      str(it.mass // 10) + "." + str(it.mass % 10) + "lbs",
                      myrect,
                      justify=1)
    y += pygwrap.BIGFONT.get_linesize()

    msg = it.desc()
    if msg:
        myimg = pygwrap.render_text(pygwrap.SMALLFONT,
                                    msg,
                                    myrect.width,
                                    justify=-1)
        myrect = myimg.get_rect(topleft=(myrect.x, y))
        screen.blit(myimg, myrect)
        y += myrect.height + 6

    msg = it.stat_desc()
    if msg and it.identified:
        myimg = pygwrap.render_text(pygwrap.ITALICFONT,
                                    msg,
                                    myrect.width,
                                    justify=0)
        myrect = myimg.get_rect(topleft=(myrect.x, y))
        screen.blit(myimg, myrect)
Exemplo n.º 23
0
    def __call__(self, screen):
        if self.predraw:
            self.predraw(screen)
        pygwrap.default_border.render(screen, self)

        # Header avatar
        if self.img:
            screen.blit(self.img, (self.x - 20, self.y - 20))
            self.smilies.render(screen, (self.x + 50, self.y),
                                self.get_smiley(self.friendliness))
            pygwrap.draw_text(screen,
                              pygwrap.SMALLFONT,
                              str(self.friendliness),
                              pygame.Rect(self.x + 55, self.y + 16, 64,
                                          pygwrap.SMALLFONT.get_linesize()),
                              justify=-1)

        # Header info- name and level/gender/race/class
        y = self.y + 6
        pygwrap.draw_text(screen,
                          pygwrap.BIGFONT,
                          str(self.npc),
                          pygame.Rect(self.x + 64, y, self.width - 64,
                                      pygwrap.BIGFONT.get_linesize()),
                          justify=0,
                          color=(240, 240, 240))
        y += pygwrap.BIGFONT.get_linesize()
        pygwrap.draw_text(screen,
                          pygwrap.SMALLFONT,
                          self.npc.desc(),
                          pygame.Rect(self.x + 64, y, self.width - 64,
                                      pygwrap.SMALLFONT.get_linesize()),
                          justify=0)

        pygwrap.draw_text(screen,
                          pygwrap.SMALLFONT,
                          self.text,
                          self.text_rect,
                          justify=-1)
Exemplo n.º 24
0
    def render( self, screen ):
        pygwrap.default_border.render( screen , self )

        y = self.y + 6

        for pc in self.party:
            screen.blit(self.avatars[pc] , (self.x-20,y-20) )

            # Header info- name and level/gender/race/class
            pygwrap.draw_text( screen, pygwrap.BIGFONT, pc.name, pygame.Rect( self.x+64, y, self.width-64, pygwrap.BIGFONT.get_linesize() ), justify = 0, color=(240,240,240) )
            y += pygwrap.BIGFONT.get_linesize()
            pygwrap.draw_text( screen, pygwrap.SMALLFONT, pc.desc(), pygame.Rect( self.x+64, y, self.width-64, pygwrap.SMALLFONT.get_linesize() ), justify = 0 )
            y += pygwrap.SMALLFONT.get_linesize()
            pygwrap.draw_text( screen, pygwrap.SMALLFONT, "XP: "+str(pc.xp)+"/"+str(pc.xp_for_next_level()), pygame.Rect( self.x+64, y, self.width-64, pygwrap.SMALLFONT.get_linesize() ), justify = 0 )
            y += 32
Exemplo n.º 25
0
    def __call__( self, screen ):
        if self.predraw:
            self.predraw( screen )
        pygwrap.default_border.render( screen , self )

        # Header avatar
        if self.img:
            screen.blit(self.img , (self.x-20,self.y-20) )

        # Header info- name and level/gender/race/class
        y = self.y + 6
        pygwrap.draw_text( screen, pygwrap.BIGFONT, str( self.npc ), pygame.Rect( self.x+64, y, self.width-64, pygwrap.BIGFONT.get_linesize() ), justify = 0, color=(240,240,240) )
        y += pygwrap.BIGFONT.get_linesize()
        pygwrap.draw_text( screen, pygwrap.SMALLFONT, self.npc.desc(), pygame.Rect( self.x+64, y, self.width-64, pygwrap.SMALLFONT.get_linesize() ), justify = 0 )

        pygwrap.draw_text( screen, pygwrap.SMALLFONT, self.text, self.text_rect, justify = -1 )
Exemplo n.º 26
0
    def __call__(self, screen):
        if self.predraw:
            self.predraw(screen)
        else:
            self.backdrop.tile(screen, (self.counter * 5, self.counter))
        if self.rect1:
            pygwrap.default_border.render(screen, self.rect1)
            if self.pc:
                pygwrap.draw_text(screen,
                                  pygwrap.BIGFONT,
                                  str(self.pc),
                                  self.rect1,
                                  justify=0,
                                  color=(240, 240, 240))
                myrect = pygame.Rect(
                    self.rect1.x,
                    self.rect1.y + pygwrap.BIGFONT.get_linesize(),
                    self.rect1.width, 32)
                pygwrap.draw_text(screen,
                                  pygwrap.ITALICFONT,
                                  "carrying " + encumberance_desc(self.pc),
                                  myrect,
                                  justify=0)

        if self.rect2:
            pygwrap.default_border.render(screen, self.rect2)
            if self.menu:
                # Display the item info in the upper display rect.
                it = self.menu.items[self.menu.selected_item].value
                if isinstance(it, Item):
                    display_item_info(screen, it, self.rect2)
        if self.caption and self.caption_rect:
            pygwrap.default_border.render(screen, self.caption_rect)
            pygwrap.draw_text(screen,
                              pygwrap.BIGFONT,
                              self.caption,
                              self.caption_rect,
                              justify=0)
        if self.off_menu:
            self.off_menu.render(do_extras=False)
        self.counter += 4
Exemplo n.º 27
0
 def just_print( self, screen, x, y, text1, text2, width=120, color=pygwrap.TEXT_COLOR ):
     """Do proper justification for stat line at x,y."""
     if text1:
         pygwrap.draw_text( screen, pygwrap.SMALLFONT, text1, pygame.Rect( x, y, width, 20 ), justify = -1, color=color )
     if text2:
         pygwrap.draw_text( screen, pygwrap.SMALLFONT, text2, pygame.Rect( x, y, width, 20 ), justify = 1, color=color )
Exemplo n.º 28
0
def edit_map( levelmap , screen ):
    # Edit this map in place.
    edit_cursor = image.Image( "edit_cursors.png" , 32 , 32 )

    curs_x = 0
    curs_y = 0

    terrain = -1

    keep_going = True

    while keep_going:
            ev = pygwrap.wait_event()

            if ev.type == pygwrap.TIMEREVENT:
                levelmap.center_on( curs_x * levelmap.tile_size + 16 , curs_y * levelmap.tile_size + 16 )
                levelmap.render( screen , show_special = True )
                edit_cursor.render( screen , ( screen.get_width() / 2 - 16 , screen.get_height() / 2 - 16 ) , 0 )
                pygwrap.draw_text( screen , pygwrap.SMALLFONT , str( curs_x ) + "," + str( curs_y ) + '  things:' + str( len( levelmap.contents ) ) , pygame.Rect( 8 , 42 , 256 , 32 ) )

                if terrain > -1:
                    levelmap.sprite.render( screen , ( 8 , 8 ) , terrain )
                edit_cursor.render( screen , ( 8 , 8 ) , 1 )

                pygame.display.flip()

            elif ev.type == pygame.KEYDOWN:
                if ( ev.key == pygame.K_UP ) and ( curs_y > 0 ):
                    curs_y += -1
                elif ( ev.key == pygame.K_DOWN ) and ( curs_y < ( levelmap.height - 1 ) ):
                    curs_y += 1
                elif ( ev.key == pygame.K_LEFT ) and ( curs_x > 0 ):
                    curs_x += -1
                elif ( ev.key == pygame.K_RIGHT ) and ( curs_x < ( levelmap.width - 1 ) ):
                    curs_x += 1
                elif ev.key == pygame.K_LEFTBRACKET:
                    terrain += -1
                    if terrain < -1:
                        terrain = levelmap.sprite.num_frames() - 1
                elif ev.key == pygame.K_RIGHTBRACKET:
                    terrain += 1
                    if terrain >= levelmap.sprite.num_frames():
                        terrain = -1
                elif ev.key == pygame.K_SPACE:
                    levelmap.map[curs_x][curs_y] = terrain
                    if terrain in TERRAIN_NEXT:
                        terrain = TERRAIN_NEXT[ terrain ]

                elif ev.unicode == u"_":
                    for x in range( 0 , levelmap.width ):
                        levelmap.map[x][curs_y] = terrain
                        if terrain in TERRAIN_NEXT:
                            terrain = TERRAIN_NEXT[ terrain ]

                elif ev.key == pygame.K_DELETE:
                    # If there's a thing in this tile, delete it.
                    # If not, delete the map terrain.
                    deleted_thing = False
                    for t in levelmap.contents:
                        if ( t.x == curs_x * levelmap.tile_size ) and ( t.y == curs_y * levelmap.tile_size ):
                            levelmap.contents.remove( t )
                            deleted_thing = True
                    if not deleted_thing:
                        levelmap.map[curs_x][curs_y] = -1
                elif ev.key == pygame.K_b:
                    select_backdrop( levelmap , screen )
                elif ev.key == pygame.K_p:
                    levelmap.pc_start_x = curs_x
                    levelmap.pc_start_y = curs_y

                elif ev.key == pygame.K_F1:
                    lm2 = copy.deepcopy( levelmap )
                    pc = player.Player()
                    lm2.enter( pc , screen )

                elif ev.key == pygame.K_TAB:
                    terrain = choose_terrain( levelmap , screen )

                elif ev.key == pygame.K_m:
                    monster = select_monster( levelmap , screen )
                    if monster:
                        levelmap.contents.append( monster( x = curs_x * levelmap.tile_size , y = curs_y * levelmap.tile_size ) )

                elif ev.key == pygame.K_i:
                    item = select_item( levelmap , screen )
                    if item:
                        levelmap.contents.append( item( x = curs_x * levelmap.tile_size , y = curs_y * levelmap.tile_size ) )

                elif ev.key == pygame.K_u:
                    item = select_usable( levelmap , screen )
                    if item:
                        levelmap.contents.append( item( x = curs_x * levelmap.tile_size , y = curs_y * levelmap.tile_size ) )

                elif ev.key == pygame.K_g:
                    monster = select_monster( levelmap , screen , prompt = "Select Monster to Generate" )
                    n = select_number( levelmap , screen , 1, 11, 1, prompt = "How many at once?" )
                    freq = select_number( levelmap , screen , 30, 301 , 30, prompt = "How often to generate?" )
                    if monster and n:
                        levelmap.contents.append( generator.Generator(x = curs_x * levelmap.tile_size , y = curs_y * levelmap.tile_size, product=monster, number = n , frequency = freq ) )

                elif ev.key == pygame.K_s:
                    if levelmap.fname == "":
                        levelmap.fname = "gorch.dat"
                    f = open( "level/" + levelmap.fname , "wb" )
                    pickle.dump( levelmap , f , -1 )
                    f.close()

                elif ev.key == pygame.K_ESCAPE:
                    keep_going = False

            elif ev.type == pygame.QUIT:
                keep_going = False
Exemplo n.º 29
0
 def __init__(self, txt="???", pos=(0,0), loop=16, color=(250,250,250), delay=1 ):
     super(Caption, self).__init__(sprite_name=None,pos=pos,loop=loop,y_off=-16, delay=delay)
     pygwrap.draw_text( self.sprite.bitmap, pygwrap.ANIMFONT, txt, pygame.Rect(0,0,54,20), color=color, justify=0 )
Exemplo n.º 30
0
    def render( self, screen ):
        pygwrap.default_border.render( screen , self )

        # Header avatar
        if self.img:
            screen.blit(self.img , (self.x-20,self.y-20) )

        # Header info- name and level/gender/race/class
        y = self.y + 6
        pygwrap.draw_text( screen, pygwrap.BIGFONT, self.pc.name, pygame.Rect( self.x+64, y, self.width-64, pygwrap.BIGFONT.get_linesize() ), justify = 0, color=(240,240,240) )
        y += pygwrap.BIGFONT.get_linesize()
        pygwrap.draw_text( screen, pygwrap.SMALLFONT, self.pc.desc(), pygame.Rect( self.x+64, y, self.width-64, pygwrap.SMALLFONT.get_linesize() ), justify = 0 )
        y += pygwrap.SMALLFONT.get_linesize()
        pygwrap.draw_text( screen, pygwrap.SMALLFONT, "XP: "+str(self.pc.xp)+"/"+str(self.pc.xp_for_next_level()), pygame.Rect( self.x+64, y, self.width-64, pygwrap.SMALLFONT.get_linesize() ), justify = 0 )

        # Column 1 - Basic info
        y = self.y + self.BODY_Y
        for s in stats.PRIMARY_STATS:
            self.just_print( screen, self.x, y, s.name+":", "" )
            current_val = self.pc.get_stat(s)
            normal_val = self.pc.get_stat(s,False)
            if current_val < normal_val:
                self.just_print( screen, self.x, y, "", str( max( current_val , 1 ) ), color=(240,50,0) )
            else:
                self.just_print( screen, self.x, y, "", str( max( current_val , 1 ) ) )

            y += pygwrap.SMALLFONT.get_linesize()

        y += pygwrap.SMALLFONT.get_linesize()

        self.just_print( screen, self.x, y, "HP:", str( self.pc.current_hp() ) + "/" + str( self.pc.max_hp() ) )
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print( screen, self.x, y, "MP:", str( self.pc.current_mp() ) + "/" + str( self.pc.max_mp() ) )
        y += pygwrap.SMALLFONT.get_linesize() * 2
        if self.camp:
            self.just_print( screen, self.x, y, "Gold:", str( self.camp.gold ) )
        else:
            self.just_print( screen, self.x, y, "Gold:", "0" )
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print( screen, self.x, y, "Encumberance:", "" )
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print( screen, self.x, y, "", encumberance_desc( self.pc, False ), width=135 )

        y += pygwrap.SMALLFONT.get_linesize() * 2
        sg = self.pc.total_spell_gems()
        self.just_print( screen, self.x, y, "Spell Slots:", "{0}/{1}".format( max(sg - self.pc.spell_gems_used(),0), sg ), width=135 )
        for sgcolor in COLORS:
            y += pygwrap.SMALLFONT.get_linesize()
            self.spell_gem_sprite.render( screen, ( self.x+2, y ), sgcolor+1 )
            sg = self.pc.spell_gems_of_color(sgcolor)
            self.just_print( screen, self.x+15, y, "{0}:".format(COLOR_NAME[sgcolor]), "{0}/{1}".format( max(sg - self.pc.spell_gems_of_color_used(sgcolor),0), sg ) )

        mystatus = list()
        for sfx in self.pc.condition:
            if sfx.NAME:
                mystatus.append( sfx.NAME )
        if mystatus:
            y += pygwrap.SMALLFONT.get_linesize() * 2
            status_dest = pygame.Rect( self.x, y, 120, self.y + self.height - y )
            pygwrap.draw_text( screen, pygwrap.SMALLFONT, ", ".join( mystatus ), status_dest, color=(240,140,0) )

            

        # Column 2 - skills
        y = self.y + self.BODY_Y
        self.just_print( screen, self.x+self.RIGHT_COLUMN, y, "Melee:", str(self.pc.get_stat(stats.PHYSICAL_ATTACK)+self.pc.get_stat_bonus(stats.STRENGTH))+"%" )
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print( screen, self.x+self.RIGHT_COLUMN, y, "Missile:", str(self.pc.get_stat(stats.PHYSICAL_ATTACK)+self.pc.get_stat_bonus(stats.REFLEXES))+"%" )
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print( screen, self.x+self.RIGHT_COLUMN, y, "Defence:", str(self.pc.get_defense())+"%" )
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print( screen, self.x+self.RIGHT_COLUMN, y, "Magic:", str(self.pc.get_stat(stats.MAGIC_ATTACK)+self.pc.get_stat_bonus(stats.INTELLIGENCE))+"%" )
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print( screen, self.x+self.RIGHT_COLUMN, y, "Aura:", str(self.pc.get_stat(stats.MAGIC_DEFENSE)+self.pc.get_stat_bonus(stats.PIETY))+"%" )
        y += pygwrap.SMALLFONT.get_linesize() * 2

        for s in stats.SECONDARY_STATS:
            # Stealth gets a bit of special treatment here.
            if s is stats.STEALTH:
                if self.pc.can_use_stealth():
                    sv = self.pc.get_stat(s) + self.pc.get_stat_bonus( s.default_bonus )
                    self.just_print( screen, self.x+self.RIGHT_COLUMN, y, s.name+":", str(sv)+"%", width=160 )
                    y += pygwrap.SMALLFONT.get_linesize()
            elif s is stats.HOLY_SIGN:
                if self.pc.can_use_holy_sign():
                    sv = self.pc.get_stat(s) + self.pc.get_stat_bonus( s.default_bonus )
                    self.just_print( screen, self.x+self.RIGHT_COLUMN, y, s.name+":", str(sv)+"%", width=160 )
                    y += pygwrap.SMALLFONT.get_linesize()
            else:
                sv = self.pc.get_stat(s)
                if sv:
                    if s.default_bonus:
                        sv += self.pc.get_stat_bonus( s.default_bonus )
                    self.just_print( screen, self.x+self.RIGHT_COLUMN, y, s.name+":", str(sv)+"%", width=160 )
                    y += pygwrap.SMALLFONT.get_linesize()
Exemplo n.º 31
0
 def __call__( self , screen ):
     self.backdrop.tile( screen , ( self.counter * 5 , self.counter ) )
     if self.caption:
         pygwrap.default_border.render( screen , self.rect )
         pygwrap.draw_text( screen , pygwrap.SMALLFONT , self.caption , self.rect , do_center = True )
     self.counter += 5
Exemplo n.º 32
0
    def render(self, screen):
        pygwrap.default_border.render(screen, self)

        # Header avatar
        if self.img:
            screen.blit(self.img, (self.x - 20, self.y - 20))

        # Header info- name and level/gender/race/class
        y = self.y + 6
        pygwrap.draw_text(screen,
                          pygwrap.BIGFONT,
                          self.pc.name,
                          pygame.Rect(self.x + 64, y, self.width - 64,
                                      pygwrap.BIGFONT.get_linesize()),
                          justify=0,
                          color=(240, 240, 240))
        y += pygwrap.BIGFONT.get_linesize()
        pygwrap.draw_text(screen,
                          pygwrap.SMALLFONT,
                          self.pc.desc(),
                          pygame.Rect(self.x + 64, y, self.width - 64,
                                      pygwrap.SMALLFONT.get_linesize()),
                          justify=0)
        y += pygwrap.SMALLFONT.get_linesize()
        pygwrap.draw_text(screen,
                          pygwrap.SMALLFONT,
                          "XP: " + str(self.pc.xp) + "/" +
                          str(self.pc.xp_for_next_level()),
                          pygame.Rect(self.x + 64, y, self.width - 64,
                                      pygwrap.SMALLFONT.get_linesize()),
                          justify=0)

        # Column 1 - Basic info
        y = self.y + self.BODY_Y
        for s in stats.PRIMARY_STATS:
            self.just_print(screen, self.x, y, s.name + ":", "")
            current_val = self.pc.get_stat(s)
            normal_val = self.pc.get_stat(s, False)
            if current_val < normal_val:
                self.just_print(screen,
                                self.x,
                                y,
                                "",
                                str(max(current_val, 1)),
                                color=(240, 50, 0))
            else:
                self.just_print(screen, self.x, y, "", str(max(current_val,
                                                               1)))

            y += pygwrap.SMALLFONT.get_linesize()

        y += pygwrap.SMALLFONT.get_linesize()

        self.just_print(
            screen, self.x, y, "HP:",
            str(self.pc.current_hp()) + "/" + str(self.pc.max_hp()))
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print(
            screen, self.x, y, "MP:",
            str(self.pc.current_mp()) + "/" + str(self.pc.max_mp()))
        y += pygwrap.SMALLFONT.get_linesize() * 2
        if self.camp:
            self.just_print(screen, self.x, y, "Gold:", str(self.camp.gold))
        else:
            self.just_print(screen, self.x, y, "Gold:", "0")
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print(screen, self.x, y, "Encumberance:", "")
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print(screen,
                        self.x,
                        y,
                        "",
                        encumberance_desc(self.pc, False),
                        width=135)

        y += pygwrap.SMALLFONT.get_linesize() * 2
        sg = self.pc.total_spell_gems()
        self.just_print(screen,
                        self.x,
                        y,
                        "Spell Slots:",
                        "{0}/{1}".format(
                            max(sg - self.pc.spell_gems_used(), 0), sg),
                        width=135)
        for sgcolor in COLORS:
            y += pygwrap.SMALLFONT.get_linesize()
            self.spell_gem_sprite.render(screen, (self.x + 2, y), sgcolor + 1)
            sg = self.pc.spell_gems_of_color(sgcolor)
            self.just_print(
                screen, self.x + 15, y, "{0}:".format(COLOR_NAME[sgcolor]),
                "{0}/{1}".format(
                    max(sg - self.pc.spell_gems_of_color_used(sgcolor), 0),
                    sg))

        mystatus = list()
        for sfx in self.pc.condition:
            if sfx.NAME:
                mystatus.append(sfx.NAME)
        if mystatus:
            y += pygwrap.SMALLFONT.get_linesize() * 2
            status_dest = pygame.Rect(self.x, y, 120, self.y + self.height - y)
            pygwrap.draw_text(screen,
                              pygwrap.SMALLFONT,
                              ", ".join(mystatus),
                              status_dest,
                              color=(240, 140, 0))

        # Column 2 - skills
        y = self.y + self.BODY_Y
        self.just_print(
            screen, self.x + self.RIGHT_COLUMN, y, "Melee:",
            str(
                self.pc.get_stat(stats.PHYSICAL_ATTACK) +
                self.pc.get_stat_bonus(stats.STRENGTH)) + "%")
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print(
            screen, self.x + self.RIGHT_COLUMN, y, "Missile:",
            str(
                self.pc.get_stat(stats.PHYSICAL_ATTACK) +
                self.pc.get_stat_bonus(stats.REFLEXES)) + "%")
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print(screen, self.x + self.RIGHT_COLUMN, y, "Defence:",
                        str(self.pc.get_defense()) + "%")
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print(
            screen, self.x + self.RIGHT_COLUMN, y, "Magic:",
            str(
                self.pc.get_stat(stats.MAGIC_ATTACK) +
                self.pc.get_stat_bonus(stats.INTELLIGENCE)) + "%")
        y += pygwrap.SMALLFONT.get_linesize()
        self.just_print(
            screen, self.x + self.RIGHT_COLUMN, y, "Aura:",
            str(
                self.pc.get_stat(stats.MAGIC_DEFENSE) +
                self.pc.get_stat_bonus(stats.PIETY)) + "%")
        y += pygwrap.SMALLFONT.get_linesize() * 2

        for s in stats.SECONDARY_STATS:
            # Stealth gets a bit of special treatment here.
            if s is stats.STEALTH:
                if self.pc.can_use_stealth():
                    sv = self.pc.get_stat(s) + self.pc.get_stat_bonus(
                        s.default_bonus)
                    self.just_print(screen,
                                    self.x + self.RIGHT_COLUMN,
                                    y,
                                    s.name + ":",
                                    str(sv) + "%",
                                    width=160)
                    y += pygwrap.SMALLFONT.get_linesize()
            elif s is stats.HOLY_SIGN:
                if self.pc.can_use_holy_sign():
                    sv = self.pc.get_stat(s) + self.pc.get_stat_bonus(
                        s.default_bonus)
                    self.just_print(screen,
                                    self.x + self.RIGHT_COLUMN,
                                    y,
                                    s.name + ":",
                                    str(sv) + "%",
                                    width=160)
                    y += pygwrap.SMALLFONT.get_linesize()
            else:
                sv = self.pc.get_stat(s)
                if sv:
                    if s.default_bonus:
                        sv += self.pc.get_stat_bonus(s.default_bonus)
                    self.just_print(screen,
                                    self.x + self.RIGHT_COLUMN,
                                    y,
                                    s.name + ":",
                                    str(sv) + "%",
                                    width=160)
                    y += pygwrap.SMALLFONT.get_linesize()
Exemplo n.º 33
0
 def pre( self, screen ):
     self.explo.view( screen )
     pygwrap.default_border.render( screen , self.full_rect )
     pygwrap.draw_text( screen, pygwrap.SMALLFONT, self.desc, self.text_rect, justify = 0 )
Exemplo n.º 34
0
    player.append( c1 )

    # Round two. Fight!
    c2 = get_player_input( screen , "Very interesting. Make your second choice!" , choices )
    player.append( c2 )

    # Round three- decide on the winner.
    # Remove the player's choices from Enemy.
    for i in player:
        if i in enemy:
            enemy.remove( i )

    if len( enemy ) == 2:
        msg = "Congratulations! You have completely defeated your enemy!"
    elif enemy:
        msg = "The game ends in a draw..."
    else:
        msg = "You have chosen poorly. You die."

    rect = pygame.Rect( 64, 64, 512, 512 )
    pygwrap.default_border.render( screen , rect )
    pygwrap.draw_text( screen , pygwrap.SMALLFONT , msg , rect , do_center = True )
    pygame.display.flip()

    while True:
        ev = pygame.event.wait()
        if ( ev.type == pygame.MOUSEBUTTONDOWN ) or ( ev.type == pygame.QUIT ) or (ev.type == pygame.KEYDOWN):
            break