Commit 5fb151a9 by BellCodeEditor

save project

parent e1e27bb7
Showing with 21 additions and 3 deletions
import random
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
...@@ -31,7 +32,6 @@ class Player(Hero): ...@@ -31,7 +32,6 @@ class Player(Hero):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
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)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
...@@ -42,4 +42,22 @@ print('-'*30) ...@@ -42,4 +42,22 @@ print('-'*30)
print(' 开始战斗') print(' 开始战斗')
while True: while True:
print('-'*30) print('-'*30)
a=input('请选择释放英雄技能1攻击,2治疗:') a=input('请选择释放英雄技能1攻击,2治疗:')
\ No newline at end of file if a=='q':
break
elif a=='1':
houyi.combat(yase)
elif a=='2':
houyi.cure()
else:
print('请选择有效技能')
continue
num=random.randint(1,3)
if num==1:
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