Commit ddcec123 by BellCodeEditor

save project

parent d4605018
Showing with 16 additions and 12 deletions
...@@ -5,17 +5,21 @@ class Hero: ...@@ -5,17 +5,21 @@ 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+50 self.hp=self.hp+50
yase.attack=yase.attack self.attack=self.attack+4
yase=Hero('yase',3000,20) houyi=Hero('yase',3000,20)
houyi=Hero('houyi',1500,30) #houyi=Hero('houyi',1500,30)
yao=Hero('yao',2500,15) #yao=Hero('yao',2500,15)
upgrade() houyi.upgrade()
upgrade() #houyi.upgrade()
print("升级两级后,亚瑟的血量为: ",yase.hp) #yao.upgrade()
print("升级两级后,后羿的血量为: ",houyi.hp) print("升级两级后,亚瑟的血量为: ",houyi.hp)
print("升级两级后,瑶的血量为: ",yao.hp) print("升级两级后,亚瑟的等级为: ",houyi.level)
print("升级两级后,亚瑟的攻击力为: ",houyi.attack)
#print("升级两级后,后羿的血量为: ",houyi.hp)
#print("升级两级后,瑶的血量为: ",yao.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