Commit 9f4c88a9 by BellCodeEditor

save project

parent 6aab6e8f
Showing with 2 additions and 23 deletions
...@@ -6,7 +6,6 @@ class Hero(object): ...@@ -6,7 +6,6 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
if self.hp+60>self.max_hp: if self.hp+60>self.max_hp:
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.max_hp) print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.max_hp)
...@@ -45,28 +44,7 @@ yase = Hero("垭瑟") ...@@ -45,28 +44,7 @@ yase = Hero("垭瑟")
# yase.cure() # yase.cure()
print('-'*30) print('-'*30)
print(' 开始') print(' 开始')
import random
while True: while True:
print('-'*30) print('-'*30)
a=input('用技能(攻击1,治疗2)') input('用技能(攻击1,治疗2)')
if a=="1":
houyi.combat(yase)
elif a=="2":
houyi.cure()
elif a=="q":
print("结束")
break
else:
print("无效,重新输")
continue
num=random.randint(1,3)
if num==1:
yase.cure()
else:
yase.combat(houyi)
\ 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