Commit 1a5d8b03 by BellCodeEditor

save project

parent 385bbef5
Showing with 9 additions and 0 deletions
...@@ -17,3 +17,12 @@ upgrade() ...@@ -17,3 +17,12 @@ upgrade()
print('升级3次后,亚瑟的血量为:',yase.hp) print('升级3次后,亚瑟的血量为:',yase.hp)
print('升级3次后,亚瑟的等级为:',yase.level) print('升级3次后,亚瑟的等级为:',yase.level)
print('升级3次后,亚瑟的攻击力为:',yase.attack) print('升级3次后,亚瑟的攻击力为:',yase.attack)
def upgrade(self):
self.level=self.level+1
self.hp=sself.hp+50
self.attack=self.attack+5
houyi=Hero('后羿',240,23)
houyi.upgrade()
print('等级为:',houyi.level)
print('血量为:',houyi.hp)
print('攻击力为:',houyi.attack)
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