def testInit(self): from player import Player from space import Space from cities.square import Square from cities.city import City testsquare = Square( "Chris' testing Square", "testing square", "Come test here", { "Master Wang": "I am Master Wang, creator various things in this Lord of the Rings game", "Miles": "Hello, I am Miles, the cookie legend" }) testcity = City("Test City", "testing city", "hello to testing city. see Chris' Square", testsquare) space = Space("Shire", "Home of the Hobbits.", city=testcity) player = Player("Frodo", space) #Player chooses to: 1(talk), to Master Wang, 1(talk), to Miles, 2(Leave) the square rawInputMock = MagicMock(side_effect=[ "1", "Master Wang", "1", "Miles", "gobbledigook", "2" ]) with patch('cities.square.raw_input', create=True, new=rawInputMock): testsquare.execute(player) #if the code gets here, then it hasn't crashed yet; test something arbitrary here, like player's money. self.assertEqual(player._money, 20, "Why does player's money not equal 20?")
def tocity(result): if result: city_id, name, country_code, district, population = result city = City(city_id, name, country_code, district, population) # print(' {}'.format(city)) return city return None
def testInit(self): from player import Player from space import Space from cities.inn import Inn from cities.city import City testinn = Inn("Chris' testing Inn", "Come test here", "hi", 5) testcity = City("Test City", "testing city", "hello to testing city. see Chris' Inn", testinn) space = Space("Shire", "Home of the Hobbits.", city=testcity) player = Player("Frodo", space) #player's health is lowest possible to be alive player._hp = 1 #player's money is equal to 10 player._money = 10 #Player chooses to stay at the inn rawInputMock = MagicMock(return_value=1) with patch('cities.inn.raw_input', create=True, new=rawInputMock): testinn.execute(player) #player's money should decrease by the cost of the inn, in our case 5. self.assertEqual(player._money, 5, "Player's money not decreased by correct amount.") #player's health should increase to maximum. self.assertEqual(player._hp, player._maxHp, "Player's health not increased to full health.")
def __init__(self): self.fields = dict([ # San Jose City fields BLDS fields ("permit_number", "permit_num"), ("work_code_description", "description"), ("work_code", ""), ("apn", ""), ("year", ""), ("owner", ""), ("final_date", "completed_date"), ("issue_date", "issued_date"), ("approval_status", "status_current"), ("sub_code", ""), ("contractor", "contractor_company_name"), ("permit_flag", ""), ("location", "original_address1"), ("lot", ""), ("units", "housing_units"), ("permit_valuation", ""), ("type", "permit_type_desc"), ("rsn", "pin"), ("sub_code_description", "permit_class"), ("square_feet", "total_sqft"), ("tract", ""), ("pool", ""), ("reroof_valuation", ""), ("applicant", "contractor_full_name"), ("sewer", ""), ("enterprise", ""), ("census_code", "") ]) self.city = City("SanJose", self.fields)
def testInit(self): from player import Player from space import Space from cities.city import City from cities.inn import Inn testInn = Inn("Seth n Breakfast Test Inn", "Testing inn", "Come test here", 3) testCity = City("TestCity","Chris' unique testing city", "Come test here", buildings = testInn) space = Space("Shire", "Home of the Hobbits.", city = testCity) player = Player("Frodo", space) #Player chooses to "gobbledigook", enter Inn, 2(Leave)s the inn, enters inn again, 2(Leave)s inn again, leaves city cityInputMock = MagicMock(side_effect = ["gobbledigook", "Seth n Breakfast Test Inn", "Seth n Breakfast Test Inn", 'leave city' ]) innInputMock = MagicMock(side_effect = ["2", "2"]) with patch('cities.city.raw_input', create = True, new = cityInputMock): with patch('cities.inn.raw_input', create = True, new = innInputMock): testCity.enter(player)
def getcity(self, city_id): info = {} city = self.dao.retrive(City(city_id)) if city: p_url, n_url = None, None p_city = self.dao.retrive_previous(City(city_id)) if p_city: p_url = url_for('getcity', city_id=p_city.city_id, _external=True) n_city = self.dao.retrive_next(City(city_id)) if n_city: n_url = url_for('getcity', city_id=n_city.city_id, _external=True) self_url = url_for('getcity', city_id=city_id, _external=True) parent_url = url_for('getcities', _external=True) country_url = url_for('getcountry', country_code=city.country_code, _external=True) info = { 'urls': { 'self': self_url, 'parent': parent_url, 'next': n_url, 'previous': p_url, 'country': country_url }, 'city': { 'city_id': city.city_id, 'name': city.name, 'country_code': city.country_code, 'district': city.district, 'population': city.population } } return self.prepare_response('cities/city.xml', info)
def testInit(self): from player import Player from space import Space from cities.shop import Shop from cities.city import City from items.armor import Armor testshop = Shop("Chris' testing Shop", "Come test here", "hi", 5, 10) testcity = City("Test City", "testing city", "hello to testing city. see Chris' Shop", testshop) space = Space("Shire", "Home of the Hobbits.", city=testcity) player = Player("Frodo", space) player_money = player._money #create starting iventory armor = Armor("Leather Tunic", "Travel cloak", 3, 1, 1) #add armor to player's inventory inventory = player._inventory player.addToInventory(armor) self.assertTrue(inventory.containsItemWithName("Leather Tunic"), "Leather Tunic not added to inventory") #Player chooses to: 3(sell items), to sell leather tunic, yes, 5(Quit) the shop rawInputMock = MagicMock(side_effect=["3", "Leather Tunic", "y", "5"]) with patch('cities.shop.raw_input', create=True, new=rawInputMock): testshop.execute(player) #player's money should increase by the half the cost of item, in our case this is half of 1, which is 0.5. self.assertEqual( player._money, 20.5, "Player's money not increased by correct amount. It is %s" % player._money) #player's inventory should no longer include leather tunic. self.assertFalse(inventory.containsItemWithName("Leather Tunic"), "Leather tunic that was sold is still in inventory") #Player chooses to: gobbledigook, 5(Quit) the shop rawInputMock = MagicMock(side_effect=["gobbledigook", "5"]) with patch('cities.shop.raw_input', create=True, new=rawInputMock): testshop.execute(player)
def __init__(self): self.fields = dict( [ # Palo Alto City fields BLDS fields ("Record ID", "permit_num"), ("Description", "description"), ("Job Value", "fee"), ("APN", ""), ("ID", "pin"), ("Date Opened", "issued_date"), ("Record Status Date", "status_date"), ("Last Updated", "completed_date"), ("Record Status", "status_current"), ("Licence NBR", ""), ("Business Name", "contractor_company_name"), ("Address Full Line", "original_address1"), ("Record Type", "permit_type"), ("Record Module", ""), ("Latitude", "latitude"), ("Longitude", "longitude") ]) self.city = City("PaloAlto", self.fields)
def testInit(self): from player import Player from space import Space from cities.shop import Shop from cities.city import City from items.potion import Potion testshop = Shop("Chris' testing Shop", "Come test here", "hi", 5, 10) testcity = City("Test City", "testing city", "hello to testing city. see Chris' Shop", testshop) space = Space("Shire", "Home of the Hobbits.", city=testcity) player = Player("Frodo", space) player_money = player._money #our shop should currently have 5 items (this was designed when it was created) self.assertEqual( len(testshop._items), 5, "Our test shop was generated with the wrong number of items") #add Potion to Shop inventory. weight=1, healing=5, cost=3. testpotion = Potion("Medium Potion of Healing", "A good concoction. Made by Master Wang.", 1, 5, 3) testshop._items.append(testpotion) #player should start with 20 rubles self.assertEqual(player._money, 20, "Player does not start with 20 rubles") #Player chooses to: 4(purchase item), to purchase medium potion of healing, 4(purchase item), gobbledigook, 5(Quit) the shop rawInputMock = MagicMock( side_effect=["4", "Medium Potion of Healing", "5"]) with patch('cities.shop.raw_input', create=True, new=rawInputMock): testshop.execute(player) #player's money should decrease by the cost of medium potion, which is 3. self.assertEqual( player._money, 17, "Player's money not decreased by correct amount. It is %s" % player._money) #player's inventory should include medium potion of healing. self.assertTrue( player._inventory.containsItemWithName("Medium Potion of Healing"), "Medium Potion that was purchased was not added to inventory") #add superduperlegendary Potion to Shop inventory. weight=1, healing=35, cost=28. testpotion2 = Potion("SuperDuperLegendary Potion of Healing", "A Wang concoction. Made by Master Wang.", 1, 35, 28) testshop._items.append(testpotion2) #Player chooses to: 4(purchase item), SuperDuperLegendary Potion of Healing, 4(purchase item) , fake item, 5(Quit) the shop rawInputMock = MagicMock( side_effect=["4", "SuperDuperLegendary Potion of Healing", "5"]) with patch('cities.shop.raw_input', create=True, new=rawInputMock): testshop.execute(player) #player's money should not decrease by the cost of SuperDuperLegendary Potion of Healing, which is 28. self.assertEqual( player._money, 17, "Player's money should not be decreased from 17. Player can't buy SuperDuperLegendary Potion. It is currently %s" % player._money) #player's inventory should not include SuperDuperLegendary Potion of Healing. self.assertFalse( player._inventory.containsItemWithName( "SuperDuperLegendary Potion of Healing"), "SuperDuperLegendary Potion that was not purchased was added to inventory" ) #Player chooses to: 4(purchase item), fake item, 5(Quit) the shop rawInputMock = MagicMock(side_effect=["4", "Fake Item", "5"]) with patch('cities.shop.raw_input', create=True, new=rawInputMock): testshop.execute(player) #player's money should not change. self.assertEqual( player._money, 17, "Player's money should not be decreased when trying to purchase fake item. It is currently %s" % player._money) #player's inventory should not include Fake Item. self.assertFalse( player._inventory.containsItemWithName("Fake Item"), "Fake Item that was not purchased was added to inventory") #Player chooses to: gobbledigook, 5(Quit) the shop rawInputMock = MagicMock(side_effect=["gobbledigook", "5"]) with patch('cities.shop.raw_input', create=True, new=rawInputMock): testshop.execute(player)
def getWorld(): #Hobbiton - The Shire #Inn description = "A place for strangers." greeting = "Welcome to our inn! I'm Sally of the Tokinsville Baggins Clan." sallyInn = Inn("Sally's Inn", description, greeting, 2) #Shop description = "Exotic selection by hobbit standards." greeting = "We have strange wares." sallyShop = Shop("Sally's Shop", description, greeting, 4, 3) #Square description = "Lots of hobbits, mostly gossip." greeting = "Did you hear the latest news on Lobelia Baggins?" talk = {"Lobelia Baggins": "Get lost!", "Naftel Took": "News has broken out that Lobelia is making an attempt on Bag End....", "Amaranth Brandybuck": "Nice weather isn't it?", "Balbo Baggins": "The word on the street is that Lobelia is trying to acquire the Baggins estate!", "Ferdinand Took": "I wonder when Gandalf will visit?"} hobbitonSquare = Square("Hobbiton Square", description, greeting, talk) tombombadilhouse = UniquePlace("Tom Bombadil's House", "Tom lives here.") #City description = """Hobbiton is a village in the central regions of the Shire within the borders of the Westfarthing. Hobbiton is located on both sides of the Water approximately a mile northwest of the neighboring village of Bywater. """ hobbiton = City("Hobbiton", description, "Did you hear the latest news?", [sallyInn, sallyShop, hobbitonSquare]) #The Shire description = """ The Shire is divided into four farthings, North, South, East and West; its chief town is Michel Delving on the White Downs in the Westfarthing. The Mayor of Michel Delving is the most important of the Shire-hobbits. The Shire is largely dependent on agriculture and its land is well-suited for farming. One of its chief products is Shire Leaf, grown especially in the warmer regions of the Southfarthing. """ shire = Space("Shire", description, city = hobbiton, uniquePlaces = [tombombadilhouse])) #tomBombadil = Place #The Old Forest description = """ The Old Forest is one of the few surviving primordial forests which covered most of Eriador before the Second Age. The Old Forest has been known to play tricks on travelers in response to its massive deforestation. """ oldForest = Space("Old Forest", description) #weathertop = Place #The Weather Hills description = """ Weather Hills was the name among Men for the north-south range of hills that lay in central Eriador and in ancient times marked part of the border between the lands of Arthedain and Rhudaur. Weathertop, or Amon Sûl, lays at the southern end of this range. """ weatherHills = Space("Weather Hills", description) #Trollshaws description = """ Trollshaws are the upland woods that lay to the west of Rivendell and the Rivers Hoarwell and Loudwater. They were the haunt of Trolls, three of which waylaid Bilbo and his companions during the Quest of Erebor. """ trollshaws = Space("Trollshaws", description) #Misty Mountains - Rivendell #Inn description = "A relaxing stay in the scenic Misty Mountains!" greeting = "Welcome to Misty Mountain Inn! Let us host you tonight...." mistyInn = Inn("Misty Mountain Inn", description, greeting, 5) #Shop description = "New Elvenware! Look like your favorite elf!" greeting = "Welcome to ElvenWares! Here we have the latest in elven gadgetry." elvenWares = Shop("ElvenWares", description, greeting, 4, 6) #Square description = "Hotshots only." greeting = "We've been waiting for your arrival...." talk = {"Elrond": "Don't you think about marrying my daughter....", "Legolas": "What do you think about my hair?", "Aragorn": "Check out these knife tricks!", "Gimli": "I bet I can eat more hotdogs than you.", "Gandalf": "Did you know I have the Ring of Fire?"} councilOfElrond = Square("Council of Elrond", description, greeting, talk) #City description = """ Rivendell, also known as Imladris, is an Elven outpost in Middle-earth. It is also referred to as "The Last Homely House East of the Sea", a reference to Valinor, which is west of the Great Sea in Aman. """ greeting = "Welcome to Rivendell! Glad the Nazgul didn't get you." rivendell = City("Rivendell", description, greeting, [mistyInn, elvenWares, councilOfElrond]) #Misty Mountains description = """The Misty Mountains or Mountains of Mist is a great mountain range that lies between Eriador in the west and the Great River Anduin in the east. It runs 795 miles (1,280 kilometers) from Mount Gundabad in the far north to Methedras in the south. """ mistyMountains = Space("Misty Mountains", description, city = rivendell) #High Pass - GoblinTown description = """Goblin-town is a Goblin dwelling which lies under the High Pass in the Misty Mountains and is ruled by the Great Goblin. Gullum's cave is deep beneath Goblin-town and is connected to the Goblins' tunnels. """ greeting = "" goblinTown = City("Goblin Town", description, greeting) #High Pass description = """The High Pass is a pass over the Misty Mountains. On its western end is the refuge of Rivendell and from there the Great East Road climbs into the mountains until it reaches Goblin-town. """ highPass = Space("High Pass", description, city = goblinTown) #Mirkwood - Elvenking's Halls #Inn description = "A woodland experience...." greeting = "Welcome to Elvenking's Inn!" elvenkingsInn = Inn("Elvenking's Inn", description, greeting, 5) #Shop description = "Your local ElvenWares!" greeting = "Great variety of elven gadgetry available!" elvenWares = Shop("ElvenWares", description, greeting, 7, 10) #Square description = "Drinks on Thrandruil!" greeting = "You can't outdrink an elf!" talk = {"Cananthir": "Gaaalaaaagh....", "Curufin": "Don't mind Canathir, he's had a rough life", "Daeron": "Let's drink away our sorrows", "Ecthelion": "Glaaaaaaack....", "Earwen": "[Ignores you]"} elvenkingsTavern = Square("Elvenking's Tavern", description, greeting, talk) #Square description = "Thrandruil's throne room." greeting = "What makes you think that you belong here?" talk = {"Thranduil": "Hmmph! I'm elvenking!", "Angrod": "Much gnashing of teeth here. You probably won't find what you're looking for.", "Aredhel": "Hmmph! Humans!", "Argon": "Hmmph! Didn't you know that you're wearing yesterday's ElvenWare?", "Beleg": "Hmmph! Dress in better ElvenWare!"} elvenkingsThrone = Square("Elvenking's Throne", description, greeting, talk) #City description = """The Elvenking's Halls is the cave system in northern Mirkwood in which King Thranduil and many of the Elves of Mirkwood live. """ greeting = "Welcome to Elvenking's Halls! Thranduil resides here." elvenkingsHalls = City("Elvenking's Halls", description, greeting, [elvenkingsInn, elvenWares, elvenkingsTavern, elvenkingsThrone]) #Mirkwood description = """Mirkwood or the Forest of Great Fear is a great forest in Rhovanion. Mirkwood is once called Greenwood the Great and later became the Wood of Greenleaves.""" mirkwood = Space("Mirkwood", description, city = elvenkingsHalls) #Barrow Downs - Bree #Inn description = "A quiet inn, tucked away in the outskirts of Bree." greeting = "Hi I'm Linda, the innkeeper." lindasInn = Inn("Linda's Inn", description, greeting, 5) #Shop description = "COME GET YOUR ORC-KILLING GEAR HERE!" greeting = "HI I'M HANK!!! KILL ORCS!!!!!" hanksBattleGear = Shop("Hank's Battle Gear", description, greeting, 10, 4) #Square description = "A noisy hole in the wall known for quarrels." greeting = "[You are greeted with silence. Two people stare at you briefly \n before turning back to their drinks.]" talk = {"Bill Ferny": "I hear there's been Nazgul in these parts.", "Harry Goatleaf": "The entire town is scared of Nazgul....", "Henry Thistlewool": "The shadow has descended upon these parts.", "Dudo Baggins": "What am I even doing here?", "Estella Brandybuck": "Time to go home I think...."} fourCorners = Square("Four Corners", description, greeting, talk) #City description = """Bree was settled in the early Third Age, in the realm Cardolan. Though the Princes of Cardolan claimed it, Bree continued to thrive without any central authority or government for many centuries. """ greeting = "Nazgul have been visiting the area at night!" bree = City("Bree", description, greeting, [lindasInn, hanksBattleGear, fourCorners]) #Barrow Downs description = """Barrow-downs or Tyrn Gorthad is a series of low hills east of the Shire, behind the Old Forest and west of the village of Bree. Many of the hills are crowned with megaliths and barrows, whence its name. """ barrowDowns = Space("Barrow Downs", description, city = bree) #Bruinen description = """Bruinen or Loudwater is a river in eastern Eriador. It began with two tributaries flowing from the western slopes of the Misty Mountains. """ bruinen = Space("Bruinen", description) #tharbad = Place #Mitheithel description = """Mitheithel is the long river that rises in a place in the icy north of Middle-earth known by Men as Hoarwell. """ mitheithel = Space("Mitheithel", description) #ostInEdhil = Place #Swanfleet description = """The Swanfleet or Nin-in-Eilph is a marshy area in eastern Eriador where the lower reaches of the Glanduin flows before it joins Mitheithel. Swanfleet is an inland delta. """ swanfleet = Space("Swanfleet", description) #Dunland description = """Dunland is the land of the Dunlendings. Dunland means Hill Land in the language of neighbouring Rohan, whose people named it after arriving in nearby Calenardhon in the later Third Age. It is a land of the wild men. """ dunland = Space("Mitheithel", description) #chamberOfMazarbul = Place #Moria - The Seventh Level description = """The Seventh Level of Moria or Khazad-dum is a level of chambers, corridors and rooms, being six levels above the Great Gates. The term level or levels in the ancient Dwarven kingdom generally refer to the eastern area of Moria, nearest the eastern gate which was most populated when Khazad-dum was a mighty city of the Dwarves. """ greeting = "" theSeventhLevel = City("The Seventh Level", description, greeting) #Moria description = """Khazad-dum, (also known as Moria, The Black Chasm, The Black Pit, Dwarrowdelf, Hadhodrond, Casarrondo, and and Phurunargian) is the grandest and most famous of the mansions of the Dwarves. There, for many thousands of years, a thriving Dwarvish community created the greatest city ever known. """ moria = Space("Moria", description, city = theSeventhLevel) #Lorien - Caras Galadhon #Inn description = "Nested between the rivers Anduin and Silverlode." greeting = "I hope you enjoy your stay at ElvenWaters." elvenWaters = Inn("ElvenWaters Inn", description, greeting, 5) #Shop description = "ElvenWares! Lots of great elven gear!" greeting = "Welcome to ElvenWares! We have lots of rare collectibles!" elvenWares = Shop("ElvenWares", description, greeting, 11, 6) #Square description = "For prophesy as well as plain old fashioned vanity." greeting = "I've been waiting for you...." talk = {"Galadriel": "Check out this new ElvenWare! How do you think I look?"} galadrielsMirror = Square("Galadriel's Mirror", description, greeting, talk) #City description = """Caras Galadhon is a city located in Lorien. Its inhabitants dwell in large flets in the trees, reached by white ladders. On the top of the hill in the greatest of trees, are the house of Celeborn and Galadriel. """ greeting = "Welcome to Caras Galdhon! Celeborn and Galadriel reside here." carasGaladhon = City("Caras Galadhon", description, greeting, [elvenWaters, elvenWares, galadrielsMirror]) #Lorien description = """Lothlorien is a kingdom of Silvan Elves on the eastern side of the Hithaeglir. It is considered one of the most beautiful places in Middle-earth and has the only mallorn-trees east of the sea. """ lorien = Space("Lorien", description, city = carasGaladhon) #entmoot = Place #Fangorn description = """Fangorn Forest is a deep, dark woodland that grew beneath the southern tips of the Misty Mountains under the eastern flanks of that range. It gains notoriety for its Ents. The forest, known as Entwood in Rohan, was named after the oldest Ent, Fangorn. """ fangorn = Space("Fangorn", description) #The Wold description = """The Wold is the northernmost and least populated part of Rohan, lying between Fangorn Forest and the Anduin, bordered to the north by the Limlight. Its main inhabitants were nomadic Men of Rohan who use the land to graze cattle. In recent years, these men have fled in response to frequent attacks by orcish raiders. """ theWold = Space("The Wold", description) #Field of Celebrant description = """The Field of Celebrant lies between the Rivers Anduin and Limlight and southeast of Lothlorien. In T.A. 2510, the decisive Battle of the Field of Celebrant at which Eorl the Young rode from the north to the aid of Gondor occurred. """ fieldOfCelebrant = Space("Field of Celebrant", description) #Calendardhon - Isenguard description = """Isengard ("Iron Fortress" or Angrenost in Sindarin) is a great fortress located within a valley at the southern end of the Misty Mountains near the Gap of Rohan. In the centre of the Ring of Isengard stands the stone tower of Orthanc. """ greetings = "" isenguard = City("Isenguard", description, greetings) #Calenardhon description = """Calenardhon contains Isengard, a great fortress located within a valley at the southern end of the Misty Mountains near the Gap of Rohan. """ calenardhon = Space("Calenardhon", description) #Westfold - Helm's Deep #Inn description = "Where people go to sober up." greeting = "[No one is there to greet you.]" sobrietyRoom = Inn("Sobriety Room", description, greeting, 0) #Shop description = "The Armory [read: booze shop]." greeting = "We got every poison under the sun...." theArmory = Shop("The Armory", description, greeting, 10, 8) #Square description = "Mass drunkenness." greeting = "[Everyone is passed out.]" talk = {"Erkenbrand": "Ughhhhhhh....", "Gambling the Old": "Merrrrrrrrrrrrr...."} helmsDeepCommons = Square("Helms Deep Commons", description, greeting, talk) #City description = """Helm's Deep is a large valley gorge in northwestern Ered Nimrais below the Thrihyrne. It is the name of the whole defensive system including its major defensive structure, the Hornburg. """ greeting = "Welcome to Helm's Deep! WHOOO!!! PARTY!." helmsDeep = City("Helm's Deep", description, greeting) #Westfold description = """The Westfold is the western part of Rohan, close to the White Mountains and situated between the river Isen and the Folde. The North-South Road runs through the Westfold from the Fords of Isen to Edoras. Its strongpoint is Helm's Deep. """ westfold = Space("Westfold", description, city = helmsDeep) #Westemnet description = """The Eastemnet is part of Rohan. It is an area of wide, grassy plains found east of the river Entwash. """ westemnet = Space("West Emmet", description) #Eastemnet description = """The Eastemnet is part of Rohan. It contains wide, grassy plains and is east of the river Entwash and west of the Great River, Anduin. """ eastemnet = Space("East Emmet", description) #Emyn Muil description = """Emyn Muil is a range of hills south of the Brown Lands and north of the Nindalf. The Anduin cuts through the hills and then pools in Nen Hithoel. """ emynMuil = Space("Emyn Muil", description) #Eastfold - Edoras """ #Inn description = "" greeting = "" = Inn("", description, greeting, 5) #Shop description = "" greeting = "" = Shop("", description, greeting, 5, 4) #Square description = "" greeting = "" talk = {} = Square("", description, greeting, talk) """ #City description = """Rohan's first capital was at Aldburg in the Folde until Eorl the Young's son Brego built Edoras. It is Rohan's only real city and holds the Golden Hall of Meduseld. """ greeting = "" edoras = City("Edoras", description, greeting) #Eastfold - Aldburg """ #Inn description = "" greeting = "" = Inn("", description, greeting, 5) #Shop description = "" greeting = "" = Shop("", description, greeting, 5, 4) #Square description = "" greeting = "" talk = {} = Square("", description, greeting, talk) """ #City description = """Aldburg was built by Eorl in the region known as the Folde, east of Edoras. The Kings of Rohan moved to Edoras after Brego, son of Eorl, completed the Golden Hall, but many centuries later there were still nobles living at Aldburg, including Eomer, son of Eomund. """ greeting = "" aldburg = City("Aldburg", description, greeting) #Eastfold description = """Eastfold is a part of the realm of Rohan. Bounded by the Mering Stream and Snowbourn River, it contains the city of Edoras. """ eastfold = Space("Eastfold", description, city = edoras) #Nindalf description = """The swamps of Nindalf or Wetwang lie to the south of Emyn Muil and east of the Great River Anduin and are fed by the great inland delta of Entwash. The Dead Marshes lie further east and may be an extension of Nindalf. """ nindalf = Space("Nimdalf", description) #Valley of Udun - Dead Marshes description = """The Black Gate of Mordor is a gate built by Sauron to prevent invasion through the Pass of Cirith Gorgor, the gap between the Ered Lithui and the Ephel Duath. """ greetings = "" morannon = City("Morannon", description, greetings) #Dead Marshes description = """The Dead Marshes are an area of swampland east by the Dagorlad plain, site of the ancient Battle of Dagorlad during the Last Alliance of Elves and Men. """ deadMarshes = Space("Dead Marshes", description, city = morannon) #Valley of Udun - Isenmouthe description = """Isenmouthe or Carach Angren is a pass in the northeastern part of Mordor and guards the southern end of the valley, Udun. The pass is heavily guarded with Fortresses and watchtowers. """ greetings = "" isenmouthe = City("Isenmouthe", description, greeting) #Valley of Udun description = """Udun is a depressed valley in northwestern Mordor. It lies between Cirith Gorgor and the Isenmouthe and is traversed by large armies of Sauron in times of war. """ udun = Space("Udun", description, city = isenmouthe) #Cair Andros description = """Cair Andros, meaning "Ship of the Long-Foam," is an island in the river Anduin, resting nearly forty miles to the north of Osgiliath. It is of paramount importance to Gondor because it prevents the enemy from crossing the river and entering into Anorien. """ cairAndros = Space("Cair Andros", description, greeting) #Orodruin description = """Mount Doom, also known as Orodruin and Amon Amarth, is the volcano in Mordor where the One Ring was forged. It is the only place that the One Ring may be destroyed. """ orodruin = Space("orodruin", description) #Anorien - Minas Tirith #Inn description = "Home of elite Gondorian healers." greeting = "Welcome to the Houses of Healing. What can I do for you?" housesOfHealing = Inn("Houses of Healing", description, greeting, 5) #Shop description = "An elite armory, used by Gondorian royalty." greeting = "Welcome to the Smithy of Kings! We have forged legendary blades...." smithyOfKings = Shop("Smithy of Kings", description, greeting, 15, 12) #Square description = "Minas Tirith commons." greeting = "Welcome to our square. This place used to be a lot more lively." talk = {"Calmacil": "Would you like to buy some fruit?", "Castamir": "Everyone is afriad.", "Ciryandil": "Orcish raids have been increasing in the outlying lands....", "Minalcar": "I wonder what we can do with Mordor....", "Narmacil": "I wonder if the king will return", "Tarondor": "I hope Rohan will bring aid.", "Atanatar": "Word has it that Mordor is preparing to attack."} citySquare = Square("Market Square", description, greeting, talk) #Square description = "Home to Gondorian royalty." greeting = "Denethor would like to see you...." talk = {"Denethor": "What do you think Sauron will do next?", "Faramir": "The lands recently stolen by Sauron should be retaken....", "Boromir": "Nice ring. Give it to me!", "Prince Imrahil": "Sauron plans on moving soon....", "Swan Knight": "The men are afraid. The land is covered in shadow...."} towerOfEcthelion = Square("Tower of Ecthelion", description, greeting, talk) #City description = """Minas Tirith is a city of Gondor originally called Minas Anor. From T.A. 1640 onwards it became the capital of the South-kingdom and the seat of its Kings and ruling Stewards. """ greeting = "Welcome to the last stronghold of the West, Minas Tirith." minasTirith = City("Minas Tirith", description, greeting, [housesOfHealing, citySquare, towerOfEcthelion, smithyOfKings]) #Anorien description = """Anorien is the fiefdom of Gondor containing Minas Tirith, the capital of Gondor. Originally known as Minas Anor, it replaced the Osgiliath as capital of Gondor as Osgiliath was overun. """ anorien = Space("Anorien", description, city = minasTirith) #argonath = Place #Anduin - Osgiliath """ #Inn description = "" greeting = "" = Inn("", description, greeting, 5) #Shop description = "" greeting = "" = Shop("", description, greeting, 5, 4) #Square description = "" greeting = "" talk = {} = Square("", description, greeting, talk) """ #City description = """Osgiliath was the ancient capital of the Kingdom of Gondor. Depopulated during the Third Age, it gradually fell into ruin. Osgiliath has strategic importance as a crossing point over the Anduin. """ greeting = "" osgiliath = City("Osgiliath", description, greeting) #Anduin description = """Anduin is a river that crosses most of Middle-earth east of the Misty Mountains. Passing through many lands, it has many names: Langflood by the ancestors of the Rohirrim, the Great River of Wilderland in the Westron of Rivendell and the Shire, and simply the Great River in Gondor. """ anduin = Space("Anduin", description, city = osgiliath) #Ephel Duath - Minas Morgul #City description = """Minas Morgul is a city-fortress in Mordor. Originally created as a Gondorian outpost and the sister city to Minas Anor, Minas Ithil safeguarded the eastern borders of the Kingdom of Gondor and the capital Osgiliath from the forces of Mordor during the early part of the Third Age. Minas Morgul is now home to the Nazgul and Cirith Ungol, a secret pass into Mordor. """ greeting = "" minasMorgul = City("Minas Morgul", description, greeting) #Ephel Duath description = """The Ephel Dúath, or the Mountains of Shadow, are a range of mountains that guard Mordor's western and southern borders. """ ephelDuath = Space("Ephel Duath", description, city = minasMorgul) #Cirith Ungol - Tower of Cirith Ungol description = """Gondor occupied the fortress until T.A. 1636 when the Great Plague killed large parts of Gondor's population. After the plague, Gondor never again manned the Tower of Cirith Ungol and evil was allowed to return to Mordor. Similar fates suffered the mountain fortress of Durthang in northwestern Mordor and the Towers of the Teeth at the Morannon. """ greeting = "" towerOfCirithUngol = City("Tower of Cirith Ungol", description, greeting) #Cirith Ungol description = """Cirith Ungol is the pass through the western mountains of Mordor and the only way towards the land from the west. It is guarded by the Tower of Cirith Ungol, built by the Men of Gondor after the War of the Last Alliance of Elves and Men. """ cirithUngol = Space("Cirith Ungol", description, city = towerOfCirithUngol) #Barad Dur description = """Barad-dur is the Dark Lord Sauron's sanctuary fortress in Mordor and serves as his base of operations. Over 1400 meters high and held together by dark magic, it is the largest fortress in Middle-earth. """ greeting = "" baradDur = City("Barad Dur", description, greeting) #Plateau of Gorgoth description = """Plateau of Gorgoroth is a region in the northwestern region of Mordor. Gorgoroth is the location of the mines and forges which supplied Mordor's armies with weapons and armor. """ plateauOfGorgoth = Space("Plateau of Gorgoth", description, city = baradDur) #Lossamarch - Pelargir #Inn description = "Beach resort along Gondor's finest coast!" greeting = "Hey bro! Welcome to Sunnyside Inn!" sunnysideInn = Inn("Sunnyside Inn", description, greeting, 5) #Shop description = "Beach accessories and paraphernalia." greeting = "Hey dude, let's hit the beach later!" palmTreeHut = Shop("Palm Tree Hut", description, greeting, 14, 6) #Square description = "Class-three waves and hot chicks!" greeting = "Bro, did you see those waves?" talk = {"Gondorian bro #1": "Bro, let's hit the beach!", "Gondorian bro #2": "Bro! Let's just chill for awhile... bro?", "Gondorian bro #3": "Bro! I hear there's going to be a party later tonight.", "Gondorian chick #1": "Bro, I have a boyfriend....", "Gondorian chick #2": "Bro, what are you doing later?"} beach = Square("Pelargir Beach", description, greeting, talk) #City description = """One of the oldest cities in Middle Earth, Pelargir served as chief haven of the faithful as Numenorians migrated to Middle Earth to escape persecution. In later years, Pelargir served as chief port of Gondor. """ greeting = "Enjoy a relaxing stay at Pelargir, port city of Gondor." pelargir = City("Pelargir", description, greeting) #Lossamarch description = """Lossarnach is a region and fiefdom in Southern Gondor. Known as the Vale of flowers, it is a fertile region lying south of the White Mountains. """ lossamarch = Space("Lossamarch", description, city = pelargir) #Ithilien description = """Ithilien was the region and fiefdom of Gondor bordering Mordor. """ ithilien = Space("Ithilien", description) #Connections: East-West shire.createExit("east", oldForest, outgoingOnly = False) oldForest.createExit("east", weatherHills, outgoingOnly = False) weatherHills.createExit("east", trollshaws, outgoingOnly = False) trollshaws.createExit("east", mistyMountains, outgoingOnly = False) mistyMountains.createExit("east", highPass, outgoingOnly = False) barrowDowns.createExit("east", bruinen, outgoingOnly = False) swanfleet.createExit("east", moria, outgoingOnly = False) moria.createExit("east", lorien, outgoingOnly = False) calenardhon.createExit("east", fangorn, outgoingOnly = False) fangorn.createExit("east", fieldOfCelebrant, outgoingOnly = False) fangorn.createExit("east", theWold, outgoingOnly = False) westfold.createExit("east", westemnet, outgoingOnly = False) westemnet.createExit("east", eastemnet, outgoingOnly = False) eastemnet.createExit("east", emynMuil, outgoingOnly = False) eastfold.createExit("east", nindalf, outgoingOnly = False) nindalf.createExit("east", deadMarshes, outgoingOnly = False) deadMarshes.createExit("east", udun, outgoingOnly = False) anorien.createExit("east", anduin, outgoingOnly = False) anduin.createExit("east", ephelDuath, outgoingOnly = False) lossamarch.createExit("east", ithilien, outgoingOnly = False) ephelDuath.createExit("east", plateauOfGorgoth, outgoingOnly = False) cirithUngol.createExit("east", plateauOfGorgoth, outgoingOnly = False) orodruin.createExit("east", plateauOfGorgoth, outgoingOnly = False) #Connections: North-South oldForest.createExit("south", barrowDowns, outgoingOnly = False) weatherHills.createExit("south", barrowDowns, outgoingOnly = False) trollshaws.createExit("south", bruinen, outgoingOnly = False) bruinen.createExit("south", mitheithel, outgoingOnly = False) highPass.createExit("south", mirkwood, outgoingOnly = False) mitheithel.createExit("south", swanfleet, outgoingOnly = False) swanfleet.createExit("south", dunland, outgoingOnly = False) dunland.createExit("south", calenardhon, outgoingOnly = False) mirkwood.createExit("south", lorien, outgoingOnly = False) lorien.createExit("south", fieldOfCelebrant, outgoingOnly = False) fieldOfCelebrant.createExit("south", theWold, outgoingOnly = False) calenardhon.createExit("south", westfold, outgoingOnly = False) fangorn.createExit("south", westemnet, outgoingOnly = False) theWold.createExit("south", eastemnet, outgoingOnly = False) westemnet.createExit("south", eastfold, outgoingOnly = False) eastemnet.createExit("south", nindalf, outgoingOnly = False) nindalf.createExit("south", cairAndros, outgoingOnly = False) emynMuil.createExit("south", deadMarshes, outgoingOnly = False) udun.createExit("south", plateauOfGorgoth, outgoingOnly = False) cairAndros.createExit("south", anduin, outgoingOnly = False) cirithUngol.createExit("south", ephelDuath, outgoingOnly = False) anorien.createExit("south", lossamarch, outgoingOnly = False) anduin.createExit("south", ithilien, outgoingOnly = False) return shire