def f():
global choice,yourobject,choice2,Hp,Hunger,obj1,obj2,obj3,obj4,obj5,obj6,obj7,nun,koo,Def,Atk,uplimit
while True:
try:
choice=int(input('\n>>(查看人物状态,返回1;查看物品栏,返回2):'))
break
except:
print('error')
if choice==1:
print('查看人物状态')
print('生命:'+str(Hp)+'\n'+'饥饿:'+str(Hunger)+'\n'+'攻击:'+str(Atk)+'\n'+'防御:'+str(Def))
if choice==2:
print('查看物品栏')
print(sorted(yourobject.values()))
if sorted(yourobject.values())==[]:
print('物品栏为空!')
koo=1
else:
while True:
try:
choice2=int(input('是否使用物品?(是:1;否;2):'))
koo=0
break
except:
print('error')
if choice2==1 and koo==0:
while True:
try:
nun=int(input('请输入将使用物品的序号:'))
break
except:
print('error')
print('你使用了'+yourobject1[nun])
if obj1>=2 and nun==1:
obj1-=1
Hunger+=80
if Hunger>=uphunger:
Hunger=uphunger
print('###############饥饿已达上线!')
else:
print('Hunger+80')
yourobject[1]=str(1 )+'牛肉干'+'×'+str(obj1)
elif obj1==1 and nun==1:
yourobject.pop(nun)
Hunger+=80
if Hunger>=uphunger:
Hunger=uphunger
print('###############饥饿已达上线!')
else:
print('Hunger+80')
elif obj2>=2 and nun==2:
obj2-=1
Hp+=50
if Hp>=uplimit:
Hp=uplimit
print('###############血量已达上线!')
else:
print('Hp:+50')
yourobject[2]=str(2 )+'旺仔牛奶'+'×'+str(obj2)
elif obj2==1 and nun==2:
yourobject.pop(nun)
Hunger+=1
Hp+=50
if Hp>=uplimit:
Hp=uplimit
print('###############血量已达上线!')
else:
print('Hp:+50')
elif obj3>=2 and nun==3:
obj3-=1
Atk+=15
Hp+=90
if Hp>=uplimit:
Hp=uplimit
print('###############血量已达上线!')
print('攻击+15')
else:
print('Hp:+90\n攻击+15')
yourobject[3]=str(3 )+'红牛'+'×'+str(obj3)
elif obj3==1 and nun==3:
yourobject.pop(nun)
Atk+=15
Hp+=90
if Hp>uplimit:
Hp=uplimit
print('###############血量已达上线!')
print('攻击+15')
else:
print('Hp:+90\n攻击+15')
elif obj4>=2 and nun==4:
obj4-=1
Hunger+=100
if Hunger>=uphunger:
Hunger=uphunger
print('###############饥饿已达上线!')
else:
print('Hunger+100')
yourobject[4]=str(4 )+'鱼肉罐头'+'×'+str(obj4)
elif obj4==1 and nun==4:
yourobject.pop(nun)
Hunger+=100
if Hunger>=uphunger:
Hunger=uphunger
print('###############饥饿已达上线!')
else:
print('Hunger+100')
elif obj5>=2 and nun==5:
obj5-=1
Def+=10
print('防御+10')
yourobject[5]=str(5 )+'健力多'+'×'+str(obj5)
elif obj5==1 and nun==5:
yourobject.pop(nun)
Def+=10
print('防御+10')
elif obj6>=2 and nun==6:
obj6-=1
uplimit+=300
print('生命上限+300')
yourobject[6]=str(6 )+'肾宝片'+'×'+str(obj6)
elif obj6==1 and nun==6:
yourobject.pop(nun)
uplimit+=300
print('生命上限+300')
elif obj7>=2 and nun==7:
obj7-=1
Atk+=1
Def+=1
print('攻击+1\n防御+1')
yourobject[7]=str(7 )+'彩虹糖'+'×'+str(obj7)
elif obj7==1 and nun==7:
yourobject.pop(nun)
Atk+=1
Def+=1
print('攻击+1\n防御+1')
if choice==2019:
print('获得一枚肾宝片!!!')
name='肾宝片'
q()
obj6+=1
yourobject[6]=str(6 )+name+'×'+str(obj6)
yourobject1[6]=name
elif choice==520:
Atk+=200
elif choice==1314:
Def+=50
def g():
global time,choice1
while True:
try:
print('\n现在是{},你该如何行动?\n>>1.搜索物资;2.打开菜单栏;3.在庇护所修整'.format(timedic[time]))
choice1=int(input('>>你的选择是(输入1或2或3)?:'))
break
except:
print('error')
def t():
enter=input('(enter继续游戏)')
if enter=='':
pass
def t1():
enter=input('(enter继续战斗!)\n')
if enter=='':
print('\n'+'*'*50)
def w():
global Hp,die,tap
ff=randint(0,50)
if ff==12 or ff==5 or ff==28 or ff==44:
print('\n糟糕!\n出现了僵尸头目!!!')
Hp-=50
print('经过战斗,你损失了50点HP\n-50Hp')
elif tap==1:
print('你遭遇了尸潮!!!')
Hp-=300
print('受到重创!!!\nHp-300')
die=1
elif ff>30 and ff<40:
print('\n糟糕!\n出现了普通僵尸!!!')
Hp-=10
print('经过战斗,你损失了10点HP\n-10Hp')
else:
print('\n你没有惊动丧尸。\n')
def w1():
global monster,Hp,Hp1
print('{}发现了你!!!\n你将面临苦战!'.format(monster))
t()
while Hp>0 and Hp1>0:
first=randint(0,1)
if first==0:
print('>>{}的回合!\n'.format(monster))
w2()
t1()
elif first==1:
print('>>你的回合!\n')
w3()
t1()
def w2():
global Atk1,Def,Hp,Hp1
mon1=randint(1,1