def jungle(): global caleb_alive if caleb_alive == 1: print("Caleb jumps out of a tree and screams, \"TAN CONG!!\"") mechanicsFork.combat(Player, Caleb) caleb_alive = 0 player_action = input('>').lower() if player_action == 'l' or player_action == "look": print(jungle_description) if caleb_alive == 0: print("There is a blue keycard here") jungle() elif player_action == 'i' or player_action == "inventory": print(Player.inv) jungle() elif "drink" in player_action and "potion" in player_action and "health potion" in Player.inv: heal_amount = random.randint(1, 8) + 1 if Player.hp + heal_amount > Player.max_hp: Player.hp = Player.max_hp else: Player.hp += heal_amount print("%s was healed for %i, leaving them with %i hp" % (Player.name, heal_amount, Player.hp)) Player.inv.remove("health potion") jungle() elif "get" in player_action and "keycard" in player_action and caleb_alive == 0: print("You get the blue keycard") Player.inv.append("blue keycard") caleb_alive = 2 jungle() elif player_action == 'w' or player_action == "west": print(lobby_description) lobby() else: print("I don't understand") jungle()
def construction(): global toni_alive if toni_alive == 1: print("You see Toni Kong start to beat his chest and throw basketballs") mechanicsFork.combat(Player, Toni) toni_alive = 0 player_action = input('>').lower() if player_action == 'l' or player_action == "look": print(construction_description) if toni_alive == 0: print("There is a green keycard here") construction() elif player_action == 'i' or player_action == "inventory": print(Player.inv) construction() elif "drink" in player_action and "potion" in player_action and "health potion" in Player.inv: heal_amount = random.randint(1, 8) + 1 if Player.hp + heal_amount > Player.max_hp: Player.hp = Player.max_hp else: Player.hp += heal_amount print("%s was healed for %i, leaving them with %i hp" % (Player.name, heal_amount, Player.hp)) Player.inv.remove("health potion") construction() elif "get" in player_action and "keycard" in player_action and toni_alive == 0: print("You get the keycard") Player.inv.append("green keycard") toni_alive = 2 construction() elif player_action == 'e' or player_action == "east": print(lobby_description) lobby() else: print("I don't understand") construction()
def cell(): global skeleton_alive if skeleton_alive == 1: print("You are ambushed by a skeleton!") mechanicsFork.combat(Player, Skeleton) skeleton_alive = 0 player_action = input('>').lower() if player_action == 'l' or player_action == "look": print(cell_description) cell() elif player_action == 'i' or player_action == "inventory": print(Player.inv) cell() elif "drink" in player_action and "potion" in player_action and "health potion" in Player.inv: heal_amount = random.randint(1, 8) + 1 if Player.hp + heal_amount > Player.max_hp: Player.hp = Player.max_hp else: Player.hp += heal_amount print("%s was healed for %i, leaving them with %i hp" % (Player.name, heal_amount, Player.hp)) Player.inv.remove("health potion") cell() elif player_action == 'w' or player_action == "west": print(teleporter_description) teleporter() elif player_action == 's' or player_action == "south": print(cellhall_description) cellhall() else: print("I don't understand") cell()
def office(): global warden_alive if warden_alive == 1: print("You see Atrienus the Warden. He is carrying keys all over his body, and he wields a giant key as a weapon.") mechanicsFork.combat(Player, Warden) warden_alive = 0 player_action = input('>').lower() if player_action == 'l' or player_action == "look": print(office_description) if warden_alive == 0: print("There is a cell key here") office() elif player_action == 'i' or player_action == "inventory": print(Player.inv) office() elif "drink" in player_action and "potion" in player_action and "health potion" in Player.inv: heal_amount = random.randint(1, 8) + 1 if Player.hp + heal_amount > Player.max_hp: Player.hp = Player.max_hp else: Player.hp += heal_amount print("%s was healed for %i, leaving them with %i hp" % (Player.name, heal_amount, Player.hp)) Player.inv.remove("health potion") office() elif "get" in player_action and "key" in player_action and warden_alive == 0: print("You get the key") Player.inv.append("cell key") warden_alive = 2 office() elif player_action == 's' or player_action == "south": print(lounge_description) lounge() else: print("I don't understand") office()
def hallway(): global rat_alive if rat_alive == 1: print("Ravio the goblin shouts and attacks you") mechanicsFork.combat(Player, Rat) rat_alive = 0 player_action = input('>').lower() if player_action == 'l' or player_action == "look": print(hallway_description) hallway() elif player_action == 'i' or player_action == 'inventory': print(Player.inv) hallway() elif "drink" in player_action and "potion" in player_action and "health potion" in Player.inv: heal_amount = random.randint(1, 8) + 1 if Player.hp + heal_amount > Player.max_hp: Player.hp = Player.max_hp else: Player.hp += heal_amount print("%s was healed for %i, leaving them with %i hp" % (Player.name, heal_amount, Player.hp)) Player.inv.remove("health potion") hallway() elif player_action == 'n' or player_action == "north": print(dininghall_description) dininghall() elif player_action == 'u' or player_action == "up": print(stairwell_description) stairwell() else: print("I don't understand") hallway()
def finalroom(): print(finalroom_description) print("The game master says, \"Fool! You dare enter my domain\"") mechanicsFork.combat(Player, Master) print("As the game master dies, this world slowly starts to fade away") print("Thank you for playing Wizards & Warriors")