Commit 29f1a02b by BellCodeEditor

save project

parent ce8fb2f8
Showing with 4 additions and 2 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 += 60 blood = random.randint(30,50)
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)
...@@ -40,8 +41,9 @@ class Player(Hero): ...@@ -40,8 +41,9 @@ class Player(Hero):
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
print("-"*30) print("-"*30)
print("战斗开始") print(" 战斗开始")
while True: while True:
print("-"*53)
choice = input("请选择:1攻击/2治疗/3退出:") choice = input("请选择:1攻击/2治疗/3退出:")
if choice == "3": if choice == "3":
print("游戏结束") print("游戏结束")
......
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