[Asm] 纯文本查看 复制代码
import random
class J():
def __init__(self,name,age,life,Jin_jie,jinyan):
self.name=name
self.age=age
self.life=life
self.jinyan=jinyan
self.Jin_jie = Jin_jie
def shengji(self):
while self.jinyan - (100 + self.Jin_jie * 100)>0:
Xiu_lian = {0: "练气期", 1: "筑基期", 2: "金丹期", 3: "化神期", 4: "大乘期", 5: "飞升期"}
self.Jin_jie += 1
self.life = self.life + 150
J =Xiu_lian[self.Jin_jie]
print(f"恭喜你突破身体桎梏,升到了{J}")
break
def shuxin(self):
Xiu_lian = {0: "练气期", 1: "筑基期", 2: "金丹期", 3: "化神期", 4: "大乘期", 5: "飞升期"}
J = Xiu_lian[self.Jin_jie]
data=f'你的名字:{self.name},年龄:{self.age},生命:{self.life},境界:{J},经验:{self.jinyan}'
print(data)
def jieju(self):
if self.Jin_jie=='飞升期':
print("恭喜你破碎虚空,飞升天界")
if self.life <= 0:
print("你死得悄无声息,默默无闻")
class Z(J):
def Cun_wai(self):
Guaiwu= {'野狼': 30, '狗熊': 50, '土匪': 80}
Gjinyan = {'野狼': 10, '狗熊': 18, '土匪': 25}
Y=list(Guaiwu.keys())
M=random.choice(Y)
self.life=self.life-Guaiwu[M]
self.jinyan=self.jinyan+Gjinyan[M]
nian=random.randint(2,5)
self.age=self.age+nian
if X.life > 0:
print(f"你经过了险象环生的战斗,终于杀死了{M},获得了{Gjinyan[M]}经验,你经过了{nian}年疗伤,终于痊愈了")
def Da_shan(self):
Guaiwu= {'恶人': 40, '野人': 70, '山贼': 100}
Gjinyan= {'恶人': 20, '野人': 30, '山贼': 45}
Y=list(Guaiwu.keys())
M=random.choice(Y)
self.life=self.life-Guaiwu[M]
self.jinyan=self.jinyan+Gjinyan[M]
nian = random.randint(2, 5)
self.age = self.age + nian
if X.life > 0:
print(f"你经过了险象环生的战斗,终于杀死了{M},你经过了{nian}年疗伤,终于痊愈了")
else:
print("战斗失败,请重新再来")
def Bi_guan(self):
self.life=self.life+random.randrange(30,60)
self.age=self.age+random.randrange(1,6)
nian=random.randrange(1,6)
print(f'你闭关{nian}年,变得龙精虎猛,虎虎生风')
age=random.randint(18,25)
life=random.randrange(100,130)
name=input("请输入你的名字:")
Jin_jie=0
jinyan=0
X=Z(name,age,life,Jin_jie,jinyan)
X.shuxin()
while True:
chang_di = int(input("请选择你的修炼地点:1为村外,2为大山,3为闭关疗伤:"))
if chang_di==1:
X.Cun_wai()
X.shengji()
X.shuxin()
X.jieju()
if X.life<0:
break
elif chang_di== 2:
X.Da_shan()
X.shengji()
X.shuxin()
X.jieju()
if X.life<0:
break
elif chang_di== 3:
X.Bi_guan()
X.shuxin()
X.jieju()
else:
print("输入错误请重新输入")
continue