Commit 39d291f9 by BellCodeEditor

save project

parent 78acfc3a
Showing with 10 additions and 11 deletions
...@@ -4,18 +4,16 @@ class Hero: ...@@ -4,18 +4,16 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def ungrade(): def upgrade():
yeas.level=yase.lelve+1 yase.level+=1
yase.hp=yase.hp+50 yase.hp+=50
yase.attack=yase.attack+4 yase.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) k=Hero('K',5600,199)
print("亚瑟的等级为",yase.level) print("亚瑟的初始血量为",yase.hp)
print("后羿的等级为",houyi.level) upgrade()
print("亚瑟的血量为",yase.hp) upgrade()
print("后羿的血量为",houyi.hp) print("升级2次后,亚瑟的血量为",yase.hp)
print("亚瑟的攻击力为",yase.attack)
print("后羿的攻击力为",houyi.attack)
print(k.attack) 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