Commit 71261e45 by BellCodeEditor

save project

parent 0fb50f79
Showing with 7 additions and 1 deletions
...@@ -7,7 +7,10 @@ class Hero(object): ...@@ -7,7 +7,10 @@ class Hero(object):
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): def cure(self):
c=randm self.hp=self.hp+60
if self.hp>self.max_hp:
self.hp==self.max_hp
print(self.name+'使用了治疗术,血量增加',)
def combat(self,a): # 攻击 def combat(self,a): # 攻击
a.hp=a.hp-self.attack a.hp=a.hp-self.attack
...@@ -28,3 +31,6 @@ class Player(Hero): ...@@ -28,3 +31,6 @@ class Player(Hero):
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
self.max_hp = self.hp self.max_hp = self.hp
self.type = type
print('角色'+self.name+'创建成功,英雄类型为:'+self.type)
print('角色属性是:'+self.attack+','self.type)
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