王者荣耀游戏(购买武器)
'''
1、选择人物
2、购买武器 金币
3、打仗 赢得金币
4、选择删除武器
5、查看武器
6、退出武器
'''
print('*'*35)
print('\t欢迎来到王者荣耀')
print('*'*35)
role= input('请选择游戏人物:1、鲁班 2、后羿 3、李白 4、孙尚香 5、貂蝉 6、诸葛亮)')
coins=1000
weapon_list=[]
print('欢迎{0}来到王者荣耀,获得金币是:{1}'.format(role,coins))
while True:
choice=int(input('请选择:\n 1、购买武器\n 2、打仗\n 3、删除武器\n 4、查看武器\n 5、退出游戏\n'))
if choice == 1:
print('欢迎来到武器库:')
weapons=[['屠龙刀',500],['樱花枪',400],['98k手枪',1000],['手榴弹',800],['碧血剑',700],['鹅毛扇',800]]
for weapon in weapons:
print(weapon[0],weapon[1],sep=' ')
weaponname=input('请输入要购买的武器名称:')
if weaponname not in weapon_list:
for weapon in weapons:
if weaponname in weapon[0]:
if coins >weapon[1]:
coins-=weapon[1]
weapon_list.append(weapon[0])
print('{0}购买武器{1}成功!'.format(role,weaponname))
print('你现在金币为{}'.format(coins))
break
else:
print('金币不足,赶快打仗挣金币!')
break
else:
print('输入武器名称错误!')
else:
print('武器已在武器库,无需购买!')
elif choice==2:
pass
elif choice==3:
pass
elif choice == 4:
pass
elif choice == 5:
result=input('确定要离开王者荣耀吗?(yes/no):')
if result == 'yes':
break
else:
pass
else:
print('输入错误,请重新选择:')