Commit 3c8ccd61 by BellCodeEditor

save project

parent 7041b907
Showing with 7 additions and 3 deletions
...@@ -4,7 +4,11 @@ class Hero: ...@@ -4,7 +4,11 @@ class Hero:
self.level=15 self.level=15
self.hp=hp self.hp=hp
self.attack=100000 self.attack=100000
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
yase=Hero("亚瑟",300,100000) yase=Hero("亚瑟",300,100000)
houyi=Hero("后羿",250,1) houyi=Hero("后羿",250,1)
print(yase.hp) yase.upgrade()
print(houyi.hp) print(yase.hp)
\ No newline at end of file \ 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