Commit 24b8429a by BellCodeEditor

save project

parent 3b207d2a
Showing with 12 additions and 11 deletions
...@@ -25,13 +25,13 @@ class Hero(object): ...@@ -25,13 +25,13 @@ class Hero(object):
info3 = enemy.name+"阵亡,游戏结束" info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
print('你干嘛啊~~') print('你才是恐怖份子')
exit() exit()
class Player(Hero): class Player(Hero):
def __init__(self,hero_type,name): def __init__(self,hero_type,name):
super().__init__(name) super().__init__(name)
self.hp = 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 self.hp = 9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
self.attack = 50000000000000000 self.attack = 50000000000000000
self.max_hp = self.hp self.max_hp = self.hp
self.hero_type = hero_type self.hero_type = hero_type
...@@ -46,15 +46,15 @@ class Player(Hero): ...@@ -46,15 +46,15 @@ class Player(Hero):
self.hp=self.max_hp self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp)
houyi = Player("射手", "后羿") apiao = Player("恐怖", "阿飘")
yase = Hero("垭瑟") abiao = Hero("阿膘")
while True: while True:
print('-'*30) print('-'*30)
a=input("请选择技能:1攻击/2治疗") a=input("请选择技能:11攻击/22治疗")
if int(a)==1: if int(a)==11:
houyi.combat(yase) apiao.combat(abiao)
elif int(a)==2: elif int(a)==22:
houyi.cure() apiao.cure()
elif a=="q": elif a=="q":
print('游戏结束') print('游戏结束')
break break
...@@ -63,9 +63,9 @@ while True: ...@@ -63,9 +63,9 @@ while True:
continue continue
b=random.randint(1,3) b=random.randint(1,3)
if b==3: if b==3:
yase.cure() abiao.cure()
else: else:
yase.combat(houyi) abiao.combat(apiao)
\ 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