Commit 133f4d50 by BellCodeEditor

save project

parent 069e687e
Showing with 11 additions and 8 deletions
......@@ -5,13 +5,15 @@ class Hero:
self.hp=hp
self.attack=attack
yase=Hero('亚瑟',30,300)
def upgrate():
yase.level+=1
yase.hp+=50
yase.attack+=5
def upgrate(self):
self.level+=1
self.hp+=50
self.attack+=5
yase=Hero('亚瑟',300,30)
houyi=Hero('后羿',350,25)
print(yase.name+'的攻击力是:'+str(yase.attack))
upgrate()
print('升级之后'+yase.name+'的攻击力是:'+str(yase.attack))
upgrate()
print(houyi.name+'的攻击力是:'+str(houyi.attack))
yase.upgrate()
houyi.upgrate()
print('升级之后'+yase.name+'的攻击力是:'+str(yase.attack))
print('升级之后'+houyi.name+'的攻击力是:'+str(houyi.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