Commit b4929f7e by BellCodeEditor

auto save

parent 1e5e6d9d
Showing with 27 additions and 6 deletions
def combat(self, enemy): # 普通攻击
import random
class Hero():
def __init__(self,name):
self.hp=2500
self.attack=40
self.name=name
self.level=1
self.max_hp=self.hp
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
enemy.hp -= self.attack
......@@ -12,6 +21,16 @@ def combat(self, enemy): # 普通攻击
print(info)
print('你干嘛啊~~')
exit()
def cure(self):
self.hp=self.hp+40
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name,'使用了治疗术,加了60点血','目前还剩',self.hp,'点血')
def miao(self):
self.hp=10000000000
self.attack=9999999
print('恭喜你使用了米奇尿尿屋秘诀,血量10000000000,攻击9999999')
class Player(Hero):
def __init__(self,hero_type,name):
......@@ -36,18 +55,20 @@ yase = Hero("垭瑟")
while True:
print('-'*30)
a=input("请选择技能:1攻击/2治疗")
if int(a)==1:
if a=='1':
houyi.combat(yase)
elif int(a)==2:
elif a=='666':
houyi.miao()
elif a=='2':
houyi.cure()
elif a=="q":
print('游戏结束')
break
else:
print('重输!')
print('再乱输入给你崩掉!')
continue
b=random.randint(1,3)
if b==3:
buu=random.randint(1,3)
if buu==3:
yase.cure()
else:
yase.combat(houyi)
......
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