Commit b02375bb by BellCodeEditor

save project

parent 39d291f9
Showing with 8 additions and 11 deletions
...@@ -4,16 +4,14 @@ class Hero: ...@@ -4,16 +4,14 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(): def upgrade(self):
yase.level+=1 houyi.level+=1
yase.hp+=50 houyi.hp+=50
yase.attack+=4 houyi.attack+=4
yase=Hero('yase',300,20) yase=Hero('yase',300,20)
houyi=Hero('houyi',240,23) houyi=Hero('houyi',240,23)
k=Hero('K',5600,199) houyi.upgrade()
print("亚瑟的初始血量为",yase.hp) print("攻击力为",houyi.hp)
upgrade() print("等级为",houyi.hp)
upgrade() print("血量为",houyi.hp)
print("升级2次后,亚瑟的血量为",yase.hp)
print(k.attack)
\ No newline at end of file
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