<commit_before>import libtcodpy as libtcod

import config
import log
import renderer
import actions


TEXT_WIDTH = config.SCREEN_WIDTH - 20
QUEST_SP = 6


def _grant_quest_sp(player):
    player.skill_points += QUEST_SP
    log.message('You gained ' + str(QUEST_SP) + ' skill points.')


def goddess_charge(player, goddess):
    libtcod.console_clear(0)

    line = 4
    libtcod.console_print_ex(
        0, config.SCREEN_WIDTH/2, line, libtcod.BKGND_NONE,
        libtcod.CENTER, 'The goddess speaks from behind her veil, in a voice as cold as the icy hells:')
    line += 2

    libtcod.console_set_default_foreground(0, libtcod.light_blue)
    line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0,
        'If you wish me to heal your people, you will have to right a offense against me. Bring me the Amulet of Golden Desires, which is worn by the cyclops Tepegoz. If you would slay him to gain it, I cannot tell you how; there is a nymph who lives in a grotto on the lakeshore who holds that knowledge to herself.')
    line += 1

    renderer.finish_welcome()
    goddess.wait_count = 0
    goddess.interactable.use_function = goddess_waiting
    _grant_quest_sp(player)


def goddess_waiting(player, goddess):
    for obj in player.inventory:
        # if it's the maguffin, win the game
        pass

    goddess.wait_count += 1
    log.message('I await the amulet; until then I have nothing further for you.', color=libtcod.light_blue)
    if goddess.wait_count > 2:
        log.message('Do not try my patience!', color=libtcod.light_blue)
        actions.inflict_bleeding(goddess, player.fighter, goddess.wait_count + player.fighter.bleeding_defense)


def nymph_info(player, nymph):
    libtcod.console_clear(0)

    line = 4
    libtcod.console_print_ex(
        0, config.SCREEN_WIDTH/2, line, libtcod.BKGND_NONE,
        libtcod.CENTER, "The nymph's words roil around you, now loud, now soft, now rushing, now slow:")
    line += 2

    libtcod.console_set_default_foreground(0, libtcod.azure)
    line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0,
        "You want to kill my son?")
    line += 1

    line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0,
        "It's about time.")
    line += 1

    line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0,
        "You'll need a spear to put his eye out - any spear will do. But then to kill him you'll need something special. A black sword lies in the depths below this mountain. The fastest way there might be to pass the horrors in the old quarry, in the southern hills.")
    line += 1

    renderer.finish_welcome()
    nymph.interactable.use_function = nymph_unhappy
    _grant_quest_sp(player)


def nymph_unhappy(player, nymph):
    log.message("Indeed, it is fated - necessary, even - that Tepegoz be slain, but do not think I'm happy about it. Neither be certain that you are fated to be his slayer.", color=libtcod.azure)


def display_welcome():
    libtcod.console_clear(0)

    libtcod.console_set_default_foreground(0, libtcod.light_yellow)
    line = 4
    libtcod.console_print_ex(
        0, config.SCREEN_WIDTH/2, line, libtcod.BKGND_NONE,
        libtcod.CENTER, 'BEYAZ DAG')
    line += 2

    libtcod.console_set_default_foreground(0, libtcod.white)
    line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0,
        'It is not far from Navekat and Suyab to the lake they call the Eye of the World. But the visions you sought there carried you much farther, across mountains, deserts, marshes, across the Mother River to the lonely Mount Beyaz. Here, perhaps, you can convince the merciful goddess who lives above the clouds to save your people from the plague.')
    line += 1

    line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0,
        "<NAME> towers solitary above the deserts. No rival peak dares rear itself nearby, though a desultory range of hills stretches southwards. The mountain's western slopes fall off steeply into a deep blue lake; north lie the marshes that fringe the Mother River.")
    line += 1

    line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0,
        'You never mastered sword and lance, like your brothers, but can shoot, ride, and wrestle as well as any of them.')
    line += 1

    libtcod.console_set_default_foreground(0, libtcod.darker_yellow)
    libtcod.console_print_ex(
        0, config.SCREEN_WIDTH/2, config.SCREEN_HEIGHT-4, libtcod.BKGND_NONE,
        libtcod.CENTER, 'Generating the map...')

    libtcod.console_flush()



    <commit_msg>quest.PageLayout helper object<commit_after>import libtcodpy as libtcod

import config
import log
import renderer
import actions


TEXT_WIDTH = config.SCREEN_WIDTH - 30
QUEST_SP = 6


