Esempio n. 1
0
def enter(the_player):

	the_player.location = 'Foreman Ave'
	the_player.directions = ['Junction','Commercial Building', 'Car barricade']
	glass = random.randint(1,4)

	print "\nLocation:", the_player.location
	print "-" * 30

	if the_player.location in the_player.visited:
		print "You're back at %s." % the_player.location
		print "There are waste containers on the side"
		print "of the road."
		print "Building with broken shop window is next to them."

	else:
		the_player.visited.append(the_player.location)

		print "You come to wide street with various shops"
		print "on each side and garbage everywhere."
		print "There are seven green waste containers on the right"
		print "side of the road that are stuffed"
		print "with various things."
		print "You see a commercial building, probably a shop"
		print "with broken front shop window."
		print "The street ends with a huge barricade made out of"
		print "cars."

	while True:

		action = prompt.standard(the_player)

		if action == "junction":
			return 'Junction'
		elif 'waste' in action or 'container' in action:
			container(the_player)
		elif 'window' in action or 'commercial' in action or 'building' in action:
			if glass == 1:
				death.type(12,the_player)
			else:
				print "You lose balance while stepping to the shop,"
				print "you almost impale yourself on glass shrapnel."
				print "Don't try that again!"
				score.calculate(the_player,'glass')
		elif 'cars' in action or 'barricade' in action or 'car' in action:

			print "You try to climb the car barricade but"
			print "you fail, falling to the ground."
	
			if 'car barricade' not in the_player.visited:
				encounter = fight.Encounter(the_player,'random')
				print "Somehow, a zombie crawls from one of the cars."
				
				custom_error.errortype(4)
				encounter.start(the_player)
				the_player.visited.append('car barricade')
			else:
				pass
		else:
			custom_error.errortype(3)
Esempio n. 2
0
	def start(self, the_player):


		create_enemy = enemies.SpawnEnemy(the_player, self.enemy)

		if self.enemy == 'random':
			created_enemy = create_enemy.generate_random(the_player)
		else:
			created_enemy = create_enemy.generate(the_player, self.enemy)

		the_enemy = enemies.Enemy(*created_enemy)

		enemy_alive = True

			
		initialize_fight = random.randint(0,1)

		print "\n"
		print "-------------"
		print "--- FIGHT ---"
		print "-------------"
		print "Your enemy is %s.\n" % (the_enemy.enemy_name)

		if initialize_fight == 0:
			print "You are quicker than %s, you get to attack first!" % the_enemy.enemy_name
			fight_order = 'player first'
		else:
			print "%s strikes first!" % the_enemy.enemy_name
			fight_order = 'enemy first'


		while enemy_alive:

			if fight_order == 'player first':
				enemy_alive = self.player_attack(the_player, the_enemy)
				if enemy_alive == True:
					self.enemy_attack(the_player, the_enemy)
				else:
					break

			elif fight_order == 'enemy first':
				if enemy_alive == True:
					self.enemy_attack(the_player, the_enemy)
					enemy_alive = self.player_attack(the_player, the_enemy)
				else:
					break
			else:
				pass

		print "Congratulations you kill %s." % the_enemy.enemy_name
		score.calculate(the_player, the_enemy.enemy_name)

		if the_enemy.enemy_name not in the_player.killed.keys():
			the_player.killed[the_enemy.enemy_name] = 1
		else:
			the_player.killed[the_enemy.enemy_name] = the_player.killed[the_enemy.enemy_name] + 1
Esempio n. 3
0
def enter(the_player):

	the_player.location = 'Apartment'
	the_player.directions = ['Curling Street']

	print "\nLocation: ", the_player.location
	print "-" * 30

	if the_player.location in the_player.visited:
		print "You've been here already. It's your old"
		print "apartment."

	elif not the_player.location in the_player.visited:
		the_player.visited.append(the_player.location)
		print "You wake up at your old apartment."
		print "All the food and water is gone"
		print "and you know you've been postponing"
		print "your leave."
		print "The cupboard in the kitchen seems empty."
		print "You can go out to %s." % the_player.directions[0]

	else:
		pass


	while True:
		action = prompt.standard(the_player)

		if action == 'curling street' and not the_player.directions[0] in the_player.visited:
			print "You take courage and step out of your apartment."
			score.calculate(the_player, 'out of the house')
			break

		elif action == 'curling street' and the_player.directions[0] in the_player.visited:
			break

		elif action == 'cupboard' and not 'chocolate bar' in the_player.inventory.keys():
			print "You take a look once again, scanning"
			print "through empty packaging..."
			print "You find a chocolate bar!"

			the_player.inventory['chocolate bar'] = 1
			score.calculate(the_player, 'chocolate bar')

		elif action == 'cupboard':
			print "You search cupboard again but it's empty."

		else:
			pass

	return 'Curling Street'


	
def workbench(the_player):

	print "You're at huge wooden workbench with some tools around."
	print "You inspect your stuff if you can make something useful,"

	cart_items = ['wheels','wooden board','broom']
	available_items = []

	for item in cart_items:
		if item in the_player.inventory.keys():
			available_items.append(item)
		else:
			pass

	
	if available_items == []:
		print "but you don't know what to do."
	elif 'cart' in the_player.inventory.keys():
		print "You've already built the cart so there's no need to mess around."
	else:
		print "and seems like %s is useful." % ' and '.join(available_items[0:len(available_items)])

		if 'wheels' in available_items and 'wooden board' in available_items and 'broom' in available_items:
			print "\nGreat! You create a box from wooden boards and then you nail"
			print "the bicycle wheels onto it. You use the broom stick as a lever"
			print "so you can push it. You've created a carrying cart!"

			del the_player.inventory['wheels']
			del the_player.inventory['wooden board']
			del the_player.inventory['broom']

			the_player.inventory['cart'] = 1
			score.calculate(the_player,'cart')
		elif 'wheels' in available_items and 'wooden board' in available_items:
			print "You get an idea to create a box from wooden boards and attach"
			print "the bicycle wheels but you still need some kind of lever"
			print "to push it."
		elif 'wheels' in available_items and 'broom' in available_items:
			print "You've got wheels and broom but there is still something missing."
		elif 'broom' in available_items and 'wooden board' in available_items:
			print "You can try to build a box from wooden boards and attach"
			print "the broom stick, but still the thing will be unmovable."
		elif 'wheels' in available_items:
			print "You've got two wheels but you need some kind of box"
			print "made from some solid material so you can put stuff in it."
		elif 'wooden board' in available_items:
			print "Your wooden boards can be made into a box. It's nice for starters"
			print "but you need to move it somehow."
		elif 'broom' in available_items:
			print "Your broom can be disassembled and the handle will be useful"
			print "as a lever. On its own it doesn't do much."
			print "There is one more thing missing."
		else:
			pass
Esempio n. 5
0
def enter(the_player):

    the_player.location = 'Kitchen'

    the_player.directions = ['Hallway of the house']

    print "\nLocation:", the_player.location
    print "-" * 30

    if the_player.location in the_player.visited:
        print "You're back at %s." % the_player.location
        print "There are several shelves and four cupboards"
        print "above the sink."

    else:
        the_player.visited.append(the_player.location)

        print "You step into a kitchen. It looks like"
        print "it's been raided."

        if 'Wanda' in the_player.visited:
            print "Wanda: 'We've been here before with"
            print "Dave to get some food.'"
        else:
            pass

        print "There are several shelves and four cupboards"
        print "above the sink."

    cupboard = 1

    while True:

        action = prompt.standard(the_player)

        if 'house' in action or 'out' in action or 'hallway' in action:
            return 'House with pirate flag'
        elif 'cupboard' in action:
            print "You search one of the cupboards..."
            cupboard = cupboard + 1
            if cupboard == 4 and 'gun' in the_player.inventory.keys():
                print "You find some bullets for the gun!"
                the_player.inventory['gun'] = the_player.inventory['gun'] + 5
                score.calculate(the_player, 'bullets')
            else:
                print "...and nothing. Maybe try looking in the other one?"
        elif 'shelves' in action or 'shelf' in action:
            print "Nothing in the shelves."
        else:
            custom_error.errortype(3)
