Commit cda687a4 by BellCodeEditor

save project

parent 12f714a5
Showing with 10 additions and 9 deletions
...@@ -20,12 +20,10 @@ class Hero(object): ...@@ -20,12 +20,10 @@ class Hero(object):
info3 = enemy.name+"还剩下"+str(enemy.hp)+"血量" info3 = enemy.name+"还剩下"+str(enemy.hp)+"血量"
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
print("-"*50)
else: else:
info3 = enemy.name+"阵亡,游戏结束" info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
print("-"*50)
exit() exit()
class Player(Hero): class Player(Hero):
...@@ -37,13 +35,17 @@ class Player(Hero): ...@@ -37,13 +35,17 @@ class Player(Hero):
self.hero_type = hero_type self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
print("-"*50)
print(" 战斗开始")
houyi = Player("射手", "后羿") houyi = Player("后羿","射手")
yase = Hero("垭瑟") yase = Hero("垭瑟")
print("-" * 50)
print(" 战斗开始")
while True: while True:
print("-"*50) print("-" * 50)
sb=0
sb=input("请选择释放英雄技能(1攻击/2治疗)") sb=input("请选择释放英雄技能(1攻击/2治疗)")
if sb=1: if sb=="1":
Player(combat) Player.combat(houyi,yase)
\ No newline at end of file elif sb=="2":
Player.cure(houyi)
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