fromkandinskyimportfill_rectasf_r,draw_stringasd_sfromrandomimportrandintasrdfromionimportkeydownaskdfromtimeimportsleepasslzombie={"PV":30,"AT":13,"DEF":1}squelette={"PV":35,"AT":15,"DEF":3}araigne={"PV":50,"AT":20,"DEF":4}gobelin={"PV":40,"AT":25,"DEF":2}blob={"PV":90,"AT":12,"DEF":7}shadow={"PV":70,"AT":42,"DEF":4}hydre={"PV":200,"AT":60,"DEF":20}en=((zombie,'Zombie'),(squelette,'Squelette'),(araigne,'Araignée'),(gobelin,'Gobelin'),(blob,'Blob'),(shadow,'Shadow'),(hydre,'Hydre'))defevent(n_e):modif=0ifn_e==2:a_s_h(2,0,0,'boss'*(n%5==0))modif=rd(10,30-8*(n//10)*(4*(n//5)>12)+12*(30-4*(n//5)<12))h["PV"]+=modifelifn_e==1:returnelifn_e==3:h["AT"]+=5modif=5elifn_e==4:h["DEF"]+=2modif=2elifn_e==5:modif=rd(10,15+5*(n//5))-h["DEF"]h["PV"]-=modifh["PV"]*=(h["PV"]>0)ifh["PV"]<=0:a_s_h(n_e,0,modif,'boss'*(n%5==0))sl(1)init_jeu()elifn_e==6:a_s_h(n_e,0,0,'boss'*(n%5==0))combat(en[rd(0,1+(n//4)*(n<24)+5*(n>=24))])modif=0elifn_e==7:globaln_gn_g+=1elifn_e==8:enne=en[(n//5+1)*(n//5+1<=6)+6*((n//5+1)>6)]enne[0]["PV"]=int(enne[0]["PV"]*1.5)enne[0]["AT"]=int(enne[0]["AT"]*1.5)enne[0]["DEF"]=int(enne[0]["DEF"]*1.5)combat(enne,1)a_s_h(n_e*(n_e!=6andn_e!=8),0,modif,'boss'*(n_e==8))returndefcombat(m_i,boss=0):e_c=1a_s_h(0,e_c,0,'boss'*(n%5==0),m_i[0],m_i[1])sl(1)whilee_c==1:m_i[0]["PV"]-=h["AT"]-m_i[0]["DEF"]m_i[0]["PV"]*=(m_i[0]["PV"]>0)a_s_h(0,e_c,0,'boss'*(n%5==0),m_i[0],m_i[1])sl(1)ifm_i[0]["PV"]<=0:e_c=0ifboss==1:globaln_gn_g+=1m_i[0]["AT"]=int(m_i[0]["AT"]/1.5)m_i[0]["DEF"]=int(m_i[0]["DEF"]/1.5)returnh["PV"]-=m_i[0]["AT"]-h["DEF"]h["PV"]*=(h["PV"]>0)a_s_h(0,e_c,0,'boss'*(n%5==0),m_i[0],m_i[1])sl(1)ifh["PV"]<=0:e_c=0sl(1)returninit_jeu()defjeu():f_r(0,0,320,222,'black')foriinrange(t_p):forjinrange(t_p*2):red=(18+int((144-2)/t_p)*j,10+int((144-2)/t_p)*i,int((144-2)/t_p),int((144-2)/t_p))ifg[i][j]=='P':f_r(red[0],red[1],red[2],red[3],'gray')d_c(red[0],red[1],red[2])else:f_r(red[0],red[1],red[2],red[3],'white')d_q_m(red[0],red[1],red[2],g[i][j])a_g()a_g2()a_s_h(0,0,0,'boss'*(n%5==0))barre_bas()defa_g(ori=[0,0]):forcharinrange(len(g)):forpersinrange(len(g[char])):ifg[char][pers]=='P':g[char][pers]=1elifg[char][pers]=='P0':g[char][pers]=0eve=g[h["pos"][1]][h["pos"][0]]ifg[h["pos"][1]][h["pos"][0]]!=0:g[h["pos"][1]][h["pos"][0]]='P'else:g[h["pos"][1]][h["pos"][0]]='P0'f_r(18+int((144-2)/t_p)*ori[0],10+int((144-2)/t_p)*ori[1],int((144-2)/t_p),int((144-2)/t_p),'white')ifg[ori[1]][ori[0]]==0:f_t["0"](18+int((144-2)/t_p)*ori[0]+9*(t_p==3)+7*(t_p==4)+5*(t_p==5)+3*(t_p==6),10+int((144-2)/t_p)*ori[1]+9*(t_p==3)+7*(t_p==4)+5*(t_p==5)+3*(t_p==6),30*(t_p==3)+21*(t_p==4)+18*(t_p==5)+18*(t_p==6))f_r(18+int((144-2)/t_p)*h["pos"][0],10+int((144-2)/t_p)*h["pos"][1],int((144-2)/t_p),int((144-2)/t_p),'gray')d_c(18+int((144-2)/t_p)*h["pos"][0]+9*(t_p==3)+7*(t_p==4)+5*(t_p==5)+3*(t_p==6),10+int((144-2)/t_p)*h["pos"][1]+9*(t_p==3)+7*(t_p==4)+5*(t_p==5)+3*(t_p==6),30*(t_p==3)+21*(t_p==4)+18*(t_p==5)+18*(t_p==6))returnevedefa_g2():nb_qm=4+nunknow=[]foriinrange(t_p*t_p*2-nb_qm):while42:co=0x,y=rd(0,t_p*2-1),rd(0,t_p-1)ifnot(x==0andy==0):forjinrange(len(unknow)):ifunknow[j]==[x,y]:co=1ifco==0:unknow.append([x,y])comp=(18+int((144-2)/t_p)*x,10+int((144-2)/t_p)*y,int((144-2)/t_p),int((144-2)/t_p))comp2=(18+int((144-2)/t_p)*x+9*(t_p==3)+7*(t_p==4)+5*(t_p==5)+3*(t_p==6),10+int((144-2)/t_p)*y+9*(t_p==3)+7*(t_p==4)+5*(t_p==5)+3*(t_p==6),30*(t_p==3)+21*(t_p==4)+18*(t_p==5)+18*(t_p==6))ifg[y][x]==8org[y][x]==7:f_r(comp[0],comp[1],comp[2],comp[3],'#FFD700')else:f_r(comp[0],comp[1],comp[2],comp[3],'white')ifg[y][x]!=1:f_t[str(g[y][x])](comp2[0],comp2[1],comp2[2])breakdefpixel_heart(x,y,t):forjinrange(9):foriinrange((j==0)+(j==3)+(j==4)*2+(j==5)+(j==8),4+1*((j==1)+(j==7))+2*((j==2)+(j==6))+3*((j==3)+(j==5))+4*(j==4)):f_r(x+int(t/9)*j+int(1/2*((t+5)/9)),y+int(t/9)*i+int(1/2*((t+15)/7)),int(t/9),int(t/9),'#FFA9A3')#F87575
defdraw_cross(x,y,t):forjinrange(5):foriinrange(((j==1)+(j==3))+((j==2)+(j==5))*2,5,4*((j==0)+(j==4))+2*((j==1)+(j==3))+3*(j==2)):f_r(x+int(t/5)*j,y+int(t/5)*i,int(t/5),int(t/5),'#FFD700')defdraw_sword(x,y,t):forjinrange(7):foriinrange(6*(j==0)+3*((j==1)+(j==2))+2*(j==3)+1*(j==4),7-2*(j==2)-1*(j==3)-3*(j==4)-4*(j==5)-5*(j==6),1+1*(j==1)):f_r(x+int(t/7)*j,y+int(t/7)*i,int(t/7),int(t/7),'green')defdraw_sword_m(x,y,t):forjinrange(7):foriinrange(6*(j==6)+3*((j==5)+(j==4))+2*(j==3)+1*(j==2),7-2*(j==4)-1*(j==3)-3*(j==2)-4*(j==1)-5*(j==0),1+1*(j==5)):f_r(x+int(t/7)*j,y+int(t/7)*i,int(t/7),int(t/7),'red')defdraw_spike(x,y,t):forjinrange(5):foriinrange(3*((j==0)+(j==4))+1*((j==1)+(j==3)),4):f_r(x+int(t/5)*j,y+int(t/5)*i+int(1/2*(t/5)),int(t/5),int(t/5),'red')defdraw_shield(x,y,t):forjinrange(5):foriinrange(6-2*((j==0)+(j==4))-1*((j==1)+(j==3))):f_r(x+int(t/6)*j+int(1/2*(t/6)),y+int(t/6)*i,int(t/6),int(t/6),'green')#7C3626
defd_c(x,y,t):forjinrange(5):foriinrange(5*((j==0)+(j==4)),6*((j==0)+(j==4))+7*(j==2)+1*((j==1)+(j==3))):if (j==1)+(j==3):forkinrange(3):f_r(x+int(t/9)*j+int(2*(t/9)),y+int(t/9)*k,int(t/9),int(t/9),'black')f_r(x+int(t/9)*j+int(2*(t/9)),y+int(t/9)*4,int(t/9),int(t/9),'black')forkinrange(2):f_r(x+int(t/9)*j+int(2*(t/9)),y+int(t/9)*(k+7),int(t/9),int(t/9),'black')breakelse:f_r(x+int(t/9)*j+int(2*(t/9)),y+int(t/9)*i,int(t/9),int(t/9),'black')defd_q_m(x,y,t,even):ifrd(0,2)<2:ifeven==5oreven==6:col='red'elifeven==2oreven==3oreven==4:col='green'else:col='black'else:col='black'forjinrange(5):foriinrange(1*((j==0)+(j==4)),1*((j==2)+(j==1))+3*((j==0)+(j==4))+4*(j==3),1*(j!=3)+3*(j==3)):if (j==2):f_r(x+int(t/8)*j+int(1.9*(t/8)),y+int(t/8),int(t/8),int(t/8),col)forkinrange(2):f_r(x+int(t/8)*j+int(1.9*(t/8)),y+int(t/8)*(k+4)+int(t/8),int(t/8),int(t/8),col)f_r(x+int(t/8)*j+int(1.9*(t/8)),y+int(t/8)*7+int(t/8),int(t/8),int(t/8),col)breakelse:f_r(x+int(t/8)*j+int(1.9*(t/8)),y+int(t/8)*i+int(t/8),int(t/8),int(t/8),col)defd_g(x,y,t):forjinrange(5):foriinrange(2*(j==0orj==4)+1*(j==1orj==3),5-2*(j==0orj==4)-1*(j==1orj==3)):f_r(x+int(t/5)*j,y+int(t/5)*i,int(t/5),int(t/5),'#46A2DA')defbarre_bas():f_r(0,200,320,22,(148,113,222))d_s("nsi.xyz/themap",2,202,(242,)*3,(148,113,222))d_s("N:"+str(n),155,202,(242,)*3,(148,113,222))ifn%5==0:d_s("Boss:"+str(n_g)+'/1',205,202,(242,)*3,(148,113,222))else:d_s("Gemme:"+str(n_g)+'/1',205,202,(242,)*3,(148,113,222))#inspiré de nsi.xyz/escape
#a compacté comme nsi.xyz/escape
defa_s_h(n_e=0,e_c=0,modif=0,c_c='gemme',m='',n_m=''):f_r(0,179,320,20,'black')d_s("Heros",5,160,'white','black')txt=[]txt.append(str(int(h["PV"])))txt.append(str(int(h["AT"])))txt.append(str(int(h["DEF"])))wr=''foriinrange(3):wr+=txt[i]+''d_s(wr,5,180,'white','black')pixel_heart(6+10*len(txt[0]),180,18)draw_sword(26+10*(len(txt[0])+len(txt[1])),180,18)draw_shield(46+10*(len(txt[0])+len(txt[1])+len(txt[2])),180,18)ifn_e!=0andn_e!=1:f_t[str(n_e)](151,180,18)ifn_e==2orn_e==3orn_e==4:d_s('+'+str(modif),283-10*len(str(modif)),180,(242,)*3,'black')f_t[str(n_e)](295,180,18)elifn_e==5:d_s('-'+str(modif),283-10*len(str(modif)),180,(242,)*3,'black')f_t["2"](295,180,18)elifn_e==7:d_s('+1',273,180,(242,)*3,'black')f_t["7"](295,180,18)ife_c==1:f_t["6"](151,180,18)d_s(str(n_m),318-10*len(str(n_m)),160,'white','black')txt=[]txt.append(str(m["PV"]))txt.append(str(m["AT"]))txt.append(str(m["DEF"]))wr=''foriinrange(3):wr+=txt[i]+''d_s(wr,285-10*(len(wr)-3),180,'white','black')pixel_heart(255-10*(len(txt[1])+len(txt[2])),180,18)draw_sword(275-10*len(txt[2]),180,18)draw_shield(295,180,18)elife_c==0:f_r(225,160,95,19,'black')foriinrange(len(en)):en[i][0]["PV"]=200*(i==6)+70*(i==5)+90*(i==4)+40*(i==3)+50*(i==2)+35*(i==1)+30*(i==0)ifc_c=='gemme':d_s("Gemme:"+str(n_g)+'/1',205,202,(242,)*3,(148,113,222))elifc_c=='boss':d_s("Boss:"+str(n_g)+'/1',205,202,(242,)*3,(148,113,222))definit_jeu():globalt_p,g,h,n_gn_g=0t_p=(4+n//(8+n//5)*(n<32)+2*(n>=32))g=[[rd(0,1)foriinrange(t_p*2)]forjinrange(t_p)]foriinrange(t_p):forjinrange(t_p*2):ifg[i][j]==0:g[i][j]=rd(1,4)else:g[i][j]=rd(5,6)g[rd(t_p-2,t_p-1)][rd(t_p*2-2,t_p*2-1)]=0g[0][0]='P'whileTrue:x,y=rd(2,t_p*2-1),rd(2,t_p-1)ifg[y][x]!=0:ifn%5==0:ifx%2==1andy%2==1:g[y][x]=8breakelse:g[y][x]=7breakh={"PV":int(75+5*(n//4)),"AT":int(15+2*(n//5)),"DEF":int(0+1*(n//5)),"pos":[0,0]}returnjeu()f_t={'P':d_c,'0':draw_cross,'2':pixel_heart,'3':draw_sword,'4':draw_shield,'5':draw_spike,'6':draw_sword_m,'7':d_g,'8':draw_sword_m}n=1init_jeu()whileTrue:sl(0.5)stop=0whilestop==0:orig=[h["pos"][0],h["pos"][1]]ifkd(2):h["pos"][1]+=1*(h["pos"][1]+1<t_p)eve=a_g(orig)ifeve==0andn_g==1:n+=1init_jeu()event(eve)sl(0.4)elifkd(3):h["pos"][0]+=1*(h["pos"][0]+1<t_p*2)eve=a_g(orig)ifeve==0andn_g==1:n+=1init_jeu()event(eve)sl(0.4)elifkd(1):h["pos"][1]-=1*(h["pos"][1]-1>=0)eve=a_g(orig)ifeve==0andn_g==1:n+=1init_jeu()event(eve)sl(0.4)elifkd(0):h["pos"][0]-=1*(h["pos"][0]-1>=0)eve=a_g(orig)ifeve==0andn_g==1:n+=1init_jeu()event(eve)sl(0.4)
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.