Commit 8c353462 by BellCodeEditor

save project

parent 8fc9df63
Showing with 9 additions and 25 deletions
...@@ -30,8 +30,8 @@ class Hero(object): ...@@ -30,8 +30,8 @@ class Hero(object):
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 = 200 self.hp = 100
self.attack = 50 self.attack = 100
self.max_hp = self.hp self.max_hp = self.hp
self.hero_type = hero_type self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
...@@ -45,26 +45,10 @@ class Player(Hero): ...@@ -45,26 +45,10 @@ 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("射手", "后羿") csj=Player('催逝员','穿山甲')
yase = Hero("垭瑟") a=Hero('王梓硕')
print('-'*50)
print(' 輚閗開試!')
while True: while True:
print('-'*30) print('-'*50)
a=input("请选择技能:1攻击/2治疗") e=input('1攻击/2回血:')
if int(a)==1: \ No newline at end of file
houyi.combat(yase)
elif int(a)==2:
houyi.cure()
elif a=="q":
print('游戏结束')
break
else:
print('重输!')
continue
b=random.randint(1,3)
if b==3:
yase.cure()
else:
yase.combat(houyi)
\ 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