Commit b0b9afc0 by BellCodeEditor

save project

parent 03cddb4a
Showing with 10 additions and 21 deletions
......@@ -5,24 +5,13 @@ class Hero:
self.hp= 300
self.attack=20
yase = Hero("夏侯渊",650,34)
yase = Hero("夏侯惇",800,25)
print("yase的血量值:",yase.hp)
print("yase的血量值:",houi,hp)
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+50
yase.attack=yase.attack+4
yase = Hero("夏侯渊",650,34)
print("夏侯渊的初始血量值为: ",yase.hp)
upgrade()
upgrade()
print("升级2次后,夏侯渊的血量值为:",yase.hp)
yase = Hero("夏侯渊",800,25)
print("夏侯惇的初始血量值为: ",yase.hp)
upgrade()
upgrade()
print("升级2次后,夏侯惇的血量值为:",yase.hp)
\ No newline at end of file
xhy = Hero("夏侯渊",650,34)
xhy.upgrade()
print("等级: ",xhy.level)
print("血量: ",xhy.up)
print("攻击: ",xhy.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