Commit 6d26999c by BellCodeEditor

save project

parent ffaf0f24
Showing with 10 additions and 5 deletions
...@@ -21,11 +21,16 @@ class Hero: # 英雄类 ...@@ -21,11 +21,16 @@ class Hero: # 英雄类
class Player(Hero): # 玩家英雄 class Player(Hero): # 玩家英雄
def __init__(self,name): def __init__(self,name,htype):
super().__init__(name) super().__init__(name)
self.hp=500 self.hp=500
self.attack=40 self.attack=40
self.htype=htype
player = Player("后羿") print("創建英雄:"+self.name+"創建成功")
print("玩家的血量值为:",player.hp) print("英雄類型是:"+self.htype)
print("玩家的攻击力为:",player.attack) print("攻擊力是"+str(self.attack))
yase=Player("亞瑟","肉盾")
houyi=Hero("后羿")
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