Esempio n. 6
0
def enter(the_player):

	the_player.location = 'Kitchen'

	the_player.directions = ['Hallway of the house']

	print "\nLocation:", the_player.location
	print "-" * 30

	if the_player.location in the_player.visited:
		print "You're back at %s." % the_player.location
		print "There are several shelves and four cupboards"
		print "above the sink."

	else:
		the_player.visited.append(the_player.location)

		print "You step into a kitchen. It looks like"
		print "it's been raided."

		if 'Wanda' in the_player.visited:
			print "Wanda: 'We've been here before with"
			print "Dave to get some food.'"
		else:
			pass
		
		print "There are several shelves and four cupboards"
		print "above the sink."

	cupboard = 1

	while True:
		
		action = prompt. standard(the_player)

		if 'house' in action or 'out' in action or 'hallway' in action:
			return 'House with pirate flag'
		elif 'cupboard' in action:
			print "You search one of the cupboards..."
			cupboard = cupboard + 1
			if cupboard == 4 and 'gun' in the_player.inventory.keys():
				print "You find some bullets for the gun!"
				the_player.inventory['gun'] = the_player.inventory['gun'] + 5
				score.calculate(the_player,'bullets')
			else:
				print "...and nothing. Maybe try looking in the other one?"
		elif 'shelves' in action or 'shelf' in action:
			print "Nothing in the shelves."
		else:
			custom_error.errortype(3)
Esempio n. 7
0
def single_shelf(shelf_id, the_player):

	compartments = []

	for item in range(1,6):
		compartment = shelf_id
		compartments.append((compartment, item))

	print "You come to shelf %s and see compartmens marked as:" % shelf_id.upper()
	
	for compartment in compartments:
		print compartment[0].upper() + str(compartment[1])

	while True:
		select = str(raw_input("Type letter and number to look into container, 0 to go back > ")).lower()

		if select == "0":
			break
		elif len(select) == 1:
			print "Please specify container."
		elif select == "t1" and shelf_id == "t" and 'motor' in the_player.inventory.keys():
			print "There is nothing else in that container."
		elif select == "t1" and shelf_id == "t":
			print "\nYou found the motor!"
			score.calculate(the_player, 'find motor')
			the_player.inventory['motor'] = 1
			
			if 'cart' in the_player.inventory.keys():
				print "You put the motor in the cart. You're ready to go!"
			else:
				print "You can carry the motor for few meters but it is very heavy."
				print "You're gonna need something for carrying it."
			custom_error.errortype(4)
			return 'Warehouse'
		elif select == "a2" and shelf_id == "a" and 'gun' in the_player.inventory.keys():
	
			if 'warehouse bullets' not in the_player.visited:
				bullets = random.randint(3,7)
				print "\nYou found %d bullets for gun." % bullets
				score.calculate(the_player,'bullets')
				the_player.inventory['gun'] = the_player.inventory['gun'] + bullets
				the_player.visited.append('warehouse bullets')
			else:
				print "\nThere is nothing else inside."
		elif select == "h4" and shelf_id == "h":
			print "You find a note:"
			print "'PUSH UP' to be the best."
			score.calculate(the_player,'easter egg')
			return 'Warehouse'
		elif select == "q2" and shelf_id == "q":
			print "You find a note:"
			print "'I wish I could write better code...' - author."
			score.calculate(the_player,'easter egg')
		elif shelf_id not in select:
			print "That container is not here."
		else:
			print random.choice(["It's empty.","There's some random junk inside","A weird steel thing!", "Nothing of interest."])
Esempio n. 8
0
def container(the_player):

    containers = range(1, 8)
    right_container = random.choice(containers)

    print "You go closer to the containers. There are"
    print "%d of them, all green. Which one do you want" % len(containers)
    print "to look at?"

    tries = 0
    right_tries = 0

    while True:

        try:
            print "Number (%d - %d), '0' to exit > " % (containers[0],
                                                        containers[-1])
            choice = int(raw_input("> "))

            if choice in containers:
                if choice == right_container and right_tries == 2 and 'foreman knife' not in the_player.visited:
                    print "You find a knife!"
                    the_player.inventory['knife'] = 15
                    score.calculate(the_player, 'knife')
                    the_player.visited.append('foreman knife')
                elif choice == right_container and right_tries == 0:
                    print "Hmm.. maybe you need to look further."
                    right_tries = right_tries + 1
                elif tries == 0:
                    tries = tries + 1
                    print "Hmm.. maybe you need to look further."
                elif choice == right_container and right_tries == 1:
                    print "You need to go deeper..."
                    right_tries = right_tries + 1
                elif tries == 1:
                    print "You need to go deeper..."
                    tries = tries + 1
                elif tries == 2:
                    print "You find nothing."
                    tries = 0
            elif choice == 0:
                break
            else:
                print "That container does not exist."
        except ValueError:
            print "Put down numbers only."
Esempio n. 9
0
def container(the_player):

	containers = range(1,8)
	right_container = random.choice(containers)

	print "You go closer to the containers. There are"
	print "%d of them, all green. Which one do you want" % len(containers)
	print "to look at?"

	tries = 0
	right_tries = 0

	while True:
		
		try:
			print "Number (%d - %d), '0' to exit > " % (containers[0],containers[-1])
			choice = int(raw_input("> "))

			if choice in containers:
				if choice == right_container and right_tries == 2 and 'foreman knife' not in the_player.visited:
					print "You find a knife!"
					the_player.inventory['knife'] = 15
					score.calculate(the_player,'knife')
					the_player.visited.append('foreman knife')
				elif choice == right_container and right_tries == 0:
					print "Hmm.. maybe you need to look further."
					right_tries = right_tries + 1
				elif tries == 0:
					tries = tries + 1
					print "Hmm.. maybe you need to look further."
				elif choice == right_container and right_tries == 1:
					print "You need to go deeper..."
					right_tries = right_tries + 1
				elif tries == 1:
					print "You need to go deeper..."
					tries = tries + 1
				elif tries == 2:
					print "You find nothing."
					tries = 0
			elif choice == 0:
				break
			else:
				print "That container does not exist."
		except ValueError:
			print "Put down numbers only."
Esempio n. 10
0
def junk(the_player):
	
	dives = 0
	dive_messages = ["You fail to find anything.",
					"Still nothing",
					"You're looking but it's just junk.",
					"Useless junk",
					"Some crap you don't need.",
					"Some dusty thing",
					"Nothing interesting"]

	print "\nYou dive into the junk."

	while dives <= random.randint(8,15):

		chance = random.randint(1,6)
		map_chance = random.randint(1,8)
		dive = raw_input("ENTER to dive, 'S' to stop > ").lower()
		custom_error.errortype(4)

		if dive == "s":
			break
		else:
			dives = dives + 1

			if chance == 4 and 'baseball bat' not in the_player.inventory.keys():
				print '\nYou find a baseball bat!'
				the_player.inventory['baseball bat'] = 10
				score.calculate(the_player, 'baseball bat')
				break
			elif map_chance == 7 and 'map' not in the_player.inventory.keys():
				print "You find a map of the Suburbs!"
				the_player.inventory['map'] = 1
				score.calculate(the_player,'map')
				print "Type 'MAP' to display map."
				break
			else:
				print '\n', random.choice(dive_messages)

	print "\nYou're bored so you need to rest for a while."
Esempio n. 11
0
def junk(the_player):

    dives = 0
    dive_messages = [
        "You fail to find anything.", "Still nothing",
        "You're looking but it's just junk.", "Useless junk",
        "Some crap you don't need.", "Some dusty thing", "Nothing interesting"
    ]

    print "\nYou dive into the junk."

    while dives <= random.randint(8, 15):

        chance = random.randint(1, 6)
        map_chance = random.randint(1, 8)
        dive = raw_input("ENTER to dive, 'S' to stop > ").lower()
        custom_error.errortype(4)

        if dive == "s":
            break
        else:
            dives = dives + 1

            if chance == 4 and 'baseball bat' not in the_player.inventory.keys(
            ):
                print '\nYou find a baseball bat!'
                the_player.inventory['baseball bat'] = 10
                score.calculate(the_player, 'baseball bat')
                break
            elif map_chance == 7 and 'map' not in the_player.inventory.keys():
                print "You find a map of the Suburbs!"
                the_player.inventory['map'] = 1
                score.calculate(the_player, 'map')
                print "Type 'MAP' to display map."
                break
            else:
                print '\n', random.choice(dive_messages)

    print "\nYou're bored so you need to rest for a while."
