Commit b0b9afc0 by BellCodeEditor

save project

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