Commit c3a9796c by BellCodeEditor

save project

parent 1b2b1bd7
Showing with 5 additions and 4 deletions
...@@ -8,7 +8,8 @@ class Hero(object): ...@@ -8,7 +8,8 @@ class Hero(object):
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
self.hp = self.hp+30 blood = random.randint(20,50)
self.hp = self.hp+blood
if self.hp > self.max_hp: if self.hp > self.max_hp:
self.hp = self.max_hp self.hp = self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
...@@ -44,12 +45,12 @@ print(' 战斗开始') ...@@ -44,12 +45,12 @@ print(' 战斗开始')
while True: while True:
print('-'*30) print('-'*30)
choice = input("请选择战斗方式,1出击,2 ICU") choice = input("请选择战斗方式,1出击,2 ICU")
if i=="q" if choice=="q":
print('游戏结束') print('游戏结束')
break break
elif choice == "1" elif choice == "1":
houyi.combat(yase) houyi.combat(yase)
elif choice == "2" elif choice == "2":
houyi.cure() houyi.cure()
else: else:
print("请重新输入1或2") print("请重新输入1或2")
......
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