Esempio n. 12
0
def create_report(filename,
                  timetables,
                  good_names=None,
                  neutral_names=None,
                  bad_names=None):
    """
	"""
    good_names = good_names or []
    neutral_names = neutral_names or []
    bad_names = bad_names or []

    courses = group_courses(timetables)
    table_scores = {}

    for table_id, course in iter_grouped_courses(courses):
        course_score = score.calculate(course, good_names, neutral_names,
                                       bad_names)
        course._score = course_score

        if table_id not in table_scores:
            table_scores[table_id] = []

        table_scores[table_id].append(course_score)

    for table in timetables:
        scores = table_scores[table.table_id]
        table._score = sum(scores) / (len(scores) * 1.0)

    sorted_courses = {}
    for course_id, tables in courses.iteritems():
        sorted_courses[course_id] = _sort_dict_by_score(tables)

    sorted_timetables = sorted(timetables,
                               key=lambda t: t._score,
                               reverse=True)

    context = {"courses": sorted_courses, "timetables": sorted_timetables}

    with codecs.open(filename, "w", "utf-8") as f:
        f.write(render_template("report.html", **context))
Esempio n. 13
0
def laptop(the_player):

	computer = True

	while computer:
		
		print "\n--- Welcome to ShopDB ver. 3.0 ---"
		print "\nPlease select number, type '0' to log out:"
		print "1. Browse inventory"
		print "2. Billings"
		print "3. Employees"


		computer_prompt = int(raw_input("> "))

		if computer_prompt == 1:

			computer2 = True
			
			while computer2:

				print "\n1. Axx - Gxx"
				print "2. Hxx - Oxx"
				print "3. Mxx - Zxx"
				print "4. <- back"

				computer_prompt2 = int(raw_input("> "))

				if computer_prompt2 == 1:

					computer3 = True

					while computer3:

						print "\n1. A6-HJT3"
						print "2. C5-TZ"
						print "3. F3-763G"
						print "4. G1-GG"
						print "5. <- back"

						computer_prompt3 = int(raw_input("> "))

						if computer_prompt3 == 5:
							print "..."
							computer3 = False
						else:
							print "Nothing of interest here."

				elif computer_prompt2 == 2:

					computer4 = True

					while computer4:

						print "\n1. H5-I54"
						print "2. K5-22TS"
						print "3. L0-002"
						print "4. <- back"

						computer_prompt4 = int(raw_input("> "))

						if computer_prompt4 == 2:
							print "Yes that's the number Wanda was talking about."
							print "It says it's in the Warehouse on shelf T-1."
							score.calculate(the_player,'find motor')
							print "You log out of computer."
							computer5 = False
							computer4 = False
							computer3 = False
							computer2 = False
							computer = False

						elif computer_prompt4 == 4:
							print "..."
							computer4 = False
						else:
							print "Nothing of interest here."

				elif computer_prompt2 == 3:

					computer5 = True

					while computer5:

						print "\n1. N7-44F"
						print "2. T9-F"
						print "3. WK-991"
						print "4. <- back"

						computer_prompt5 = int(raw_input("> "))

						if computer_prompt5 == 4:
							print "..."
							computer5 = False
						else:
							print "Nothing of interest here."

				elif computer_prompt2 == 4:
					computer2 = False
					print "..."

				else:
					custom_error.errortype(3)

		elif computer_prompt == 2:
			print "\nSome accounting program opens but it's not"
			print "what you need so you close it."
			custom_error.errortype(4)
		elif computer_prompt == 3:
			print "\nYou see files on bunch of employees. Nothing of interest here."
			custom_error.errortype(4)
		elif computer_prompt == 0:
			print "You log out of computer."
			computer = False
			return 'Motor Shop'
		else:
			custom_error.errortype(3)
Esempio n. 14
0
def enter(the_player):
    the_player.location = 'Curling Street'
    the_player.directions = ['Apartment', 'Junction']

    print "\nLocation:", the_player.location
    print "-" * 30

    if the_player.location in the_player.visited and 'charlie sleepover' in the_player.visited and 'Wanda' in the_player.visited:
        print "\nThe whole Curling St. is swarmed with a herd of zombies."
        print "Wanda: 'Tss.. be careful."
        print "Here's the plan: I'm gonna sneak onto other side"
        print "and distract them."
        print "Meanwhile get in the shop and look for the motor - it should"
        print "have label 'K5-22TS' on it. It's pretty heavy so you might need"
        print "something to move it around."
        print "We'll meet back at Junction once you're done but be quick!'"

        score.calculate(the_player, 'wanda decoy')

        print "\nWanda sneaks behind the cars and gets about 30m away from you."
        print "'Come on, you fuckers!' she screams. The herd starts moving towards"
        print "her. You hope she'll be fine."
        print "'B&D Motors' is ahead, you carefully sneak into the shop..."

        custom_error.errortype(4)

        return 'Motor Shop'

    elif the_player.location in the_player.visited and 'charlie sleepover' in the_player.visited:
        print "You try to step carefully, hiding behind close by dumpster."
        print "Unfortunately you step on broken glass and the"
        print "swarm starts to navigate towards you..."

        custom_error.errortype(4)

        while True:
            encounter = fight.Encounter(the_player, 'zombie male')
            encounter.start(the_player)
            print "As you finished one zombie, another one approaches."
            print "Time to get ready..."

            custom_error.errortype(4)

    elif 'motor' in the_player.inventory.keys(
    ) and 'Wanda' in the_player.visited:
        print "Wanda: 'We already got what we need, let's just go"
        print "the herd might move back here again.'"
        return 'Junction'

    elif the_player.location in the_player.visited:

        if 'gun' in the_player.inventory.keys():
            pass

        else:
            print "There is still a policeman lying on the floor."
            pass

        print "You're in %s again." % the_player.location
        print "You've been here before."

        pass

    else:

        the_player.visited.append(the_player.location)

        print "You walk out of your apartment."
        print "You are on %s, it's a large street" % the_player.location
        print "with junction at the end."
        print "There are corpses everywhere, all of them"
        print "are dead and didn't turn."
        print "Most of them probably commited suicide."
        print "You notice a corpse of policeman few meters from you."

    while True:
        if the_player.hitpoints <= 0:
            death.type(3, the_player)
        else:
            pass

        action = prompt.standard(the_player)

        if action == "apartment":
            return the_player.directions[0]
            break
        elif action == "policeman" and not 'gun' in the_player.inventory.keys(
        ):
            bullets = random.randint(5, 10)
            the_player.inventory['gun'] = bullets
            print "You take the gun which has %d bullets in it." % bullets
            get_score = score.calculate(the_player, 'gun')
        elif action == "policeman":
            print "You already searched the policeman."
        elif action == "junction":
            return 'Junction'
        else:
            custom_error.errortype(3)
