Commit f762e986 by BellCodeEditor

save project

parent d6c81a0f
Showing with 22 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
亚瑟=Hero('亚瑟',4500,130)
后羿=Hero('后羿',3900,155)
#print("亚瑟攻击力为:",亚瑟.attack)
#rint("后羿攻击力为:",后羿.attack)
def upgrade(self):
亚瑟.attack=亚瑟.attack+20
亚瑟.level=亚瑟.level+1
亚瑟.hp=亚瑟.hp+200
#亚瑟=Hero("亚瑟",4500,130)
#print("当前血量为:",亚瑟.hp)
亚瑟=Hero("亚瑟",4500,130)
亚瑟.upgrade()
print("等级为:",亚瑟.level)
print("血量为:",亚瑟.hp)
print("攻击力为:",亚瑟.attack)
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