Commit c0572f7a by BellCodeEditor

save project

parent 49240410
Showing with 9 additions and 5 deletions
...@@ -12,7 +12,7 @@ class Hero(object): ...@@ -12,7 +12,7 @@ class Hero(object):
self.hp=self.max_hp self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:", 30,",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击 def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻," info1 = self.name+"对"+enemy.name+"发起进攻,"
...@@ -40,8 +40,12 @@ class Player(Hero): ...@@ -40,8 +40,12 @@ class Player(Hero):
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
print("_"*30)
print(" 战斗开始")
print("_"*30)
while True: while True:
print("_"*30) a=input("1,攻击,2,治疗:")
a=input() if a=='1':
houyi.combat(yase)
else:
houyi.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