Commit 345ddec7 by BellCodeEditor

save project

parent 98c7976e
Showing with 25 additions and 5 deletions
class Hero:
def __init__(self,n,h,a):
self.level=1
self.level=0
self.name=n
self.hp=h
self.attack=a
#升级
def up_level(self):
self.level+=1
self.hp+=50
self.attack+=100
#定义亚瑟
亚瑟=Hero('亚瑟',340,80)
#升级亚瑟
for i in range(100):
亚瑟.up_level()
#定义赵云
赵云=Hero('赵云',240,120)
#升级赵云
for i in range(100):
赵云.up_level()
#定义后羿
后羿=Hero('后羿',240,110)
#升级后羿
for i in range(100):
后羿.up_level()
#定义张飞
张飞=Hero('张飞',320,90)
#升级张飞
for i in range(100):
张飞.up_level()
print(亚瑟.name,"\n","的血量是:",亚瑟.hp,"\n","攻击力是:",亚瑟.attack,"\n","等级是:",亚瑟.level)
print(赵云.name,"\n","的量是:",赵云.hp,"\n","攻击力是:",赵云.attack,"\n","等级是:",赵云.level)
print(赵云.name,"\n","的量是:",赵云.hp,"\n","攻击力是:",赵云.attack,"\n","等级是:",赵云.level)
print(后羿.name,"\n","的量是:",后羿.hp,"\n","攻击力是:",后羿.attack,"\n","等级是:",后羿.level)
print(后羿.name,"\n","的量是:",后羿.hp,"\n","攻击力是:",后羿.attack,"\n","等级是:",后羿.level)
print(张飞.name,"\n","的量是:",张飞.hp,"\n","攻击力是:",张飞.attack,"\n","等级是:",张飞.level)
\ No newline at end of file
print(张飞.name,"\n","的血量是:",张飞.hp,"\n","攻击力是:",张飞.attack,"\n","等级是:",张飞.level)
\ 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