Commit 4990d0b8 by BellCodeEditor

save project

parent 3aa4dff1
Showing with 8 additions and 6 deletions
...@@ -4,12 +4,13 @@ class Hero: ...@@ -4,12 +4,13 @@ class Hero:
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
self.name=name self.name=name
def upgrade(self):
self.hp=self.hp+50
self.level=self.level+1
self.attack=self.attack+4
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
houyi=Hero("后羿",250,23) houyi=Hero("后羿",250,23)
def upgrade(): yase.upgrade()
yase.hp=yase.hp+50 houyi.upgrade()
yase.level=yase.level+1
yase.attack=yase.attack+4
upgrade()
upgrade()
print(yase.hp) print(yase.hp)
print(houyi.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