Esempio n. 15
0
def enter(the_player):
	the_player.location = 'Curling Street'
	the_player.directions = ['Apartment','Junction']

	print "\nLocation:", the_player.location
	print "-" * 30

	if the_player.location in the_player.visited and 'charlie sleepover' in the_player.visited and 'Wanda' in the_player.visited:
		print "\nThe whole Curling St. is swarmed with a herd of zombies."
		print "Wanda: 'Tss.. be careful."
		print "Here's the plan: I'm gonna sneak onto other side"
		print "and distract them."
		print "Meanwhile get in the shop and look for the motor - it should"
		print "have label 'K5-22TS' on it. It's pretty heavy so you might need"
		print "something to move it around."
		print "We'll meet back at Junction once you're done but be quick!'"

		score.calculate(the_player,'wanda decoy')
		
		print "\nWanda sneaks behind the cars and gets about 30m away from you."
		print "'Come on, you fuckers!' she screams. The herd starts moving towards"
		print "her. You hope she'll be fine."
		print "'B&D Motors' is ahead, you carefully sneak into the shop..."

		custom_error.errortype(4)

		return 'Motor Shop'

	elif the_player.location in the_player.visited and 'charlie sleepover' in the_player.visited:
		print "You try to step carefully, hiding behind close by dumpster."
		print "Unfortunately you step on broken glass and the"
		print "swarm starts to navigate towards you..."

		custom_error.errortype(4)

		while True:
			encounter = fight.Encounter(the_player, 'zombie male')
			encounter.start(the_player)
			print "As you finished one zombie, another one approaches."
			print "Time to get ready..."

			custom_error.errortype(4)

	elif 'motor' in the_player.inventory.keys() and 'Wanda' in the_player.visited:
		print "Wanda: 'We already got what we need, let's just go"
		print "the herd might move back here again.'"
		return 'Junction'

	elif the_player.location in the_player.visited:

		if 'gun' in the_player.inventory.keys():
			pass		

		else:
			print "There is still a policeman lying on the floor."
			pass
	
		print "You're in %s again." % the_player.location
		print "You've been here before."

		pass		
	
	else:

		the_player.visited.append(the_player.location)

		print "You walk out of your apartment."
		print "You are on %s, it's a large street" % the_player.location
		print "with junction at the end."
		print "There are corpses everywhere, all of them"
		print "are dead and didn't turn."
		print "Most of them probably commited suicide."
		print "You notice a corpse of policeman few meters from you."
	
	while True:
		if the_player.hitpoints <= 0:
			death.type(3, the_player)
		else:
			pass

		action = prompt.standard(the_player)

		if action == "apartment":
			return the_player.directions[0]
			break
		elif action == "policeman" and not 'gun' in the_player.inventory.keys():
			bullets = random.randint(5,10)
			the_player.inventory['gun'] = bullets
			print "You take the gun which has %d bullets in it." % bullets
			get_score = score.calculate(the_player, 'gun')
		elif action == "policeman":
			print "You already searched the policeman."
		elif action == "junction":
			return 'Junction'
		else:
			custom_error.errortype(3)
Esempio n. 16
0
def enter(the_player):

    if 'Wanda' in the_player.visited:
        the_player.location = 'Wanda\'s boat'
    else:
        the_player.location = 'Yellow boat'

    the_player.directions = ['Marina']

    print "\nLocation:", the_player.location
    print "-" * 30

    if 'zombie captain' not in the_player.visited:

        print "Looks like a habitant of Marina has turned."
        print "You see funny looking dead in striped shirt"
        print "and captain's hat... but boy he's ripped"
        print "as hell..."

        custom_error.errortype(3)

        encounter = fight.Encounter(the_player, 'zombie captain')
        encounter.start(the_player)

        the_player.visited.append('zombie captain')

    else:
        pass

    if 'Wanda' in the_player.visited:
        if the_player.location in the_player.visited:
            print "You're back at %s." % the_player.location
            print "Wanda: 'OK, let's get this thing going.'"
        else:
            the_player.visited.append(the_player.location)

            print "Wanda: 'So this is the boat that me and"
            print "Dave found.'"

            print "You both inspect the ship and see that the"
            print "motor is indeed missing. Also the boat"
            print "needs special key to operate."
    else:
        pass

    if the_player.location in the_player.visited:
        print "You're back at the %s." % the_player.location

    else:
        the_player.visited.append(the_player.location)
        print "You inspect the boat and notice that the motor is missing."
        print "Also you need special key to operate the boat."

    while True:

        action = prompt.standard(the_player)

        if 'motor' in action and 'motor' in the_player.inventory.keys():
            print "You install the motor onto the boat. There seems to"
            print "be enough fuel left in tanks. Now all you need"
            print "is to start the motor."

            the_player.visited.append('motor installed')
        elif 'start' in action or 'key' in action or 'boat key' in action:
            print "You put the boat key in the ignition."

            if 'motor installed' in the_player.visited:
                print "You hear the motor start."
                score.calculate(the_player, 'end game')
                custom_error.errortype(4)
                return 'Ending'
            else:
                print "Nothing happens, the motor is still missing."
        elif action == "marina":
            return 'Marina'
        else:
            custom_error.errortype(3)
Esempio n. 17
0
def enter(the_player):

	the_player.location = 'Old Building (first floor)'
	the_player.directions = ['Old Building', 'Old Building (second floor)']

	print "\nLocation:", the_player.location
	print "-" * 30

	if the_player.location in the_player.visited:

		dave = False

		print "You're on %s again. Dave's corpse is still here." % the_player.location
		print "You can go down in Old Building Lobby or up"
		print "in to second floor."

		if 'Wanda' in the_player.visited and 'Dave is dead' in the_player.visited:
			print "\nYou see Wanda turning away from Dave's body."
			print "'Let's go' she says."

		elif 'Wanda' in the_player.visited:
			print "\nWanda: 'My god... that's David... or what's left of him!'"
			print "She starts sobbing uncontrollably. You decide"
			print "that it's best if you just go."

		else:
			pass
	
	else:
		the_player.visited.append(the_player.location)

		dave = True

		print "You see that the light comes from the windows"
		print "that were not boarded up."
		print "You see a grafitti painted on eastern wall"
		print "saying 'DON'T GO UP!'."
		print "You go to near the window to look outside."
		print "You scan the horizon towards Curling Street"
		print "and see a pack of zombies coming towards you."
		print "You quickly step away from the window and"
		print "immediately hear growling breath behind you."
		print "You quickly turn around to see decomposed"
		print "guy in uniform." 
		print "He reminds you if pizza delivery boy"
		print "that you used to meet."

		custom_error.errortype(4)

		if 'Wanda' in the_player.visited:
			print "'DAVE!' Wanda shouts. 'Please let's leave him"
			print "alone!'"
		else:
			pass

		custom_error.errortype(4)

		print "It's weird. He has a leash on his neck and"
		print "he angrily swings his arm towards you,"
		print "clenching his teeth."
		print "You try to slide past him but pizza boy"
		print "snaps into amok."
		print "In one moment the rope on his leash snaps."
		print "Ooops..."

		custom_error.errortype(4)

		encounter = fight.Encounter(the_player, 'Dave')
		encounter.start(the_player)

		dave = False

		the_player.visited.append('Dave is dead')

		if 'Wanda' in the_player.visited:
			print "'Oh my what did we just do? ..."
			print "I guess it was necessary... but.."
			print "poor Dave. He didn't deserve this.'"
			custom_error.errortype(4)
		else:
			pass

		print "Breathing heavily you observe remains of this"
		print "familiar guy and notice a name tag on his"
		print "shirt. It says 'DAVE'."

	while True:
		action = prompt.standard(the_player)

		if action == "dave" and 'dave chocolate' in the_player.visited:
			print "There's not anything on Dave."

		elif action == "dave" and not 'dave chocolate' in the_player.visited:
			the_player.visited.append('dave chocolate')
			print "You quickly search Dave's body"
			print "and to your surprise you find"
			print "old chocolate but it still looks OK."

			if 'chocolate bar' in the_player.inventory.keys():
				print "Cool another chocolate bar."
				the_player.inventory['chocolate bar'] = the_player.inventory['chocolate bar'] + 1
				print "You have %d bars now." % the_player.inventory['chocolate bar']
				score.calculate(the_player, 'chocolate bar')
			elif 'chocolate bar' not in the_player.inventory.keys():
				the_player.inventory['chocolate bar'] = 1
				score.calculate(the_player, 'chocolate bar')
		elif action == "second floor" or action == "old building (second floor)":
			return 'Old Building (second floor)'
		elif action == "lobby" or action == "old building":
			return 'Old Building'
		else:
			custom_error.errortype(3)
