Commit 6e822edf by BellCodeEditor

save project

parent 802e0775
Showing with 24 additions and 4 deletions
......@@ -6,10 +6,24 @@ class Hero(object):
self.hp = 5000
self.attack = 165
self.max_hp = self.hp
def jineng(self, enemy): # 普通攻击
info11 = self.name+"对"+enemy.name+"发起光翼连斩,"
info22 = "造成"+'1000'+"点伤害,"
enemy.hp -= 1000
if enemy.hp > 0:
info33 = enemy.name+"还剩下"+str(enemy.hp)+"血量"
info1 = info11+info22+info33
print(info1)
else:
info33 = enemy.name+"阵亡,游戏结束"
info1 = info11+info22+info33
print(info1)
print('你干嘛啊~~')
exit()
def cure(self): # 治疗
def cure(self):
self.hp+=120
if self.hp>250:
if self.hp>5000:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 120,",目前的血量为:",self.hp)
......@@ -50,11 +64,13 @@ houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
while True:
print('-'*30)
a=input("请选择技能:1攻击/2治疗")
a=input("请选择技能:1攻击/2治疗/3光翼连斩")
if int(a)==1:
houyi.combat(yase)
elif int(a)==2:
houyi.cure()
elif int(a)==3:
houyi.jineng(yase)
elif a=="q":
print('游戏结束')
break
......@@ -64,8 +80,11 @@ while True:
b=random.randint(1,3)
if b==3:
yase.cure()
else:
if b==2:
yase.combat(houyi)
else:
yase.jineng(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