Commit 2277c964 by BellCodeEditor

save project

parent 71261e45
Showing with 7 additions and 2 deletions
......@@ -10,7 +10,7 @@ class Hero(object):
self.hp=self.hp+60
if self.hp>self.max_hp:
self.hp==self.max_hp
print(self.name+'使用了治疗术,血量增加',)
print(self.name+'使用了治疗术,血量增加',60,'目前血量为:',self.hp)
def combat(self,a): # 攻击
a.hp=a.hp-self.attack
......@@ -33,4 +33,9 @@ class Player(Hero):
self.max_hp = self.hp
self.type = type
print('角色'+self.name+'创建成功,英雄类型为:'+self.type)
print('角色属性是:'+self.attack+','self.type)
print('角色的生命,攻击,属性是:'self.hp','self.attack','self.type)
print('_'*30)
print(' 战斗开始')
houyi=Player('后裔','射手')
yase=Hero('亚瑟')
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