def __init__(self): self.richard = player() #references player class to define self.richard self.i = interface.interpreter(self.richard) #references interface function in interpreter module and uses player (self.richard) as an argument self.level_1 = level.level_1(self.i, self.richard) #defines level.1 here as the level_1 function in level, calls interface and player class as arguments return None
def mother_calls(playerassignment): print "Your mother calls. She wants to know if you've done that thing he asked." mother_responses = ["yes", "ihave", "yup", "i'mdoingitnow", "saymaybe", "maybe"] other_responses = ["iwilldo"] i = interface.interpreter(playerassignment) z = i.read() if z in mother_responses: if playerassignment.coffee < 5: print "She wears you down and eventually you admit you haven't done that thing. Coping with your mother would be easier with more coffee." playerassignment.depression_level = playerassignment.depression_level - 20 else: print "You have successfully coped with your mother's questions." playerassignment.depression_level = playerassignment.depression_level + 20 elif z in other_responses: print "Tactical move. Telling your mother you will do something will work for now, but you can't get away wth it for too long..." else: print "I gave birth to you %s, you could at least do this one thing. I'm only trying to help you. I care about you %s and this is how i'm treated...." % (classes_and_actions.x.gamername, x.gamername) playerassignment.depression_level = playerassignment.depression_level - 40
def cat_calls(playerassignment, x=1, y=1): """function where cat calls and gives random dictionary response, or assigned response based on input x=1 or not. If response is acceptable, consequences. note room for expansion using assigned responses left.""" integer, integer2 = random.randint(1, 10), random.randint(1, 3) phone_dict = {1:"Your mobile telephone device begins to ring.", 2:"Your mobile rings.", 3:"Your chair vibrates expectantly."} cat_topics = {1:"Your woman, Cataus, is upset about something or other.", 2:"Cat enquires as to why you did not answer her previous call.", 3:"'Love you', says Cat", 4:"'Are you ignoring me?' says Cat.", 5:"Your girlfriend, Cat, tells you an amusing anecdote about a bear stuck in a pond.", 6:"Cat recommends some tv programme for you to watch on iplayer.", 7:"Cat is drunk. She tells you about an exciting event happening nearby.", 8:"Your woman Cat, talks about arts and crafts for a while and you doze off to the sound of her voice.", 9:"Love you!", 10:"Love you?!"} i = interface.interpreter(playerassignment) if x == 1: #x=1 is cat_calls with random variable print phone_dict[integer2] time.sleep(1) z = i.read() acceptable_responses = ["answerphone", "answerthephone", "answer"] if z in acceptable_responses: #possible ways of answering phone print cat_topics[integer] print answer = i.read() #if richard answers the phone and chooses the correct answer then he will reap benefits cap = playerassignment if integer > 4 and answer == "loveyou": cap.change_health(20) cap.depression_level = cap.depression_level - 5 cap.coffee = cap.coffee + 5 elif integer <= 4 and answer == "lethertalkforawhile" or "talk": cap.change_health(20) cap.depression_level = cap.depression_level - 5 cap.coffee = cap.coffee + 5 else: cap.change_health(-20) # but if not there will be consequences cap.depression_level = cap.depression_level -5 cap.coffee = cap.coffee - 5 else: pass