Commit 0c9292bb by BellCodeEditor

save project

parent 3857c807
Showing with 36 additions and 9 deletions
class hero:
def __init__(self):
self.level = 15
self.hp = 99999999999999999999999999999999
self.attack = 99999999999999999999999999999999
yase=hero()
print('yase的血量:',yase.hp)
print('yase的攻击力:',yase.attack)
\ No newline at end of file
class Hero:
def __init__(self, name, hp, attack):
self.level = 25
self.name = name
self.hp = hp
self.attack = attack
# yase = Hero('亚瑟',9999999,999999)
# jiji = Hero('吉吉',9999999,999999)
# print('亚瑟的血量:',yase.hp)
# print('吉吉的血量:',jiji.hp)
# def upgrade():
# yase.level=yase.level+1
# yase.hp=yase.hp+99999
# yase.attack=yase.attack+99999
# yase = Hero('亚瑟',9999999,999999)
# print('亚瑟的初始能量值为:',yase.hp)
# upgrade()
# upgrade()
# print('升级两次后,亚瑟的血量值为:',yase.hp)
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+99999
self.attack=self.attack+99999
jiji = Hero('吉吉',9999999,999999)
jiji.upgrade()
jiji.upgrade()
jiji.upgrade()
print('xl:',jiji.hp)
print('dj:',jiji.level)
print('gjl:',jiji.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