Commit de247ed1 by BellCodeEditor

save project

parent 28c8e6ab
Showing with 24 additions and 2 deletions
import random
class Hero(object):
def __init__(self, name):
self.name = name
......@@ -10,6 +11,7 @@ class Hero(object):
self.hp+=60
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name,'用了治疗,',self.name,"还有",self.hp,"滴血")
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
......@@ -40,4 +42,24 @@ print('-'*30)
print(" 游戏开始")
while True:
print('-'*30)
input("请选择释放技能(1攻击,2治疗):")
\ No newline at end of file
ada=input("请选择释放技能(1攻击/2治疗):")
if ada=='q':
print('game over.')
break
elif ada=='1':
houyi.combat(yase)
elif ada=='2':
houyi.cure()
else:
print('重输')
continue
a=random.randint(1,3)
if a==1 or a==2 :
yase.combat(houyi)
else:
yase.cure()
\ 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