示例#1
0
def get_life_member_stats(entity):
    stats = get_alpha_surface(RESOURCE_HUD_BASE.get_width(),
                              RESOURCE_HUD_BASE.get_height())
    name = get_text_surface(entity.combatant.name, fontsize=12, color=WHITE)
    level = get_text_surface(str(entity.combatant.level.current_level),
                             fontsize=12,
                             color=WHITE)
    hp = get_surface(HP)
    mp = get_surface(MP)
    tp = get_surface(TP)
    vp = get_surface(VP)

    percent_hp = entity.combatant.attributes.current_hp / entity.combatant.max_hp
    percent_mp = entity.combatant.attributes.current_mp / entity.combatant.max_mp
    percent_tp = entity.combatant.attributes.current_tp / entity.combatant.max_tp
    percent_vp = entity.combatant.attributes.current_vp / entity.combatant.max_vp

    stats.blit(name, (95, 0))
    stats.blit(level, (65, 60))
    stats.blit(scale(hp, (int(hp.get_width() * percent_hp), hp.get_height())),
               (86, 22))
    stats.blit(scale(mp, (int(mp.get_width() * percent_mp), mp.get_height())),
               (86, 34))
    stats.blit(scale(tp, (int(tp.get_width() * percent_tp), tp.get_height())),
               (86, 46))
    stats.blit(scale(vp, (int(vp.get_width() * percent_vp), vp.get_height())),
               (86, 58))

    return stats
示例#2
0
def character_screen(self):

    char_sheet = get_surface(CHARACTER_SHEET_BASE)
    player = self.game.model.party.p1

    # level = get_level_icon(player)
    # age = get_age_icon(player)
    # species = None
    # sex = None

    xp = display_xp_fill(player)
    resources = display_resources(player)
    primaries = display_primary_stats(player)
    secondaries = display_secondary_stats(player)
    attributes = display_attributes(player)
    saves = display_saving_throws(player)

    p_name = get_text_surface(player.name,
                              fontsize=25,
                              color=WHITE,
                              style='source_sans_pro')
    align_and_blit(char_sheet, p_name, x_ratio=0.23, y_ratio=0.25)
    align_and_blit(char_sheet, player.images.portrait, x_ratio=0.23)
    # surf.blit(level, (35, 110))
    # surf.blit(age, (35, 110 + level.get_height()))
    # surf.blit(species, (39, 110 + level.get_height() + age.get_height() + 10))
    # surf.blit(sex, (39, 110 + level.get_height() + age.get_height() + species.get_height() + 20))
    # surf.blit(xp, ((surf.get_width() / 4) - (xp.get_width() / 2), 420))
    align_and_blit(char_sheet, resources, x_ratio=0.23, y_ratio=0.9)
    align_and_blit(char_sheet, xp, x_ratio=0.224, y_ratio=0.948)
    char_sheet.blit(primaries, (405, 175))
    char_sheet.blit(secondaries, (475, 387))
    char_sheet.blit(attributes, (675, 145))
    char_sheet.blit(saves, (605, 386))
    align_and_blit(self.screen, char_sheet)
示例#3
0
def dialogue_screen(self):
    display = get_surface(DIALOGUE_BG)
    surf = get_alpha_surface(display.get_width(),
                             int(display.get_height() * 1.5))
    partner = self.handler.partner

    partner_name = get_text_surface(partner.name.capitalize(),
                                    fontsize=24,
                                    color=WHITE)

    display.blit(
        partner_name,
        (int(display.get_width() * 0.1), int(display.get_height() * 0.05)))
    align_and_blit(surf, partner.images.portrait, y_ratio=0.12)

    dialogue = self.handler.partner.converser.dialogue
    current_node = dialogue.graph_dict.get(dialogue.conversation)
    words = get_wrapped_text_surface(current_node.words,
                                     width=int(display.get_width() * 0.95),
                                     fontsize=18,
                                     color=WHITE)
    display.blit(
        words, (int(display.get_width() * 0.025),
                int(display.get_height() * 0.05 + partner_name.get_height())))

    options = get_dialogue_options(self)
    display.blit(
        options,
        (int(display.get_width() * 0.025), int(display.get_height() * 0.505)))

    surf.blit(display, (surf.get_width() - display.get_width(),
                        surf.get_height() - display.get_height()))
    align_and_blit(self.screen, surf, y_ratio=0.65)
示例#4
0
def display_calendar(time):

    surf = get_surface(CALENDAR_BG)

    display_month(surf, time.month)
    display_day(surf, time.day)

    return surf
