Commit 8c7863a0 by BellCodeEditor

save project

parent afd09c33
Showing with 45 additions and 2 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.hp=hp
self.attack=attack
#
def upgrad(self):
self.level=yase.level*2
self.hp=yase.hp*2
self.attack=yase.attack*2
#
wudi=Hero("无敌",99999999999999999999999999999999999999999999999999999,9999999999999999999999999999999999999999999)
yase=Hero("亚瑟",300,20)
#
def upgrad_yase():
yase.level=yase.level*2
yase.hp=yase.hp*2
yase.attack=yase.attack*2
#
def upgrad_wudi():
wudi.level=wudi.level*2
wudi.hp=wudi.hp*2
wudi.attack=wudi.attack*2
input_name=input("你要升级哪个英雄?无敌\亚瑟 ")
c=input("几级?")
#
if input_name=="无敌":
for i in range(int(c)):
upgrad_wudi()
print("无敌的血量为",wudi.attack)
if input_name=="亚瑟":
for i in range(int(c)):
upgrad_yase()
print("亚瑟的血量为",wudi.attack)
# yase.upgrad()
# print("亚瑟的血量为",yase.hp)
\ No newline at end of file
...@@ -22,9 +22,13 @@ class Hero: # 英雄类 ...@@ -22,9 +22,13 @@ class Hero: # 英雄类
exit() exit()
class Player(): # 玩家英 class Player(Hero): # 玩家英
def __init__(self,name): def __init__(self,name):
p super().__init__(name)
self.hp = 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
self.attack = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
self.max_hp = self.hp
player = Player("后羿") player = Player("后羿")
......
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