Commit 5d88491e by BellCodeEditor

save project

parent 293ff0e1
Showing with 7 additions and 8 deletions
...@@ -5,14 +5,13 @@ class Hero: ...@@ -5,14 +5,13 @@ class Hero:
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(): def upgrade(self):
yase.level=yase.level+1 self.level=self.level+1
yase.hp=yase.hp+275 self.hp=self.hp+275
yase.attack=yase.attack+50 self.attack=self.attack+50
yase=Hero("亚瑟",5000,350) yase=Hero("亚瑟",5000,350)
upgrade()
print("亚瑟的血量:",yase.hp)
houyi=Hero("后羿",4500,400) houyi=Hero("后羿",4500,400)
yase.upgrade()
houyi.upgrade()
print("亚瑟的血量:",yase.hp)
print("后羿的血量:",houyi.hp) print("后羿的血量:",houyi.hp)
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