Commit 79cc8f1e by BellCodeEditor

auto save

parent 15abf93f
Showing with 2 additions and 5 deletions
...@@ -5,8 +5,6 @@ class Hero: # 英雄类 ...@@ -5,8 +5,6 @@ class Hero: # 英雄类
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
def combat(self, enemy): # 攻击功能 def combat(self, enemy): # 攻击功能
info1 = self.name+"对"+enemy.name+"发起进攻," info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害," info2 = "造成"+str(self.attack)+"点伤害,"
...@@ -20,14 +18,13 @@ class Hero: # 英雄类 ...@@ -20,14 +18,13 @@ class Hero: # 英雄类
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
exit() exit()
class Player(Hero): # 玩家英雄 class Player(Hero): # 玩家英雄
def __init__(self,name): def __init__(self,name):
super().__init__(name) super().__init__(name)
self.hp=20000000000000 self.hp=20000000000000
self.attack=999999999999999999999999999999999999999999999999999 self.attack=999999999999999999999999999999999999999999999999999
player = Player("后羿") player = Player("后羿")
print("杀手的血量值为:",player.hp) print("杀手的血量值为:",player.hp)
print("杀手的攻击力为:",player.attack) print("杀手的攻击力为:",player.attack)
print("kdsjfhrdghrebhbvfujfvbkuhgb的血量值为:",enemy.hp)
print("kdsjfhrdghrebhbvfujfvbkuhgb的攻击力为:",enemy .attack)
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