Commit 1c2a9b79 by BellCodeEditor

save project

parent 56521d69
Showing with 20 additions and 3 deletions
class Hero:
def __init__(self):
def __init__(self,name,hp,attack):
self.level = 1
self.name = name
self.hp= 300
......@@ -8,4 +8,21 @@ class Hero:
yase = Hero("夏侯渊",650,34)
yase = Hero("夏侯惇",800,25)
print("yase的血量值:",yase.hp)
print("yase的血量值:",houi,hp)
\ No newline at end of file
print("yase的血量值:",houi,hp)
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
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