Commit 8b50aab5 by BellCodeEditor

auto save

parent de0f22d8
Showing with 9 additions and 4 deletions
...@@ -36,7 +36,12 @@ class Player(Hero): ...@@ -36,7 +36,12 @@ class Player(Hero):
self.max_hp=self.hp self.max_hp=self.hp
self.hero_type = hero_type self.hero_type = hero_type
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
def cure(self):#治疗术
asdfghjkl=random.randint(30,50)
self.hp=self.hp+asdfghjkl
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:,",asdfghjkl,"目前的血量为:",self.hp)
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
...@@ -49,12 +54,12 @@ while True: ...@@ -49,12 +54,12 @@ while True:
if choice=="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("请重新输入) print("请重新输入")
start=random.randint(1,3) start=random.randint(1,3)
if start=="1": if start=="1":
yase.cure() yase.cure()
......
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