Commit 533a5980 by BellCodeEditor

save project

parent bf8622f4
Showing with 17 additions and 2 deletions
...@@ -17,10 +17,26 @@ class Hero(object): ...@@ -17,10 +17,26 @@ class Hero(object):
else: else:
print(enmey.name+"阵亡,游戏结束") print(enmey.name+"阵亡,游戏结束")
exit() exit()
def zhiliao(self):
self.hp+=50
self.attack+=10
print(self.name+"开启了治疗模式")
def youxi(self,enmey):
a=int(input(self.name+"请选择:1(治疗)or 2(攻击)"))
if a==1:
self.zhiliao()
if a==2:
self.combat(enmey)
qiao = Hero("乔治") qiao = Hero("乔治")
pei= Hero("佩奇") pei= Hero("佩奇")
while 1: while 1:
print("-"*50)
qiao.youxi(pei)
pei.youxi(qiao)
qiao.combat(pei) qiao.combat(pei)
pei.combat(qiao) pei.combat(qiao)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment