Exemplo n.º 1
0
def request_name_interpreter(key_event):
    """
    Receives input from the player on the PC's name.
    :param key_event: The Pygame key event representing the keyboard key
    pressed.
    """
    global partialName
    if key_event.key == K_RETURN:
        universal.state.player = person.PlayerCharacter(partialName, gender)
        person.get_PC().set_all_stats(2, 2, 2, 2, 2, 20, 10)
        person.set_party(person.Party([person.get_PC()]))
        universal.state.player.currentEpisode = firstEpisode.name
        universal.state.player.name = partialName
        universal.state.player.set_fake_name()
        request_nickname()
    elif key_event.key == K_ESCAPE:
        partialName = ''
        request_gender()
    else:
        playerInput = pygame.key.name(key_event.key)
        if re.match(re.compile(r'^\w$'), playerInput):
            partialName += playerInput
        elif key_event.key == K_BACKSPACE:
            partialName = partialName[:-1]
        universal.say(requestNameString)
        partialName = simpleTitleCase(partialName)
        if key_event.key == K_SPACE:
            partialName += ' '
        universal.say(partialName)
        universal.say('_')
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
def load_game(loadNameIn=None, preserveLoadName=True):
    clear_screen()
    global loadName
    if loadNameIn:
        loadName = loadNameIn
    try:
        with open(os.path.join(saveDirectory, loadName), 'rb') as loadFile:
            universal.state.load(loadFile)
    except IOError:
        universal.say([loadName, 'does not exist!'])
        acknowledge(load, returnTo)
    else:
        assert(person.get_PC().name != '')
        if not preserveLoadName:
            #global loadName
            loadName = ''
        if universal.state.location == universal.state.get_room("offStage"):
            try:
                episode.allEpisodes[universal.state.player.currentEpisode].start_episode(False)
            except KeyError:
                return
        else:
            go(universal.state.location)
Exemplo n.º 4
0
 try:
     #I don't know what this is doing, or why it's here but I'm not going to mess with it.
     self.punisher = self.punisher()
 except TypeError:
     pass
 #This is such a horrible, quick and dirty hack. I really need to make a function that allows one to modify this
 #kind of thing without having to dig into this code, but I'm too lazy. I'll rework this the next time I need to have some episode-specific event trigger on
 #rest.
 try:
     import episode1
 except ImportError, e:
     self.clean_check()
 else:
     #Horrible, horrible hack. Must figure out a better way of implementing this kind of thing.
     if universal.state.player.currentEpisode == "Tension":
         if 'taking_Carrie_home' in person.get_PC().keywords:
             episode1.ep1_carrie_sex()
         else:
             episode1.ep1_catalin()
     else:
         self.clean_check()
         universal.say(universal.format_text([[person.get_PC().name, '''plops down in''', 
             person.hisher(), '''nice bed, and sleeps the night away.''']]), 
             justification=0)
         #TODO: Need to figure out a way to implement the health penalties.
         for char in universal.state.party:
             if char.coins >= universal.state.livingExpenses:
                 char.coins -= 3
             else:
                 char.coins = 0
             char.restores()