Commit ab9cd5de by BellCodeEditor

save project

parent 63824017
Showing with 9 additions and 6 deletions
...@@ -5,14 +5,17 @@ class Hore: ...@@ -5,14 +5,17 @@ class Hore:
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+50 self.HP=self.HP+50
yase.attack=yase.attack+4 self.attack=self.attack+4
yase = Hore("亚瑟",300,20) yase = Hore("亚瑟",300,20)
houyi=Hore("后羿",250,25)
print("亚瑟初始血量为:",yase.HP) print("亚瑟初始血量为:",yase.HP)
upgrade() upgrade(yase)
upgrade()
print("亚瑟升级后血量为:",yase.HP) print("亚瑟升级后血量为:",yase.HP)
print("后羿初始血量为:",houyi.HP)
upgrade(houyi)
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