Commit 70184e89 by BellCodeEditor

save project

parent c2ac8e64
Showing with 6 additions and 7 deletions
...@@ -5,13 +5,12 @@ class Hero: ...@@ -5,13 +5,12 @@ class Hero:
self.hp self.hp
self.attack self.attack
def upgrade(): def upgrade():
self.level=yase.levle+1 self.level=self.levle+1
self.hp=yase.hp+50 self.hp=self.hp+50
self.attack=yase.attack+4 self.attack=self.attack+4
yase=Hero("亚瑟",300,20) houyi=Hero("后羿",300,20)
houyi=Hero("亚瑟初始血量",yase.hp) houyi=Hero("初始血量",yase.hp)
upgrade houyi.upgrade
upgrade
print("升级两次后亚瑟血量",yase.hp) print("升级两次后亚瑟血量",yase.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