Question: Working on my text based python game. When you move to the great hall where the goblin king is located, it you have all 8

Working on my text based python game. When you move to the great hall where the goblin king is located, it you have all 8 inventory items you should defeat the king, if not he kills you. When i move to the hall, nothing happens. Code is:
# Rooms dictionary with items
rooms ={
'Barracks': {'North': 'Officer Quarters', 'East': 'Courtyard', 'South': 'Stables', 'West': 'Arsenal'},
'Arsenal': {'East': 'Barracks', 'South': 'Armory', 'item': 'Sword'},
'Armory': {'North': 'Arsenal', 'items': 'Armor'},
'Stables': {'North': 'Barracks', 'South': 'Kitchen', 'item': 'Bolts'},
'Kitchen': {'North': 'Stables', 'East': 'Great Hall', 'item': 'Liquid Courage'},
'Officer Quarters': {'East': 'Lookout Tower', 'South': 'Barracks', 'item': 'Shield'},
'Lookout Tower': {'East': 'Main Gate', 'South': 'Courtyard', 'West': 'Officer Quarters', 'item': 'Helmet'},
'Main Gate': {'West': 'Lookout Tower', 'item': 'Spear'},
'Courtyard': {'North': 'Lookout Tower', 'South': 'Great Hall', 'West': 'Barracks', 'item': 'Crossbow'},
'Great Hall': {'North': 'Courtyard', 'West': 'Kitchen', 'villian': 'The Goblin King'}
}
#game intro
multi_text ='''
The Goblin King has snuck into your outpost and captured the Lord Regent.
You are woken from your sleep in the barracks by the alarm bells.
Before confronting The Goblin King, you must visit various outpost areas to gather your weapons and arms to defeat The Goblin King and save the Lord Regent.
You do not know which room in the outpost The Goblin King has taken The Lord Regent to.
Collect all the weapons and armor in the outpost before facing The Goblin King or he will surely kill you!
Good hunting brave soldier!
'''
print(multi_text)
# Player inventory
inventory =[]
#player status
def display_status(player_room, inventory):
print("You are in the", player_room)
print("Inventory:", inventory)
if 'item' in rooms[player_room]:
print("You see a", rooms[player_room]['item'])
print("---------------------")
# List commands
command_list =['Move North', 'Move South', 'Move East', 'Move West', 'Get', 'Inventory']
print("Please use the following commands:", command_list)
# Player's starting point
player_room = 'Barracks'
#Game_over
game_over = False
#win lose
win_lose =0
# Movement loop
while not game_over:
display_status(player_room, inventory)
# Get player command
move = input(f"Make your next move. Beware The Goblin King! (North, South, East, West, 'commands' for commands, 'get' to pick up an item, or 'inventory' to see inventory): ").strip().lower()
# Commands
if move == 'command':
print("Please use the following commands:", command_list)
elif move in ['move north', 'move south', 'move east', 'move west']:
direction = move.split()[1].capitalize()
if direction in rooms[player_room]:
player_room = rooms[player_room][direction]
print(f"You swiftly and silently move {direction} to {player_room}.")
else:
print(f"You bang your head on the wall. You can't go {direction} from the {player_room}.")
elif move == 'get':
if 'item' in rooms[player_room] and rooms[player_room]['item']:
items = rooms[player_room].pop('item') # Remove the item from the room
inventory.append(items) # Add the item to the inventory
print(f"You have added, {items}, to your inventory!")
else:
print("There are no items to pick up in this room.")
#list inventory
elif move == 'inventory':
print("Your inventory:")
for item in inventory:
print(item)
elif len(inventory)==8 and player_room == 'Great Hall':
print(f"You have slain The Goblin King! You have saved The Lord Regent! Huzzah!")
win_lose =1
game_over = True
elif len(inventory)!=8 and player_room == 'Great Hall':
print(f"The Goblin King dispatches you with ease. The Lord Regent must wait for another braver soldier to attempt is rescue...")
win_lose =2
game_over = True
else:
print("Invalid command. Please enter a valid command.")
if win_lose ==1:
print("You smited your enemy! Thank you for playing")
if win_lose ==2:
print("You have been defeated! Learn from your mistakes and try again. Thank you for playing!")
Working on my text based python game. When you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!