Ejemplo n.º 1
0
def select_gem_interpreter(keyEvent, testing=False):
    global partialNum, chosenPersonGem
    if keyEvent.key in NUMBER_KEYS:
        if len(gemList) < 10:
            num = int(pygame.key.name(keyEvent.key)) - 1
            if 0 <= num and num < len(gemList):
                global chosenPersonGem
                chosenPersonGem = gemList[num]
                if not testing:
                    select_equipment()
        else:
            partialNum += pygame.key.name(keyEvent.key)
            set_commands(['(#) Select Gem:' + str(partialNum) + '_', '<==Back'])
    elif keyEvent.key == K_BACKSPACE:
        if len(gemList) >= 10 and partialNum != '':
            partialNum = partialNum[:-1]
        elif litany is None:
            townmode.town_mode()
        else:
            shopkeeper.litany = litany
            conversation.converse_with(shopkeeper, townmode.town_mode)
    elif keyEvent.key == K_RETURN:
        if len(gemList) >= 10 and partialNum:
            try:
                chosenPersonGem = gemList[int(partialNum)-1]
            except IndexError:
                return
            else:
                if not testing:
                    select_equipment()
Ejemplo n.º 2
0
def shop_interpreter(keyEvent):
    if keyEvent.key == K_b: 
        window_shop() 
    elif keyEvent.key == K_s:
        window_sell()
    elif keyEvent.key == K_BACKSPACE:
        if litany is None:
            townmode.town_mode()
        else:
            shopkeeper.litany = litany
            say_title(universal.state.location.name)
            conversation.converse_with(shopkeeper, townmode.town_mode)
Ejemplo n.º 3
0
def select_equipment_interpreter(keyEvent, testing=False):
    global partialNum, chosenEquipment
    if keyEvent.key in NUMBER_KEYS:
        if len(equipmentList) < 10:
            num = int(pygame.key.name(keyEvent.key)) - 1
            if 0 <= num and num < len(equipmentList):
                global chosenEquipment
                chosenEquipment = equipmentList[num][1]
                gem = chosenPersonGem[1]
                maxEnchantment = chosenEquipment.maxEnchantment
                enchantmentLevel = chosenEquipment.enchantment_level()
                if maxEnchantment - enchantmentLevel < gem.cost:
                    universal.say(' '.join(["Cannot enchant", chosenEquipment.name, "with", 
                        gem.name + ".", gem.name, "requires", str(gem.cost), "enchantment points,",
                        "but", chosenEquipment.name, "only has", str(maxEnchantment - 
                            enchantmentLevel), "points available."]))
                    universal.acknowledge(select_equipment, ())
                else:
                    if not testing:
                        confirm_enchantment()
        else:
            partialNum += pygame.key.name(keyEvent.key)
            set_commands(['(#) Select Equipment:' + str(partialNum) + '_', '<==Back'])
    elif keyEvent.key == K_BACKSPACE:
        if len(equipmentList) >= 10 and partialNum != '':
            partialNum = partialNum[:-1]
        elif litany is None:
            townmode.town_mode()
        else:
            shopkeeper.litany = litany
            conversation.converse_with(shopkeeper, townmode.town_mode)
    elif keyEvent.key == K_RETURN:
        if len(equipmentList) < 10 and partialNum:
            try:
                chosenEquipment = equipmentList[int(partialNum)-1][1]
            except IndexError:
                return
            else:
                gem = chosenPersonGem[1]
                maxEnchantment = chosenEquipment.maxEnchantment
                enchantmentLevel = chosenEquipment.enchantment_level()
                if maxEnchantment - enchantmentLevel < gem.cost:
                    universal.say(' '.join(["Cannot enchant", chosenEquipment.name, "with", 
                        gem.name + ".", gem.name, "requires", str(gem.cost), "enchantment points,",
                        "but", chosenEquipment.name, "only has", str(maxEnchantment - 
                            enchantmentLevel), "points available."]))
                    universal.acknowledge(select_equipment, ())
                else:
                    if not testing:
                        confirm_enchantment()