def _grant_quest_sp(player):
    player.skill_points += QUEST_SP
    log.message('You gained ' + str(QUEST_SP) + ' skill points.')


class PageLayout(object):
    def __init__(self):
        libtcod.console_clear(0)
        self.line = 4

    def title(self, text):
        libtcod.console_print_ex(
            0, config.SCREEN_WIDTH/2, line, libtcod.BKGND_NONE,
            libtcod.CENTER, text)
        line += 4

    def color(self, color):
        libtcod.console_set_default_foreground(0, color)

    def paragraph(self, text):
        line += libtcod.console_print_rect(0, 10, line, TEXT_WIDTH, 0, text)
        line += 1


def goddess_charge(player, goddess):
    page = PageLayout()

    page.title('The goddess speaks from behind her veil, in a voice as cold as the icy hells:')
    page.color(libtcod.light_blue)
    page.paragraph(
        'If you wish me to heal your people, you will have to right a offense against me. Bring me the Amulet of Golden Desires, which is worn by the cyclops Tepegoz. If you would slay him to gain it, I cannot tell you how; there is a nymph who lives in a grotto on the lakeshore who holds that knowledge to herself.')

    renderer.finish_welcome()
    goddess.wait_count = 0
    goddess.interactable.use_function = goddess_waiting
    _grant_quest_sp(player)


def goddess_waiting(player, goddess):
    for obj in player.inventory:
        # if it's the maguffin, win the game
        pass

    goddess.wait_count += 1
    log.message('I await the amulet; until then I have nothing further for you.', color=libtcod.light_blue)
    if goddess.wait_count > 2:
        log.message('Do not try my patience!', color=libtcod.light_blue)
        actions.inflict_bleeding(goddess, player.fighter, goddess.wait_count + player.fighter.bleeding_defense)


def nymph_info(player, nymph):
    page = PageLayout()

    page.title("The nymph's words roil around you, now loud, now soft, now rushing, now slow:")

    page.color(libtcod.azure)
    page.paragraph("You want to kill my son?")
    page.paragraph("It's about time.")
    page.paragraph(
        "You'll need a spear to put his eye out - any spear will do. But then to kill him you'll need something special. A black sword lies in the depths below this mountain. The fastest way there might be to pass the horrors in the old quarry, in the southern hills.")

    renderer.finish_welcome()
    nymph.interactable.use_function = nymph_unhappy
    _grant_quest_sp(player)


def nymph_unhappy(player, nymph):
    log.message("Indeed, it is fated - necessary, even - that Tepegoz be slain, but do not think I'm happy about it. Neither be certain that you are fated to be his slayer.", color=libtcod.azure)


def display_welcome():
    page = PageLayout()

    page.color(libtcod.light_yellow)
    page.title('BEYAZ DAG')

    page.color(libtcod.white)
    page.paragraph(
        'It is not far from Navekat and Suyab to the lake they call the Eye of the World. But the visions you sought there carried you much farther, across mountains, deserts, marshes, across the Mother River to the lonely Mount Beyaz. Here, perhaps, you can convince the merciful goddess who lives above the clouds to save your people from the plague.')
    page.paragraph(
        "Beyaz Dag towers solitary above the deserts. No rival peak dares rear itself nearby, though a desultory range of hills stretches southwards. The mountain's western slopes fall off steeply into a deep blue lake; north lie the marshes that fringe the Mother River.")
    page.paragraph(
        'You never mastered sword and lance, like your brothers, but can shoot, ride, and wrestle as well as any of them.')
    page.paragraph(
        'Beyaz Dag teems with life: hyenas and gazelles in the desert scrub, deer, wolves, bear in the forests. Travellers tell of other, darker things here: ruins, abandoned quarries, sunken grottoes...')

    page.line += 2
    page.paragraph(
        "Now you're almost through the marshes; the mountain rises to the southwest.")

    libtcod.console_set_default_foreground(0, libtcod.darker_yellow)
    libtcod.console_print_ex(
        0, config.SCREEN_WIDTH/2, config.SCREEN_HEIGHT-6, libtcod.BKGND_NONE,
        libtcod.CENTER, 'Generating the map...')

    libtcod.console_flush()



    
{'fraction_non_alphanumeric': 0.07988888888888888, 'fraction_numerical': 0.009555555555555555, 'mean_word_length': 3.4296259842519685, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '544127', 'n_tokens_mistral': 2988, 'n_tokens_neox': 2783, 'n_words': 1017}