Commit bbd1318e by BellCodeEditor

save project

parent d6c81a0f
Showing with 30 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.hp=hp
self.attack=attack
yase=Hero('亚瑟',300,20)
hoyi=Hero('后裔',250,23)
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+50
yase.attack=yase.attack+4
def npgrade():
hoyi.level=yase.level+1
hoyi.hp=yase.hp+25
hoyi.attack=yase.attack+11
upgrade()
upgrade()
npgrade()
npgrade()
print('亚瑟的等级为:',yase.level)
print('亚瑟的血量为:',yase.hp)
print('亚瑟的攻击为:',yase.attack)
print('后裔的等级为:',hoyi.level)
print('后裔的血量为:',hoyi.hp)
print('后裔的攻击为:',hoyi.attack)
\ 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