Commit ddcec123 by BellCodeEditor

save project

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