def flourish(): # This needs to be re-done for aa in range(1, 301): print("* %", end="") delay(2) print("\n") cls() return
def monsterAttacks(): # Line 4780 global player global monster print(" ") w = int(rnd() * 7 + 1) print(". . . . . . . It attacks you") if (w <= 2): print("But . . . . . . . . it misses") delay(2) else: w = int(rnd() * 6 + 1) if (w >= 3): n = int(rnd() * player.hp * difficulty + 1) else: n = int(rnd() * player.hp / level + 1) + int(rnd() * player.hp / level + 1) if monster.hm <= 2: n = 1 player.decHP(n) delay(1) if player.dead: return print(f'And it does {n} hit points of damage') print(" ") print(f'You have . . . {player.hp} hit points left') print(" ") return
def somethingJumps(): # Line 5290 cls() print("Suddenly... something jumps...") print("in front of you......") delay(2) cls() return
def doBattle(): battleloop = True delay(2) print(" ") w = int(rnd() * 4 + 1) if (w > 2): delay(1) monsterAttacks() # GOSUB 4780 if player.dead: battleloop = False return while battleloop: f = fightOrFlee() if f.upper() == 'F': check = attackMonster() if check <= 0: battleloop = False continue else: monsterAttacks() if player.dead: battleloop = False return else: flee() battleloop = False return
def monsterAttacks(): global player global monster print("") w = int(rnd()*7+1) print(". . . . . . . It attacks you") if (w <= 2): print("But. . . . . . It misses") delay(1) else: w = int(rnd()*6+1) if (w >= 3): n = int(rnd()*player.hp*difficulty+1) else: n = int(rnd()*player.hp/currentlevel+1)+int(rnd()*player.hp/currentlevel+1) if monster.hm <= 2: n = 1 player.decHP(n) delay(1) print(f"And it does {n} hit-points of damage") print(" ") print(f"You have . . . {player.hp} hit-points left") print(" ") return
def teleportTrap(): global teleportactive global player if teleportactive == False: teleportactive = True print("You activated some sort of trap . . . ") delay(1) teleportx = player.x teleporty = player.y player.x = int(rnd() * 8 + 1) player.y = int(rnd() * 8 + 1) player.oldx = player.x player.oldy = player.y print("Suddenly you feel dizzy, and pass out") delay(2) flourish() print("When you wake up . . . you find") print("that you were . . . . teleported") print("to an unknown location . . . . ") delay(2) else: teleportactive = False print("You reactivated the teleportation trap") delay(1) flourish() delay(1) print("You end up back in the area where") print(". . . you last teleported from") player.x = teleportx player.y = teleporty return
def getKey(): # Line 3110 global player player.haskey = True print("\nYou look to the ground......") print("and find the Enchanted Key!") delay(2) 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 giantSpider(): global monster monster.name = 'Giant Spider' monster.hp = 6 monster.hm = 12 print("It's a huge man-sized crawling") print(". . . . . . SPIDER . . . . . . ") delay(2) print(". . . . . . and . . . . . . ") doBattle() return
def giantSpider(): # Line 5170 global monster monster.name = "Giant Spider" monster.hp = 6 monster.hm = 12 print("It's a huge man-sized crawling") print("....... SPIDER .......") delay(2) print("...... and ......") doBattle() # GOTO 4530 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 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 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 intoPit(): global pitfall global player print("You fell into a deep . . . pit") delay(1) print("Luckily . . you didn't get hurt") print(" ") delay(1) print("But in climbing out . . . ") print("You . . . . . . lost") print("all of your gold pieces.") print(" ") player.gold = 0 if player.haskey: print("But . . . you still have your key") return
def mrWizard(): # Line 5040 global player print("Halt... I am the Ancient Wizard") print("I will not harm you......") delay(4) print(" ") gold = int(rnd() * 300 + 1) + 100 player.gold = player.gold + gold print(" ") print(f'I give you... {gold} gold pieces') print("Out of good will and friendship.") print(" ") hp = int(rnd() * 10 / difficulty + 1) + (6 / difficulty) player.incHP(hp) print("Also, I will increase...") print(f'your hit-points by {hp}.') delay(2) return
def intoPit(): # Not 100% sure this is all correct global pitfall global player print("You fell into a deep . . . pit") pitfall = True delay(1) print("Luckily . . you didn't get hurt") print(" ") delay(1) print("But in climbing out . . . ") player.gold = 0 print("\nYou . . . . . . lost") print("all of your gold pieces") print(" ") if pitfall: pitfall = False return if player.haskey: print("But . . . you still have your key") return
def deadMonster(): # Line 4890 global player delay(2) print("") print(f'You have killed the {monster.name}') print("\n") if (inroom < 6) and (inroom != 2): if level == 1: index = getIndex(player.x, player.y, 9) level1[index] = 1 else: index = getIndex(player.x, player.y, 9) level2[index] = 1 gold = 500 if inroom >= 6: gold = 250 givegold = int(rnd() * gold / level + 1) + 75 if inroom == 2: givegold = givegold * 2 player.gold = player.gold + givegold delay(2) print("You search the area....") delay(2) print(f'and find ... {givegold} gold pieces') player.monsterskilled = player.monsterskilled + 1 if player.haskey != True: if level == 1: checkKey() # GOTO 3190 else: getKey() # GOTO 3110 return
def deadMonster(): global player delay(1) print("") print(f"You have killed the {monster.name}") print("") if (inroom < 6) and (inroom !=2): level[currentlevel].setMapIdx(index,1) gold = 500 givegold = int(rnd()*gold/currentlevel+1)+75 if (inroom >= 6): gold = 250 elif (inroom == 2): givegold=givegold*2 player.gold = player.gold+givegold delay(2) print("You search the area. . . . ") delay(1) print(f"and find ... {givegold} gold pieces") player.monsterskilled = player.monsterskilled + 1 player.totalkills = player.totalkills + 1 if player.haskey != True: checkKey() return
def trapDoor(): # Line 2610 Not sure this is right, either global level global player print("You activated a . . . trap door") delay(2) trap = int(rnd() * 4 + 1) * difficulty if trap > 4: print("You fell thru . . . ") delay(2) pass # GOTO 1720 player.dead = True return elif trap == 4: pass # GOTO 2690 if level == 2: pass # GOTO 2800 intoPit() return level = level + 1 print(" ") # player.haskey = True print("You fell thru to level 2 . . . and") delay(1) intoPit() return else: print("But . . . you caught yourself") print("from falling") return return
def occupiedCavern(): global monster if player.hasMoved() == False: print("You are in a misty cavern.") return if (inroom == 4): w = int(rnd()*15+1)+15 else: w = int(rnd()*15+1) print("There is something lurking. . . ") print(". . . . in this chamber . . . . ") delay(1) print(". . . . . . . . . Beware") delay(1) print("") monster.name = monsterInfo[0][w] monster.hp = monsterInfo[1][w] monster.hm = monsterInfo[2][w] print(f"It is a . . . . . {monster.name} . . ") delay(1) doBattle() return
def hiddenCavern(): if player.hasmoved: print("You have stunbled onto . . . . . ") else: print("You are in . . . . . ") print("A hidden cavern.") if player.hasmoved != True: return delay(2) print("") findVial() if player.dead: print("Unforunately, the swig of that potion has poisoned") print("you.") playerDead() w = int(rnd()*9+1) if w > 3: print("The cavern seems empty. . . ") return delay(2) print("But wait. . . before you proceed") delay(1) print("") print("You hear a noise off in the distance") delay(1) print("Cautiously, you walk towards the sound.") delay(2) w = int(rnd()*4+1) somethingJumps() if (w == 1) and (player.hp < player.initialhp): mrWizard() elif (w == 2): giantSpider() elif (w == 4) and (currentlevel > 1): fallInPool() else: darkWizard() return
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 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 findVial(): global player print("You look around . . . ") delay(2) v = int(rnd()*7+1) if (v < 5): print(". . . but you don't see anything interesting.") else: 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 like a drink?") d = input("Enter (Y)es or (N)o: ") dl = int(rnd()*6+1) if d.upper() == 'N': print("You think maybe drinking strange 'milky' liquids") print("in strange vials lying on the ground is a bad ") print("idea and you put it down.") return else: print("You take a swig. . . ") delay(3) if (dl >= 3): h = int(rnd()*10/difficulty+1)+(6/difficulty) h = int(h) player.incHP(h) print("It was a white magic potion. . . ") print(f"Which restored you hit-points by {h}") elif (dl == 2): print("The liquid has no effect on you.") else: h = int(rnd()*6+1)*difficulty h = int(h) player.decHP(h) print("You feel a little funny. . . ") delay(2) print("\nIt was a black magic potion. . .") print(f"Which decreased your hit-points by {h}.") if player.dead: print("It kind of killed you.") return
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 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 flee(): global player w = int(rnd()*4+1) player.x = player.oldx player.y = player.oldy print("You decide to make a strategic withdrawal. . . ") if teleportactive: teleportTrap() n = int(rnd()*2+1) delay(1) if (w >= 3): player.decHP(n) print(f"As you leave. . . ") print(f"the {monster.name} attacks") delay(1) print(f"And it does {n} hit-points of damage") delay(1) return
def occupiedCavern(): if inroom == 4: w = int(rnd() * 15 + 1) + 15 else: w = int(rnd() * 15 + 1) print(" ") print("There is something lurking...") print(".... in this chamber ....") delay(1) print("........... Beware") delay(1) print(" ") monster.name = monsterInfo[0][w] monster.hp = monsterInfo[1][w] monster.hm = monsterInfo[2][w] print(f'It is a ..... {monster.name} .. ') delay(2) # continue at 4510 doBattle() return
def flee(): # Line 4700 global player w = int(rnd() * 4 + 1) player.x = player.oldx player.y = player.oldy print("You quickly run out . . .") if teleportactive: # Use teleportactive = True teleportTrap() # GOTO 5560 n = int(rnd() * 2 + 1) delay(2) if w >= 3: pass # GOTO 5330 player.decHP(n) print(f'As you leave . . . ') print(f'the {monster.name} attacks') delay(1) if player.dead: return print(f'And it does {n} hit points of damage') delay(2) return