Esempio n. 18
0
def enter(the_player):

    the_player.location = 'Old Building (second floor)'
    the_player.directions = ['Old Building (first floor)']

    print "\nLocation:", the_player.location
    print "-" * 30

    if the_player.location in the_player.visited:

        charlie_greets = [
            'looking good', 'missed you', "haven't seen you for a while",
            'nice ass', 'nice outside?'
        ]

        print "You come back to %s." % the_player.location
        print "'Hey there %s, %s!' Charlie screams." % (
            the_player.name, random.choice(charlie_greets))

        if 'Wanda' in the_player.visited:
            print "Good day to you too, Wanda. Sorry about Dave."

    else:
        the_player.visited.append(the_player.location)

        print "You slowly and carefully climb to second"
        print "floor. You see the source of light now."
        print "It's a small candle under the window."
        print "You see sleeping bag near it and"
        print "empty food cans around."
        print "Someone lives here, evidently."

        custom_error.errortype(4)

        if 'Wanda' in the_player.visited:
            print "Old grey man appears out of nowhere."
            print "'Wanda, wh-wh-what you doin here?' he says."
            print "'I came here to get our stuff' she replies."
            print "\n'Me and Dave were here few days earlier"
            print "and we had a plan to get out of Welton.'"
            print "Old man looks into the ground, his eyes"
            print "fixed on his feet."

            custom_error.errortype(4)

            print "'Listen... sorry if you feel offended, I just"
            print "wanted to keep Dave around, in case something..."
            print "I don't know... changed.'"
            print "\nWanda: 'It's okay Charlie. Don't sweat it..."
            print "We ended it. Just few moments ago. I know"
            print "he wouldn't want a life like that'"
            print "Charlie: 'Oh.. OK. You can stay for today"
            print "if you need the rest':"

            while True:
                rest = str(raw_input("Y/N > ")).lower()
                the_player.visited.append('charlie sleepover')

                if rest == "y":
                    the_player.hitpoints = the_player.max_hitpoints
                    print "You feel good after good rest. You have %.1f hitpoints now." % the_player.hitpoints
                    break
                elif rest == "n":
                    break
                else:
                    custom_error.errortype(5)

            custom_error.errortype(4)
            print "Charlie: 'OK, your stuff is down in the lobby."
            print "I think you're gonna need this.'"
            print "He handles you a flashlight."

            if 'flashlight' in the_player.inventory.keys():
                pass
            else:
                the_player.inventory['flashlight'] = 1

        else:
            charlie_check = random.randint(0, 1)
            if charlie_check == 0:
                print "You feel something hard landing on your head"
                print "and almost lose conscience."
                charlie_hit = random.uniform(0.1, 1.0)
                the_player.hitpoints = the_player.hitpoints - charlie_hit

                if the_player.hitpoints <= 0:
                    death.type(6)
                else:
                    print "You lose %.1f hitpoints." % charlie_hit
                    custom_error.errortype(4)

            elif charlie_check == 1:
                print "You see something approaching fast in"
                print "your peripheral vision."
                print "You manage to roll a feet away and stand"
                print "on your feet."

                score.calculate(the_player, 'charlie hit')

            print "You see old grey man in front of you."
            print "He was definitely hiding in the dark corner"
            print "across the candle."
            print "'Howdy there, I'm awfully sorry for that!"
            print "I thought it was Dave, he snapped that"
            print "rope last week and I had to fight him.'"

            end_conversation = False

            while end_conversation == False:
                print "\n'Heard some noise, is he allright?'\n"
                print "1. Yes"
                print "2. No"

                answer = prompt.conversation()

                if answer == 1:
                    print "'Good, good, he's a good boy."
                    print "He used to work for me in my restaurant."
                    print "I know he's different now...."
                    print "But I keep him around, as a warning"
                    print "and to keep me safe."
                    print "I know it's strange, don't judge me.'"

                    break

                elif answer == 2:

                    while end_conversation == False:

                        print "'No? What did you do to him?!'"
                        print "1. The rope snapped, I just defended myself."
                        print "2. I killed that f****r!"

                        answer2 = prompt.conversation()

                        if answer2 == 1:
                            print "'Oh...' Looks like old man is about to cry."
                            print "I kind of got attached to him, even when"
                            print "he became different, y'know..."
                            print "Nevermind...'"

                            end_conversation = True

                        elif answer2 == 2:
                            print "'What!!! You... I'm gonna f****n ~#^@#$...'"
                            print "Old man pulls a huge shotgun out of his"
                            print "coat."
                            death.type(8, the_player)

                        else:
                            custom_error.errortype(1)

                else:
                    custom_error.errortype(1)

            print "'Hey there, my name's Charlie. What's yours?'"

            custom_error.errortype(4)

            print "'%s' you mumble." % the_player.name
            print "\nYou hear Charlie's story, about his pizza place"
            print "and life he had before."
            print "You talked for a while and he offered you to stay"
            print "for the night: 'I saw a pack of 'em from the window."
            print "Wouldn't be safe for you to wander around at night.'\n"
            print "You agree and wake up late next day."

            custom_error.errortype(4)

            hp_to_heal = the_player.max_hitpoints - the_player.hitpoints
            the_player.hitpoints = the_player.hitpoints + hp_to_heal
            the_player.visited.append('charlie sleepover')

            print "You gain %.1f hitpoints from good night sleep.\n" % hp_to_heal
            print "'Listen, %s, by the way you wouldn't have some candy" % the_player.name
            print "on you or something?'"
            print "I might have a flashlight to trade...'"

    while True:
        action = prompt.standard(the_player)

        if "first floor" in action:
            return 'Old Building (first floor)'
        elif "chocolate" in action and 'Wanda' in the_player.visited:
            print "Charlie: 'No thanks.'"
        elif action == "chocolate" and 'flashlight' in the_player.inventory.keys(
        ) or action == "chocolate bar" and 'flashlight' in the_player.inventory.keys(
        ):
            print "Sorry, I don't have anything else to trade."
        elif action == "chocolate" or action == "chocolate bar" and the_player.inventory[
                'chocolate bar'] >= 1:
            the_player.inventory[
                'chocolate bar'] = the_player.inventory['chocolate bar'] - 1
            the_player.inventory['flashlight'] = 1
            print "Charlie: 'Great! Here you go, you might have a good use for it!'"
            print "He gives you working flashlight"
            score.calculate(the_player, 'flashlight')
        elif action == "chocolate" or action == "chocolate bar" and the_player.inventory[
                'chocolate bar'] == 0:
            print "You don't have any chocolate bar to give to Charlie."
        else:
            custom_error.errortype(3)
Esempio n. 19
0
def enter(the_player):

    the_player.location = 'Old Building'
    the_player.directions = ['March Street', 'Old Building (first floor)']

    print "\nLocation:", the_player.location
    print "-" * 30

    num_of_tries = 4

    if the_player.location in the_player.visited and 'flashlight' in the_player.inventory.keys(
    ):
        print "You turn on the flashlight. Suddenly you can see all"
        print "the dead bodies in the room."

        if 'first time flash light' in the_player.visited:
            print "You see the trunk."

        else:
            the_player.visited.append('first time flash light')
            score.calculate(the_player, 'turn on lights')

            print "Apart from the horrendous scene you notice a large trunk"
            print "in the back of the room."
            print "You come closer to open it but discover that"
            print "it has a mechanical lock on it with three"
            print "cylinders with number on them."
            print "The trunk has letters 'AK' crudely painted on it."

            if 'Wanda' in the_player.visited:
                print "\nWanda: 'That trunk is where our stuff should be.'"

    elif the_player.location in the_player.visited:

        print "You are at the lobby of %s again. It's dark here." % the_player.location

    else:
        the_player.visited.append(the_player.location)

        print "It's very dark inside and the smell is horrible."
        print "You can't see anything but you see a little"
        print "light coming from the other side of the lobby."
        print "You see some stairs leading up to first floor."

        if 'Wanda' in the_player.visited:
            print "\nWanda: 'This is it, this is the building. The stuff"
            print "must be somewhere here.'"

    while True:
        action = prompt.standard(the_player)

        if action == "march street" or 'out' in action:
            return 'March Street'
        elif action == "stairs" or action == "first floor":
            return 'Old Building (first floor)'
        elif action == "trunk" and not 'map' in the_player.inventory.keys():

            if 'Wanda' in the_player.visited:
                print "\n'The code is 498 but be careful"
                print "because you only have few tries."
                print "There's a special poison needle"
                print "to avoid hassling with the lock'"
            else:
                pass

            while True:
                if num_of_tries != 0:
                    try:
                        passcode = int(
                            raw_input(
                                "Enter three digits, '000' to go away > "))
                        num_of_tries = num_of_tries - 1
                    except ValueError:
                        print "Put three numbers only"
                    if passcode == 000:
                        break
                    elif passcode == 498:
                        the_player.inventory['boat key'] = 1
                        score.calculate(the_player, 'key')

                        print "You find some junk inside but most importantly,"
                        print "the key for the boat is there. It is squared-shaped"
                        print "and kind of unique."

                        if 'Wanda' in the_player.visited:
                            print "Wanda: 'We got the key! Let's go.'"
                        else:
                            pass
                        break
                    else:
                        print "It's still locked."
                else:
                    death.type(9, the_player)

        else:
            custom_error.errortype(3)
            pass
