Commit 956fe835 by BellCodeEditor

save project

parent 7a3d8bee
Showing with 15 additions and 0 deletions
...@@ -3,7 +3,21 @@ class Hero: ...@@ -3,7 +3,21 @@ class Hero:
self.hp=hp self.hp=hp
self.level=1 self.level=1
self.attach=attach self.attach=attach
def upgrade():
lanlingwang.hp=lanlingwang.hp+150
lanlingwang.level=lanlingwang.level+1
lanlingwang.attach=lanlingwang.attach+100
def upgrade1():
sunce.hp=sunce.hp+150
sunce.level=sunce.level+1
sunce.attach=sunce.attach+100
lanlingwang=Hero(1300,50,'兰陵王') lanlingwang=Hero(1300,50,'兰陵王')
sunce=Hero(1500,30,'孙策') sunce=Hero(1500,30,'孙策')
print('兰陵王的血量为: ',lanlingwang.hp) print('兰陵王的血量为: ',lanlingwang.hp)
upgrade()
upgrade()
print('兰陵王升2级后的血量为: ',lanlingwang.hp)
print('孙策的血量为: ',sunce.hp) print('孙策的血量为: ',sunce.hp)
upgrade1()
upgrade1()
print('孙策升2级的血量为: ',sunce.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