Ejemplo n.º 4
0
def guild_bedroom_after_arrival():
    guildBedroom = universal.state.get_room('Bedroom')
    thisEpisode = episode.allEpisodes[universal.state.player.currentEpisode]  
    if universal.state.player.currentEpisode == episode1.name and thisEpisode.currentSceneIndex == 2:
        alondraSleeping = '''Alondra, the girl Vengador Ildri shielded from the city guard, is already curled up in one of the beds, soundly asleep.'''
        if not alondraSleeping  in guildBedroom.description:
            guildBedroom.description = universal.format_text([guildBedroom.description, alondraSleeping])
        if not universal.format_line(['''If''', name(), '''wishes,''', heshe(), '''can rest, and put an end to this seemingly neverending day.''']) in guildBedroom.description:
            guildBedroom.description = universal.format_text([guildBedroom.description, ['''If''', name(), '''wishes,''', heshe(), 
                '''can rest, and put an end to this seemingly neverending day.''']])
        if 'Elise_shows_you_around' in pwutilities.keywords() and universal.state.player.currentEpisode == episode1.name and not ("should go meet Elise at the Shrine" in 
                guildBedroom.description):
            guildBedroom.description = universal.format_text([guildBedroom.description, ['''If''', name(), '''hasn't already,''', p.heshe(), 
                '''should go meet Elise at the Shrine. After all,''', p.heshe(), '''shouldn't keep her waiting!''']])
    if guildBedroom.boarding:
        townmode.rest_mode(guildBedroom)
    else:
        townmode.town_mode()
Ejemplo n.º 5
0
def marias_home_after_arrival():
    universal.say_title("Maria's Home")
    maria = universal.state.get_character('Maria.person')
    mariasHome = universal.state.get_room("Maria's Home")
    if mariasHome.has(maria) and universal.state.player.currentEpisode == episode1.name:
        mariasHome.description = format_text([mariasHomeDesc, ['''Maria is hunched over the small firepit, making some stew. She glances up as''', name(), 
            '''enters.''']])
    if 'boarding_with_Maria' in keywords() and universal.state.player.currentEpisode == episode1.name:
        mariasHome.description = universal.format_text([['''Maria lives in a dinky little room with barely enough room for two people to lie down comfortably. The''',
    '''floor is packed dirt, and the old wooden walls sag, seeming on the verge of collapse at any moment. A small, stone-circled firepit sits in the''',
    '''center, just below a small hole in the ceiling. A small collection of wooden bowls, plates, and  skewers lie next to the pit. A pile of ragged''',
    '''blankets is crumpled up in the corner. A few additional blankets are spread out next to the firepit.''']])
        if 'Elise_shows_you_around' in keywords():
            mariasHome.description = universal.format_text([mariasHome.description, ['''There is a small note written in the dirt. It reads:''',
    '''"Went for a walk. Your blankets are spread out next to the pit. We'll look for a better place tomorrow. Maria"''']])
        mariasHome.description = format_text([mariasHome.description, [''' If''', name(), '''wishes,''', heshe(), 
            '''can Rest, and put an end to this seemingly neverending day.''']])
    if mariasHome.boarding:
        townmode.rest_mode(mariasHome)
    else:
        townmode.town_mode()
Ejemplo n.º 6
0
def armor_shop_after_arrival():
    wesleyAndAnnesArmorShop = universal.state.get_room("Wesley and Anne's Smithy")
    wesleyAndAnnesArmorShop.description = universal.format_line(['''The shop consists of a single small room. A counter runs the length of the far wall. Hanging on the left wall are a variety of small metal things: nails, buckles, hinges, locks, horseshoes. The right side contains a few samples of larger tools: a large sickle, and a shovel. What really catches''', universal.state.player.name + "'s", '''attention is a 'suit' of chanmail hanging on the wall above the counter.''', universal.format_line(['''The armor is a two piece affair. The top looks like to be barely big enough to cover (for a sufficiently loose definition of 'cover')''', universal.state.player.name + "'s", '''breasts, while the bottom is a thong. A thong made out of chainmail.''' if universal.state.player.is_female() else '''The armor is a single, small thong, which is made out of chainmail.'''])])
    if "visited_blacksmith" not in universal.state.player.keywords:
        wesleyAndAnnesArmorShop.description = (
            universal.format_text([wesleyAndAnnesArmorShop.description, [universal.state.player.name, 
                '''stares at the piece for a few seconds, trying to process''', 
                '''just how or why anyone would ever make something so''', 
                '''patently useless out of valuable steel. Then, remembering''',
                '''a lecture given to''', himher(universal.state.player), 
                '''by Nana about trusting just''', hisher(universal.state.player), '''eyes,''', 
                heshe(universal.state.player), '''studies it with''', hisher(universal.state.player), 
                '''more magical senses.''', HisHer(universal.state.player), 
                '''eyes widen. Useless nothing, the enchantments on that armor''',
                '''make it as protective as mail, and a hundredth as''',
                '''heavy. Whoever made that was cursed good at enchanting''', 
                '''equipment.'''],
                ['''However, there is something odd about the enchantment.''', 
                '''Peering more closely,''', universal.state.player.name, '''realizes that the''', 
                '''strength of the enchantment is based on the force of a blow.''',
                '''If the force being exerted is enough to break skin,''', 
                '''bones, etc. (basically enough to trigger one's health)''', 
                '''then the enchantment springs into full force. If the''',
                '''force of the blow would only cause a little bruising, then''',
                '''the enchantment remains dormant. Basically, the magic would''',
                '''protect''', 
                universal.state.player.name, '''from a spear thrust, but not a spanking. Which''', 
                '''is unfortunate, because if Nana ever caught''', universal.state.player.name, 
                '''wearing such an absurd suit of armor, she'd put the young''',
                '''Taironan over her knee so fast it'd double as the invention''',
                '''of a new haste spell.''']]))
        wesleyAndAnnesArmorShop.description = universal.format_text([wesleyAndAnnesArmorShop.description, 
            ['''The proprietor of the shop hussles out of the backroom.''',
            '''He is also clearly the smith; he's six feet tall, and has more muscles in one arm than''', 
            universal.state.player.name, '''has in''', hisher(universal.state.player), '''entire body. He has light skin,''',
            '''short-cropped''',
            '''dark brown hair, a trimmed beard, and blue eyes. He is wearing''',
            '''a thick leather apron, and a pair of heavily patched trousers.''']])
    wesleyAndAnnesArmorShop.after_arrival = None
    townmode.town_mode()
