Commit a0950308 by BellCodeEditor

save project

parent e11daca3
Showing with 9 additions and 4 deletions
...@@ -8,10 +8,10 @@ class Hero: ...@@ -8,10 +8,10 @@ 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 = yase.level+1 self.level = self.level+1
yase.hp = yase.hp+50 self.hp = self.hp+50
yase.attack = yase.attack+10 self.attack = self.attack+10
yase=Hero('亚瑟',500,35) yase=Hero('亚瑟',500,35)
houyi=Hero('后羿',350,50) houyi=Hero('后羿',350,50)
BLSY=Hero('百里守约',360,60) BLSY=Hero('百里守约',360,60)
...@@ -22,3 +22,7 @@ print('后羿的生命值为',houyi.hp) ...@@ -22,3 +22,7 @@ print('后羿的生命值为',houyi.hp)
print('百里守约的生命值为',BLSY.hp) print('百里守约的生命值为',BLSY.hp)
print('蔡文姬的生命值为',CVJ.hp) print('蔡文姬的生命值为',CVJ.hp)
print('澜的生命值为',lan.hp) print('澜的生命值为',lan.hp)
yase=Hero('亚瑟',500,35)
yase.upgrade()
yase.upgrade()
print('亚瑟的升级两次的血量为',yase.hp)
\ 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