Esempio n. 20
0
def laptop(the_player):

    computer = True

    while computer:

        print "\n--- Welcome to ShopDB ver. 3.0 ---"
        print "\nPlease select number, type '0' to log out:"
        print "1. Browse inventory"
        print "2. Billings"
        print "3. Employees"

        computer_prompt = int(raw_input("> "))

        if computer_prompt == 1:

            computer2 = True

            while computer2:

                print "\n1. Axx - Gxx"
                print "2. Hxx - Oxx"
                print "3. Mxx - Zxx"
                print "4. <- back"

                computer_prompt2 = int(raw_input("> "))

                if computer_prompt2 == 1:

                    computer3 = True

                    while computer3:

                        print "\n1. A6-HJT3"
                        print "2. C5-TZ"
                        print "3. F3-763G"
                        print "4. G1-GG"
                        print "5. <- back"

                        computer_prompt3 = int(raw_input("> "))

                        if computer_prompt3 == 5:
                            print "..."
                            computer3 = False
                        else:
                            print "Nothing of interest here."

                elif computer_prompt2 == 2:

                    computer4 = True

                    while computer4:

                        print "\n1. H5-I54"
                        print "2. K5-22TS"
                        print "3. L0-002"
                        print "4. <- back"

                        computer_prompt4 = int(raw_input("> "))

                        if computer_prompt4 == 2:
                            print "Yes that's the number Wanda was talking about."
                            print "It says it's in the Warehouse on shelf T-1."
                            score.calculate(the_player, 'find motor')
                            print "You log out of computer."
                            computer5 = False
                            computer4 = False
                            computer3 = False
                            computer2 = False
                            computer = False

                        elif computer_prompt4 == 4:
                            print "..."
                            computer4 = False
                        else:
                            print "Nothing of interest here."

                elif computer_prompt2 == 3:

                    computer5 = True

                    while computer5:

                        print "\n1. N7-44F"
                        print "2. T9-F"
                        print "3. WK-991"
                        print "4. <- back"

                        computer_prompt5 = int(raw_input("> "))

                        if computer_prompt5 == 4:
                            print "..."
                            computer5 = False
                        else:
                            print "Nothing of interest here."

                elif computer_prompt2 == 4:
                    computer2 = False
                    print "..."

                else:
                    custom_error.errortype(3)

        elif computer_prompt == 2:
            print "\nSome accounting program opens but it's not"
            print "what you need so you close it."
            custom_error.errortype(4)
        elif computer_prompt == 3:
            print "\nYou see files on bunch of employees. Nothing of interest here."
            custom_error.errortype(4)
        elif computer_prompt == 0:
            print "You log out of computer."
            computer = False
            return 'Motor Shop'
        else:
            custom_error.errortype(3)
Esempio n. 21
0
def enter(the_player):

	the_player.location = 'Old Building (second floor)'
	the_player.directions = ['Old Building (first floor)']

	print "\nLocation:", the_player.location
	print "-" * 30

	if the_player.location in the_player.visited:

		charlie_greets = [
		'looking good','missed you',"haven't seen you for a while",
		'nice ass','nice outside?']

		print "You come back to %s." % the_player.location
		print "'Hey there %s, %s!' Charlie screams." % (the_player.name, random.choice(charlie_greets))

		if 'Wanda' in the_player.visited:
			print "Good day to you too, Wanda. Sorry about Dave."

	else:
		the_player.visited.append(the_player.location)

		print "You slowly and carefully climb to second"
		print "floor. You see the source of light now."
		print "It's a small candle under the window."
		print "You see sleeping bag near it and"
		print "empty food cans around."
		print "Someone lives here, evidently."

		custom_error.errortype(4)

		if 'Wanda' in the_player.visited:
			print "Old grey man appears out of nowhere."
			print "'Wanda, wh-wh-what you doin here?' he says."
			print "'I came here to get our stuff' she replies."
			print "\n'Me and Dave were here few days earlier"
			print "and we had a plan to get out of Welton.'"
			print "Old man looks into the ground, his eyes"
			print "fixed on his feet."

			custom_error.errortype(4)

			print "'Listen... sorry if you feel offended, I just"
			print "wanted to keep Dave around, in case something..."
			print "I don't know... changed.'"
			print "\nWanda: 'It's okay Charlie. Don't sweat it..."
			print "We ended it. Just few moments ago. I know"
			print "he wouldn't want a life like that'"
			print "Charlie: 'Oh.. OK. You can stay for today"
			print "if you need the rest':"

			while True:
				rest = str(raw_input("Y/N > ")).lower()
				the_player.visited.append('charlie sleepover')

				if rest == "y":
					the_player.hitpoints = the_player.max_hitpoints
					print "You feel good after good rest. You have %.1f hitpoints now." % the_player.hitpoints
					break
				elif rest == "n":
					break
				else:
					custom_error.errortype(5)

			custom_error.errortype(4)
			print "Charlie: 'OK, your stuff is down in the lobby."
			print "I think you're gonna need this.'"
			print "He handles you a flashlight."

			if 'flashlight' in the_player.inventory.keys():
				pass
			else:
				the_player.inventory['flashlight'] = 1



		else:
			charlie_check = random.randint(0,1)
			if charlie_check == 0:
				print "You feel something hard landing on your head"
				print "and almost lose conscience."
				charlie_hit = random.uniform(0.1,1.0)
				the_player.hitpoints = the_player.hitpoints - charlie_hit

				if the_player.hitpoints <= 0:
					death.type(6)
				else:
					print "You lose %.1f hitpoints." % charlie_hit
					custom_error.errortype(4)

			elif charlie_check == 1:
				print "You see something approaching fast in"
				print "your peripheral vision."
				print "You manage to roll a feet away and stand"
				print "on your feet."

				score.calculate(the_player, 'charlie hit')

			print "You see old grey man in front of you."
			print "He was definitely hiding in the dark corner"
			print "across the candle."
			print "'Howdy there, I'm awfully sorry for that!"
			print "I thought it was Dave, he snapped that"
			print "rope last week and I had to fight him.'"

			end_conversation = False

			while end_conversation == False:
				print "\n'Heard some noise, is he allright?'\n"
				print "1. Yes"
				print "2. No"
				
				answer = prompt.conversation()

				if answer == 1:
					print "'Good, good, he's a good boy."
					print "He used to work for me in my restaurant."
					print "I know he's different now...."
					print "But I keep him around, as a warning"
					print "and to keep me safe."
					print "I know it's strange, don't judge me.'"
					
					break

				elif answer == 2:

					while end_conversation == False:
		
						print "'No? What did you do to him?!'"
						print "1. The rope snapped, I just defended myself."
						print "2. I killed that f****r!"
					
						answer2 = prompt.conversation()

						if answer2 == 1:
							print "'Oh...' Looks like old man is about to cry."
							print "I kind of got attached to him, even when"
							print "he became different, y'know..."
							print "Nevermind...'"
							
							end_conversation = True

						elif answer2 == 2:
							print "'What!!! You... I'm gonna f****n ~#^@#$...'"
							print "Old man pulls a huge shotgun out of his"
							print "coat."
							death.type(8, the_player)

						else:
							custom_error.errortype(1)

				else:
					custom_error.errortype(1)

			print "'Hey there, my name's Charlie. What's yours?'"

			custom_error.errortype(4)

			print "'%s' you mumble." % the_player.name
			print "\nYou hear Charlie's story, about his pizza place"
			print "and life he had before."
			print "You talked for a while and he offered you to stay"
			print "for the night: 'I saw a pack of 'em from the window."
			print "Wouldn't be safe for you to wander around at night.'\n"
			print "You agree and wake up late next day."

			custom_error.errortype(4)

			hp_to_heal = the_player.max_hitpoints - the_player.hitpoints
			the_player.hitpoints = the_player.hitpoints + hp_to_heal
			the_player.visited.append('charlie sleepover')

			print "You gain %.1f hitpoints from good night sleep.\n" % hp_to_heal
			print "'Listen, %s, by the way you wouldn't have some candy" % the_player.name
			print "on you or something?'"
			print "I might have a flashlight to trade...'"


	while True:
		action = prompt.standard(the_player)

		if "first floor" in action:
			return 'Old Building (first floor)'
		elif "chocolate" in action and 'Wanda' in the_player.visited:
			print "Charlie: 'No thanks.'"
		elif action == "chocolate" and 'flashlight' in the_player.inventory.keys() or action == "chocolate bar" and 'flashlight' in the_player.inventory.keys():
			print "Sorry, I don't have anything else to trade."
		elif action == "chocolate" or action == "chocolate bar" and the_player.inventory['chocolate bar'] >= 1:
			the_player.inventory['chocolate bar'] = the_player.inventory['chocolate bar'] - 1
			the_player.inventory['flashlight'] = 1
			print "Charlie: 'Great! Here you go, you might have a good use for it!'"
			print "He gives you working flashlight"
			score.calculate(the_player, 'flashlight')
		elif action == "chocolate" or action == "chocolate bar" and the_player.inventory['chocolate bar'] == 0:
			print "You don't have any chocolate bar to give to Charlie."
		else:
			custom_error.errortype(3)