Ejemplo n.º 7
0
def thereses_tailors_after_arrival():
    theresesTailors = universal.state.get_room("Therese's Tailors")
    if 'visited_tailors' not in universal.state.player.keywords:
        theresesTailors.description = universal.format_text([[universal.state.player.name + "'s", '''eyes widen when''', 
            heshe(universal.state.player), '''enters the tailors.''', HeShe(universal.state.player) + "'d", 
            '''expected to find a small, mostly bare shop with a''', 
            '''couple of tailors taking custom orders, and maybe a few pieces of clothing''', 
            '''for demonstration purposes. What''', heshe(universal.state.player), '''finds instead is''',
            '''a large, open room with racks of clothing of all shapes and sizes.''', 
            '''Tunics and trousers hang on racks in the middle of the room. Dresses''',
            '''and skirts line the walls.''', universal.state.player.name, '''even notices in the back''',
            '''what appears to be a display rack for underwear of all sorts.''', 
            '''A variety of people, mostly women, move about the clothing racks.''', 
            '''They riffle through them, occasionally pulling something''', 
            '''off the shelves and holding it against themselves or their''', 
            '''companion.''', universal.state.player.name, '''also notices several people who appear to''',
            '''be workers. They move about the racks, reorganizing, and''',
            '''rehanging clothing, while keeping an eye on the various customers.''',
            '''One in particular, a woman about''', universal.state.player.name + "'s", '''age, watches''',
            universal.state.player.name, '''out of the corner of her eye.'''], 
            ['''The young woman has light brown hair pulled back into a single long''',
                '''braid, and light brown eyes. She is wearing a light red tunic''',
                '''emblazoned on the right chest with a pair of crossed needles, and''',
                '''a matching knee-length skirt.''']])
    else:
        theresesTailors.description = universal.format_line([
            '''Tunics and trousers hang on racks in the middle of the room. Dresses''',
            '''and skirts line the walls.''', universal.state.player.name, '''even notices in the back''',
            '''what appears to be a display rack for underwear of all sorts.''', 
            '''A variety of people, mostly women, move about the clothing racks.''', 
            '''They riffle through them, occasionally pulling something''', 
            '''off the shelves and holding it against themselves or their''', 
            '''companion.''', universal.state.player.name, '''also notices several people who appear to''',
            '''be workers. They move about the racks, reorganizing, and''',
            '''rehanging clothing, while keeping an eye on the various customers.''',
            '''One in particular, a woman about''', universal.state.player.name + "'s", '''age, watches''',
            universal.state.player.name, '''out of the corner of her eye.'''])
    theresesTailors.after_arrival = None
    townmode.town_mode()
Ejemplo n.º 8
0
def done_shopping():
    if litany is None:
        townmode.town_mode()
    else:
        shopkeeper.litany = litany
        conversation.converse_with(shopkeeper, townmode.town_mode)