from math import *
from ti_system import *
from random import *
from time import *
def dvs(pet,bag):
lv=chooselevel()
clear_history()
if lv!=0:
sz=choosepet(bag,pet)
else:
sz=[2,2,2]
clear_history()
heart=[0,0,0,0,0,0]
dheart=[0,0,0,0,0,0]
petname=[]
dpet=[]
for i in range(3):
sz.append(randint(0,len(pet)-1))
for i in range(len(pet)):
if i==sz[3]:
dpet.append([0,pet[sz[3]][1],[[pet[sz[3]][2][0][0],0,pet[sz[3]][2][0][2],pet[sz[3]][2][0][3],0],[pet[sz[3]][2][1][0],0,pet[sz[3]][2][1][2],pet[sz[3]][2][1][3],0]]])
if i==sz[4]:
dpet.append([0,pet[sz[4]][1],[[pet[sz[4]][2][0][0],0,pet[sz[4]][2][0][2],pet[sz[4]][2][0][3],0],[pet[sz[4]][2][1][0],0,pet[sz[4]][2][1][2],pet[sz[4]][2][1][3],0]]])
if i==sz[5]:
dpet.append([0,pet[sz[5]][1],[[pet[sz[5]][2][0][0],0,pet[sz[5]][2][0][2],pet[sz[5]][2][0][3],0],[pet[sz[5]][2][1][0],0,pet[sz[5]][2][1][2],pet[sz[5]][2][1][3],0]]])
for i in range(3):
if sz[i]!=-1:
dheart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3))
heart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3))
petname.append(pet[sz[i]][0])
else:
dheart[i]=0
heart[i]=0
petname.append("空缺")
dbag=[[0,0],[0,0],[0,0]]
for i in range(3):
dbag[i][1]=randint((lv*2-1)*10,(lv*2+1)*10)
dbag[i][0]=randint(lv*2-1,lv*2)
dheart[i+3]=2*(dpet[i][1]+dbag[i][0]*int(dbag[i][1]/3))
heart[i+3]=2*(dpet[i][1]+dbag[i][0]*int(dbag[i][1]/3))
petname.append(pet[sz[i+3]][0])
sum=end=0
while 1>0:
if lv==0:
break
sum+=1
ene=12
for i in range(3):
table(dheart,heart,sum,ene)
print("(1):",petname[0],"(4):",petname[3],"(",dbag[0][0],"命",dbag[0][1],"阶",randint(0,9),"星)")
print("(2):",petname[1],"(5):",petname[4],"(",dbag[1][0],"命",dbag[1][1],"阶",randint(0,9),"星)")
print("(3):",petname[2],"(6):",petname[5],"(",dbag[2][0],"命",dbag[2][1],"阶",randint(0,9),"星)")
a=int(input("选择宠物"))
if a==0:
end=3
break
if dheart[a-1]==0 or a>3 or a<1:
print("请重新选择")
sleep(1)
continue
b=int(input("选择技能"+"(1)"+pet[sz[a-1]][2][0][0]+str(pet[sz[a-1]][2][0][4])+"点"+"(2)"+pet[sz[a-1]][2][1][0]+str(pet[sz[a-1]][2][1][4])+"点"))
if ene>=pet[sz[a-1]][2][b-1][4]:
ene-=pet[sz[a-1]][2][b-1][4]
elif ene<2:
print("能量不足,敌方先动")
sleep(1)
break
c=int(input("选择对象"))
clear_history()
dheart=petattack(sz,a-1,b,c-1,bag[sz[a-1]+5],dheart,heart,pet[sz[a-1]])
for j in range(6):
if dheart[j]<=0:
dheart[j]=0
if heart[j]
heart[j]:
heart[j]=dheart[j]
if dheart[0]==dheart[1]==dheart[2]==0:
end=2
break
table(dheart,heart,sum,ene)
back=int(input("任意键确定"))
clear_history()
if end==2:
table(dheart,heart,sum,ene)
print("游戏失败,-50$")
bag[0]-=50
if bag[0]<0:
bag[0]=0
back=int(input("任意键确定"))
break
return bag
def chooselevel():
print("level<<<")
print("(0)退出")
print("(1)普通(1-2命10-30阶0星)")
print("(2)中等(3-4命30-50阶0星)")
print("(3)困难(5-6命50-70阶0星)")
print("(4)恶梦(7-8命70-90阶0星)")
print("(5)炸天(9-10命90-110阶0星)")
a=int(input())
return a
def choosepet(bag,pet):
sz=[0,0,0]
for u in range(3):
clear_history()
print("选择宠物<<<")
print("(0) 空缺")
f=0
ff=[0 for i in range(len(pet))]
for i in range(len(pet)):
if bag[i+5][0]>0 and pet[i][3]==0:
ff[f]=i
f+=1
print("("+str(f)+")",pet[i][0],"(",bag[i+5][0],"命",bag[i+5][1],"阶",bag[i+5][2],"星)")
a=int(input("选择上阵宠物"+"("+str(u+1)+")"))
if a==0:
sz[u]=-1
else:
sz[u]=ff[a-1]
pet[ff[a-1]][3]=1
clear_history()
print("上阵宠物:")
for i in range(len(pet)):
if pet[i][3]==1:
print(pet[i][0])
back=int(input("任意键确定"))
return sz
def table(dheart,heart,sum,ene):
print("(0)退出 回合:",str(sum)," 能量:",str(ene))
print("#########################")
print("# (1)"+str(dheart[0])+"/"+str(heart[0])+"hp hp"+str(dheart[3])+"/"+str(heart[3])+"(4)#")
print("# (2)"+str(dheart[1])+"/"+str(heart[1])+"hp hp"+str(dheart[4])+"/"+str(heart[4])+"(5) #")
print("# (3)"+str(dheart[2])+"/"+str(heart[2])+"hp hp"+str(dheart[5])+"/"+str(heart[5])+"(6) #")
print("##########################")
def test(bag,pet):
sz=choosepet(bag,pet)
dheart=[0,0,0,0,0,0]
heart=[0,0,0,0,0,0]
z=99999
petname=[]
for i in range(3):
if sz[i]!=-1:
dheart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3))
heart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3))
petname.append(pet[sz[i]][0])
else:
dheart[i]=0
heart[i]=0
petname.append("空缺")
dheart[i+3]=99999
heart[i+3]=99999
while dheart[4]!=0:
if sz[0]==sz[1]==sz[2]==-1:
break
clear_history()
print("(0)退出<<<")
print("(1)",pet[sz[0]][0],dheart[0],"/",heart[0]," 桩(4)",dheart[3],"/99999")
print("(2)",pet[sz[1]][0],dheart[1],"/",heart[1]," 桩(5)",dheart[4],"/99999")
print("(3)",pet[sz[2]][0],dheart[2],"/",heart[2]," 桩(6)",dheart[5],"/99999")
a=int(input("选择宠物"))
if a==0:
break
b=int(input("选择技能"+"(1)"+pet[sz[a-1]][2][0][0]+str(pet[sz[a-1]][2][0][4])+"点"+"(2)"+pet[sz[a-1]][2][1][0]+str(pet[sz[a-1]][2][1][4])+"点"))
c=int(input("选择对象"))
clear_history()
dheart=petattack(sz,a-1,b,c-1,bag[sz[a]+4],dheart,heart,pet[sz[a]])
for j in range(6):
if heart[j]