MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / player_interact

Function player_interact

TEXTVENTURE/game.py:330–361  ·  view source on GitHub ↗
(action)

Source from the content-addressed store, hash-verified

328
329# Player Interaction
330def player_interact(action):
331 if ZONE_MAP[player.location]["SOLVED"]:
332 print("\nYou visited this place earlier. Move further!\n")
333 return
334
335 else:
336 if action == 'inspect':
337 print("\n" + ZONE_MAP[player.location]["DESCRIPTION"])
338 return
339
340 elif action == 'examine' or action == 'interact':
341 print("\n" + ZONE_MAP[player.location]["EXAMINATION"])
342 return
343
344 elif action == 'look':
345 # Display effects if there are any.
346 if len(player.effects) > 0:
347 print("\nYou have entitled with the following effects:")
348 for effect in player.effects:
349 sys.stdout.write("\t" + effect + "\n")
350 sys.stdout.flush()
351 time.sleep(0.5)
352
353 return
354
355 else:
356 print("\nYou have no effects.\n")
357 return
358
359 else:
360 print("\nI don't understand that command.\nPlease enter a valid command. ⚠️\n")
361 return
362
363
364# Movement Handler

Callers 1

promptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected