Commit 6336b2c8 by BellCodeEditor

save project

parent feff2a4f
Showing with 9 additions and 0 deletions
...@@ -4,7 +4,15 @@ class Hero: ...@@ -4,7 +4,15 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+400
self.attack=self.attack+82
yuange=Hero("元歌",500,46) yuange=Hero("元歌",500,46)
yase=Hero("亚瑟,",1000,20) yase=Hero("亚瑟,",1000,20)
print(yase.hp) print(yase.hp)
print(yuange.hp) print(yuange.hp)
yuange.upgrade()
yase.upgrade()
print(yase.hp)
print(yuange.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