Commit 12b5b87a by BellCodeEditor

save project

parent 894fb6ab
Showing with 7 additions and 2 deletions
...@@ -6,8 +6,12 @@ class Hero: # 英雄类 ...@@ -6,8 +6,12 @@ class Hero: # 英雄类
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
def cure(self,name): def cure(self):
self.hp+=60
if self.hp>self.max_hp:
self.hp=self.max_hp
print()
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)+"点伤害,"
...@@ -25,6 +29,7 @@ class Hero: # 英雄类 ...@@ -25,6 +29,7 @@ class Hero: # 英雄类
class Player(): # 玩家英雄 class Player(): # 玩家英雄
def __init__(self,name): def __init__(self,name):
super
print("玩家"+player.name+"创建成功") print("玩家"+player.name+"创建成功")
print("玩家"+player.name+"的攻击力,生命值为:",self.attack,self.hp) print("玩家"+player.name+"的攻击力,生命值为:",self.attack,self.hp)
......
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