Commit 1c888bfd by BellCodeEditor

save project

parent c0fe9bc7
Showing with 29 additions and 3 deletions
class Hero:
def __init__(self):
self.
\ No newline at end of file
def __init__(self,name):
self.name = name
self.level = 1
self.hp = 250
self.attacK = 40
self.max_hp = self
def combat(self,enemy):
info1 = self.name + self.name
info2 = '造成' + str(self.attack) + '点伤害,'
enemy.hp -= self.attack
if enemy.hp > 0:
info3 = enemy.name + '还剩下' + str(enemy.hp) + '血量'
info = info1 + info2 + info3
print(info)
else:
info3 = enemy.name + '阵亡,游戏结束'
info = info1 + info2 + info3
print(info)
exit()
class Hero:
def __init__(self,name,hero_type):
super(Player,self).__init__(name)
self.hp = 200
self.attacK = 50
self.hero_type = hero_type
print('角色')
\ No newline at end of file
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