Commit de41a9f4 by BellCodeEditor

save project

parent b64abddc
Showing with 22 additions and 3 deletions
inport
class Hero: # 英雄类 class Hero: # 英雄类
def __init__(self, name): # 实例属性 def __init__(self, name): # 实例属性
self.name = name self.name = name
...@@ -45,7 +46,25 @@ print(' 战斗开始') ...@@ -45,7 +46,25 @@ print(' 战斗开始')
while True: while True:
print('-'*40) print('-'*40)
choice=input('请选择攻击or治疗,1为攻击,2为治疗:') choice=input('请选择攻击or治疗,1为攻击,2为治疗:')
elif choice==1: if choice=="q":
houyi.combat() print('游戏结束')
elif choice==2: break
elif choice=='1':
houyi.combat(yase)
elif choice=='2':
houyi.cure() houyi.cure()
else:
print('输入错误请重新输入')
continue
num = randon.randint(1,3)
if num==1:
yase.cure()
else:
yase.combat(houyi)
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