I'm building a text adventure game for one of my projects. I'm currently trying to make it so that only certain weapon options appear depending on which 'class' the player has previously selected. For eg. if the player has chosen ranger, only bow or dagger will appear. Regardless of what the player has chosen, only the warrior options appear. Any advice?
def preferred_weapon(player_class):
"""
Player chooses their preferred weapon, each class has different options.
"""
fprint("I'm sure you're strong in a fight, but if you had to choose, which weapon would be your preference?\n", 1)
if player_class == "warrior" or "Warrior":
fprint("Sword")
fprint("or")
fprint("Axe")
while True:
weapon = input(" ")
weapons = ["sword", "Sword", "axe", "Axe"]
if weapon in weapons:
print(f"The mighty {weapon}, of course... of course.")
break
else:
print("Please type one of the weapons listed.")
continue
elif player_class == "ranger" or "Ranger":
fprint("Dagger")
fprint("or")
fprint("Bow")
while True:
weapon = input(" ")
weapons = ["dagger", "Dagger", "bow", "Bow"]
if weapon in weapons:
print(f"The elegant {weapon}, of course... of course.")
break
else:
print("Please type one of the weapons listed.")
continue
else:
fprint("Staff")
fprint("or")
fprint("Spell Tome")
while True:
weapon = input(" ")
weapons = ["staff", "Staff", "spell tome", "Spell Tome"]
if weapon in weapons:
print(f"The mystical {weapon}, of course... of course.")
break
else:
print("Please type one of the weapons listed.")
continue
return weapon