示例#5
0
def get_life_event_log(log):
    event_log = get_surface(EVENT_LOG_BG)
    y = 0
    for message in log.messages.messages:
        off_x = 5
        off_y = 5
        print_message(event_log, message, off_x, off_y, y)
        y += 1
    return event_log
示例#6
0
    def get_message_box(self, off_x, off_y):

        window = get_surface(ENCOUNTER_MESSAGE_BG)

        y = 0
        for message in self.game.model.log.messages.messages:
            print_message(window, message, off_x, off_y, y)
            y += 1
        return window
示例#7
0
def get_life_party_travel_settings(party):
    window = get_alpha_surface(248, 186)
    setting_titles = ['Formation', 'Move Speed', 'Rations']
    settings = [party.formation, party.move_speed, party.rations]
    for i in range(3):
        settings_frame = get_surface(PARTY_SETTINGS_FRAME)
        setting_title = get_text_surface(setting_titles[i], color=WHITE)
        align_and_blit(settings_frame, setting_title, y_ratio=0.24)
        setting = get_text_surface(settings[i], fontsize=16)
        align_and_blit(settings_frame, setting, y_ratio=0.68)
        window.blit(settings_frame, (0, i * settings_frame.get_height()))
    return window
示例#8
0
    def life(self):

        life_backdrop = get_surface(LIFE_BACKDROP)
        self.screen.blit(life_backdrop, (0, 0))

        left_panel = get_life_left_panel(self.game.model.party)
        self.screen.blit(left_panel, (0, 0))

        main_screen = get_life_main_screen(self)
        self.screen.blit(main_screen, (264, 36))

        right_panel = get_life_right_panel(self.game)
        self.screen.blit(right_panel, (1654, 0))
示例#9
0
def inventory_screen(self):
    surf = get_surface(INVENTORY_BG)

    display_name_and_portrait(self.game.model.party.p1, surf)
    display_equipment_icons(self.game.model.party.p1, surf)
    display_selected_icon(self, surf)
    display_subinventory(self, surf)
    if self.handler.menu_type.state in (MenuSubStates.SELECTED_OPTIONS, MenuSubStates.EXAMINING_MENU_OBJECT):
        display_entity_options(self, surf)
    if self.handler.menu_type.state is MenuSubStates.EXAMINING_MENU_OBJECT:
        display_entity_examination(self, surf)
    display_mass_capacities(self.game.model.party, surf)
    display_wealth(self.game.model.party.inventory.money, surf)

    align_and_blit(self.screen, surf)
示例#10
0
def display_xp_fill(player):
    fill = get_surface(XP_FILL)
    l = player.combatant.level
    display = get_alpha_surface(fill.get_width(), fill.get_height())
    align_and_blit(
        display,
        scale(fill, (int(fill.get_width() * l.percentage_leveled / 100),
                     fill.get_height())))
    xp_text = get_text_surface('XP:  ' + str(l.current_xp) + '  /  ' +
                               str(l.experience_to_next_level) + '  ( ' +
                               str(int(l.percentage_leveled)) + '% )',
                               fontsize=8,
                               color=WHITE)
    align_and_blit(display, xp_text)

    return display
示例#11
0
def map_screen(self):
    display = get_surface(MAP_BG)
    overworld_tiles = self.game.model.world.dungeons['overworld'].maps[0].tiles
    window = get_alpha_surface(len(overworld_tiles[0]), len(overworld_tiles))

    i, j = 0, 0

    for row in self.game.model.world.mini:
        for img in row:
            if overworld_tiles[j][i].explored:
                window.blit(img, (i, j))
            i += 1
        j += 1
        i = 0
    align_and_blit(display, window)
    align_and_blit(self.screen, display)
示例#12
0
def journal_options_display(subjournal, option):
    obj = JOURNAL_OBJS.get('selected_quest')

    surf = get_alpha_surface(obj.get_width(),
                             obj.get_height() * len(subjournal))
    y = 0
    for i in subjournal:
        if y is option:
            color = YELLOW_SELECT
            bg = get_surface(obj)
        else:
            color = GREY
            bg = get_alpha_surface(obj.get_width(), obj.get_height())
        text = get_text_surface(i.title, 18, color, 'source_sans_pro')
        align_and_blit(bg, text)
        surf.blit(bg, (0, 0 + (y * obj.get_height())))
    return surf
示例#13
0
def shop_screen(self):
    surf = get_surface(SHOP_MENU)
    if self.handler.state is ShopStates.BASE:
        options_img = INVENTORY_ICONS[self.game.options.current.choice]
        party_subinv, shop_subinv = self.handler.get_subinventories(
            self.game.options.current.choice)
    elif self.handler.state in (ShopStates.BUYING, ShopStates.SELLING,
                                ShopStates.TRANSACTING):
        options_img = INVENTORY_ICONS[self.handler.sub_index]
        party_subinv, shop_subinv = self.handler.get_subinventories(
            self.handler.sub_index)
    else:
        ind = self.handler.menu_type.options.choice
        options_img = INVENTORY_ICONS[ind]
        surf.blit(INDICATOR_H,
                  (410, 130 + (32 * self.game.options.current.choice)))
        subinventory = self.handler.menu_type.get_sub()
    ps, ss = display_partysub(party_subinv), display_shopsub(shop_subinv)
    sk_name = get_text_surface(self.handler.shopkeeper.name.capitalize(),
                               fontsize=18)
    sk_money = split_money(self.handler.shopkeeper.shopkeeper.inventory.money,
                           color=WHITE)
    party_money = split_money(self.game.party.inventory.money, color=WHITE)
    td_text = get_text_surface('Transaction Details', fontsize=14, color=WHITE)
    align_and_blit(surf, options_img, x_ratio=0.17, y_ratio=0.16)
    align_and_blit(surf, options_img, x_ratio=0.5, y_ratio=0.16)
    align_and_blit(surf, options_img, x_ratio=0.83, y_ratio=0.16)
    align_and_blit(surf,
                   sk_name,
                   x_ratio=0.1,
                   y_ratio=0.05,
                   x_adjust=6,
                   y_adjust=2)
    align_and_blit(surf, td_text, x_ratio=0.5, y_ratio=0.11)
    align_and_blit(surf, sk_money, x_ratio=0, y_ratio=0.11, x_adjust=60)
    align_and_blit(surf, party_money, x_ratio=0, y_ratio=0.11, x_adjust=622)
    align_and_blit(surf, ps, x_ratio=0.83, y_ratio=0.27)
    align_and_blit(surf, ss, x_ratio=0.17, y_ratio=0.27)
    align_and_blit(self.screen, surf)
示例#14
0
def journal_screen(self):
    surf = get_surface(JOURNAL_OBJS.get('bg'))

    text = JOURNAL_OBJS.get('text' + str(self.handler.menu_type.menu.pointer))
    selected_icon = JOURNAL_OBJS.get('selected_icon')
    current = JOURNAL_OBJS.get('current')
    completed = JOURNAL_OBJS.get('completed')
    codex = JOURNAL_OBJS.get('codex')
    history = JOURNAL_OBJS.get('history')

    align_and_blit(surf, text, x_ratio=0.227, y_ratio=0.227)
    align_and_blit(surf,
                   selected_icon,
                   x_ratio=0.426 +
                   (0.05 * self.handler.menu_type.menu.pointer),
                   y_ratio=0.131)
    align_and_blit(surf, current, x_ratio=0.426, y_ratio=0.131)
    align_and_blit(surf, completed, x_ratio=0.476, y_ratio=0.131)
    align_and_blit(surf, codex, x_ratio=0.526, y_ratio=0.131)
    align_and_blit(surf, history, x_ratio=0.576, y_ratio=0.131)

    sj = self.handler.menu_type.menu.pointer_data
    if len(sj) > 0:

        j_display = journal_options_display(
            sj, self.handler.menu_type.menu.pointer)
        details = get_entry_details(sj.pointer_data)
        surf.blit(
            j_display,
            (int(surf.get_width() * 0.05), int(surf.get_height() * 0.27)))
        surf.blit(
            details,
            (int(surf.get_width() * 0.43), int(surf.get_height() * 0.255)))

    if self.handler.menu_type.state is MenuSubStates.SELECTED_OPTIONS:
        display_quest_options(self, surf)

    align_and_blit(self.screen, surf)
示例#15
0
def get_upcoming_events():
    events = get_surface(UPCOMING_EVENTS)
    return events
示例#16
0
 def intialize_canvas(self) -> Surface:
     return get_surface(self.specs.bg)
示例#17
0
 def blit_turn_order_queue(self):
     toq = get_surface(TURN_ORDER_QUEUE)
     align_and_blit(self.screen, toq, x_ratio=0.15, y_ratio=0.05)