def buy(num): global chosenGood chosenGood = shopGoods[num-1][ITEM] say_title('Matrons: ' + str(chosenPerson.coins)) universal.say(chosenGood.display()) set_commands(['(Enter) Purchase', '<==Back']) set_command_interpreter(confirm_buy_interpreter)
def can_enemies_spank(): universal.say_title("Can Enemies Spank Your Characters In Battle?") universal.say(' '.join(["Now you have to decide whether or not enemies are allowed you to spank your characters in battle. If you select (Y)es, then enemies will try to spank you during", "combat. If you select no, then enemies will never try to spank you, however you can still try to spank them. Note that this does NOT affect story scenes. It only affects the generic", "spankings you can see in combat (so if you choose (N)o, but lose to a boss, the boss may still spank you after the battle. However the boss will not spank you during battle)."])) set_commands(['(Y)es', '(N)o', '<==Back']) set_command_interpreter(can_enemies_spank_interpreter)
def start_scene_1_episode_3(loading=False): universal.say("Next Time on Pandemonium Cycle: The Potion Wars") music.play_music(music.THEME) universal.say(["Roland and Elise are getting married, and", pwutilities.name(), "is asked to escort Elise to the Lowen Monastery for the wedding. But things get a little bit complicated when an old enemy of Roland's", "ambushes them!"]) universal.set_commands("Press Enter to save") universal.set_command_interpreter(pwutilities.end_content_interpreter)
def town_mode_interpreter(keyEvent, previousModeIn=None): if previousModeIn is None: previousModeIn = town_mode global previousMode if keyEvent.key == K_ESCAPE: confirm_quit(previousMode) elif keyEvent.key == K_i: confirm_title_screen(previousMode) elif keyEvent.key == K_s: save(previousMode) elif keyEvent.key == K_l: load(previousMode) elif keyEvent.key == K_q: save_game('quick', previousMode) elif keyEvent.key == K_t: talk(previousMode) elif keyEvent.key == K_g: select_destination(previousMode) elif keyEvent.key == K_p: previousMode = previousModeIn universal.set_commands(['(#)Character', '<==Back']) universal.say_title('Characters:') #universal.say(''.join(['Name:', universal.tab("Name:"), 'Health:', universal.tab("Health:"), 'Mana:\n'])) universal.say('\t'.join(['Name:', 'Health:', 'Mana:\n\t']), columnNum=3) universal.say(universal.state.party.display_party(), columnNum=3) universal.set_command_interpreter(select_character_interpreter)
def choose_character_to_equip_item_interpreter(keyEvent): global chosenPerson, partialNum if keyEvent.key in NUMBER_KEYS: num = int(pygame.key.name(keyEvent.key)) - 1 if len(person.get_party()) < 10: if 0 <= num and num < len(person.get_party()): personWhoBoughtGood = chosenPerson chosenPerson = person.get_party().get_member(num) personWhoBoughtGood.drop_item(chosenGood) chosenPerson.take_item(chosenGood) chosenPerson.equip(chosenGood) universal.say([chosenPerson.name, 'has equipped', chosenGood.name + '.']) chosenPerson = personWhoBoughtGood acknowledge(window_shop_person_chosen, ()) else: partialNum += pygame.key.name(keyEvent.key) elif keyEvent.key == K_BACKSPACE and len(person.get_party()) < 10: partialNum = partialNum[:-1] elif keyEvent.key == K_RETURN and len(person.get_party()) < 10: try: num = int(partialNum) except ValueError: return partialNum = '' personWhoBoughtGood = chosenPerson chosenPerson = person.get_party().get_member(num) chosenPerson.equip(chosenGood) universal.say([chosenPerson.name, 'has equipped', chosenGood.name + '.']) chosenPerson = personWhoBoughtGood acknowledge(window_shop_person_chosen, ())
def marias_home_before_arrival(): if not 'Marias_home' in keywords(): universal.say(universal.format_text([['''While''', name(), '''would like to find Maria's home,''', heshe(), '''has no idea where it is.''']]), justification=0) return False elif 'grudge_against_Maria' in keywords() and universal.state.player.currentEpisode == episode1.name: universal.say(universal.format_text([[name(), '''has no interest in speaking to Maria right now.''']]), justification=0) return False return True
def display_inventory_item(): try: universal.say(universal.player.inventory[chosenItemIndex]) except (IndexError, TypeError): bedroom.store_inventory() else: set_commands(['(Enter) Store Item', '<==Back']) set_command_interpreter(display_inventory_item_interpreter)
def confirm_sell(): say_title('Matrons: ' + str(chosenPerson.coins)) universal.say(chosenGood.display()) set_commands([' '.join(['Sell for', str(chosenGood.price // 2), ('matrons' if chosenGood.price // 2 > 1 else 'matron') + "?", '(Y/N)'])]) global partialNum partialNum = '' set_command_interpreter(confirm_sell_interpreter)
def armor_shop_before_arrival(): if 'flirting_with_Peter' in keywords() and universal.state.player.currentEpisode == episode1.name: universal.say('''Peter's shop is currently closed.''', justification=0) return False elif (('refused_to_leave_Peters_shop' in keywords() or 'insulted_Peters_kid' in keywords()) and universal.state.player.currentEpisode != episode1.name and episode.allEpisodes[universal.state.player.currentEpisode].currentSceneIndex != 0): universal.say('''Probably wise not to go back just yet.''', justification=0) return False return True
def display_item(): global chosenItemIndex try: universal.say(bedroom.items[chosenItemIndex].display()) except IndexError: bedroom.store_items() else: set_commands(['(Enter) Take item', '<==Back']) set_command_interpreter(display_item_interpreter)
def after_arrival(self): universal.say_title('Bedroom') if self.after_after_arrival is not None: self.after_after_arrival() universal.say(self.description) if self.boarding: rest_mode(self) else: town_mode()
def clean(self): if person.get_PC().current_health() < person.get_PC().health() // 2 or person.get_PC().current_mana() < person.get_PC().mana() // 2: universal.say(universal.format_text([[person.get_PC().name, '''considers taking some time to clean, but plops down on''', person.hisher(), '''bed instead.''', person.HeShe(), '''is too darn tired to clean.''']]), justification=0) else: universal.say(universal.format_text([[person.get_PC().name, '''takes some time to do some cleaning.''', person.HeShe(), '''cleans dirty clothing, scrapes the mud off''', person.hisher(), '''boots, washes''', person.hisher(), '''linens, and makes sure''', person.hisher(), '''equipment is in good condition.''']]), justification=0) self.dirtiness = 0
def shrine_before_arrival(): if (universal.state.player.currentEpisode == episode1.name and episode.allEpisodes[universal.state.player.currentEpisode].currentSceneIndex == 0 and 'second_hand_tragedy' in universal.state.player.keywords): universal.say(universal.format_line([name(), 'has no interest in going to the Matirian Church again any time soon.'])) return False elif (universal.state.player.currentEpisode == episode1.name and episode.allEpisodes[universal.state.player.currentEpisode].currentSceneIndex == 2 and 'finished_night_on_town' in keywords()): universal.say(universal.format_line([name(), '''has nothing more to do in the Shrine.''', HeShe(), '''should probably find a bed.''']), justification=0) else: return True
def choose_character_to_carry_item_interpreter(keyEvent): if keyEvent.key in NUMBER_KEYS: num = int(pygame.key.name(keyEvent.key)) - 1 if 0 <= num and num < len(universal.state.party): personWhoBoughtGood = chosenPerson chosenPerson = person.get_party().get_member(num) chosenPerson.take_item(chosenGood) universal.say([chosenPerson.name, 'has taken', chosenGood.name + "."]) chosenPerson = personWhoBoughtGood acknowledge(window_shop_person_chosen, ())
def window_shop(): global chosenPerson if person.get_party().len() == 1: chosenPerson = universal.state.player window_shop_person_chosen() else: say_title('Please select a character to go shopping.') universal.say(person.get_party().display()) set_commands(['(#) Select a character.', '<==Back']) set_command_interpreter(select_character_to_buy_interpreter)
def shop_mode(personIn=None, doneShoppingLitany=None): global shopkeeper, litany if personIn is not None: shopkeeper = personIn set_goods() say_title(' '.join(['''Shopping with''', shopkeeper.printedName])) litany = doneShoppingLitany universal.say('"What can I do for you?"') set_commands(['(B)uy', '(S)ell', '<==Leave']) set_command_interpreter(shop_interpreter)
def select_clothing_interpreter(clothing_list, key_event, previous_selection): """ Based on player input, selects the desired article of clothing from clothing_list, and returns the chosen article. :param clothing_list: The list of clothing to choose from. :param key_event: The keyboard event representing the next number in the player's choice. :param previous_selection: :return The article of clothing selected by the user, or None if the user hasn't finished selectin yet. """ global user_input next_digit = universal.key_name(key_event) if len(clothing_list) < 10: try: num = int(next_digit) - 1 except ValueError: if key_event.key == K_BACKSPACE: previous_selection() else: try: chosen_clothing = clothing_list[num] except IndexError: return else: return chosen_clothing else: try: int(next_digit) except ValueError: if key_event.key == K_BACKSPACE: if user_input: user_input = user_input[:-1] set_commands(universal.add_number_to_select_number_command( user_input)) else: previous_selection() elif key_event.key == K_RETURN: clothing_index = int(user_input) - 1 try: selected_clothing = clothing_list[clothing_index] except IndexError: universal.say(' '.join(['"' + user_input + '"', 'is too large. Please provide a number between 1 and', str(len(clothing_list))])) acknowledge(select_shirt, ()) else: global user_input user_input = '' return selected_clothing else: user_input += next_digit set_commands(universal.add_number_to_select_number_command( user_input))
def select_char_quickspells(previousModeIn): universal.clear_screen() global previousMode previousMode = previousModeIn if len(universal.state.party) == 1: modify_quick_spells(universal.state.party[0]) else: universal.say_title(format_line([chosenPerson.name + "'s", "Quick Spells"])) universal.say(universal.numbered_list(universal.state.party.members)) set_commands(['(#) Select a character.', '<==Back']) set_command_interpreter(select_char_quickspells_interpreter)
def window_sell(): say_title('Sell') global chosenPerson if person.get_party().len() == 1: chosenPerson = universal.state.player window_sell_person_chosen() else: say_title('Select a party member whose inventory you would like to look at.') universal.say(person.get_party().display()) set_commands(['(#) Select party member', '<==Back']) set_command_interpreter(select_party_member_to_sell_interpreter)
def select_lower_clothing_interpreter(key_event): """ Interpreters the player's keystroke when selecting lower clothing. :param key_event: The player's keystroke. """ pants = select_clothing_interpreter(pantsList, key_event, select_shirt) if pants: global chosenPants chosenPants = pants universal.say(chosenPants.display()) set_command_interpreter(confirm_lower_clothing_interpreter) set_commands(['(Enter) Equip pants', '<==Back'])
def request_musculature(): universal.say_title('Select Musculature') musculature = '\n'.join([m + ':' for m in universal.numbered_list(person.MUSCULATURE)]) musculatureDescr = [ ' '.join(['', universal.state.player.name, '''has a soft, jiggly body.''']), ' '.join(['', universal.state.player.name, '''has a firm, smooth body.''']), ' '.join(['', universal.state.player.name, '''has a hard, muscled body.''']) ] musculatureDescr = '\n'.join(musculatureDescr) universal.say(musculature + '\t' + musculatureDescr, justification=0, columnNum=3) set_command_interpreter(request_musculature_interpreter) set_commands(universal.SELECT_NUMBER_BACK_COMMAND)
def select_weapon(): """ Asks the user to select a weapon, one of a dagger, sword, or spear. """ global weaponList weaponList = [itemspotionwars.familyDagger, itemspotionwars.familySword, itemspotionwars.familySpear] universal.say_title('Request Weapon') universal.say('\n'.join(universal.numbered_list([weapon.name for weapon in weaponList])), justification=0) set_commands(SELECT_NUMBER_BACK_COMMAND) set_command_interpreter(select_weapon_interpreter)
def confirm_sell_interpreter(keyEvent): if keyEvent.key == K_y: universal.say([chosenPerson.name, 'has sold', chosenGood.name, 'for', str(chosenGood.price // 2), 'matrons.']) success = chosenPerson.drop_item(chosenGood) if success: chosenPerson.coins += chosenGood.price // 2 shopkeeper.take_item(chosenGood) set_goods() acknowledge(window_sell_person_chosen, ()) elif keyEvent.key == K_n: window_sell_person_chosen()
def select_underwear(): """ Asks the user which set of underwear the player character should wear. """ global underwearList underwearList = [item for item in STARTING_INVENTORY if items.is_underwear(item)] if universal.state.player.lower_clothing() == items.emptyLowerArmor: underwearList.remove(items.emptyUnderwear) universal.say_title('Select Underwear') universal.say('\n'.join(universal.numbered_list([underwear.name for underwear in underwearList])), justification=0) set_commands(SELECT_NUMBER_BACK_COMMAND) set_command_interpreter(select_underwear_interpreter)
def window_shop_person_chosen(): say_title('Matrons: ' + str(chosenPerson.coins)) listOne = [i + ". " + good.name + ': ' + price for (i, good, price) in shopGoods[:10]] #listOne.append('\t') listTwo = [i + ". " + good.name + ': ' + price for (i, good, price) in shopGoods[10:]] #listTwo.append('\t') universal.say('\t'.join(['\n'.join(listOne), '\n'.join(listTwo)]), columnNum=2, justification=0) if len(shopGoods) < 10: set_commands(['(#) Select item to examine.', '<==Back']) else: set_commands(['(#) Select item to examine:_', '(Enter)Choose', '<==Back']) set_command_interpreter(window_shop_interpreter)
def select_shirt_interpreter(key_event): """ Interprets commands given by the user when selecting a shirt. :param key_event: The user provided keyboard key. """ shirt = select_clothing_interpreter(shirtList, key_event, request_hair_style) if shirt: global chosenShirt chosenShirt = shirt universal.say(chosenShirt.display()) set_command_interpreter(confirm_shirt_interpreter) set_commands(['(Enter) Equip shirt', '<==Back'])
def choose_character_to_equip_item(): if len(person.get_party()) == 1: universal.say([universal.state.player.name, 'has equipped', chosenGood.name + "."]) universal.state.player.equip(chosenGood) acknowledge(window_shop_person_chosen, ()) else: say_title(['Who should equip', chosenGood.name + "?"]) universal.say(person.get_party().display()) if len(person.get_party()) < 10: set_commands(['(#) Select party member']) else: set_commands(['(#) Select party member:_', '(Enter)Done']) set_command_interpreter(choose_character_to_equip_item_interpreter)
def window_sell_person_chosen(): say_title([chosenPerson.name + "'s", 'Matrons: ', str(chosenPerson.coins)]) playerGoods = zip([str(i) for i in range(1, len(chosenPerson.inventory) + len(chosenPerson.equipmentList)+1)], chosenPerson.inventory + chosenPerson.equipmentList, [str(good.price // 2) + (' E' if good in chosenPerson.equipmentList else '') for good in chosenPerson.inventory + chosenPerson.equipmentList]) universal.say('\n'.join([str(i) + ". " + good.name + ": " + str(price) for (i, good, price) in playerGoods])) if len(playerGoods) < 10: set_commands(['(#) Select item to sell.', '<==Back']) else: partialNum = '' set_commands(['(#) Select item to sell:_', '<==Back']) set_command_interpreter(window_sell_interpreter)
def final_confirmation(): universal.state.player.learn_spell(person.allSpells[0][0][0]) universal.state.player.learn_spell(person.allSpells[0][1][0]) universal.state.player.learn_spell(person.allSpells[0][2][0]) universal.state.player.learn_spell(person.allSpells[0][3][0]) universal.state.player.equip(itemspotionwars.oldShirt) universal.state.player.equip(itemspotionwars.comfyShorts) spells = [person.allSpells[0][0][0], person.allSpells[0][1][0], person.allSpells[0][2][0], person.allSpells[0][3][0]] for i in range(len(spells)): universal.state.player.quickSpells[i] = spells[i] universal.say(universal.state.player.appearance(True), justification=0) universal.say(' '.join(["\n\nEnemies will try to spank you in battle: ", "Yes" if universal.state.enemiesCanSpank else "No"]), justification=0) universal.set_commands(['(Enter) Begin Game', '<==Back', '(Esc) To Title Screen']) universal.set_command_interpreter(final_confirmation_interpreter)
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()