Commit c9d61dcd by BellCodeEditor

save project

parent 3e66eed6
Showing with 18 additions and 4 deletions
import random
class Hero: # 英雄类 class Hero: # 英雄类
def __init__(self, name): # 实例属性 def __init__(self, name): # 实例属性
self.name = name self.name = name
self.level = 1 self.level = 1
...@@ -38,7 +40,19 @@ class Player(Hero): # 玩家英雄 ...@@ -38,7 +40,19 @@ class Player(Hero): # 玩家英雄
print(self.level,self.hp,self.attack) print(self.level,self.hp,self.attack)
houyi = Player("后羿","射手") houyi = Player("后羿","射手")
yase=Hero("亚瑟") yase=Hero("亚瑟")
houyi.combat(yase) print("-"*30)
yase.combat(houyi) print(" 战斗开始")
houyi.cure() while True:
yase.cure() print("-"*30)
A=input("请选择释放英雄技能(1攻击/2治疗:)")
if A =="q":
print("游戏结束")
break
elif A=="1":
houyi.combat(yase)
elif A=="2":
houyi.cure()
else:
yase.combat(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