Commit 6dea7272 by BellCodeEditor

save project

parent d6c81a0f
Showing with 27 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def upgrade():
lvbu.level=lvbu.level+1
lvbu.hp=lvbu.hp+50
lvbu.attack=lvbu.attack+4
lvbu=Hero('吕布',300,20)
#zhaoyun=Hero('赵云',300,20)
#diaochan=Hero('貂蝉',300,20)
#luban=Hero('鲁班',300,20)
#caiwenji=Hero('蔡文姬',300,20)
print("lvbu的血量值为",lvbu,hp)
upgrade()
upgrade()
print("升级2次后,吕布的血量值为:"lvbu.hp)
#print("zhaoyun的攻击力为",zhaoyun.)
#print("diaochan的血量值为",diaochan.hp)
#print("luban的血量值为",luban.hp)
#print("caiwenji的血量值为",caiwenji.hp)
\ 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