Commit fdfa8e46 by BellCodeEditor

save project

parent d69056f4
Showing with 12 additions and 3 deletions
......@@ -7,8 +7,13 @@ class Hero(object):
self.attack = 40
self.max_hp = self.hp
def asdfg(self):
self.attack+=80
print(self.name+"攻击力增加:", 80,",目前的攻击力为:",self.attack)
def cure(self): # 治疗
self.hp+=55
asd=random.randint(30,90)
self.hp+=asd
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
......@@ -32,7 +37,7 @@ class Player(Hero):
def __init__(self,hero_type,name):
super().__init__(name)
self.hp = 200
self.attack = 50
self.attack = 1
self.max_hp = self.hp
self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
......@@ -50,11 +55,13 @@ houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
while True:
print('-'*30)
lamb=input('请选择释放英雄技能(1攻击/2治疗):')
lamb=input('请选择释放英雄技能(1攻击/2治疗/3狂暴):')
if lamb=='1':
yase.combat(houyi)
elif lamb=='2':
yase.cure()
elif lamb=='3':
yase.asdfg()
elif lamb =='p':
print('退出')
break
......@@ -66,3 +73,5 @@ while True:
houyi.combat(yase)
elif n==2:
houyi.cure()
elif n==3:
houyi.asdfg()
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