def somethingJumps(): # Line 5290 cls() print("Suddenly... something jumps...") print("in front of you......") delay(2) cls() return
def flourish(): # This needs to be re-done for aa in range(1, 301): print("* %", end="") delay(2) print("\n") cls() return
def playerDead(): global player global newgame delay(2) cls() if player.movesdepleted: print(f"{player.name}, you have run out of moves.") else: print("Your hit-points are depleted.") player.gold = 0 print("And, unfortunately, you have died.") delay(2) w = int(rnd()*6+1) player.dead = False if (player.movesdepleted == False) and (w >= 3): delay(1) player.hp = player.initialhp flourish() print("") print("You have entered .. a zone") print("between .. Life and Death") print(" ") delay(1) print("I.... The Ancient Wizard") print(f"will restore your hit-points to {player.initialhp}") print("and .... You have one more") print("chance in the Dungeon.") print(" ") player.turnsleft = int(rnd()*15+1)*player.monsterskilled+10 print(f'You shall have {player.turnsleft} moves') print("left to find your way out") print("of the Dungeon of Danger.") delay(2) flourish() else: # Kube 1710 (that's what happens when you type with your hands shifted one key to the left print("You lost all your gold and you were") print("... unable to meet the demands of") print(".....The Dungeon of Danger") print("\n\n") print(" ") print("Better luck next time") gg=player.gold + 100 r = int ((gg*player.monsterskilled-7000+1)/player.turnstaken) rating = getRating(r) print(f'Game rating is {r} = {rating}') print(" ") print("Another game?") # f=input("Enter (Y)es or (N)o >") f = yesNo() if f == 'Y': newgame = True # Goto 210 cls() else: quit() return
def ewCorridor(): cls() print("You are in an East-West corridor") print("You can only go East or West.") if player.hasMoved() == False: return if (player.y+1 == player.oldy) or (player.y-1 == player.oldy): print("The door closes and locks behind you") inCorridor() return
def nsCorridor(): cls() print("You are in a North-South corridor") print("You can only go North or South.") if player.hasMoved() == False: return if (player.x - 1 == player.oldx) or (player.x +1 == player.oldx): print("The door closes and locks behind you") inCorridor() return
def introTop(): cls() print("The Dungeon of Danger".center(40)) print(" For Python 3".center(40)) print("(c) 1980 by Howard Berenbon".center(40)) print("Adapted from Atari BASIC verson".center(40)) print(" ") print("A Fantasy Game".center(40)) print("=-=-=-=-=-=-=-=-=-=-".center(40)) print("You will be teleported to...") print(" ") return
def darkWizard(): # Line 5230 global monster monster.name = 'Dark Wizard' monster.hp = 8 monster.hm = 14 cls() print(f"Do not pass . . . I am the {monster.name}") delay(2) print("And I will hack you to pieces . . . ") delay(2) doBattle() return
def introBottom(): print(f'You carry a magic sword and {player.gold} gold pieces with you.') print(f'Your hit-point value is {player.hp}.') print("If it reaches zero, you will die . . . So be careful!") delay(1) print(f'{player.name} . . . You are on your way.') delay(3) cls() print("You have arrived at . . . ") print("The Dungeon of Danger . . . Level 2") print(" ") print("You will encounter monsters and thieves and . . . gold.") print("Good luck!") return
def fallInPool(): # Have not seen if this works yet global monster cls() print("You fall into a deep . . dark") delay(1) print(". . . pool . . of murky water") delay(3) w = int(rnd() * 6 + 1) print(" ") if (w >= 5): # GOTO 5780 monster.name = 'Gill Monster' monster.hp = 8 monster.hm = 14 cls() print("The water is . . . icy cold") delay(4) print("Suddenly . . you feel something warm") print(" . . . Rub against your legs . . . .") delay(3) print(" ") print("It then surfaces next to you . . . ") print(" and you see that is is a slimy . . ") print(f'. . . {monster.name} . . ready to attack') delay(2) print() print("As you climb out . . . ") delay(2) doBattle() return elif (w >= 3): # GOTO 5860 print("The water is steaming . . . . hot") delay(3) print() print("As you quickly jump out . . . . ") g4 = int(rnd() * 500 + 1) + 100 if (player.gold - g4) < 0: g4 = player.gold player.gold = player.gold - g4 print(f'You drop {g4} gold pieces') print("Which fall into the pool . . lost") delay(3) else: print("It is warm and soothing . . And") delay(2) print("You climb out . . feeling relaxed") print(" ") return
def showMap(): # Line 1570 & 1990 cls() if (player.hasmap == False): print("You don't have the map.") delay(1) else: print("The Dungeon of Danger Map: Level " + str(level)) print(" ") for q in range(1, 9): for n in range(1, 9): if (player.x == n) and (player.y == q): print("Pl ", end=" ") continue else: idx = getIndex(n, q, 9) if level == 1: s1 = level1[idx] else: s1 = level2[idx] if s1 == 1: # pass() # Line 2910 print("O ", end=" ") elif s1 == 2: # pass() # Line 2970 print("C ", end=" ") elif s1 == 3: # pass() # Line 2930 print("M ", end=" ") elif s1 == 4: # pass() # Line 2930 print("M ", end=" ") elif s1 == 5: # pass() # Line 2950 print("? ", end=" ") elif s1 == 6: # pass() # Line 2990 print("NS ", end=" ") elif s1 == 7: # pass() # Line 3010 print("EW ", end=" ") elif s1 == 8: # pass() # Line 3030 print("? ", end=" ") elif s1 == 9: # pass() # Line 3040 print("UP ", end=" ") print("\n") dummy = input("~~Press Enter to Continue~~") return
def thief(): global player cls() print("There is a thief in this chamber") idx = getIndex(player.x, player.y, 9) if level == 1: level1[idx] = 1 else: level2[idx] = 1 delay(1) g4 = int(rnd() * 500 / level + 1) if (player.gold - g4 < 0): g4 = player.gold y = int(rnd() * 8 + 1) if y <= 3: print(" ") print("You suprised the thief . . . . ") delay(1) print("As he runs out, he drops . . . . ") g4 = int(rnd() * 400 / level + 1) print(f'. . . {g4} gold pieces.') print("You pick up the gold pieces") player.gold = player.gold + g4 print(" ") if player.hasmap: return ma = int(rnd() * 4 + 1) if ma <= 2: player.hasmap = True getMap() return else: print("\n. . . . . . . . He surprises you") delay(2) print("As he quickly passes by you, he") print(f'snatches . . . {g4} gold pieces.\n') player.gold = player.gold - g4 if player.hasmap: return else: ma = int(rnd() * 4 + 1) if ma <= 2: player.hasmap = True getMap() return
def introTop(): cls() showFile("./intro.txt") delay(5) delay(2) print("\n") print("The Dungeon of Dangeresque".center(40)) print(" For Python 3".center(40)) print("(c) 1980 by Howard Berenbon".center(40)) print("Adapted from Atari BASIC verson".center(40)) print("Of 'Dunger of Danger'".center(40)) print(" ") print("A Fantasy Game".center(40)) print("=-=-=-=-=-=-=-=-=-=-".center(40)) print("You will be teleported to...") print(" ") return
def attackMonster(): # Line 4600 global monster cls() delay(1) print(f'You attack the . . . {monster.name}') delay(1) print("With a swing of your sword") n = int(rnd() * 5 + 1) + int(rnd() * player.monsterskilled / 2 + 1) monster.hm = monster.hm - n if monster.hm <= 0: deadMonster() # GOTO 4890 return (monster.hm) print(f'You do {n} hit points of damage') delay(1) print(f'It has . . {monster.hm} hit points left') delay(1) return (monster.hm)
def attackMonster(): global monster cls() delay(1) print(f"You attack the. . . {monster.name}") delay(1) print("With a swing of your sword") n = int(rnd()*5+1)+int(rnd()*player.monsterskilled/2+1) monster.decHM(n) if monster.dead: deadMonster() return(monster.hm) print(f"You do {n} hit-points of damage") delay(1) print(f"It has . . {monster.hm} hit-points left") delay(1) return(monster.hm)
def findVial(): # Line 4210 global player print("\nYou look around...") delay(2) v = int(rnd() * 7 + 1) if v < 5: return print("On the ground, at your feet, is a vial.") delay(2) print("You pick up the vial.. and see that") print("It contains ... a milky liquid.") print("Would you like a drink?") d = input("Enter (Y)es or (N)o:") dl = int(rnd() * 6 + 1) if d.upper() == 'N': return print("\nYou take a drink...") delay(3) cls() if dl >= 3: h = int(rnd() * 10 / difficulty + 1) + (6 / difficulty) player.incHP(h) print("It was a white magic potion...") print(f'Which increased your hit-points by {h}') elif dl == 2: print("The liquid had no effect on you.") else: h = int(rnd() * 6 + 1) * difficulty player.decHP(h) print("You feel a little funny...") delay(4) if player.dead: return print("\nIt was a black magic potion...") print(f'Which decreased your hit-points by {h}.') return
def thief(): global player global level cls() print("There is a thief in this chamber") idx = level[currentlevel].getIndex(player.x,player.y) level[currentlevel].setMapIdx(idx,1) delay(1) gg = int(rnd()*500/currentlevel+1) if (player.gold - gg < 0): gg = player.gold y = int(rnd()*8+1) if (y <= 3): print(" ") print("You surprised the thief. . . . ") delay(1) print("As he runs out, he drops . . . . ") gg = int(rnd()*400/currentlevel+1) print(f". . . {gg} gold pieces") player.gold = player.gold + gg print("") else: print(" ") print(". . . . . . He surprises you") delay(1) print("As he quickly passes by you, he") print(f"snatches. . . {gg} gold pieces.") player.gold = player.gold - gg if player.hasmap: return else: ma = int(rnd()*4+1) if (ma <= 2): getMap() return
def goUpstairs(): # Line 1480 global level # should put level in playerObject global player cls() if (inroom != 9): print("You are not at a stairway.") delay(1) else: if player.haskey: level = level - 1 print("You walk up the stairway...") delay(1) print("The Enchanted Key ... Opens the lock") delay(1) if level == 0: gameWon() else: player.hasmap = False player.haskey = False k4 = int(rnd() * 4 + 1) + 1 if player.hp < initialHP: player.hp = initialHP print("You feel stronger .....") delay(1) print(f'Your hit points are restored to {initialHP}') print(" ") bmonsterskilled = player.monsterskilled + k4 print("You are at..... Level 1") delay(2) return else: print("\nYou cannot go up the stairway.") print("You don't have the key.") delay(1) return
def somethingJumps(): cls() print("Suddenly. . . Something jumps. . . ") print("in front of you . . . . . ") delay(2) return
def ewCorridor(): # Line 1620 cls() print("You are in an East-West corridor") print("You can only go East or West") corridor() return
def nsCorridor(): # Line 1660 cls() print("You are in a North-South corridor") print("You can only go North or South.") corridor() return
def playerDead(): global dy global player global newgame delay(2) cls() if player.movesdepleted: print(f'{player.name}, you have depleted your moves.') else: print("Your hit-points have been depleted,") player.gold = 0 print("And unfortunately... You just died.") delay(3) w = int(rnd() * 6 + 1) player.dead = False if (player.movesdepleted == False) and (w >= 3): # Line 5370 delay(1) dy = 1 player.hp = initialHP flourish() print("", end='\n') print("You have entered .. a zone") print("between .. Life and Death") print(" ") delay(1) print("I.... The Ancient Wizard") print("will restore your hit-pointes to " + str(initialHP)) print("and .... You have one more") print("chance in the Dungeon.") print(" ") # md = int(rnd()*15+1)*ca+10 player.turnsleft = int(rnd() * 15 + 1) * player.monsterskilled + 10 # player.hp = hi print(f'You shall have {player.turnsleft} moves') print("left to find your way out") print("of the Dungeon of Danger.") delay(2) flourish() # player.dead = False # print("",end='\n') # print(" ") # print("Another game?") # f=input("Enter (Y)es or (N)o >") # if f.upper() == 'Y': # newgame = True # Goto 210 # cls() # else: # quit() # return else: # Kube 1710 # cls() print("You lost all your gold and you were") print("... unable to meet the demands of") print(".....The Dungeon of Danger") print("\n\n") print(" ") print("Better luck next time") gg = player.gold + 100 r = int((gg * player.monsterskilled - 7000 + 1) / player.turnstaken) rating = getRating(r) print(f'Game rating is {r} = {rating}') # playerRating() print(" ") print("Another game?") f = input("Enter (Y)es or (N)o >") if f.upper() == 'Y': newgame = True # Goto 210 cls() else: quit() return
player.haskey = False player.gold = 500 difficulty = int(getDifficulty()) initialHP = 20 + int(rnd() * 15 + 1) initialHP = int(initialHP / difficulty) targetKills = int(rnd() * 4 + 1) + 4 player.name = getName() player.hp = initialHP teleportactive = False delay(2) introBottom() inroom = getContents(player.x, player.y) newgame = False # showLevels() # while te == 1: cls() # print(level2) # bubba = input("Press ENTER") if inroom == 1: emptyChamber() elif inroom == 2: hiddenCavern() elif (inroom == 3) or (inroom == 4): occupiedCavern() elif inroom == 5: thief() elif inroom == 6: nsCorridor() elif inroom == 7: ewCorridor()