def inter_decantcure(item_id,object_id): from player import inventory if (item_id == "boot" or item_id == "goblet") and (item_oldboot in inventory and item_hangover2 in inventory): print("You decant the contents of the goblet into the old boot") inventory.remove(item_hangover2) inventory.remove(item_oldboot) inventory.append(item_hangover) else: print("Nothing interesting happens")
def inter_watergoblet(item_id,object_id): from player import inventory if item_id == "ingredients" or item_id == "goblet": if item_watergoblet in inventory: inventory.remove(item_ingredients) inventory.remove(item_watergoblet) inventory.append(item_hangover2) print("You mix the ingredients in the wooden goblet full of water.") else: print("Nothing interesting happens.") else: print("Nothing interesting happens")
def inter_waterboot(item_id): from player import inventory if item_id == "ingredients" or item_id == "boot": if item_waterboot in inventory: inventory.remove(item_ingredients) inventory.remove(item_waterboot) inventory.append(item_hangover) print("You mix the ingredients in the old boot full of water.") else: print("Nothing interesting happens.") else: print("Nothing interesting happens")
def inter_fountain(item_id,object_id): from player import inventory if item_id == "boot" and item_oldboot in inventory: inventory.remove(item_oldboot) inventory.append(item_waterboot) print("You fill the old boot up with water.") elif item_id == "goblet": inventory.remove(item_goblet) inventory.append(item_watergoblet) print("You fill the wooden goblet up with water.") else: print("Nothing interesting happens")
def player_mass(items): from player import inventory global current_room total_mass = 0 for item in items: total_mass = total_mass + item["mass"] if total_mass >3: print("You can't carry anymore.") print("") inventory.remove(item) current_room["items"].append(item)
def execute_give(item_id): """This function takes an item_id as an argument and transfers this item from the player's inventory to the character who is in the current room that the player is in. However, if there is no such item in the inventory, this function prints "You don't have that in your inventory." """ global inventory for ite in inventory: if item_id == ite["id"]: current_room["character"]["items"].append(ite) inventory.remove(ite) print("You have given " + ite["name"] + " to " + current_room["character"]["id"] + ".") time.sleep(1) # 3
def inter_smashgrate(item_id,object_id): from player import inventory from player import current_room from map import rooms global current_room if item_id == "rock": inventory.remove(item_rock) print("""You smash the grating with the rock, a small hole is opened. You can see light outside...""") input("Press ENTER to continue...") print("""You crawl through the small space and your eyes struggle to adjust to the bright sunlight.""") current_room = rooms["Courtyard"] from game import main main()
def inter_gold(item_id,object_id): from player import inventory if item_id == 'gold' and item_money in inventory: print("\"Ah gold, that's loosened my lips a little.") print("Gaius is the old drunken wizard in the great hall.\"") inventory.remove(item_money) from conversations import conv_soldier1 from conversations import conv_lady conv_soldier1["questions"] = people_conversations["Qsoldier_paid"] conv_soldier1["responses"] = people_conversations["Rsoldier_paid"] conv_lady["questions"] = people_conversations["Qlady_change1"] conv_lady["responses"] = people_conversations["Rlady_change1"] from map import room_courtyard room_courtyard["puzzles"] = people_conversations["Plady_riddle"] object_soldier1["interaction"] = inter_turner else: print("Nothing interesting happens")
def inter_cure(item_id, object_id): from player import inventory if item_id == "boot" and item_hangover in inventory: from conversations import conv_wizard print("You give the smelly old boot containing a hangover cure to the wizard.") print("The wizard sniffs it curiously. Then proceeds to drink the contents...\n") inventory.remove(item_hangover) print("""The wizard seems to recover from his hangover instantly! If only you knew what ingredients the lady used to make such a potion.""", "\n") print("\"I cannot talk here. Meet me in the anteroom to the north\"\n") conv_wizard["opening"] = people_conversations["wizard_cured"] conv_wizard["questions"] = people_conversations["Qwizard_cured"] conv_wizard["responses"] = people_conversations["Rwizard_cured"] from map import room_greathall from map import room_ante from people import people_wizard room_greathall["description"] = """A Grand hall, with fine tapestries and paintings on every wall. A straight oak table stands in centre of the hall with many chairs. At the head of the table, a grand gilded chair dominates the room.""" room_ante["description"] = """The room is the same as ever. However you now happen to notice an odd picture on the wall with a mechanical dial next to it.""" room_greathall["people"] = {} room_greathall["objects"] = [] room_greathall["items"] = [] room_ante["people"] = {"wizard": people_wizard} room_ante["objects"] = [object_wizard, object_dial, object_painting] object_wizard["interaction"] = inter_turner elif item_id == "goblet" and item_hangover2 in inventory: print("*The wizard bats the goblet away*") print("\"$!&@*! I will never drink from such a thing of my own will!\"") print("(Looks like you'll need to find something else to contain the cure)") else: print("Nothing interesting happens")
def execute_drop(item_id): """This function takes an item_id as an argument and moves this item from the player's inventory to list of items in the current room. However, if there is no such item in the inventory, this function prints "You cannot drop that." """ global current_room global inventory drop = False for item in inventory: if item["id"] == item_id: current_room["items"].append(item) inventory.remove(item) drop = True if drop == False: print("You cannot drop that.") pass
def execute_drop(item_id): """This function takes an item_id as an argument and moves this item from the player's inventory to list of items in the current room. However, if there is no such item in the inventory, this function prints "You cannot drop that." """ item_dropped = False global inventory for ite in inventory: if item_id == ite["id"]: current_room["items"].append(ite) inventory.remove(ite) print("You have dropped " + ite["name"] + " at " + current_room["name"] + ".") item_dropped = True time.sleep(1) # 3 if item_dropped == False: print("This doesn't make sense.") item_taken = False time.sleep(1) # 3
def inter_cure(item_id): from player import inventory if item_id == "boot" and item_hangover in inventory: from conversations import conv_wizard print( "You give the smelly old boot containing a hangover cure to the wizard." ) print( "The wizard sniffs it curiously. Then proceeds to drink the contents...\n" ) inventory.remove(item_hangover) print("""The wizard seems to recover from his hangover instantly! If only you knew what ingredients the lady used to make such a potion.""") conv_wizard["opening"] = people_conversations["wizard_cured"] conv_wizard["questions"] = people_conversations["Qwizard_cured"] conv_wizard["responses"] = people_conversations["Rwizard_cured"] elif item_id == "goblet" and item_hangover2 in inventory: print("*The wizard bats the goblet away*") print("$!&@*! I will never drink from such a thing of my own will!") print( "(Looks like you'll need to find something else to contain the cure)" ) else: print("Nothing interesting happens")
def checkProgress(current_room): from player import inventory, story_progress if current_room[ "name"] == "Samantha's Office" and not stage_1["Completion"]: stage_1["Completion"] = True elif current_room["name"] == "Samantha's Office" and ( STORY_TALKED_TO_SAMANTHA in story_progress) and not stage_2["Completion"]: stage_2["Completion"] = True elif (STORY_TALKED_TO_STEPHEN in story_progress) and not stage_3["Completion"]: Stephen["inventory"].remove(item_usb) inventory.append(item_usb) stage_3["Completion"] = True elif current_room[ "name"] == "Computer Mainframe" and not stage_3_3["Completion"]: if not stage_3_2["Completion"]: story_progress.append(STORY_ENTER_MAINFRAME) if (item_usb in inventory) and (item_login in inventory): story_progress.append(STORY_USB_IN_MAINFRAME) inventory.remove(item_usb) print("login and usb inputted") stage_3_2["Completion"] = True if item_ink in inventory: print("printing diagnostics") inventory.append(item_vault_log) inventory.remove(item_ink) stage_3_3["Completion"] = True story_progress.append(STORY_HAS_DIAGNOSTICS) else: print("printer out of ink, please refill") elif (item_usb in inventory) or (item_login in inventory): if item_usb in inventory: print("Need login details") elif item_login in inventory: print("Please input usb") else: print("usb and login required") elif stage_3_2["Completion"] and not stage_3_3["Completion"]: if item_ink in inventory: print("printing diagnostics") inventory.append(item_vault_log) inventory.remove(item_ink) stage_3_3["Completion"] = True story_progress.append(STORY_HAS_DIAGNOSTICS) else: print("printer out of ink, please refill") elif (STORY_HAS_DIAGNOSTICS in story_progress) and not stage_3_4["Completion"]: if item_vault_log in Stephen["inventory"]: story_progress.append(STORY_COFFEE_STARTED) stage_3_4["Completion"] = True print(stage_4Coffee["StephenStart"]) elif item_vault_log in Debra["inventory"]: story_progress.append(STORY_DOUBLE_STARTED) stage_3_4["Completion"] = True print(stage_4Agent["DebraStart"]) elif (STORY_COFFEE_STARTED in story_progress): if current_room["name"] == "the Vault Room": if not stage_4_1C["Completion"]: story_progress.append(STORY_ENTER_VAULT) if (item_vault_pass in inventory): inventory.append(item_tech) story_progress.append(STORY_HAS_TECH) print("Password accepted. Tech acquired") stage_4_1C["Completion"] = True else: print("Vault Password required.") elif (STORY_HAS_TECH in story_progress) and not stage_4_2C["Completion"]: if item_tech in Stephen["inventory"]: story_progress.append(STORY_COFFEE_COLLECTION_STARTED) stage_4_2C["Completion"] = True elif (STORY_COFFEE_COLLECTION_STARTED in story_progress) and not stage_5Coffee["Completion"]: if (item_mugs in Stephen["inventory"]) and ( item_power_lead in Stephen["inventory"]) and (item_heat_plate in Stephen["inventory"]): story_progress.append(STORY_COFFEE_MADE) stage_5Coffee["Completion"] = True print(stage_6Coffee["StephenStart"]) elif (STORY_COFFEE_MADE in story_progress) and not stage_6Coffee["Completion"]: if current_room["name"] == "Computer Mainframe": inventory.append(item_usb) elif item_usb in Stephen["inventory"]: print(stage_7Coffee["StephenStart"]) story_progress.append(STORY_USB_BACK) elif (STORY_DOUBLE_STARTED in story_progress): if not stage_4Agent["Completion"]: if (item_camera in Debra["inventory"]) and ( item_recorder in Debra["inventory"]) and (item_gun in Debra["inventory"]): story_progress.append(STORY_EVIDENCE_FOUND) stage_4Agent["Completion"] = True Debra["inventory"].remove(item_gun) inventory.append(item_gun) print(stage_5Agent["DebraStart"]) elif not stage_5Agent[ "Completion"] and STORY_EVIDENCE_FOUND in story_progress: if current_room[ "name"] == "Computer Mainframe" and item_gun in inventory: print("Running fingerprints...") time.sleep(2) print("Match found!") print("Fingerprints match Jenifer's data.") elif current_room["name"] == "the Break Room": if STORY_CORRECT_AGENT in story_progress: stage_5Agent["Completion"] = True print(stage_6Agent["SamanthaStart"]) choice = [] while choice != ["chest"] and choice != ["leg"]: shoot = input("Shoot Jenifer in the CHEST or LEG: ") choice = normalise_input(shoot) if choice == ["chest"]: story_progress.append(STORY_CHEST_SHOT) print(stage_7Agent["SamanthaStart"]) elif choice == ["leg"]: story_progress.append(STORY_LEG_SHOT) print(stage_8Agent["SamanthaStart"]) elif STORY_INCORRECT_AGENT in story_progress: stage_5Agent["Completion"] = True print(stage_9Agent["SamanthaStart"])