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 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 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 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 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 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 corridor(): # Line 3240 global monster print("The door closes and locks behind you") delay(1) w = int(rnd() * 8 + 1) if w >= 7: # GOTO 3300 w = int(rnd() * 4 + 1) + 30 monster.name = monsterInfo[0][w] monster.hp = monsterInfo[1][w] monster.hm = monsterInfo[2][w] print("There is something lurking") print("In this corridor . . . ") delay(1) print(". . . . Beware") delay(1) print(f"\nIt is a . . . . . {monster.name} . . ") delay(1) doBattle() return w = int(rnd() * 8 + 1) if w == 8: # GOTO 3390 if player.haskey == False: player.haskey = True print("\nYou notice a shiny object . . . . ") print(". . . . at your feet") delay(1) print("You pick it up and find that . . . ") print("It is the enchanted key . . . . . ") delay(1) print("\nBut you weren't careful . . . . ") delay(1) print("You activated some sort of trap . . . ") delay(1) 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) return
def inCorridor(): global monster global player w = int(rnd()*8+1) if (w >= 7): w = int(rnd()*4+1)+30 monster.name = monsterInfo[0][w] monster.hp = monsterInfo[1][w] monster.hm = monsterInfo[2][w] print("There is something lurking") print("in this corridor . . . ") delay(1) print(". . . . Beware") delay(1) print(f"\nIt is a . . . . . {monster.name} . . ") delay(1) doBattle() return w = int(rnd()*8+1) if (w == 8): if player.haskey == False: player.haskey == True print("\nYou notice a shiny object . . . . ") print(". . . . at your feet") delay(1) print("You pick it up and find that . . . ") print("It is the enchanted key . . . . . ") delay(1) print("\nBut you weren't careful . . . . ") delay(1) print("You activated some sort of trap . . . ") delay(1) player.x = int(rnd()*8+1) player.y = int(rnd()*8+1) # player.oldx = player.x # player.oldy = player.y player.move(player.x,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) findFleeExit() 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 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 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 findFleeExit(): global player exitfind = True while exitfind: r=int(rnd()*4+1) if (r == 1): # Check North if ((player.y - 1) > 0 and (inroom != 7)): player.oldy = player.y -1 exitfind = False else: continue if (r == 3): # Check South if ((player.y + 1 < 9) and (inroom != 7)): player.oldy = player.y + 1 exitfind = False else: continue if (r == 2): # Check East if (player.x + 1 < 9) and (inroom != 6): player.oldx = player.x + 1 exitfind = False else: continue if (r == 4): # Check West if (player.x - 1 > 0) and (inroom != 6): player.oldx = player.x - 1 exitfind = False else: continue 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 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 fillMap(lvl): global level # seed() n = 0 for y in range(1,9): for x in range(1,9): # i = level[lvl].getIndex(x,y) i = getIndex(x,y) level[lvl] = int(rnd()*7+1) h = int(rnd()*3+1) for n in range(1,h+1): x = int(rnd()*9) y = int(rnd()*9) i = getIndex(x,y) level[lvl] = 8 s = int(rnd()*4+1)+2 for n in range(1,s+1): x = int(rnd()*8+1) y = int(rnd()*8+1) i = getIndex(x,y) level[lvl] = 9 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 emptyChamber(): w = int(rnd()*2+1) if (w == 2): print("You are in a damp and misty. . . . ") print(". . . . empty chamber.") else: print("You are in a cold and dark. . . . ") print(". . . . empty chamber.") 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 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 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 emptyChamber(): # Line 2100 w = int(rnd() * 2 + 1) if w == 2: # THEN 2160 print("You are in a damp and misty") print("...... Empty chamber.") print("") else: print("You are in a cold and dark") print("...... Empty chamber.") print("") 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
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 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 hiddenCavern(): # Line 4060 print("You stumbled onto .....") print("A hidden cavern") delay(2) print(" ") findVial() # GOSUB 4210 if player.dead: playerDead() w = int(rnd() * 9 + 1) delay(3) if w > 3: print("The cavern seems empty...") return delay(2) print("But wait... Before you proceed") delay(2) print(" ") print("You hear a noise off in the distance") delay(2) print("Cautiously, you walk towards the sound.") delay(2) w = int(rnd() * 4 + 1) # Line 4160 if initialHP < player.hp: if w == 2: # GOTO 5170 somethingJumps() giantSpider() else: if w == 1: # GOTO 5040 somethingJumps() mrWizard() elif (w == 4) and level == 2: fallInPool() # GOTO 5720 else: somethingJumps() darkWizard() # GOTO 5230 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 trapDoor(): global currentlevel global player print("You activated a . . . trap door") delay(2) trap = int(rnd()*4+1)*difficulty if (trap > 4): print("You fell thru . . . ") delay(1) print("And it killed you.") player.dead = True player.deathreason = "Broken neck" return elif (trap == 4): if (currentlevel > 1): intoPit() return currentlevel = currentlevel + 1 if (currentlevel > maxlevel): currentlevel = maxlevel print(" ") print(f"You fell thru to level {currentlevel} . . . and") delay(1) print("you . . . . . . . lost") print("all of your gold pieces") player.gold = 0 if (player.haskey): print("But you still have your key!") return else: print("But . . . you caught yourself") print("from falling") return return