Commit c14208fd by BellCodeEditor

save project

parent df33adaa
Showing with 5 additions and 5 deletions
...@@ -4,16 +4,16 @@ class Hero(): ...@@ -4,16 +4,16 @@ class Hero():
self.level=level self.level=level
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def Up_level(i,up): def Up_level(self,up):
i.level=i.level+up self.level=self.level+up
i.hp=i.hp+up*50 self.hp=self.hp+up*50
i.attack=i.attack+up*4 self.attack=self.attack+up*4
yase=Hero("垭瑟",300,20,1) yase=Hero("垭瑟",300,20,1)
houyi=Hero("后羿",250,23,1) houyi=Hero("后羿",250,23,1)
print("垭瑟升级前攻击:",yase.attack) print("垭瑟升级前攻击:",yase.attack)
print("垭瑟升级前血量:",yase.hp) print("垭瑟升级前血量:",yase.hp)
print("垭瑟升级前等级:",yase.level) print("垭瑟升级前等级:",yase.level)
Up_level(yase,1) yase.Up_level(1)
print("-"*50) print("-"*50)
print("垭瑟升级后攻击:",yase.attack) print("垭瑟升级后攻击:",yase.attack)
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