from time import * from random import * import os,sys, random def clear_screen(): os.system('cls' if os.name=='nt' else 'clear') def title(): print (" __ _ __ ") print (" / / ___ __ _ ___ _ __ __| | ___ / _| /\ /\___ _ __ ___ ___ ___ ") print (" / / / _ \/ _` |/ _ \ '_ \ / _` | / _ \| |_ / /_/ / _ \ '__/ _ \ / _ \/ __|") print ("/ /__| __/ (_| | __/ | | | (_| | | (_) | _| / __ / __/ | | (_) | __/\__ \ ") print ("\____/\___|\__, |\___|_| |_|\__,_| \___/|_| \/ /_/ \___|_| \___/ \___||___/") def castle(): print ("* |>>> + ") print ("+ * | * +") print (" |>>> _ _|_ _ * |>>> ") print (" * | |;| |;| |;| | *") print (" + _ _|_ _ \\. . / _ _|_ _ +") print (" * |;|_|;|_|;| \\: + / |;|_|;|_|;|") print (" \\.. / ||:+++. | \\. . / *") print (" + \\. , / ||:+++ | \\: . /") print (" ||:+ |_ _ ||_ . _ | _ _||:+ | *") print (" * ||+++.|||_|;|_|;|_|;|_|;|_|;||+++ | +") print (" ||+++ ||. . . . ||+++.| *") print ("+ * ||: . ||:. . . . , ||: | *") print (" * ||: ||: , + . ||: , | +") print (" * ||: ||:. +++++ . ||: | *") print (" + ||: ||. +++++++ . ||: . | +") print (" + ||: . ||: , +++++++ . . ||: | +") print (" ||: . ||: , +++++++ . . ||: | *") print (" ||: . ||: , +++++++ . . ||: |") def north(): print("to go north press n then enter") def east(): print("to go east press e then enter") def south(): print("to go south press s then enter") def west(): print("to go west press w then enter") def setup(): global name global HP global MP name = input ("what is your name warrior") HP = randint(2, 20) MP = randint(5, 20) def villager(): global npcname global responses responses = ["hi","are you a hero", "are you from this village", "there has been a dark shadow cast across this village"] npcnamechoice = ["roger", "dexter", "sarah", "susan"] random.shuffle(npcnamechoice) npcname = npcnamechoice[0] print("\n["+npcname+":] hello, my name is"+npcname+", would you like to talk to me?\n") random.shuffle(responses) print("press y to talk to the villager") if input() == "y": print("["+npcname+":]"+responses[0]) else: print("["+npcname+":] goodbye") def enemy (): global enemyHP global enemyMP global enemyname enemyHP = randint(5, 20) enemyMP = randint(5, 20) enemyname = "Ogre" print("\nsuddenly you hear a roar, and from the shadows you see an"+enemyname+" coming straight at you....") print("your enemy has " + " " + str(enemyHP) + " " + "health points") print("your enemy has " + " " + str(enemyMP) + " " + "magic points") clear_screen() title() castle() setup() global name global HP global MP global move global enemyHP print("welcome to middle earth, " + name) sleep(2) print("your health is" + " " + str(HP)) print("your magic skill is" + " " + str(MP)) print("would you like to venture out into the land? press y then enter to continue") if input() == "y": print("you are in your home, with a roaring fireplace in front of you, above the fire you can see your sword and shield") print("would you like you like to take your sword and shield? press y then enter to continue") if input() == "y": weapon = [] weapon.append("sword") weapon.append("shield") print("you are now carrying your" + " " + weapon[0] + " "+ "and your" + " " + weapon[1]) print ("Armed with your " + weapon[0] + " " + "and " + weapon[1] + " you swing open the door to your home and see a green valley gleaming in the sunshine.") else: print("you choose not to take your weapons") print("armed with your sense of humour, you swing open the door to see a green valley full of opportunitys awaiting you.") else: print("you stay at home, sat in your favorite chair watching the fire grow colder. middle earth no longer has a hero.") print("game over") sys.exit(0) print("in the distance to the north you can see a samll villag, to the east you can see a river and to the west a feild of wild flowers.") print("\n") north() east() west move = input("where would you like to go?") if move == 'n': print("\nyou move to the north, walking in the sunrise") print("a villager is in your path and greets you") elif move == 'e': print("\nyou want to the river which lies to the east of your home") print("a villager is in your path and greets you") elif move == 'w': print("\nyou walk to the feild of wild flower, stopping to take in the beauty") print("a villager is in your path and greets you\n") villager() enemy() sleep(3) fight = input("do you wish to fight?") if fight == "y": while HP > 0: hit = randint(0, 5) print("you swing your sword and cause " + str(hit) + " of damage") enemyHP = enemyHP - hit print (enemyHP) enemyhit = randint(0, 5) print("the ogre swings a club at you and causes " + str(enemyhit) + " of damage") HP = HP -enemyhit print (HP) else: print("you turn and run away from the ogre") print("this is where this template ends, this is now TOUR world, build your adventure and share it with the world") print (" _ _ _") print (" /_\ __| |_ _____ _ __ | |_ _ _ _ __ ___") print (" //_\\ / _` \ \ / / _ \ '_ \| __| | | | '__/ _ \ ") print ("/ _ \ (_| |\ V / __/ | | | |_| |_| | | | __/") print ("\_/ \_/\__,_| \_/ \___|_| |_|\__|\__,_|_| \___|") print (" _ _") print (" __ ___ ____ _(_) |_ ___") print (" / _` \ \ /\ / / _` | | __/ __|") print ("| (_| |\ V V / (_| | | |_\__ \ ") print (" \__,_| \_/\_/ \__,_|_|\__|___/") print (" _ _ ___ _ _") print ("| | | |/ _ \| | | |") print ("| |_| | (_) | |_| |") print (" \__, |\___/ \__,_|") print (" |___/")