def waterTent(self, player, aMap, pInventory, pMaxHP): thePlayer = player faireMap = aMap inventory = pInventory maxHP = pMaxHP water = Items.Consumable("water", 5, 2) pHP = inventory.get("Hit Points") if pHP <= 3: print( "Wow, you look like you're about to die. Consider this on the house" ) inventory["Hit Points"] = maxHP else: shopping = True while shopping: choice = input(''' ╔══════════════════════════════════╗ ║Buy some damn water ║ ╠══════════════════════════════════╣ ║1 - Buy water for $2 ║ ║2 - Leave this area ║ ╚══════════════════════════════════╝ ''') if choice == "1": inventory["Hit Points"] = maxHP inventory["Money"] = (inventory.get("Money") - water.get_price()) print( "As you down the cool water, you feel fully refreshed and ready for more adventures!" ) input() elif choice == "2": shopping = False inventory["Hit Points"] = inventory.get("Hit Points") - 1 os.system('cls') print("Weird how even buying water makes you thirsty.") gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI)
def generateNewLevel(): global newMap global level level += 1 itemlevelmodifier = 1 + (level * 0.5) enemylevelmodifer = level * 2 itemSpawnRateModifier = 1 + (level * 0.1) enemySpawnRateModifer = 1 + (level * 0.3) UI.root.title("Dungeon Salvos | Level: {0}".format(level)) #Create the parameters for enemies, items here minEnemies = round(3 * enemySpawnRateModifer) maxEnemies = round(5 * enemySpawnRateModifer) numberOfEnemies = random.randint(minEnemies, maxEnemies) minItems = round(3 * itemSpawnRateModifier) maxItems = round(7 * itemSpawnRateModifier) numberOfItems = random.randint(minItems, maxItems) #global stat variables global enemiesStats global weapons global armour global consumables #Stores data of every enemy within the level global enemies enemies = [] newMap = Map.Map(40, 100, 10, 3, 4, 8) newMap.generateDungeon() placePlayer() #Create enemies and place them randomly for i in range(numberOfEnemies): randomEnemyIndex = random.randint(0, len(enemiesStats) - 1) enemyStats = enemiesStats[randomEnemyIndex] name = enemyStats[0] health = enemyStats[1] damage = enemyStats[2] graphic = enemyStats[3] health = round(health * enemylevelmodifer) damage = round(damage * enemylevelmodifer) print("Creating enemy {0}".format(name)) newEnemy = Enemy.Enemy(name, health, damage, graphic) emptyTile = newMap.getEmptyTile() newEnemy.setTile(newMap, emptyTile.x, emptyTile.y) enemies.append(newEnemy) for i in range(numberOfItems): itemTypeChance = random.randint(1, 5) itemRarity = random.randint( 1, 10 ) #60% chance of tier 1, 30% chance of tier 2, 10% chance of tier 3 if itemTypeChance == 5: #spawn consumable if itemRarity == 10: itemStats = consumables[2] elif itemRarity <= 6: itemStats = consumables[0] else: itemStats = consumables[1] name = itemStats[0] stat = itemStats[1] modifier = itemStats[2] modifier = round(modifier * itemlevelmodifier) item = Items.Consumable(name, stat, modifier) elif itemTypeChance <= 2: #spawn weapon if itemRarity == 10: itemStats = weapons[2] elif itemRarity <= 6: itemStats = weapons[0] else: itemStats = weapons[1] randomItem = random.randint(0, len(itemStats) - 1) itemStats = itemStats[randomItem] minDamage = itemStats[0] maxDamage = itemStats[1] name = itemStats[2] minDamage = round(minDamage * itemlevelmodifier) maxDamage = round(maxDamage * itemlevelmodifier) item = Items.Weapon(minDamage, maxDamage, name) else: #spawn armour if itemRarity == 10: itemStats = armour[2] elif itemRarity <= 6: itemStats = armour[0] else: itemStats = armour[1] randomItem = random.randint(0, len(itemStats) - 1) itemStats = itemStats[randomItem] name = itemStats[0] defence = itemStats[1] slot = itemStats[2] defence = round(defence * itemlevelmodifier) item = Items.Armour(name, defence, slot) emptyTile = newMap.getEmptyTile() emptyTile.entity = item
def randomEncounter(aList, pInventory): encounterList = aList inventory = pInventory listRange = len(encounterList) selection = random.randrange(listRange) encounter = encounterList[selection] if encounter == "Faire Manager": inventory["Attack"] = inventory.get("Attack") + 5 print(''' As you are walking along, you see a harried-looking woman on her phone. When you approach, you catch a bit of her conversation. "The guy playing the knight hurt his leg yesterday during the event, so make sure that he's taking it easy so that he doesn't make it worse." Maybe this information will come in handy...''') input() elif encounter == "Water": inventory["Hit Points"] = inventory.get("Hit Points") + 5 print(''' You came across a tent offering free water! You drink some, and the metallic, chlorinated taste of the municipal water supply leaves you feeling refreshed.''') input() elif encounter == "Money": moneyValues= [1, 5, 10] dollarAmt = random.choice(moneyValues) inventory["Money"] = (inventory.get("Money") + dollarAmt) print("You found $" + str(dollarAmt) + " lying on the ground! Neat.") input() elif encounter == "Raccoon": inventory["Charisma"] = inventory.get("Charisma") - 2 inventory["Attack"] = inventory.get("Attack") + 2 print(''' From behind an overflowing trashcan, an enormous, vicious looking raccoon is peering at you. Without warning, it darts out, bites you on the ankle, and vanishes amongst the crowd. You feel nauseous, and you notice foam forming around your mouth. However, you also feel suddenly stronger, angrier, and bitier''') input() elif encounter == "Uber Nerd": print(''' You are approached by the smell of stale Cheetohs, Red Bull, and poor hygiene. The person this odor is attached to is making their way towards you wih intent They level a finger at you, and loudly declare, 'I challenge you to an duel of honor! You must accept, or be labeled a coward!''') response = input("Do you accept, y/n? ") if response == "y": print(''' "I accept your challenge!" you respond, as you watch a small crowd gather. Your opponent charges forward, only to slip in some mud and fall onto his greasy face. Clearly humiliated, he shuffles off without a word.''') input() inventory["Charisma"] = inventory.get("Charisma") + 2 elif response == "n": print(''' "I don't have time for this," you mutter, eager to escape the staring eyes of the crowd. "Ha!" your greasy antagonizer shouts. "Just as I thought, you're too scared of my strength and power." The people in the crowd turn away, clearly disappointed at your lack of bravery.''') input() inventory["Charisma"] = inventory.get("Charisma") - 2 elif encounter == "Firebreather": print(''' You hear a loud 'Fwoosh!" coming from nearby. Peering through the gathering crowd, you see a burst of flame. A troupe of performers, dressed in what looks like the stained remnants of your grandmother's old couch, are performing fire-breathing and juggling tricks for the crowd.''') input() elif encounter == "Faries 1": print(''' "Move!" snarls a middle-aged woman in a cheap fairy costume that still has visible clearance labels from Party City. She pushes past you, leading a group of similarly dressed women as she goes. As they pass, you catch a glimpse of one of the fairies clutching at a mostly empty, plastic bottle labeled 'McCormick'.''') input() elif encounter == "Drunk Monk": consumable = inventory.get("Consumables") print(''' The crowd disperses rather suddenly. You see a dishevelled-looking gentleman wearing a robe, though you can't really tell if it's a costume or just what he was wearing when he left his trailer house in the morning. He is very obviously trashed; you can smell the alcohol from quite a distance. He looks up, and his gaze locks onto you. He stumbles over to you, mutters something unintelligible, and presses a bottle of something into your hand, before stumbling a few more paces and falling flat onto the ground, where he stays.''') input() mysteryDrink = Items.Consumable("mystery drink", 10, 0) consumable.append(mysteryDrink) inventory["Consumables"] = consumable elif encounter == "Fortune": print(''' As you're walking around, minding your own business a frantic looking woman wearing layers of silk and satin scarves, one wrapped around her head in the fashion of a turban, comes toward you with purpose. You look left, you look right, sadly there is no escape. You are forced to hear her empassioned words as she tries to pull you into her fortune telling tent... ''') fortunes = ["I have never seen aura like yours. You are exceptional!", "In your previous life, you were royalty, a movie star, or died in the war.", "I sense a dead person is trying to contact you.", "Love and money are coming your way, but you need me to guide you and tell you what to do and when.", "I saw you in a vision. Buying my magic crystals will help you later in life.", "Someone important to you has the initial 'R.'", "You are surrounded by enemies; I am your only true friend."] choice = random.choice(fortunes) print(choice) print(''' Luckily for you, there are many more people nearby, ones that look like better marks, I mean customers for the fortune teller. You continue on your way wondering if maybe she knows something you don't.... ''') input() elif encounter == "Bracelet": print(''' While perusing some merchandise of dubious quality, a glint of gold catches your eye. You walk over, and see a small bracelet in a clump of grass. Picking it up, you examine it. It has a slender chain, with delicate charms dangling from it. A heart, a musical note, and a silouette of a dancer glimmer in the sunlight. While meant for a small wrist, the bracelet looks well-crafted and expensive. You scan the crowd, trying to see who it could belong to. An aristocratically dressed woman is frantically searching through some nearby shrubs, with a small, morose little girl at her side. You walk up to them, with the bracelet in your outstreched hand. "Is this yours?" you ask. The woman turns around, and, upon catching sight of the bracelet, you see relief evident across her face. "Oh, yes, we lost that about twenty minutes ago! Where did you find it?" she asks, as you hand her the bracelet. "I just happened across it in some grass over there," you say, and gesture towards where you found it. The woman is putting the bracelet on the little girl's wrist, and her small face is lights up with joy. "Thank you so much!" the woman continues. "This bracelet was a gift from her grandmother, and just about all that she has to remember her by. Now," she says, turning back towards her daughter, "be sure to thank the brave warrior for finding your bracelet." "Thanks, brave warrior!" the little girl says, a huge smile on her face. "Not a problem!" you say, "It's all in a day's work!" With a last thank you and wave, the two head off. You watch them leave, with a warm glow from helping them out. ''') input() elif encounter == "Horror": print(''' You're sitting on a bench, watching the crowd idly as you take a quick break. From the corner of your eye, you catch a glimpse of a small figure disappearing into the trees. Intrigued, you stand up and follow it. Pushing your way between two trees and some undergrowth, you stumble into a dimly lit clearing with a small, solitary figure turned away from you. At first glance, it appears to be a little boy in a somewhat dingy, colorless Victorian outfit. You feel a vague sense of disquiet as you watch him; you can't put your finget on it, but something about him seems... wrong. His skin seems a bit too pale, and his arms and legs are stick thin and jointed oddly. His hair is matted with dirt, and sits oddly on his head. He's squatting over the ground, playing with a tatty old stuffed bear. As you approach, the little boy turns and looks at you, and your vague trepidation turns into outright terror and revulsion. The boy's face is covered with caked-on powder, in an attempt to cover up the grey, lesion-covered skin. His eyes are wide, and bloodshot. He stares directly at you, with a look of cold fury that no true child's face could possiby convey. He opens his mouth, revealing the black stumps of teeth set in raw red gums, and an equally black, slug-like tongue crawling behind them. You expect to hear a bone-chilling screech come out, but what you hear instead is a trilling, almost birdsong-like sound. His wig falls off of his head, revealing a raw, scabbed, hairless, scalp. You hear more sounds coming from further in the trees, and your nerve fails you. You bolt, running as fast as you can the way you came. You hear some things crashing through the brush behind you, catching up, and you suddenly burst into searing daylight and the sounds of the faire. You look behind you, and there's no sound or movement. You hurriedly make your way back into the crowd, eager to put some distance between you and what you witnessed, followed by the fading sound of birds. ''') input() elif encounter == "Old Man": print(''' While munching on an overfried corn dog, you see a hunched-over figure sitting in the shade under a tree. You head over, thinking a rest in the shade sounds like a nice reprieve from the brutal sunlight and oppressive heat. You sit next to the hunched figure, who turns out to be an elderly gentleman wearing nondescript clothes. He looks tired, and his clothes are drenched in sweat. You offer him the drink that came with your corndog, which he gratefully accepts with a nod of thanks. He drinks half of it in one swig, wipes his mouth, and says, "Thanks, kid, I really needed that. I'm way too old to be out here in this heat, but my grandkids love it, and I could never say no to them. Speaking of, they're probably wondering where I'm at, so I'd best be off." He stands up, looking much better than he had before, and disappears into the crowd. You finish your corndog, get up, and do the same. ''') input() del encounterList[selection] inventory["Hit Points"] = inventory.get("Hit Points") - 1
def sell(self, playerClass, pInventory): player = playerClass inventory = pInventory if self.vendorType == "weapon": if player == "Child": print( "You stare in awe at the wide assortment of weapons before you, but your eye keeps landing on that perfect, shiny sword that looks just your size...there is a price tag that says $10" ) if self.charmed == True: print( "I see that this fine sword fits perfectly in your hands. Since you are so charming, I'll only ask $5." ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": childWeapon = Items.Weapon("Sword", 2, 6, 5) return childWeapon if buy == "n": print("Deals like this don't last!") else: print( "I see that this fine sword fits perfectly in your hands. It can be yours for a mere $10" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": childWeapon = Items.Weapon("Sword", 2, 6, 10) return childWeapon if buy == "n": print("Deals like this don't last!") elif player == "Adult": print( "As you down some mead from your drinking horn, you glance quickly at the wares inside the tent. There! It's size and shininess immediately attract your semi-drunken eyes. You know you need that giant foam sword. The price tag says $20." ) if self.charmed == True: print( "Ahh, for such a fighter as you, this two-handed sword would be a fine fit. Your words are as honeyed as your mead, so for a mere $10 and this can be yours." ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": adultWeapon = Items.Weapon("Two-Handed Sword", 3, 12, 10) return adultWeapon if buy == "n": print("Deals like this don't last!") else: print( "Ahh, for such a fighter as you, this two-handed sword would be a fine fit. It can be yours for $20" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": adultWeapon = Items.Weapon("Two-Handed Sword", 3, 12, 20) return adultWeapon if buy == "n": print("Deals like this don't last!") elif player == "Anime Fan": print( "You came because your friends told you it was a costume friendly event, and you stayed because there's food and alcohol. But wait, what is this? A ridiculously large blade with a barrel attached to the top, and a trigger fixed in the handle! You must have it! The price tag on it says $20" ) if self.charmed == True: print( "I honestly don't know why I brought this gunblade, but it seems you can't take your eyes off it. I can appreciate some good anime as much as the next guy, so how about just $10 for it?" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": animeWeapon = Items.Weapon("Gunblade", 4, 8, 10) return animeWeapon if buy == "n": print("Deals like this don't last!") else: print( "I honestly don't know why I brought this gunblade, but it seems you can't take your eyes off it. It matches your costume quite well, how about $20" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": animeWeapon = Items.Weapon("Gunblade", 4, 8, 20) return animeWeapon if buy == "n": print("Deals like this don't last!") elif player == "LARPer": print( "You live for these events, and the chance to show off your gear. You also never turn down the chance for more gear, and that battle hammer would be a nice addition to your collection, and it says it's only $10." ) if self.charmed == True: print( "You look like you could bash a few heads in with just your bare hands, but this battle hammer would work even better! This can be yours for the discounted price of $5" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": larperWeapon = Items.Weapon("Battle Hammer", 5, 10, 5) return larperWeapon if buy == "n": print("Deals like this don't last!") else: print( "You look like you could bash a few heads in with just your bare hands, but this battle hammer would work even better! This can be yours for only $10." ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": larperWeapon = Items.Weapon("Battle Hammer", 5, 10, 10) return larperWeapon if buy == "n": print("Deals like this don't last.") elif player == "King Arthur": print( "As a King you must always be prepared, and that means a sword. Approaching the tent, you see a familiar rock on display." ) if self.charmed == True: print( "A fine day to you, my King. I have this special sword over here. Some damp tart chucked it at me from out of a lake as I was walking by" ) kingWeapon = Items.Weapon("Excalibur", 20, 1000000, 0) else: print( "A fine day to you, my King. I have this special sword over here. Some damp tart chucked it at me from out of a lake as I was walking by" ) kingWeapon = Items.Weapon("Excalibur", 20, 1000000, 0) return kingWeapon if self.vendorType == "armor": if player == "Child": print( "As you step through the flaps, your eyes behold an assortment of protective gear. Most of it looks much too big for you, but then you see a shield that looks just your size! As you grab hold of it, you faintly hear the words 'Hey! Listen!' ringing in your ears... The tag on the shield says it's $10." ) if self.charmed == True: print( "Your knowledge of this shield has made my day! How about you take it for just $5, today. It goes with that green costume really well!" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": childArmor = Items.Armor("Shield", 5, 5) inventory["Dexterity"] = inventory.get( "Dexterity") + childArmor.get_ac() print( "You have an incredible urge to start smashing clay pots..." ) return childArmor if buy == "n": print("Deals like this don't last!") else: print( "This shield has been used to save many princesses! Or actually, just one... many times. It goes for $10." ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": childArmor = Items.Armor("Shield", 5, 10) inventory["Dexterity"] = inventory.get( "Dexterity") + childArmor.get_ac() return childArmor if buy == "n": print("Deals like this don't last!") elif player == "Adult": print("The breastplate is $30.") if self.charmed == True: print( "You seem quite the talker. I'll give you this breastplate for $15 if you'll just go away." ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": adultArmor = Items.Armor("Breastplate", 2, 15) inventory["Dexterity"] = inventory.get( "Dexterity") + adultArmor.get_ac() return adultArmor if buy == "n": print("Deals like this don't last!") else: print( "That's a great piece of armor there; it got me through some tough battles. How about $30 and it's yours?" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": adultArmor = Items.Armor("Breastplate", 2, 30) inventory["Dexterity"] = inventory.get( "Dexterity") + adultArmor.get_ac() return adultArmor if buy == "n": print("Deals like this don't last!") elif player == "Anime Fan": print( "You're not sure why you are bothering to come here; none of the stuff on display matches your costume. Oh, what's this? You just happen to catch a glimpse of the end of a dangling belt, one of many(almost 100 it seems!), attached to a long coat with an enormous hood. You search frantically for the price tag, there...it says $30." ) if self.charmed == True: print( "You actually want to buy this? I didn't think I'd ever get rid of it. I'll let you have it for just $15" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": animeArmor = Items.Armor("Trenchcoat", 1, 15) inventory["Dexterity"] = inventory.get( "Dexterity") + animeArmor.get_ac() return animeArmor if buy == "n": print("Deals like this don't last!") else: print( "I didn't actually mean to pack that for today, but now I'm glad I did. It suits you! Let's call it $30" ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": animeArmor = Items.Armor("Trenchcoat", 1, 30) inventory["Dexterity"] = inventory.get( "Dexterity") + animeArmor.get_ac() return animeArmor if buy == "n": print("Deals like this don't last!") elif player == "LARPer": print( "From across the walkway you are blinded by the shining metal reflecting off of a chainmail shirt. As you look closer, you realize it's actually just soda can tabs strung together. But hey, people don't get that close to you anyway. With a price of $20 on the tag, you might need to add this to your collection." ) if self.charmed == True: print( "This set of chainmail seems it was made just for you. It's a perfect fit! It also matches the rest of your gear. I'll take $10 and it's yours." ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": larperArmor = Items.Armor("Chainmail", 3, 10) inventory["Dexterity"] = inventory.get( "Dexterity") + larperArmor.get_ac() if buy == "n": print("Deals like this don't last!") else: print( "Each tab was carefully collected from the leftover cans of long hours at the keyboard, grinding and completing raids with my guild. It's only $20." ) buy = input( "Would you like to complete this purchase? y/n") if buy == "y": larperArmor = Items.Armor("Chainmail", 3, 20) inventory["Dexterity"] = inventory.get( "Dexterity") + larperArmor.get_ac() return larperArmor if buy == "n": print("Deals like this don't last!") elif player == "King Arthur": print( "Even a magnificent king such as yourself needs some fantastic armor. Hold on I have just the thing. The man walks away and comes back with a set of full plate mail." ) if self.charmed == True: print( "A fitting set of plate mail for a fitting king! Hurrah!" ) kingArmor = Items.Armor("Excalibur", 20, 0) else: print( "You're used to people fawning over you but this guy seems less than impressed as he tells you the armor will be $100" ) kingArmor = Items.Armor("Excalibur", 20, 100) return kingArmor if self.vendorType == "consumable": water = Items.Consumable("water", 5, 2) mutton = Items.Consumable("mutton", 4, 6) mead = Items.Consumable("mead", 3, 4) liquor = Items.Consumable("liquor", 4, 5) turkey = Items.Consumable("turkey leg", 3, 5) shopping = True consumable = inventory.get("Consumables") while shopping: choice = input(''' ╔══════════════════════════════════╗ ║What food or drink would you like?║ ╠══════════════════════════════════╣ ║1 - Buy water for $2 ║ ║2 - Buy mead for $4 ║ ║3 - Buy liquor for $5 ║ ║4 - Buy mutton for $6 ║ ║5 - Buy turkey leg for $5 ║ ║6 - Leave this area ║ ╚══════════════════════════════════╝ ''') if choice == "1": consumable.append(water) elif choice == "2": if player == "Child": print( "I don't believe you're old enough to purchase that." ) else: consumable.append(mead) elif choice == "3": if player == "Child": print( "I don't believe you're old enough to purchase that." ) else: consumable.append(liquor) elif choice == "4": consumable.append(mutton) elif choice == "5": consumable.append(turkey) elif choice == "6": inventory["Consumables"] = consumable shopping = False
def battle(self, thePlayer, pInventory, theKnight, kWeapon): player = thePlayer inventory = pInventory consumables = inventory.get("Consumables") playerClass = inventory.get("Player Class") knight = theKnight knightWeapon = kWeapon water = Items.Consumable("water", 5, 2) mutton = Items.Consumable("mutton", 4, 6) mead = Items.Consumable("mead", 3, 4) liquor = Items.Consumable("liquor", 4, 5) turkey = Items.Consumable("turkey leg", 3, 5) soda = Items.Consumable("soda", 3, 0) #battle intro - print from txt file, use text from outline file = open("KnightIntro.txt", "r") for x in file: renquestIntro.slowPrint(x, .025) file.close() input("\nHit enter to step into the ring.") fighting = True knightImg = (''' _,. ,` -.) ( _/-\\\\-._ /,|`--._,-^| , \\_| |`-._/|| ,'| | `-, / | / / | || | / / `r-._||/ __ / / __,-<_ )`-/ `./ / ' \\ `---' \ / / | |./ / / // / \\_/' \\ |/ / | | _,^-'/ / | , `` (\\/ /_ \\,.->._ \\X-=/^ ( / `-._//^` `Y-.____(__} | {__) () ''') adultImg = ('''\n ,#####, #_ _# /\\ |a` `a| / / | u | / / \\ = / / / |\\___/| / / ___ ____/: :\\____ ___ / / .' `.-===-\\ /-===-.` '. / / / .-"""""-.-"""""-. \\ / / /' =:= '\\ / / .' ' .: o -=:=- o :. ' `. / / (.' /'. '-.....-'-.....-' .'\\ '.) / / /' ._/ ". --:-- ." \\_. '\\ / / | .'| ". ---:--- ." |'. | / / | : | | ---:--- | | : |\\ / \\ : | |_____._____| | : ///\\ / ( |----|------| ) \\/ \\ /... .| | | | |. ...\\ |::::/'' / | \\ ''\\::::| '"""" /' .L_ `\\ //""""' /'-.,__/` `\\__..-'\\ // ; / \\ ; O : / \\ | ----------------------------- ''') childImg = (''' ,,,,,,,,,,, //////// \\\\\\\\ // == == \\\\ ( o o )\\\\ . ( L )\\ / \ ( .___ )\\\\ | | (______)\\\\ | | | |\\\\ |.| ------/ ^ \\---- |.| / ~~~o~~~~ \\ |:| I o I |:| I I o I I `--8--' II o II I I 8 II II o |`-._/\_.-`| IO I II o | || | I______II o |___o()o___| I%%%%%%@%|__((<>))__| I \\ o\\/o / I \\ || / I i \\ || / I I '.||.' I I I `` I I I I____I____I __I II I__ (_______II______) ''') larperImg = (''' ______ ,-'""`-, /\\ \\ ,' `. / \\ \\ / _,,,_ \\ / \\#####\\ / ,' | `\\/\\\\ / # \\ \\ / /,--' `--. ` / # \\_____\\ | / ___\\_ \ # / / | | / ______| \ # / / | | | |_' \'| / /\ / / \\ ,' ( _) -`| / / \/_____/ '--- \\ '-.-- / / / ______/`--'--< / / | |`-. ,;/``--._ | |-. _/// ,'`\ | |`-Y;'/ / ,-'\ | | // <_ / ,' ,-'\ '----'// -- `-./,' ,-' \\/ | //[==] \,' \_.,-\\ | // ` -- | \__.,-' // -[==]_ | ____\\ // `-- |--' | \\ [==__,,,,--' |-'" ---""'' | ___...____/ --------------------. ''') animeImg = (''' ._ ,-'_ `-. ::".^-. `. ||< >. \\ |: _, _| \\ \\ : .'| '| ;\\`. _\\ .` ' | \\ \\ .' `\\ *-' ; . \\ '\\ `. `. /\\ . \\ _/ `. \\ \\ : `. `.; _/ \\ \\ `-._ /| ` ._/ / `. `. `. / : ) \\ `;._. \\ _.'/ \\ .' .'; / .'`._.* / .-' ( .'`._ / ; .' .-' ; ; `._.: |( ._ _.'| `._ ; ; `.-' | | / .-'./ .' \\ . /: | +.' \\ `-. .\\ *--*' ;\\ ;.' `. \\ `. /` `. / . /.L-'\\_: L__..-* \\ ". \\ :/ / .' `' ; `-. `. \\ . / /_/ / \\ ; \\ _/ / / \\ `./ . . ; / .' `-. ; \\ / / , / `"' \\ . . ' / .' `. \\ / / / / | `-. . ''') while fighting: knightTurn = True os.system('cls') playerStatsUI = player.playerBattleStatsUI(player.inventory) knightStatsUI = knight.battleStatsUI() self.display(playerStatsUI, knightStatsUI) if playerClass == "Adult": print(adultImg) elif playerClass == "Child": print(childImg) elif playerClass == "LARPer": print(larperImg) elif playerClass == "Anime Fan": print(animeImg) choice = input(''' ╔══════════════════════════════════╗ ║What would you like to do? ║ ╠══════════════════════════════════╣ ║1 - Regular Attack ║ ║2 - Special Attack ║ ║3 - Use Item ║ ╚══════════════════════════════════╝ ''') if choice == "1": toHit = player.regAttack() if toHit >= knight.getDex(): weapon = inventory.get("Weapon") toDmg = weapon.get_damage() dmg = random.randint(1, toDmg) knightHP = knight.getHP() print("You deal " + str(dmg) + " points of damage to the knight.") knight.setHP((knightHP - dmg)) input() else: print("You missed.") input() elif choice == "2": if playerClass == "Adult": toHit, drunkRage = player.specialAttack(playerClass) if toHit >= knight.getDex(): weapon = inventory.get("Weapon") toDmg = weapon.get_damage() dmg = random.randint(1, toDmg) knightHP = knight.getHP() print( "The alcohol in your blood strengthens you and you strike a mightty blow of " + str(dmg + drunkRage) + " points of damage to the knight.") knight.setHP((knightHP - dmg - drunkRage)) input() else: print("You missed.") input() #Add child if playerClass == "Child": knightTurn = player.specialAttack(playerClass) print( "You begin crying tears of entitlement that this isn't fair and the world is too hard. The knight seems confused." ) #Add LARPer if playerClass == "LARPer": toHit = player.specialAttack(playerClass) if toHit >= knight.getDex(): weapon = inventory.get("Weapon") toDmg = weapon.get_damage() dmg1 = random.randint(1, toDmg) dmg2 = random.randint(1, toDmg) knightHP = knight.getHP() print( "All those weekend LARP events have prepared you well for this very moment. \nYou've been practicing thos move for some time. You swing once and hit for " + str(dmg1) + " \npoints of damage and before the knight knows what is happening, you swing back for another \n" + str(dmg2) + "points of damage!") knight.setHP((knightHP - dmg1 - dmg2)) input() else: print("You missed.") input() #Add Anime Fan if playerClass == "Anime Fan": heal = player.specialAttack(playerClass) inventory["Hit Points"] = inventory.get( "Hit Points") + heal print("You heal for " + str(heal) + " points of damage.") input() elif choice == "3": if len(consumables) > 0: os.system('cls') playerStatsUI = player.playerBattleStatsUI( player.inventory) knightStatsUI = knight.battleStatsUI() self.display(playerStatsUI, knightStatsUI) print(playerImg) for x in consumables: print(str(x)) itemChoice = input("Which item would you like to use?") if itemChoice == "water": heal = water.get_heal() inventory["Hit Points"] = inventory.get( "Hit Points") + heal print("You heal for " + str(heal) + " points of damage.") input() elif itemChoice == "mutton": heal = mutton.get_heal() inventory["Hit Points"] = inventory.get( "Hit Points") + heal print("You heal for " + str(heal) + " points of damage.") input() elif itemChoice == "mead": heal = mead.get_heal() inventory["Hit Points"] = inventory.get( "Hit Points") + heal print("You heal for " + str(heal) + " points of damage.") input() elif itemChoice == "liquor": heal = liquor.get_heal() inventory["Hit Points"] = inventory.get( "Hit Points") + heal print("You heal for " + str(heal) + " points of damage.") input() elif itemChoice == "turkey": heal = turkey.get_heal() inventory["Hit Points"] = inventory.get( "Hit Points") + heal print("You heal for " + str(heal) + " points of damage.") input() elif itemChoice == "soda": heal = soda.get_heal() inventory["Hit Points"] = inventory.get( "Hit Points") + heal print("You heal for " + str(heal) + " points of damage.") input() elif itemChoice == "Full Health": maxHP = player.getHP() inventory["Hit Points"] = maxHP print("You heal for to full hit points.") input() else: print( "You waste time looking for an item that you don't have." ) else: print( "You waste time looking for an item that you don't have." ) elif choice == "4": dmg = 100 knightHP = knight.getHP() print("You hit really hard and nearly kill the poor guy.") knight.setHP((knightHP - dmg)) input() knightHP = knight.getHP() if knightHP <= 0: os.system('cls') file = open("RenQuestWinText.txt", "r") for x in file: renquestIntro.slowPrint(x, .025) input() file.close() os.system('cls') playerStatsUI = player.playerBattleStatsUI(player.inventory) knightStatsUI = knight.battleStatsUI() self.display(playerStatsUI, knightStatsUI) playerAC = inventory.get("Dexterity") print(knightImg) if knightTurn == "False": print( "Still confused from your earlier rant, the knight stands there just \ntrying to figure out what to do next." ) else: if knightHP < 10: if knight.healed < 1: print( "The knight seems weak from your battle. He draws himself up to his full \nheight and begins chanting \"Fight. The. Knight.\" Soon everyone \nis chanting and it's almost as if that chant has healed him!" ) heal = knight.specialAttack() knight.setHP(knightHP + heal) else: healChance = random.randint(1, 100) if healChance <= 25: print( "The knight seems weak from your battle. He draws himself up to his full \nheight and begins chanting \"Fight. The. Knight.\" Soon everyone \nis chanting and it's almost as if that chant has healed him!" ) heal = knight.specialAttack() knight.setHP(knightHP + heal) else: toHit = player.knightAttack() if toHit >= playerAC: toDmg = knightWeapon.get_damage() dmg = random.randint(1, toDmg) inventory["Hit Points"] = inventory.get( "Hit Points") - dmg print( "The knight strikes a mighty blow and does " + str(dmg) + " points of damage to you.") input() else: print("The Knight missed.") input() else: toHit = player.knightAttack() if toHit >= playerAC: toDmg = knightWeapon.get_damage() dmg = random.randint(1, toDmg) inventory["Hit Points"] = inventory.get( "Hit Points") - dmg print("The knight strikes a mighty blow and does " + str(dmg) + " points of damage to you.") input() else: print("The Knight missed.") input() if inventory.get("Hit Points") <= 0: os.system('cls') file = open("RenQuestLoseText.txt", "r") for x in file: renquestIntro.slowPrint(x, .025) input() file.close()
def vendors(self, curPosX, curPosY, pClass, pInventory, aMap, thePlayer): playerClass = pClass posX = curPosX posY = curPosY inventory = pInventory faireMap = aMap player = thePlayer shopping = True if posX == 3 and posY == 7: print( "Welcome to Boffer's Blades! Look around and let me know how I can help you." ) weaponVend = vendorclass.vendor("weapon", 15, 20) while shopping: choice = weaponVend.printMenu() if choice == "1": weapon = weaponVend.sell(playerClass, player.inventory) elif choice == "2": weaponVend.charm(self.player.inventory.get("Charisma")) elif choice == "3": weapon, caught = weaponVend.steal( self.player.inventory.get("Dexterity"), playerClass) if caught == True: print("You lose the game") input() sys.exit() elif choice == "4": shopping = False inventory["Money"] = (inventory.get("Money") - weapon.get_price()) inventory["Weapon"] = weapon inventory["Hit Points"] = inventory.get("Hit Points") - 1 os.system('cls') print("That encounter took some effort, watch those hit points!") gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) if posX == 3 and posY == 12: print( "As you approach the tent, you hear the sounds of beautiful music." ) print(''' ___|\_______|________|_______________________O__________@____________ ___|/_______|________|_|___|__________|__@__|_____@__|_|____O._______|| __/|____4___|__O_____|_|___|__O.______|_|@__|____|___|_|___|O.______o|| _(_/^\__4__@|_|_____@__|___|_|________|_|@__|____|___|_|___|________o|| __\|/'_____@__|________|__@|_|________|_|________|___|_____|_________|| d | @ | | ''') print( "\nYou can feel the music lifting your spirits and giving you confidence. \nAlmost like the sound of this music is going to make you harder to hit." ) inventory["Dexterity"] = inventory.get("Dexterity") + 1 inventory["Hit Points"] = inventory.get("Hit Points") - 1 input("Press any key to continue.") os.system('cls') print( "All that dancing kind of wore you out. Be sure to drink plenty of water!" ) gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) if posX == 4 and posY == 16: choice = input("You see trash. Do you want to investigate? y/n: ") if choice == "y": chance = random.randint(1, 100) if chance < 50: print("you see bees...run!") print(''' _ _ | )/ ) \\ |//,' __ (")(_)-"()))=- (\\ _ _ HEELP ( | / ) \\ \|/,' __ \_o_/ (")(_)-"()))=- ) <\\ /\__ _____ \ ________________________________ ''') input("Press any key to continue.") inventory["Hit Points"] = inventory.get("Hit Points") - 2 os.system('cls') print( "That encounter took some effort, watch those hit points!" ) gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) elif chance >= 50: soda = Items.Consumable("soda", 3, 0) print("you see an unopened soda and put it in your bag") consumable = player.inventory.get("Consumables") consumable.append(soda) input("Press any key to continue.") inventory["Hit Points"] = inventory.get("Hit Points") - 1 os.system('cls') print( "That encounter took some effort, watch those hit points!" ) gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) if posX == 5 and posY == 5: print( "The sign above this establishment says 'Red Dragon Tavern & Snack Bar'...\nperhaps getting some food for later would be a good idea." ) water = Items.Consumable("water", 5, 2) mutton = Items.Consumable("mutton", 4, 6) mead = Items.Consumable("mead", 3, 4) liquor = Items.Consumable("liquor", 4, 5) turkey = Items.Consumable("turkey leg", 3, 5) shopping = True consumable = player.inventory.get("Consumables") while shopping: os.system('cls') gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) choice = input(''' ╔══════════════════════════════════╗ ║What food or drink would you like?║ ╠══════════════════════════════════╣ ║1 - Buy water for $2 ║ ║2 - Buy mead for $4 ║ ║3 - Buy liquor for $5 ║ ║4 - Buy mutton for $6 ║ ║5 - Buy turkey leg for $5 ║ ║6 - Leave this area ║ ╚══════════════════════════════════╝ ''') if choice == "1": consumable.append(water) inventory["Money"] = (inventory.get("Money") - water.get_price()) elif choice == "2": if playerClass == "Child": print( "I don't believe you're old enough to purchase that." ) else: consumable.append(mead) inventory["Money"] = (inventory.get("Money") - mead.get_price()) elif choice == "3": if playerClass == "Child": print( "I don't believe you're old enough to purchase that." ) else: consumable.append(liquor) inventory["Money"] = (inventory.get("Money") - liquor.get_price()) elif choice == "4": consumable.append(mutton) inventory["Money"] = (inventory.get("Money") - mutton.get_price()) elif choice == "5": consumable.append(turkey) inventory["Money"] = (inventory.get("Money") - turkey.get_price()) elif choice == "6": inventory["Consumables"] = consumable inventory["Hit Points"] = inventory.get("Hit Points") - 1 shopping = False os.system('cls') print("Man it's hot outside, better stay hydrated!") gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) if posX == 6 and posY == 18: print( "As you step into the tent, you see business cards with the name 'Patricia's Protectives' \non them. A pleasant looking gentleman smiles at you and says to ask if you have any questions." ) armorVend = vendorclass.vendor("armor", 17, 25) while shopping: choice = armorVend.printMenu() if choice == "1": armor = armorVend.sell(playerClass, player.inventory) elif choice == "2": armorVend.charm(self.player.inventory.get("Charisma")) elif choice == "3": armor, caught = armorVend.steal( self.player.inventory.get("Dexterity"), playerClass) if caught == True: print("You lose the game") input() sys.exit() elif choice == "4": shopping = False inventory["Money"] = (inventory.get("Money") - armor.get_cost()) inventory["Armor"] = armor inventory["Hit Points"] = inventory.get("Hit Points") - 1 os.system('cls') print("That encounter took some effort, watch those hit points!") gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) if posX == 7 and posY == 9: puck = vendorclass.vendor("puck", 0, 0) puck.theTrickster(player, player.inventory) inventory["Hit Points"] = inventory.get("Hit Points") - 1 os.system('cls') print( "Even thinking can take it's toll when it's hot. Visit a ♥ to buy some water!" ) gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI) if posX == 10 and posY == 10: print( "You hear the sounds of hooves and clanging metal. Interested, you move \ncloser. You see a couple of people wearing what look to be galvanized metal \ntrashcans shaped into the crude approximation of armor wailing on each other \nwith mop handles." ) print(''' .oo. .\\. .. ,'..''\\ ...oooo'' | \\_/' ...oooo'' /''.'\\ . ...oooo'' | | '| ...o!oo'' | | |. ...oooo''./ '\\ | '\\, """"\\ ./ ./\\ '\\. /\\ooo''|""""-/ -../ / \\'' '\\. / '\\. '|.''\\--/-+-+-+-+-+-+-+-+.' ....- \\. \\. '\\-'/',, /'---/' """ ././ ''\\.-.-.\\ '\\| '',,\\--; /-/| |-'\\. '> '\\\\ !--!| /---/' ./' | !--!! ./---/' ,/| | ./'-/'| |----\\ \\-| | ./'--/ |..........|''' '''./'|...........| -'-'-' '/---/\\---|' '/-\\--\\'""" /--/' |--\\ ./---\\--\\ |--| \--\\. ./--/' \\--\\ |--| |--| ./--/' \\--\\. '\\-| '\\-| /--/' \\--| |..\\ |..\\ |..\\ |..\\ ''') print( "\nYou watch these fine gentlemen beat the hell out of each other for a few minutes. \nYou feel like you've learned a few things about fighting someone in armor." ) inventory["Attack"] = inventory.get("Attack") + 1 inventory["Hit Points"] = inventory.get("Hit Points") - 1 input("Press any key to continue.") os.system('cls') print( "Standing out in the sun like this sure is making you thirsty. Better get some water!" ) gameMapUI = faireMap.mapUI() gameStatsUI = player.statsUI(player.inventory) self.display(gameMapUI, gameStatsUI)