Commit 8485b196 by BellCodeEditor

save project

parent e9d856a7
Showing with 6 additions and 1 deletions
class Hero: # 英雄类 class Hero(opject): # 英雄类
def __init__(self, name): # 实例属性 def __init__(self, name): # 实例属性
self.name = name self.name = name
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
def cure(self):
self.hp = self.hp + 60
if self.hp > self.max_hp
self.hp = self.max_hp
print(self.name + "使用了治疗,血量加:",60,"血量为:", self.hp)
def combat(self, enemy): # 攻击功能 def combat(self, enemy): # 攻击功能
......
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