Esempio n. 22
0
def enter(the_player):

    the_player.location = 'Foreman Ave'
    the_player.directions = [
        'Junction', 'Commercial Building', 'Car barricade'
    ]
    glass = random.randint(1, 4)

    print "\nLocation:", the_player.location
    print "-" * 30

    if the_player.location in the_player.visited:
        print "You're back at %s." % the_player.location
        print "There are waste containers on the side"
        print "of the road."
        print "Building with broken shop window is next to them."

    else:
        the_player.visited.append(the_player.location)

        print "You come to wide street with various shops"
        print "on each side and garbage everywhere."
        print "There are seven green waste containers on the right"
        print "side of the road that are stuffed"
        print "with various things."
        print "You see a commercial building, probably a shop"
        print "with broken front shop window."
        print "The street ends with a huge barricade made out of"
        print "cars."

    while True:

        action = prompt.standard(the_player)

        if action == "junction":
            return 'Junction'
        elif 'waste' in action or 'container' in action:
            container(the_player)
        elif 'window' in action or 'commercial' in action or 'building' in action:
            if glass == 1:
                death.type(12, the_player)
            else:
                print "You lose balance while stepping to the shop,"
                print "you almost impale yourself on glass shrapnel."
                print "Don't try that again!"
                score.calculate(the_player, 'glass')
        elif 'cars' in action or 'barricade' in action or 'car' in action:

            print "You try to climb the car barricade but"
            print "you fail, falling to the ground."

            if 'car barricade' not in the_player.visited:
                encounter = fight.Encounter(the_player, 'random')
                print "Somehow, a zombie crawls from one of the cars."

                custom_error.errortype(4)
                encounter.start(the_player)
                the_player.visited.append('car barricade')
            else:
                pass
        else:
            custom_error.errortype(3)
Esempio n. 23
0
def enter(the_player):

	if 'Wanda' in the_player.visited:
		the_player.location = 'Wanda\'s boat'
	else:
		the_player.location = 'Yellow boat'

	the_player.directions = ['Marina']

	print "\nLocation:", the_player.location
	print "-" * 30

	if 'zombie captain' not in the_player.visited:

		print "Looks like a habitant of Marina has turned."
		print "You see funny looking dead in striped shirt"
		print "and captain's hat... but boy he's ripped"
		print "as hell..."

		custom_error.errortype(3)

		encounter = fight.Encounter(the_player,'zombie captain')
		encounter.start(the_player)

		the_player.visited.append('zombie captain')

	else:
		pass


	if 'Wanda' in the_player.visited:
		if the_player.location in the_player.visited:
			print "You're back at %s." % the_player.location
			print "Wanda: 'OK, let's get this thing going.'"
		else:
			the_player.visited.append(the_player.location)

			print "Wanda: 'So this is the boat that me and"
			print "Dave found.'"

			print "You both inspect the ship and see that the"
			print "motor is indeed missing. Also the boat"
			print "needs special key to operate."
	else:
		pass

	if the_player.location in the_player.visited:
		print "You're back at the %s." % the_player.location


	else:
		the_player.visited.append(the_player.location)
		print "You inspect the boat and notice that the motor is missing."
		print "Also you need special key to operate the boat."


	while True:
		
		action = prompt.standard(the_player)

		if 'motor' in action and 'motor' in the_player.inventory.keys():
			print "You install the motor onto the boat. There seems to"
			print "be enough fuel left in tanks. Now all you need"
			print "is to start the motor."

			the_player.visited.append('motor installed')
		elif 'start' in action or 'key' in action or 'boat key' in action:
			print "You put the boat key in the ignition."

			if 'motor installed' in the_player.visited:
				print "You hear the motor start."
				score.calculate(the_player,'end game')
				custom_error.errortype(4)
				return 'Ending'
			else:
				print "Nothing happens, the motor is still missing."
		elif action == "marina":
			return 'Marina'
		else:
			custom_error.errortype(3)
Esempio n. 24
0
def standard(the_player):

	push_ups = 1

	while True:
		
		user_input = str(raw_input("> ")).lower()		

		if user_input == "save":
			handler.save(the_player)
		elif user_input == "inventory" or user_input == "inv":
			print "Inventory:"
			for key, item in the_player.inventory.items():
				condition = item

				if condition > 0 and condition <= 5:
					print_condition = "weak"
				elif condition > 5 and condition <= 15:
					print_condition = "OK"
				else:
					print_condition = "fine"
				
				if key == 'knife' or key == 'baseball bat':					
					print "- %s (%s)" % (key, print_condition)
				elif key == 'gun':
					print "- %s (%d bullets left)" % (key, item)
				elif item > 0:
					print "- %s (%d)" % (key, item)
				elif item <= 0:
					pass

		elif user_input == "char":
			print "\n---", the_player.name, "---"
			print "Age:", the_player.age
			print "Is male?:", the_player.male
			print "Hitpoints: %.1f" % the_player.hitpoints, "/ %.1f" % the_player.max_hitpoints 
			print "Current location:", the_player.location
			print "Score:", the_player.score, "points","\n"
		elif user_input == "help":
			game_help()
		elif user_input == "look":
			print "You can go to:", ", ".join(the_player.directions)
		elif user_input == "hint":
			print "Hint:", hint.location(the_player.location)
		# EASTER EGG
		elif user_input == "push up" and the_player.age > 90:
			death.type(4, the_player)
		elif user_input == "push up" and push_ups > 18:
			death.type(5, the_player)
		elif user_input == "push up":
			push_up = score.calculate(the_player, 'push up')
			print "You've done %d sets of push ups." % push_ups
			push_ups = push_ups + 1
		elif user_input == "heal":
			if 'bandage' not in the_player.inventory.keys() or the_player.inventory['bandage'] == 0:
				print "You do not have bandage."

			elif the_player.hitpoints >= the_player.max_hitpoints:
				print "You don't need to heal yourself."

			elif the_player.inventory['bandage'] > 0:
				healed_hp = random.uniform(11.0,15.0)
				the_player.hitpoints = the_player.hitpoints + healed_hp
				the_player.inventory['bandage'] = the_player.inventory['bandage'] - 1

				if the_player.hitpoints > the_player.max_hitpoints:
					over_hp = the_player.hitpoints - the_player.max_hitpoints
					the_player.hitpoints = the_player.max_hitpoints
					healed_hp = healed_hp - over_hp
				else:
					pass

				print "\nYou heal %.1f hitpoints. (Now: %.1f/%.1f HP). %d bandages left." % (healed_hp, the_player.hitpoints, the_player.max_hitpoints, the_player.inventory['bandage'])
			else:
				pass
		elif user_input == "map":
			if 'map' in the_player.inventory.keys():
				print """
				WELTON SUBURBS MAP

 Left____Another St.____Longer St.____Row of H.
   |                                     |
Suburbs...Very long st.____Small h.___Junction____Mansion
   |                                     |
 Right____Regular St.____Shorter St.____St. w/ tree
"""				

			else:
				print "You don't have a map."
		elif user_input == "visited":
			print the_player.visited
		elif user_input == "killed":
			print the_player.killed
		elif user_input == "quit":

			print "Are you sure? Y/N"

			while True:
				to_quit = str(raw_input("> ")).lower()

				if to_quit == "y":
					break
				elif to_quit == "n":
					return ''
				else:
					custom_error.errortype(5)

			print "Do you want to save? Y/N"
				
			while True:
				save_input = str(raw_input("> ")).lower()

				if save_input == "y":
					handler.save(the_player)
					break
				elif save_input == "n":
					break
				else:
					custom_error.errortype(5)
			exit(1)
		else:
			return user_input
