Commit 010ae392 by BellCodeEditor

save project

parent db1f748c
Showing with 4 additions and 2 deletions
...@@ -5,6 +5,7 @@ class Hero: # 英雄类 ...@@ -5,6 +5,7 @@ class Hero: # 英雄类
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
self.type = "战士"
def combat(self, enemy): # 攻击功能 def combat(self, enemy): # 攻击功能
...@@ -27,7 +28,8 @@ class Player(Hero): # 玩家英雄 ...@@ -27,7 +28,8 @@ class Player(Hero): # 玩家英雄
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
self.type = "射手"
print("角色"+self.name+"创建成功,英雄类型为:"+self.type,"\n",end="")
print("等级:",self.level,"血量:",self.hp,"攻击力:",self.attack,end="")
houyi = Player("后羿") houyi = Player("后羿")
yase = Hero("亚瑟") yase = Hero("亚瑟")
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