Commit a65bb31f by BellCodeEditor

auto save

parent beb166ed
Showing with 26 additions and 12 deletions
......@@ -6,13 +6,17 @@ class Hero(object):
self.hp = 250
self.attack = 40
self.max_hp = self.hp
self.jingshen = 10
def cure(self): # 治疗
self.hp+=55
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
elif self.jingshen == 0:
print(selfname+"被精神污染了,3秒后死亡")
time(3)
print("您已阵亡")
exit()
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
......@@ -25,9 +29,9 @@ class Hero(object):
info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3
print(info)
print('你干嘛啊~~')
print(enemy.name+':你干嘛~~诶哟~~')
print(self.name+':你是傻逼呀')
exit()
class Player(Hero):
def __init__(self,hero_type,name):
super().__init__(name)
......@@ -44,17 +48,30 @@ class Player(Hero):
self.hp+=c
if self.hp>self.max_hp:
self.hp=self.max_hp
elif self.jingshen == 0:
print(selfname+"被精神污染了,3秒后死亡")
time(3)
print("您已阵亡")
exit()
print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp)
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
while True:
print('-'*30)
a=input("请选择技能:1攻击/2治疗")
a=input("请选择技能:1攻击/2治疗/3巴嘎武器/4呕呕/5全体目光向我看齐/6` OK do the 发")
if int(a)==1:
houyi.combat(yase)
elif int(a)==2:
houyi.cure()
elif int(a)==3:
houyi.hp -= houyi.hp
elif int(a)==4:
yase.jingshen -= 1
elif int(a)==5:
yase.jingshen -= 5
elif int(a)==6:
print("你已阵亡")
exit()
elif a=="q":
print('游戏结束')
break
......@@ -65,7 +82,4 @@ while True:
if b==3:
yase.cure()
else:
yase.combat(houyi)
\ No newline at end of file
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