Esempio n. 25
0
def enter(the_player):

	the_player.location = 'Old Building'
	the_player.directions = ['March Street','Old Building (first floor)']

	print "\nLocation:", the_player.location
	print "-" * 30

	num_of_tries = 4

	if the_player.location in the_player.visited and 'flashlight' in the_player.inventory.keys():
		print "You turn on the flashlight. Suddenly you can see all"
		print "the dead bodies in the room."

		if 'first time flash light' in the_player.visited:
			print "You see the trunk."


		else:
			the_player.visited.append('first time flash light')
			score.calculate(the_player,'turn on lights')

			print "Apart from the horrendous scene you notice a large trunk"
			print "in the back of the room."
			print "You come closer to open it but discover that"
			print "it has a mechanical lock on it with three"
			print "cylinders with number on them."
			print "The trunk has letters 'AK' crudely painted on it."

			if 'Wanda' in the_player.visited:
				print "\nWanda: 'That trunk is where our stuff should be.'"


	elif the_player.location in the_player.visited:

		print "You are at the lobby of %s again. It's dark here." % the_player.location

	else:
		the_player.visited.append(the_player.location)

		print "It's very dark inside and the smell is horrible."
		print "You can't see anything but you see a little"
		print "light coming from the other side of the lobby."
		print "You see some stairs leading up to first floor."

		if 'Wanda' in the_player.visited:
			print "\nWanda: 'This is it, this is the building. The stuff"
			print "must be somewhere here.'"

	while True:
		action = prompt.standard(the_player)

		if action == "march street" or 'out' in action:
			return 'March Street'
		elif action == "stairs" or action == "first floor":
			return 'Old Building (first floor)'
		elif action == "trunk" and not 'map' in the_player.inventory.keys():

			if 'Wanda' in the_player.visited:
				print "\n'The code is 498 but be careful"
				print "because you only have few tries."
				print "There's a special poison needle"
				print "to avoid hassling with the lock'"
			else:
				pass

			while True:
				if num_of_tries != 0:
					try:
						passcode = int(raw_input("Enter three digits, '000' to go away > "))
						num_of_tries = num_of_tries - 1
					except ValueError:
						print "Put three numbers only"
					if passcode == 000:
						break
					elif passcode == 498:
						the_player.inventory['boat key'] = 1
						score.calculate(the_player, 'key')

						print "You find some junk inside but most importantly,"
						print "the key for the boat is there. It is squared-shaped"
						print "and kind of unique."

						if 'Wanda' in the_player.visited:
							print "Wanda: 'We got the key! Let's go.'"
						else:
							pass
						break
					else:
						print "It's still locked."
				else:
					death.type(9, the_player)


		else:
			custom_error.errortype(3)
			pass
Esempio n. 26
0
def standard(the_player):

    push_ups = 1

    while True:

        user_input = str(raw_input("> ")).lower()

        if user_input == "save":
            handler.save(the_player)
        elif user_input == "inventory" or user_input == "inv":
            print "Inventory:"
            for key, item in the_player.inventory.items():
                condition = item

                if condition > 0 and condition <= 5:
                    print_condition = "weak"
                elif condition > 5 and condition <= 15:
                    print_condition = "OK"
                else:
                    print_condition = "fine"

                if key == 'knife' or key == 'baseball bat':
                    print "- %s (%s)" % (key, print_condition)
                elif key == 'gun':
                    print "- %s (%d bullets left)" % (key, item)
                elif item > 0:
                    print "- %s (%d)" % (key, item)
                elif item <= 0:
                    pass

        elif user_input == "char":
            print "\n---", the_player.name, "---"
            print "Age:", the_player.age
            print "Is male?:", the_player.male
            print "Hitpoints: %.1f" % the_player.hitpoints, "/ %.1f" % the_player.max_hitpoints
            print "Current location:", the_player.location
            print "Score:", the_player.score, "points", "\n"
        elif user_input == "help":
            game_help()
        elif user_input == "look":
            print "You can go to:", ", ".join(the_player.directions)
        elif user_input == "hint":
            print "Hint:", hint.location(the_player.location)
        # EASTER EGG
        elif user_input == "push up" and the_player.age > 90:
            death.type(4, the_player)
        elif user_input == "push up" and push_ups > 18:
            death.type(5, the_player)
        elif user_input == "push up":
            push_up = score.calculate(the_player, 'push up')
            print "You've done %d sets of push ups." % push_ups
            push_ups = push_ups + 1
        elif user_input == "heal":
            if 'bandage' not in the_player.inventory.keys(
            ) or the_player.inventory['bandage'] == 0:
                print "You do not have bandage."

            elif the_player.hitpoints >= the_player.max_hitpoints:
                print "You don't need to heal yourself."

            elif the_player.inventory['bandage'] > 0:
                healed_hp = random.uniform(11.0, 15.0)
                the_player.hitpoints = the_player.hitpoints + healed_hp
                the_player.inventory[
                    'bandage'] = the_player.inventory['bandage'] - 1

                if the_player.hitpoints > the_player.max_hitpoints:
                    over_hp = the_player.hitpoints - the_player.max_hitpoints
                    the_player.hitpoints = the_player.max_hitpoints
                    healed_hp = healed_hp - over_hp
                else:
                    pass

                print "\nYou heal %.1f hitpoints. (Now: %.1f/%.1f HP). %d bandages left." % (
                    healed_hp, the_player.hitpoints, the_player.max_hitpoints,
                    the_player.inventory['bandage'])
            else:
                pass
        elif user_input == "map":
            if 'map' in the_player.inventory.keys():
                print """
				WELTON SUBURBS MAP

 Left____Another St.____Longer St.____Row of H.
   |                                     |
Suburbs...Very long st.____Small h.___Junction____Mansion
   |                                     |
 Right____Regular St.____Shorter St.____St. w/ tree
"""

            else:
                print "You don't have a map."
        elif user_input == "visited":
            print the_player.visited
        elif user_input == "killed":
            print the_player.killed
        elif user_input == "quit":

            print "Are you sure? Y/N"

            while True:
                to_quit = str(raw_input("> ")).lower()

                if to_quit == "y":
                    break
                elif to_quit == "n":
                    return ''
                else:
                    custom_error.errortype(5)

            print "Do you want to save? Y/N"

            while True:
                save_input = str(raw_input("> ")).lower()

                if save_input == "y":
                    handler.save(the_player)
                    break
                elif save_input == "n":
                    break
                else:
                    custom_error.errortype(5)
            exit(1)
        else:
            return user_input