Commit 7b1b1bd9 by BellCodeEditor

auto save

parent f47689a4
Showing with 40 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.leve = 1
self.name = name
self.hp = hp
self.attack = attack
def upgrade(self):
self.leve = self.leve + 1
self.hp = self.hp + 50
self.attack = self.attack + 5
# def upgrade():
# yase.leve = yase.leve+1
# yase.hp = yase.hp+50
# yase.attack = yase.attack+4
# def upgrade():
# houyi.leve = yase.leve+1
# houyi.hp = yase.hp+35
# houyi.attack = yase.attack+8
yase=Hero('亚瑟',300,20)
yase.upgrade()
yase.upgrade()
# print('亚瑟的初始血量是',yase.hp)
houyi=Hero('后羿',240,23)
houyi.upgrade()
houyi.upgrade()
# print('后羿的初始血量是',houyi.hp)
# upgrade()
# upgrade()
print('亚瑟血量是',yase.hp)
print('后羿血量是',houyi.hp)
print('亚瑟等级是',yase.leve)
print('后羿等级是',houyi.leve)
print('亚瑟攻击力是',yase.attack)
print('后羿攻击力是',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