python 用eclipse编辑器编写唐僧打白骨精
#coding:utf-8
'''
Created on 2019年7月10日
@note:唐僧打白骨精
@author: LSW
@version: 3.0
'''
YaoGj = 10;#妖怪攻击力
YaoSm = 100;#妖怪血量
TanGj = 1;#唐僧初始攻击
TanSm = 2;#唐僧血量
TanLan = 10;#唐僧蓝量
ReBlue = 2;#唐僧回复蓝药水个数
ReBlood = 3;#唐僧回复血量药水个数
print('*'*20),
print"唐僧大战白骨精",
print('*'*20);
print("选择你的身份:");
print('\t'+"1.唐僧"+'\t'+"2.白骨精");
ChoPeople = int(input("请选择"));
if(ChoPeople == 1):
print("你选择了唐僧"),
print("唐僧初始生命2点,攻击力为1点");
else:
print("想选白骨精,白骨精没有选择你,"),
print("唐僧最后选择了你,"),
print("唐僧初始生命2点,攻击力为1点");
while True:
print("选择你要做的事:");
print('\t'+"1.练级"+'\t'+"2.打boss"+'\t'+"3.逃跑");
choose = int(input("选择操作[1-3]:"));
if(choose == 1):
TanGj+=1;
TanSm+=10;
print("此时唐僧的攻击为%d,生命为%d"%(TanGj,TanSm));
elif(choose == 2):
while True:
print("请选择技能:");
print('\t'+"1.普通攻击"+'\t'+"2.禅杖攻击:伤害10,消耗蓝5"+'\t'+"3.火焰禅杖:伤害20,消耗蓝10"+'\t'+"4.喝蓝药水:回复蓝10"+'\t'+"5.喝血瓶:回复血量20");
Skill = int(input("请输入你的技能"));
if(Skill == 1):
print("你攻击了boss一下");
YaoSm-=TanGj;
if(YaoSm <= 0):
YaoSm = 0;
print("白骨精血量%d"%(YaoSm));
if(YaoSm <= 0):
print("获得胜利,白骨精死亡");
break;
else:
print("白骨精打了你一下");
TanSm-=YaoGj;
if TanSm < 0:
TanSm = 0;
print("唐僧的血量%d"%(TanSm));
if(TanSm <= 0):
print("唐僧死亡,游戏结束,你输了");
break;
if(Skill == 2):
if TanLan<5:
print("蓝不够无法释放");
continue;
else:
TanLan-=5;
print("你用‘禅杖攻击’攻击了boss一下");
YaoSm-=10;
if(YaoSm <= 0):
YaoSm = 0;
print("白骨精血量%d"%(YaoSm));
if(YaoSm <= 0):
print("获得胜利,白骨精死亡");
break;
else:
print("白骨精打了你一下");
TanSm-=YaoGj;
if TanSm < 0:
TanSm = 0;
print("唐僧的血量%d"%(TanSm));
if(TanSm <= 0):
print("唐僧死亡,游戏结束,你输了");
break;
if(Skill == 3):
if TanLan<10:
print("蓝不够无法释放");
continue;
else:
TanLan-=10;
print("你用‘火焰禅杖’攻击了boss一下");
YaoSm-=20;
if(YaoSm <= 0):
YaoSm = 0;
print("白骨精血量%d"%(YaoSm));
if(YaoSm <= 0):
print("获得胜利,白骨精死亡");
break;
else:
print("白骨精打了你一下");
TanSm-=YaoGj;
if TanSm < 0:
TanSm = 0;
print("唐僧的血量%d"%(TanSm));
if(TanSm <= 0):
print("唐僧死亡,游戏结束,你输了");
break;
if(Skill == 4):
if ReBlue < 0:
print("回复蓝药瓶不足");
else:
TanLan+=10;
print("白骨精打了你一下");
TanSm-=YaoGj;
if TanSm < 0:
TanSm = 0;
print("唐僧的血量%d"%(TanSm));
if(TanSm <= 0):
print("唐僧死亡,游戏结束,你输了");
break;
if(Skill == 5):
if ReBlood < 0:
print("回复血量药瓶不足");
else:
TanSm+=20;
print("白骨精打了你一下");
TanSm-=YaoGj;
if TanSm < 0:
TanSm = 0;
print("唐僧的血量%d"%(TanSm));
if(TanSm <= 0):
print("唐僧死亡,游戏结束,你输了");
break;
break;
elif(choose == 3):
print("你逃跑了,虽然你逃跑了,但是你输了");
break;
else:
print("输入错误请重新输入");
本文为原创,转载请链接此处,谢谢