void build_mmap(){
	for(ll i=0;i<=mxl+1;i++){
		for(ll j=0;j<=myl+1;j++){
			mmap[i][j]=1;
		}
	}
	for(ll i=1;i<=mxl;i++){
		for(ll j=1;j<=myl;j++){
			mmap[i][j]=2;
			mmap_hp[i][j]=0;
			mmap_en[i][j]=0;
		}
	}
	
	
	//maze1
	for(ll i=501;i<=600;i++){
		for(ll j=501;j<=600;j++){
			mmap[i][j]=maze1[i-500][j-500];
		}
	}
	
	//grass1
	for(ll i=601;i<=700;i++){
		for(ll j=601;j<=700;j++){
 			mmap[i][j]=grass1[i-600][j-600];
		}
	}
	
	//grass2
	for(ll i=601;i<=700;i++){
		for(ll j=501;j<=600;j++){
			mmap[i][j]=grass2[i-600][j-500];
		}
	}
	
	//sea1
	for(ll i=601;i<=700;i++){
		for(ll j=701;j<=800;j++){
			mmap[i][j]=sea1[i-600][j-700];
		}
	} 
	
	return;
}

ll pl_data_mb;
ll pl_data[MAXN];
string pl_data_name[MAXN];
void build_pl_data(){
	pl_data_mb=0;
	for(ll i=0;i<MAXN;i++){
		pl_data[i]=0;
	}
	pl_data_mb++;
	pl_data_name[pl_data_mb]="蚀毒";
	pl_data_mb++;
	pl_data_name[pl_data_mb]="杀戮之气";
}

bool i_right(ll partial_x,ll partial_y){
	return(partial_x>0 && partial_x<mxl && partial_y>0 && partial_y<myl);
}//判断坐标是否合法 

bool find_ani(ll find_ani_x,ll find_ani_y){
	ll gjygjg=mmap[find_ani_x][find_ani_y];
	ll huihui=gjygjg;
	if(gjygjg>10000) gjygjg=ani_live[gjygjg-10000];
	mmap[find_ani_x][find_ani_y]=-99;
	ll dasdsa=5;
	while(dasdsa--){
		for(ll i=find_ani_x-5;i<=find_ani_x+5;i++){
			for(ll j=find_ani_y-5;j<=find_ani_y+5;j++){
				if(i_right(i,j)){
					if(mmap[i][j]==gjygjg || mmap[i][j]>10000){
						ll koipoi=0;
						for(ll k=0;k<4;k++){
							if (mmap[i+dx[k]][j+dy[k]]==-99) koipoi=1;
						}
						if(koipoi==1) {
							if(mmap[i][j]==gjygjg) mmap[i][j]=-99;
							else {
								for(ll i=find_ani_x-5;i<=find_ani_x+5;i++){
									for(ll j=find_ani_y-5;j<=find_ani_y+5;j++){
										if(mmap[i][j]==-99) mmap[i][j]=gjygjg;
									}
								}
								mmap[find_ani_x][find_ani_y]=huihui;
								return false;
							}
						}
					}
				}
			}
		}
	}
	for(ll i=find_ani_x-5;i<=find_ani_x+5;i++){
		for(ll j=find_ani_y-5;j<=find_ani_y+5;j++){
			if(mmap[i][j]==-99) mmap[i][j]=gjygjg;
		}
	}
	mmap[find_ani_x][find_ani_y]=huihui;
	return true;
}

void get(ll ima_type,ll ima_amount){
	if(ima_type<10000) {
		ima[ima_type]+=ima_amount;
	}
	else{
		lv_ima[ima_type/100-100][ima_type%100]+=ima_amount;
	}
	return;
}

bool pay(ll ima_type,ll ima_amount){
	if(ima_type<10000){
		if(ima[ima_type]>=ima_amount){
			ima[ima_type]-=ima_amount;
			return true;
		}
		change_colour(1);
		printf("你的");
		cout << ima_name[ima_type];
		printf("不足!\n");
		change_colour(8);	
	}
	else{
		if(lv_ima[ima_type/100-100][ima_type%100]>=ima_amount){
			lv_ima[ima_type/100-100][ima_type%100]-=ima_amount;
			return true;
		}
		change_colour(1);
		printf("你的");
		cout << lv_name[ima_type%100] << "阶" << lv_ima_name[ima_type];
		printf("不足!\n");
		change_colour(8);	
	}
	return false;
}

void txt_read(){
	//FILE* fr=fopen("out.txt","w");
    //freopen("out.txt","w",stdout);
    //printf("jkdcs");
    //fclose(fr);
    //fclose(stdin);
    //fclose(stdout);
    ifstream sdtsa;
    if(player_name=="zcy") sdtsa.open("zcy.txt",ios::in);
    else{
    	change_colour(1);
    	printf("数据读取失败!\n");
    	change_colour(8);
    	waiting(3);
    	return;
	}
    ll buf,buf_1,buf_2;
    sdtsa >> buf;
    for(ll i=1;i<=-buf;i++){
    	ima[i]=0;
	}
    while(sdtsa >> buf){
    	if(buf<0) break;
    	sdtsa >> buf_1;
    	ima[buf]=buf_1;
	}
	for(ll i=1;i<=-buf;i++){
		for(ll j=0;j<=10;j++){
			lv_ima[i][j]=0;
		}
	}
	while(sdtsa >> buf){
    	if(buf<0) break;
    	sdtsa >> buf_1;
    	sdtsa >> buf_2;
    	lv_ima[buf][buf_1]=buf_2;
	}
	while(sdtsa >> buf){
    	if(buf<0) break;
    	sdtsa >> buf_1;
    	sdtsa >> buf_2;
    	gar[buf]=buf_1;
    	gar_lv[buf]=buf_2;
    	buf_1=1;
    	while(buf_1>=0){
    		sdtsa >> buf_1;
    		if(buf_1>=0){
    			sdtsa >> buf_2;
    			gar_ins_lv[buf][buf_1]=buf_2;
			}
		}
	}
	for(ll i=1;i<=-buf;i++){
		for(ll j=0;j<=10;j++){
			ar[i][j]=0;
		}
	}
	while(sdtsa >> buf){
    	if(buf<0) break;
    	sdtsa >> buf_1;
    	sdtsa >> buf_2;
    	ar[buf][buf_1]=buf_2;
	}
	sdtsa.close();
	//cin >> in;
    return;
} 

void txt_write(){
	if(player_name=="zcy") {
		FILE* fr=fopen("zcy.txt","w");
		fclose(fr);
	}
	else{
		change_colour(1);
    	printf("数据保存失败!\n");
    	change_colour(8);
    	return;
	}
	ll record_xx=ima[6],record_yy=ima[7];
	ima[6]=get_life_xplace;
	ima[7]=get_life_yplace;
	if(player_name=="zcy"){
		ofstream outfile("zcy.txt",std::ios::app);
		outfile << -ima_mb << " ";
		for(ll i=1;i<=ima_mb;i++){
			if(ima[i]>0) outfile << i << " " << ima[i] << " ";
		}
		outfile << -lv_ima_mb << " ";
		for(ll i=1;i<=lv_ima_mb;i++){
			for(ll j=0;j<=10;j++){
				if(lv_ima[i][j]>0) outfile << i << " " << j << " " << lv_ima[i][j] << " ";
			}
		}
		outfile << -ima[8] << " ";
		for(ll i=1;i<=ima[8];i++){
			outfile << i << " " << gar[i] << " " << gar_lv[i] << " ";
			for(ll j=1;j<=ins_mb;j++){
				if(gar_ins_lv[i][j]>0) outfile << j << " " << gar_ins_lv[i][j] << " ";
			}
			outfile << "-1 ";
		}
		outfile << -ani_mb << " ";
		for(ll i=1;i<=ani_mb;i++){
			for(ll j=0;j<=10;j++){
				if(ar[i][j]>0){
					if(ar[i][j]>0) outfile << i << " " << j << " " << ar[i][j] << " ";
				}
			}
		}
	//	outfile << "Hello World!" << std::endl;
		outfile.close();
	} 
	
	
	ima[6]=record_xx;
	ima[7]=record_yy;
    return;
} 

void add_player(){
	system("cls");
	printf("请输入你的用户名称。\n若你没有账号,请输入new_player注册……\n");
	cin >> in;
	if(in=="new_player"){
		int bo_rror=0;
		while(bo_rror==0){
			system("cls");
			printf("输入您的昵称:");
			cin >> in;
			player_name=in;
			printf("昵称确认,确认后不可更改:");
			cout << player_name;
			printf("\n输入yes确认。\n");
			cin >> in;
			if(in=="yes") return;
		}	
	}
	else {
		for(ll i=1;i<=ima_mb;i++){
		//	ima[i]=0;
		}
		for(ll i=1;i<=lv_ima_mb;i++){
			for(ll j=0;j<=10;j++){
		//		lv_ima[i][j]=0;
			}
		}
	}
    if(in[0]=='z' && in[1]=='c' && in[2]=='y' && true){
        player_name=in;
        ima[1]=12;
        ima[5]=3;
        ima[6]=601;
        ima[7]=701;
        ima[8]=3;
        ima[10]=1;
        lv_ima[1][0]=3;
        lv_ima[1][1]=1;
        lv_ima[3][0]=23;
        lv_ima[6][1]=1;
        lv_ima[6][2]=4;
        lv_ima[7][1]=1;
        lv_ima[8][0]=3;
        gar[1]=1,gar_lv[1]=0;
        gar[2]=1,gar_lv[2]=0;
        gar[3]=1,gar_lv[3]=0;
        ar[1][0]=30;
        txt_read();
        return;
    }
    if(in[0]=='u' && in[1]=='s' && in[2]=='e' && in[3]=='r' && in[4]=='1' && true){
        player_name=in;
        ima[5]=3;
        ima[6]=665;
        ima[7]=665;
        ima[8]=3;
        lv_ima[1][0]=3;
        lv_ima[1][1]=1;
        lv_ima[3][0]=1;
        gar[1]=2,gar_lv[1]=0;
        gar[2]=1,gar_lv[2]=0;
        gar[3]=1,gar_lv[3]=0;
        ar[1][0]=31;
        return;
    }


	
	//在上一行添加储存代码 ^ ~ ^
	
	add_player();
	return;
}

void end_player(){
	ima[6]=get_life_xplace;
	ima[7]=get_life_yplace;
	txt_write();
/*	if(player_name=="zcy") freopen("zcy.txt","w",stdout);
	    system("cls");
		printf("%lld ",-ima_mb);
		for(ll i=1;i<=ima_mb;i++){
			if(ima[i]>0) printf("%lld %lld ",i,ima[i]);
		}
		printf("%lld ",-lv_ima_mb);
		for(ll i=1;i<=lv_ima_mb;i++){
			for(ll j=0;j<=10;j++){
				if(lv_ima[i][j]>0) printf("%lld %lld %lld",i,j,lv_ima[i][j]);
			}
			
		}
		printf("%lld ",-ima[8]);
		for(ll i=1;i<=ima[8];i++){
			printf("%lld %lld %lld ",i,gar[i],gar_lv[i]);
		}
		printf("%lld ",-ani_mb);
		for(ll i=1;i<=ani_mb;i++){
			for(ll j=0;j<=10;j++){
				if(ar[i][j]>0){
					if(ar[i][j]>0) printf("%lld %lld %lld ",i,j,ar[i][j]);
				}
			}
		}
	fclose(stdout);*/
	system("cls");
	cout << "    if(";
	for(ll i=0;i<player_name.length();i++ )printf("in[%lld]=='%c' && ",i,player_name[i]);
	printf("true){\n");
	printf("        player_name=in;\n");
	for(ll i=1;i<=ima_mb;i++){
		if(ima[i]>0) printf("        ima[%lld]=%lld;\n",i,ima[i]);
	}
	for(ll i=1;i<=lv_ima_mb;i++){
		for(ll j=0;j<=10;j++){
			if(lv_ima[i][j]>0) printf("        lv_ima[%lld][%lld]=%lld;\n",i,j,lv_ima[i][j]);
		}
	}
	for(ll i=1;i<=ima[8];i++){
		printf("	gar[%lld]=%lld,gar_lv[%lld]=%lld;\n",i,gar[i],i,gar_lv[i]);
	}
	for(ll i=1;i<=ani_mb;i++){
		for(ll j=0;j<=10;j++){
			if(ar[i][j]>0){
				if(ar[i][j]>0) printf("	ar[%lld][%lld]=%lld;\n",i,j,ar[i][j]);
			}
		}
	}
	printf("        return;\n    }");
	cin >> in;
	return;
}

void player_die(){
	inc= _getch();
	ima[6]=get_life_xplace;
	ima[7]=get_life_yplace;
	system("cls");
	change_colour(1);
	printf("你死了!!!\n\n按下任意建继续……\n\n\n\n\n\n_____________________________\n");
	inc= _getch();
	change_colour(8);
	end_player();
	
	player_die();
	return;
}

void print_ani_ima(ll ani_type){
	cout << "[" << ani_name[ani_type] << "] ";
	cout << att_name[ani_att[ani_type]] << "属性 | ";
	if(ani_eng[ani_type]<100) printf("中立");
	else printf("敌对");
	printf("\n");
	change_colour(0);
	if(ani_gat[ani_type]>1) printf("▽通常%lld个同类共同刷新!",ani_gat[ani_type]);
	change_colour(8);
	if(ani_dam[ani_type]!=0) printf("伤害:%lld\n",ani_dam[ani_type]);
	if(ani_hp[ani_type]!=0) printf("血量:%lld\n",ani_hp[ani_type]);
	if(ani_hea[ani_type]!=0) printf("恢复力:%lld\n",ani_hea[ani_type]);
	if(ani_reh[ani_type]!=0) printf("治疗力:%lld\n",ani_reh[ani_type]);
	printf("速度:%lld\n",ani_spe[ani_type]);
	printf("感官力:%lld\n",ani_dgr[ani_type]);
	printf("引伤:%lld\n",ani_v[ani_type]);
	printf("主动技:");
	if(ani_mski_mb[ani_type]==0) printf("无");
	printf("\n"); 
	for(ll i=1;i<=ani_mski_mb[ani_type];i++){
		cout << mski_name[ani_mski[ani_type][i]] << "[cd:" << mski_cd[ani_mski[ani_type][i]] << "]" << mski_itd[ani_mski[ani_type][i]] << endl;
	}
	printf("\n"); 
	for(ll i=1;i<=ski_mb;i++){
		if(ani_ski[ani_type][i]!=0) printf("{%lld}",i),cout << ski_name[i] << ":" << ani_ski[ani_type][i] << endl;
	}
	
	while(true){
		cin >> in;
		if(in[0]>='0' && in[0]<='9'){
			rin=s_to_ll(in);
			cout << ski_name[rin] << ":" << ski_itd[rin] << endl;
		}
	
		else return;
	}
	return;
} 

ll get_dst(ll base_x,ll base_y,ll fi_x,ll fi_y){
	ll base_xy=mmap[base_x][base_y];
	ll fi_xy=mmap[fi_x][fi_y];
	if(base_xy>10000 && base_xy<10000000) base_xy=ani_live[base_xy/100-100];
	if(fi_xy>10000 && fi_xy<10000000) fi_xy=ani_live[fi_xy/100-100];
	if(base_xy!=fi_xy){
		return -1;
	}
	else if(abs(base_x-fi_x)+abs(base_y-fi_y)>50) return -2;
	else if(abs(base_x-fi_x)+abs(base_y-fi_y)==0) return 0;
	mmap[base_x][base_y]+=200000000000000;
	ll afseshhgjfs=1;
	while(afseshhgjfs<=50){
		for(ll i=base_x-afseshhgjfs;i<=base_x+afseshhgjfs;i++){
			for(ll j=base_y-afseshhgjfs;j<=base_y+afseshhgjfs;j++){
				ll gdjjdsauehea=mmap[i][j];
				if(mmap[i][j]>10000 && mmap[i][j]<10000000){
					gdjjdsauehea=ani_live[gdjjdsauehea/100-100];
				}
				if(gdjjdsauehea==base_xy){
					bool dsghjdsartpm=false;
					for(ll k=0;k<4;k++){
						if(mmap[i+dx[k]][j+dy[k]]>100000000000000) dsghjdsartpm=true;
					}
					if(dsghjdsartpm){
						if(i==fi_x && j==fi_y){
							for(ll ii=base_x-50;ii<=base_x+50;ii++){
			                    for(ll jj=base_y-50;jj<=base_y+50;jj++){
			                    	if(mmap[ii][jj]>100000000000000){
			                    		mmap[ii][jj]-=200000000000000;
									}
			            		}
			            	}
							return afseshhgjfs;
						}
						mmap[i][j]+=200000000000000;
					}
				}
				
			}
		}
		afseshhgjfs++;
	} 
	for(ll ii=base_x-50;ii<=base_x+50;ii++){
        for(ll jj=base_y-50;jj<=base_y+50;jj++){
           	if(mmap[ii][jj]>100000000000000){
           		mmap[ii][jj]-=200000000000000;
			}
   		}
   	}
   	return -2;
	
	
}//搜索两个间的距离 

ll get_hp(ll gar_num){
	return ani_hp[gar[gar_num]]*add[gar_lv[gar_num]]+pc_turn(ani_hp[gar[gar_num]]*add[gar_lv[gar_num]],gar_ins_lv[gar_num][1]);
}//获取玩家最大血量 

ll get_dam(ll gar_num){
	return ani_dam[gar[gar_num]]*add[gar_lv[gar_num]];
}

ll get_hea(ll gar_num){
	return ani_hea[gar[gar_num]]*add[gar_lv[gar_num]];
}

ll get_reh(ll gar_num){
	return ani_reh[gar[gar_num]]*add[gar_lv[gar_num]];
}

ll get_ski(ll gar_num,ll ski_num){
	return ani_ski[gar[gar_num]][ski_num];
} //获取玩家技能数据 


ll get_v(ll gar_num){
	return ani_v[gar[gar_num]];
}


void ani_die(ll fi_x,ll fi_y){
	mmap_hp[fi_x][fi_y]=0;
	mmap[fi_x][fi_y]=ani_live[(mmap[fi_x][fi_y]-10000)/100];
	mmap_en[fi_x][fi_y]=0;
	return;
} 

ll hjhjhjhjhjhjdkfh=-1/*你在该回合攻击生物的伤害*/,hfsdjhvfivi=-1/*你在该回合攻击生物的种类*/,ncdndkefr=-1/*你在该回合是否击杀了生物*/,cdedfcsa=-1/*你在该回合攻击生物的等级*/,hurt_living_x,hurt_living_y/*坐标*/;//全局定义 

void one_get_hurt(ll dwhhjopp,ll amount_hurt,ll attack_type/*灵魂类(-1)or物理类(属性号码)*/){
	gar_hp[dwhhjopp]-=amount_hurt;
	printf("你的");
	cout << ani_name[gar[dwhhjopp]] << "·" << lv_name[gar_lv[dwhhjopp]] << "(" << dwhhjopp << ") 受到了" << amount_hurt << "点伤害\n";
	if(gar_hp[dwhhjopp]<0) gar_hp[dwhhjopp]=0 , change_colour(1) , cout << ani_name[gar[dwhhjopp]] << "·" << lv_name[gar_lv[dwhhjopp]] << "(" << dwhhjopp << ") 阵亡了!\n" , change_colour(8);
	return;
}

void get_hurt(ll amount_hurt,ll attack_type/*灵魂类(-1)or物理类(属性号码)*/){
//	printf("%lld\n",amount_hurt);
	ll wadfhgdw=0;
	for(ll i=1;i<=ima[8];i++){
		if(gar_hp[i]>0)wadfhgdw+=get_v(i);
	} 
	if(wadfhgdw==0) return;
	ll dwhhjopp=lrand(wadfhgdw);
	
	for(ll i=1;i<=ima[8];i++){
		if(gar_hp[i]>0){
			if(dwhhjopp>=get_v(i)) dwhhjopp-=get_v(i);
		else dwhhjopp=i,i=ima[8]+1;
		}
	}
	
	one_get_hurt(dwhhjopp,amount_hurt,attack_type);
	
	return;
}

void out_hurt(ll amount_hurt,ll fi_x,ll fi_y,bool i_you_out/*是否为你造成的伤害*/){
	
	if(i_you_out) hjhjhjhjhjhjdkfh=amount_hurt;
	if(i_you_out) hfsdjhvfivi=(mmap[fi_x][fi_y]-10000)/100;
	if(i_you_out) cdedfcsa=(mmap[fi_x][fi_y]-10000)%100;
	if(i_you_out) cout << "你对 " << ani_name[(mmap[fi_x][fi_y]-10000)/100] << "·" << lv_name[(mmap[fi_x][fi_y]-10000)%100] << "造成了" << amount_hurt << "点伤害\n";
	if(i_you_out){
		hurt_living_x=fi_x;
		hurt_living_y=fi_y;
		mmap_en[fi_x][fi_y]+=ani_den[(mmap[fi_x][fi_y]-10000)/100];
		if(mmap_en[fi_x][fi_y]>=100 && mmap_en[fi_x][fi_y]-ani_den[(mmap[fi_x][fi_y]-10000)/100]<100){
			cout << ani_name[(mmap[fi_x][fi_y]-10000)/100] << "·" << lv_name[(mmap[fi_x][fi_y]-10000)%100] << "发怒了!\n";
		}
	}
	mmap_hp[fi_x][fi_y]-=amount_hurt;
	if(mmap_hp[fi_x][fi_y]<=0) {
		
		if(i_you_out){
			ncdndkefr=1;
			cout << "你击杀了" << ani_name[(mmap[fi_x][fi_y]-10000)/100] << "·" << lv_name[(mmap[fi_x][fi_y]-10000)%100] << "!\n";
		}
		ani_die(fi_x,fi_y);
	}
	return;
}//输出伤害

void ani_ah(ll fii_x,ll fii_y,ll ah_amount){
	if(mmap[fii_x][fii_y]>10000){
		mmap_hp[fii_x][fii_y]+=ah_amount;
		if(max(fii_x-ima[6],ima[6]-fii_x)+max(fii_y-ima[7],ima[7]-fii_y)==1) {
			printf("在你");
			if(fii_x-ima[6]==1) printf("南");
			else if(fii_x-ima[6]==-1) printf("北");
			else if(fii_y-ima[7]==1) printf("东");
			else if(fii_y-ima[7]==-1) printf("西");
			printf("面的");
			cout << ani_name[(mmap[fii_x][fii_y]-10000)/100] << "·" << lv_name[(mmap[fii_x][fii_y]-10000)%100];
			if(mmap_hp[fii_x][fii_y]>ani_hp[(mmap[fii_x][fii_y]-10000)/100]*add[(mmap[fii_x][fii_y]-10000)%100]) printf("恢复了%lld血量\n",ah_amount-mmap_hp[fii_x][fii_y]+ani_hp[(mmap[fii_x][fii_y]-10000)/100]*add[(mmap[fii_x][fii_y]-10000)%100]);
			else  printf("恢复了%lld血量\n",ah_amount);
		}
		if(mmap_hp[fii_x][fii_y]>ani_hp[(mmap[fii_x][fii_y]-10000)/100]*add[(mmap[fii_x][fii_y]-10000)%100]) mmap_hp[fii_x][fii_y]=ani_hp[(mmap[fii_x][fii_y]-10000)/100]*add[(mmap[fii_x][fii_y]-10000)%100];
		
	}
	return;
} //生物回血

void add_gar_hp(ll gar_number,ll ah_amount){
	gar_hp[gar_number]+=ah_amount;
	printf("你的");
	cout << ani_name[gar[gar_number]] << "·" << lv_name[gar_lv[gar_number]] << "[" << gar_number << "] 恢复了";
	if(gar_hp[gar_number]>get_hp(gar_number)) printf("%lld",ah_amount-gar_hp[gar_number]+get_hp(gar_number));
	else printf("%lld",ah_amount);
	printf("点血量\n");
	if(gar_hp[gar_number]>get_hp(gar_number)) gar_hp[gar_number]=get_hp(gar_number);
	return;
}//玩家回血 

void print_ima(){
	ll ghghjghjghjghjioa=0;
	printf("\n___________________________________________________________________________________\n");
	for(ll i=1;i<=ima_mb;i++){
		if(ima[i]>0){
			cout << ima_name[i] << ":" << ima[i];
			ghghjghjghjghjioa++;
			if(ghghjghjghjghjioa%5==0) printf("\n___________________________________________________________________________________\n");
			else printf(" | ");
		} 	
	}
	printf("\n__________________________________________________________________\n");
	ghghjghjghjghjioa=0;
	for(ll i=1;i<=lv_ima_mb;i++){
		for(ll j=0;j<11;j++){
			if(lv_ima[i][j]>0){
				cout << lv_name[j] << "阶" << lv_ima_name[i] << ":" << lv_ima[i][j];
				ghghjghjghjghjioa++;
				if(ghghjghjghjghjioa%5==0) printf("\n__________________________________________________________________\n");
				else printf(" | ");
			}
		}
	}
	printf("\n");
	return;
}

void print_army(){
	for(ll i=1;i<=ani_mb;i++){
		ll dsaghhgj=true;//是否是第一个 
		for(ll j=0;j<=10;j++){
			if(ar[i][j]>0){
				if(dsaghhgj){
					cout << "[" << i << "]" << ani_name[i] << "  ";
					dsaghhgj=false;
				}
				cout << lv_name[j] << ":" << ar[i][j] << "  ";
			}
		}
		if(!dsaghhgj) printf("\n");
	}
	
	return;
}

void print_pl_data(){
	ll hsgdgjdtyeg=1;
	for(ll i=1;i<=pl_data_mb;i++){
		if(pl_data[i]!=0){
			hsgdgjdtyeg++;
			cout << pl_data_name[i] << ":" << pl_data[i];
			if(hsgdgjdtyeg%5==0) printf("\n");
			else printf(" | ");
		}
	} 
	printf("\n");
	return;
}

void print_gar(){
	for(ll i=1;i<=ima[8];i++){
		if(gar_hp[i]<=0) change_colour(1);
		cout << "[" << i << "]" << ani_name[gar[i]] << lv_name[gar_lv[i]] << "级   ";
		if(gar_hp[i]>0) printf("H:"),e_num(gar_hp[i]),printf("/"),e_num(get_hp(i));
		else printf("已阵亡");
		change_colour(8);
		if(i%3==0) printf("\n");
		else printf(" | ");
		
	}
	return;
}

void form(){
	for(ll i=1;i<=ima[8];i++){
		gar_hp[i]=get_hp(i);
		for(ll j=0;j<=ani_mski_mb[gar[i]];j++){
			gar_cd[i][j]=0;
		}
	}
	return;
}//出战格式化 

bool i_get_ani(ll ani_type){
	bool i_get_ani_ans=true;
	for(ll i=1;i<=ani_get_mb[ani_type];i++){
		if(ani_get[ani_type][i]>10000){
			if(lv_ima[ani_get[ani_type][i]/100-100][ani_get[ani_type][i]%100]<ani_get_amo[ani_type][i]) i_get_ani_ans=false;
		}
		else{
			if(ima[ani_get[ani_type][i]]<ani_get_amo[ani_type][i]) i_get_ani_ans=false;
		}
	}
	return i_get_ani_ans;
}//是否足够合成生物 
bool i_inc_ani(ll ani_type,ll purp_lv,ll amount,ll success/*成功概率*/){
	if(lv_ima[29][purp_lv]<amount*(success-1)*success/2) return false;
	for(ll i=1;i<=ani_high_mb[ani_type];i++){
		if(ani_high[ani_type][i]%1000000000<10000){
			if(ima[ani_high[ani_type][i]%1000000000]<(ani_high_amo[ani_type][i]+ani_high_amo[ani_type][i]*(_pow(purp_lv,3)-1)*(ani_high[ani_type][i]/1000000000))*amount) return false;
		}
		else{
			if(ani_high[ani_type][i]%100-20+purp_lv>=0){
				if(lv_ima[(ani_high[ani_type][i]%1000000000)/100-100][ani_high[ani_type][i]%100-20+purp_lv]<(ani_high_amo[ani_type][i]+ani_high_amo[ani_type][i]*(_pow(purp_lv,3)-1)*(ani_high[ani_type][i]/1000000000))*amount) return false;
			}
			
		}
	}
	return true;
}
void tt_inc_ani(ll ani_type,ll purp_lv,ll amount,ll success/*成功概率*/){
	if(!i_inc_ani(ani_type,purp_lv,amount,success)) {
		system("cls");
		change_colour(1);
		printf("升级失败!\n");
		char sdaiwujawkdjiw;
		sdaiwujawkdjiw= _getch();
		change_colour(8);
		return;
	}
	lv_ima[29][purp_lv]-=amount*(success-1)*success/2;
	for(ll i=1;i<=ani_high_mb[ani_type];i++){
		if(ani_high[ani_type][i]%1000000000<10000){
			ima[ani_high[ani_type][i]%1000000000]-=(ani_high_amo[ani_type][i]+ani_high_amo[ani_type][i]*(_pow(purp_lv,3)-1)*(ani_high[ani_type][i]/1000000000))*amount;
		}
		else{
			if(ani_high[ani_type][i]%100-20+purp_lv>=0){
				lv_ima[(ani_high[ani_type][i]%1000000000)/100-100][ani_high[ani_type][i]%100-20+purp_lv]-=(ani_high_amo[ani_type][i]+ani_high_amo[ani_type][i]*(_pow(purp_lv,3)-1)*(ani_high[ani_type][i]/1000000000))*amount;
			}
			
		}
	}
	ll success_ans=0;
	for(ll i=1;i<=amount;i++){
		ll opdasdwe=lrand(purp_lv);
		if(opdasdwe<success) success_ans++;
	}
	ar[ani_type][purp_lv-1]-=amount;
	ar[ani_type][purp_lv]+=success_ans;
	txt_write();
	system("cls");
	change_colour(4);
	printf("恭喜你获得%lld个\n",success_ans);
	cout << ani_name[ani_type] << "·" << lv_name[purp_lv] << "!";
	char sdaiwujawkdjiw;
	sdaiwujawkdjiw= _getch();
	change_colour(8);
	return;
}
void inc_ani(ll gar_num){
	if(!i_inc_ani(gar[gar_num],gar_lv[gar_num]+1,1,1)) return;
	for(ll i=1;i<=ani_high_mb[gar[gar_num]];i++){
		if(ani_high[gar[gar_num]][i]%1000000000<10000){
			ima[ani_high[gar[gar_num]][i]%1000000000]-=ani_high_amo[gar[gar_num]][i]+ani_high_amo[gar[gar_num]][i]*(_pow(gar_lv[gar_num]+1,3)-1)*(ani_high[gar[gar_num]][i]/1000000000);
		}
		else{
			if(ani_high[gar[gar_num]][i]%100-20+gar_lv[gar_num]+1>=0){
				lv_ima[(ani_high[gar[gar_num]][i]%1000000000)/100-100][(ani_high[gar[gar_num]][i]%1000000000)%100-20+gar_lv[gar_num]+1]-=ani_high_amo[gar[gar_num]][i]+ani_high_amo[gar[gar_num]][i]*(_pow(gar_lv[gar_num]+1,3)-1)*(ani_high[gar[gar_num]][i]/1000000000);
			}
			
		}
	}
	gar_lv[gar_num]++;
	return;
}//升级 

void get_ani(ll ani_type){
	for(ll i=1;i<=ani_get_mb[ani_type];i++){
		if(ani_get[ani_type][i]>10000){
			lv_ima[ani_get[ani_type][i]/100-100][ani_get[ani_type][i]%100]-=ani_get_amo[ani_type][i];
		}
		else{
			ima[ani_get[ani_type][i]]-=ani_get_amo[ani_type][i];
		}
	}
	ar[ani_type][0]++;
	return;
}//合成生物 

void print_mski(){
	ll hghghsaduyei=0;
	for(ll i=1;i<=ima[8];i++){
		if(gar_hp[i]>0){
			for(ll j=1;j<=ani_mski_mb[gar[i]];j++){
				hghghsaduyei++;
				if(gar_cd[i][j]>0){
					change_colour(0);
					cout << mski_name[ani_mski[gar[i]][j]] << "[" << i << "." << j << "] (" << gar_cd[i][j] << ")";
					change_colour(8);
				}
				else{
					cout << mski_name[ani_mski[gar[i]][j]] << "[" << i << "." << j << "]";
				}
				if(hghghsaduyei%5==0) printf(" |\n");
				else printf(" | ");
			}
		}
		
	}
	printf("\n");
	return;
}

void search_ani(){
	system("cls");
	printf("输入你要搜索的生物名称:");
	cin >> in;
	bool hgdhasgyhjgdsj=false;//是否搜寻到 
	for(ll i=1;i<=ani_mb;i++){
		ll koppjd=0;//搜索到的位置
		for(ll j=0;j<ani_name[i].length() && koppjd<1000;j++){
			if(ani_name[i][j]!=' '){
				if(ani_name[i][j]==in[koppjd]) koppjd++;
				else koppjd=1000;
			}
		} 
		if(koppjd<1000){
			print_ani_ima(i);
			i=ani_mb+1;
			hgdhasgyhjgdsj=true;
		}
	}
	if(!hgdhasgyhjgdsj) change_colour(1),printf("\n未搜寻到该角色!\n"),change_colour(8);
	return;
} 

bool into_building(ll place,ll into_x,ll into_y){
	if(place==1){
		system("cls");
		change_colour(1);
		printf("你撞墙了!!!\n");
		waiting(1);
		change_colour(0);
		return false;
	}
	else if(place==4){
		return false;
	}
	else if(place==5){
		system("cls");
		change_colour(4);
		if(into_x==get_life_xplace && into_y==get_life_yplace){
			
			printf("欢迎回到旅者之家!\n\n按下任意键继续……");
			inc= _getch();
			change_colour(8);
		}
		else{
			printf("欢迎来到旅者之家!\n\n按下l键支付200枚下品灵石在此定居……\n\n");
			inc= _getch();
			if(inc=='l'){
				if(pay(1,200)){
					get_life_xplace=into_x;
					get_life_yplace=into_y;
					printf("定居成功!!\n\n按下任意键继续……");
					inc= _getch(); 
				}
				else {
					printf("\n按下任意键继续……");
					inc= _getch();
					change_colour(8);
					return false;
				}
			}
			else {
				change_colour(8);
				return false;
			}
			change_colour(8);
		}
		
	}
	else if(place==6){
		bool gyuuipkhre=true;//退出 
		while(gyuuipkhre){
			system("cls");
			printf("-------------传灵塔-------------\n[t]选择要合成的生物\n[s]搜索要合成的生物\n[c]替换出阵生物\n[l]升级出阵生物\n[i]升级未出阵生物\n[r]退出\n");
			inc= _getch();
			if(inc=='r') gyuuipkhre=false;
			else if(inc=='s'){
				printf("请输入:");
				cin >> in;
				bool hgdhasgyhjgdsj=false;//是否搜寻到 
				for(ll i=1;i<=ani_mb;i++){
					ll koppjd=0;//搜索到的位置
					for(ll j=0;j<ani_name[i].length() && koppjd<1000;j++){
						if(ani_name[i][j]!=' '){
							if(ani_name[i][j]==in[koppjd]) koppjd++;
							else koppjd=1000;
						}
					} 
					if(koppjd<1000){
						printf("\n合成TA需要:");
						for(ll j=1;j<=ani_get_mb[i];j++){
							if(ani_get[i][j]>10000){
								cout << lv_ima_name[ani_get[i][j]/100-100] << "·" << lv_name[ani_get[i][j]%100];
							}
							else cout << ima_name[ani_get[i][j]];
							printf("*%lld ",ani_get_amo[i][j]);
							if(j!=ani_get_mb[i]) printf("、");
						}
						if(i_get_ani(i) ){
							printf("\n按下g取消合成。\n");
							inc= _getch();
							if(inc!='g') get_ani(i),printf("\n合成成功!\n");
						}
						else change_colour(1),printf("\n资源不足!\n"),change_colour(8);
						i=ani_mb+1;
						hgdhasgyhjgdsj=true;
					}
				}
				if(!hgdhasgyhjgdsj) change_colour(1),printf("\n未搜寻到该角色!\n"),change_colour(8);
				
				printf("按下任意键继续……\n");
				
			}
			else if(inc=='t'){
				system("cls");
				for(ll i=1;i<=ani_mb;i++){
					if(i_get_ani(i)){
						printf("[%lld]",i);
						cout << ani_name[i] << endl;
					}
				}
				cin >> in;
				rin=s_to_ll(in);
				if(rin>0 && rin<=ani_mb){
					printf("\n合成TA需要:");
					for(ll i=1;i<=ani_get_mb[rin];i++){
						if(ani_get[rin][i]>10000){
							cout << lv_ima_name[ani_get[rin][i]/100-100] << "·" << lv_name[ani_get[rin][i]%100];
						}
						else cout << ima_name[ani_get[rin][i]];
						printf("*%lld ",ani_get_amo[rin][i]);
						if(i!=ani_get_mb[rin]) printf("、");
					}
					if(i_get_ani(rin)){
						printf("\n按下g取消合成。\n");
						inc= _getch();
						if(inc!='g') get_ani(rin),printf("\n合成成功!\n");
						
						
					}
					else change_colour(1),printf("\n资源不足!\n"),change_colour(8);
				}
				else change_colour(1),printf("输入有误!\n"),change_colour(8);
				
				
				printf("按下任意键继续……\n");
				
			}
			else if(inc=='c'){
				system("cls");
				print_gar();
				printf("\n__________________________________________\n");
				print_army();
				printf("\n输入对应编号:");
				cin >> in;
				rin=s_to_ll(in);
				if(rin>0 && rin<=ima[8]){
					ll dghkausoi=rin;
					printf("\n输入你要替换成的角色(对应编号):");
					cin >> in;
					rin=s_to_ll(in);
					ll huioosdkx=rin;
					if(huioosdkx>0 && huioosdkx<=ani_mb){
						printf("\n输入等级:");
						cin >> in;
						rin=s_to_ll(in);
						if(rin>=0 && rin<11){
							if(ar[huioosdkx][rin]>0){
								ar[huioosdkx][rin]--;
								ar[gar[dghkausoi]][gar_lv[dghkausoi]]++;
								gar[dghkausoi]=huioosdkx;
								gar_lv[dghkausoi]=rin;
								form();
								printf("替换成功!\n");
							}
							else change_colour(1),printf("你没有该角色!\n"),change_colour(8);
						}
						else change_colour(1),printf("输入有误!\n"),change_colour(8);
					}
					else change_colour(1),printf("输入有误!\n"),change_colour(8);
				}
				else change_colour(1),printf("输入有误!\n"),change_colour(8);
				
			}
			else if(inc=='l'){
				system("cls");
				print_gar();
				printf("\n输入对应编号:");
				cin >> in;
				rin=s_to_ll(in);
				if(rin>0 && rin<=ima[8]){
					printf("\n将TA升级需要:");
					for(ll i=1;i<=ani_high_mb[gar[rin]];i++){
						
							if((ani_high[gar[rin]][i]%1000000000)>10000){
								if((ani_high[gar[rin]][i]%1000000000)%100-20+gar_lv[rin]+1>=0){									
									cout << lv_ima_name[(ani_high[gar[rin]][i]%1000000000)/100-100] << "·" << lv_name[(ani_high[gar[rin]][i]%1000000000)%100-20+gar_lv[rin]+1];
									printf("*%lld ",ani_high_amo[gar[rin]][i]+ani_high_amo[gar[rin]][i]*(_pow(gar_lv[rin]+1,3)-1)*(ani_high[gar[rin]][i]/1000000000));
									if(i!=ani_high_mb[gar[rin]]) printf("、");
									else printf("\n");
								}
							}
							else {
								cout << ima_name[(ani_high[gar[rin]][i]%1000000000)];
								printf("*%lld ",ani_high_amo[gar[rin]][i]+ani_high_amo[gar[rin]][i]*(_pow(gar_lv[rin]+1,3)-1)*(ani_high[gar[rin]][i]/1000000000));
								if(i!=ani_high_mb[gar[rin]]) printf("、");
								else printf("\n");
							}
							
						
						
					}
					if(i_inc_ani(gar[rin],gar_lv[rin]+1,1,1)){
						
						printf("\n按下g取消升级。\n");
						inc= _getch();
						if(inc!='g') inc_ani(rin),printf("升级成功!\n"),form();
						
					}
					else change_colour(1),printf("\n资源不足!\n"),change_colour(8);
				}
				else change_colour(1),printf("输入有误!\n"),change_colour(8);
			}
			else if(inc=='i'){
				bool aghsiwoxmxjc=true;//是否退出
				while(aghsiwoxmxjc) {
					system("cls");
					print_army();
					printf("请输入生物种类编号(输入【r】退出):\n"); 
					cin >> in;
					rin=s_to_ll(in);
					if(rin>0 && rin<=ani_mb){
						ll uhiuibyfrqrd=-1;//等级(位置) 
						ll dawdwacdfrfh=1;//数量 
						ll dghwhduhidiw=1;//成功概率 
						for(ll i=0;i<=10;i++){
							if(ar[rin][i]>0) uhiuibyfrqrd=i;
						}
						while(uhiuibyfrqrd>=0){
							system("cls");
							cout << ani_name[rin] << "|成功概率:" << dghwhduhidiw << "/" << uhiuibyfrqrd+1 << "|已选" << dawdwacdfrfh << "个" << endl << "_______________________________" << endl << "[COST] ";
							if(dghwhduhidiw>1) cout << dghwhduhidiw*(dghwhduhidiw-1)/2 << "*" << dawdwacdfrfh << "=" << dawdwacdfrfh*dghwhduhidiw*(dghwhduhidiw-1)/2 << lv_name[uhiuibyfrqrd+1] << "阶" << lv_ima_name[29] << "(你有" << lv_ima[29][uhiuibyfrqrd+1] << "个)、"; 
							for(ll i=1;i<=ani_high_mb[rin];i++){
								if(ani_high[rin][i]%1000000000<10000){
									cout << ani_high_amo[rin][i]+ani_high_amo[rin][i]*(_pow(uhiuibyfrqrd+1,3)-1)*(ani_high[rin][i]/1000000000) << "*" << dawdwacdfrfh << "=" << (ani_high_amo[rin][i]+ani_high_amo[rin][i]*(_pow(uhiuibyfrqrd+1,3)-1)*(ani_high[rin][i]/1000000000))*dawdwacdfrfh << "个" << ima_name[ani_high[rin][i]%1000000000] << "(你有" << ima[ani_high[rin][i]%1000000000] << "个)、";
								}
								else{
									if(ani_high[rin][i]%100-20+uhiuibyfrqrd+1>=0){
										cout << ani_high_amo[rin][i]+ani_high_amo[rin][i]*(_pow(uhiuibyfrqrd+1,3)-1)*(ani_high[rin][i]/1000000000) << "*" << dawdwacdfrfh << "=" << (ani_high_amo[rin][i]+ani_high_amo[rin][i]*(_pow(uhiuibyfrqrd+1,3)-1)*(ani_high[rin][i]/1000000000))*dawdwacdfrfh << "个" << lv_name[ani_high[rin][i]%100-20+uhiuibyfrqrd+1] << "阶" << lv_ima_name[(ani_high[rin][i]%1000000000)/100-100] << "(你有" << lv_ima[(ani_high[rin][i]%1000000000)/100-100][ani_high[rin][i]%100-20+uhiuibyfrqrd+1] << "个)、";
									}
									
								}
							}
							printf("\n");
							if(!i_inc_ani(rin,uhiuibyfrqrd+1,dawdwacdfrfh,dghwhduhidiw)) change_colour(1),printf("资源不足!\n"),change_colour(8);
							printf("_______________________________________\n");
							for(ll i=0;i<=10;i++){
								if(uhiuibyfrqrd==i) change_colour(6);
								if(ar[rin][i]>0) cout << lv_name[i] << ":" << ar[rin][i] << endl;
								change_colour(8);
							}
							
							printf("_______________________________________\n(【-】向上【=】向下【a】增加【z】增加5个【l】减少【k】减少5个【i】提升成功概率【o】降低成功概率【e】确定【r】退出)\n");
							inc= _getch();
							if(inc=='r'){
								uhiuibyfrqrd=-1;
							}
							else if(inc=='-'){
								for(ll i=uhiuibyfrqrd-1;i>=0;i--){
									if(ar[rin][i]>0){
										uhiuibyfrqrd=i;
										i=-1;
									}
								}
								dawdwacdfrfh=1;
								dghwhduhidiw=1;
							}
							else if(inc=='='){
								for(ll i=uhiuibyfrqrd+1;i<=ani_mb;i++){
									if(ar[rin][i]>0){
										uhiuibyfrqrd=i;
										i=ani_mb+1;
									}
								}
								dawdwacdfrfh=1;
								dghwhduhidiw=1;
							}
							else if(inc=='a'){
								dawdwacdfrfh++;
								if(dawdwacdfrfh>ar[rin][uhiuibyfrqrd]) dawdwacdfrfh=ar[rin][uhiuibyfrqrd];
							}
							else if(inc=='z'){
								dawdwacdfrfh+=5;
								if(dawdwacdfrfh>ar[rin][uhiuibyfrqrd]) dawdwacdfrfh=ar[rin][uhiuibyfrqrd];
							}
							else if(inc=='l'){
								dawdwacdfrfh--;
								if(dawdwacdfrfh<1) dawdwacdfrfh=1;
							}
							else if(inc=='k'){
								dawdwacdfrfh-=5;
								if(dawdwacdfrfh<1) dawdwacdfrfh=1;
							}
							else if(inc=='e'){
								tt_inc_ani(rin,uhiuibyfrqrd+1,dawdwacdfrfh,dghwhduhidiw);
							}
							else if(inc=='i'){
								dghwhduhidiw++;
								if(dghwhduhidiw>uhiuibyfrqrd+1) dghwhduhidiw=uhiuibyfrqrd+1;
							}
							else if(inc=='o'){
								dghwhduhidiw--;
								if(dghwhduhidiw<1) dghwhduhidiw=1;
							}
						}
					}//借用rin变量 
					else if(in=="r"){
						aghsiwoxmxjc=false;
					}
				}
				
			}
			if(inc!='r') inc= _getch();//不用考虑在if中Inc改变的问题 
		}
		
		
	} 
	else if(place==9){
		search_ani();
		return false;	
	}
	else if(place>=11 && place<=14) return false;
	else if(place>10000){
		ll all_out_hurt=0;
		for(ll i=1;i<=ima[8];i++){
			if(gar_hp[i]>0) all_out_hurt+=get_dam(i);
		}
		out_hurt(all_out_hurt,into_x,into_y,true);
		return false;
	}
	
	return true;
}//进入建筑物 

ll pfind_x=0,pfind_y=0;//玩家锁定的格;

void print_watch(){
	for(ll i=ima[6]-ima[5];i<=ima[6]+ima[5];i++){
		for(ll j=ima[7]-ima[5];j<=ima[7]+ima[5];j++){
			change_colour(0);
			printf("*******");
			change_colour(8);
		}
		change_colour(0);
		printf("*\n");
		change_colour(8);
		for(ll j=ima[7]-ima[5];j<=ima[7]+ima[5];j++){
			change_colour(0);
			printf("*");
			change_colour(8);
			if(i==ima[6] && j==ima[7]) change_colour(3);
			if(pfind_x<0) if(i==-pfind_x && j==-pfind_y) change_colour(5);
			if(i<0 || j<0 || i>mxl+1 || j>myl+1){
				cout << building_name_a[1];
			}
			else {
				if(i==ima[6] && j==ima[7] && mmap[i][j]==0) printf(" ^  ^ ");
				else {
					if(mmap[i][j]>10000){
						cout << ani_name[(mmap[i][j]-10000)/100];
					}
					else cout << building_name_a[mmap[i][j]];
				}
			}
			change_colour(8);
		}
		change_colour(0);
		printf("*\n");
		change_colour(8);
		for(ll j=ima[7]-ima[5];j<=ima[7]+ima[5];j++){
			change_colour(0);
			printf("*");
			change_colour(8);
			if(i==ima[6] && j==ima[7]) change_colour(3);
			if(pfind_x<0) if(i==-pfind_x && j==-pfind_y) change_colour(5);
			if(i<0 || j<0 || i>mxl+1 || j>myl+1){
				cout << building_name_u[1];
			}
			else {
				if(i==ima[6] && j==ima[7] && mmap[i][j]==0) printf("  ~~  ");
				else {
					if(mmap[i][j]>10000){
						if(ima[10]==0) e_num(mmap_hp[i][j]);
						else if(mmap_hp[i][j]==ani_hp[mmap[i][j]/100-100]*add[mmap[i][j]%100])  change_colour(4),e_num(mmap_hp[i][j]),change_colour(8);
						else print_percent(mmap_hp[i][j],ani_hp[mmap[i][j]/100-100]*add[mmap[i][j]%100]);
						cout << lv_name[(mmap[i][j]-10000)%100];
					}
					else cout << building_name_u[mmap[i][j]];
				}
			}
			change_colour(8);
		}
		change_colour(0);
		printf("*\n");
		change_colour(8);
	}
	change_colour(0);
	for(ll i=1;i<=7*(ima[5]*2+1)+1;i++) printf("*");
	printf("\n");
	change_colour(8); 
	if(ima[12]==1) print_pl_data();
	print_gar();
	return;
}


void pfind(){
	pfind_x=ima[6];
	pfind_y=ima[7];
	while(true){
		system("cls");
		printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
		printf("Tip:按e键确定\n");
		pfind_x=-pfind_x;
		pfind_y=-pfind_y; 
		print_watch();
		pfind_x=-pfind_x;
		pfind_y=-pfind_y; 
		inc= _getch();
		in=" ";
		in[0]=inc;
		if((x_walk(in)-2)*(y_walk(in)-2)!=0){
			pfind_x+=x_walk(in);
			pfind_y+=y_walk(in);
		}
		else if(inc=='e') return;
	}
	return;
} 


ll wwwmap[1010][1010];
ll jiumap[101][101];//召唤技能               
int main(){
	ll ansans=1000;
	for(ll i=1;i<=200;i++){
		ansans=ansans*11/10;
	} 
	printf("%lld",ansans);
	cin >> in;
	srand(time(NULL));
	//printf("\nfdgf\n");
	build_lv();
	//printf("sax00\n");
	build_print_skill();
	build_mski();
	build_ani();
	build_ins();
	build_ar(); 
	build_ima();
	//printf("xhgudshzusdhxkdsxds\n");
	//printf("%lld\n",ani_rel[2][0]);
	//printf("%lld\n",ani_mb); 
	build_building();
	//printf("dxsdsxds\n");
	build_mmap();
	build_pl_data();
	//printf("xassa\n");
	for(ll i=1;i<=ima[8];i++){
		gar[i]=1;
		gar_lv[i]=0;
		gar_hp[i]=ani_hp[1]*add[gar_lv[i]];
	}//出战位初始化 
	add_player();
	form();
	ll ani_main_bron=0;//生物刷新区域 0~9 
	//printf("%lld\n",building_ani_rel_mb[2]);
	get_life_xplace=ima[6];
	get_life_yplace=ima[7];
	//cin >> in;
	system("cls");
	mmap[665][665]=6;
	while(true){
		bool dwguyxhguyfcuiguv=false;//是否存活 
		for(ll i=1;i<=ima[8];i++){
			if(gar_hp[i]>0) dwguyxhguyfcuiguv=true;
		}
		if(!dwguyxhguyfcuiguv) player_die();
		for(ll i=ima[6]-50;i<=ima[6]+50;i++){
			for(ll j=ima[7]-50;j<=ima[7]+50;j++){
				if(mmap[i][j]<10000 && jiumap[i-ima[6]+50][j-ima[7]+50]>0){
					if(ani_live[jiumap[i-ima[6]+50][j-ima[7]+50]/100]==mmap[i][j]){
						mmap[i][j]=jiumap[i-ima[6]+50][j-ima[7]+50]+10000;
						mmap_hp[i][j]=ani_hp[jiumap[i-ima[6]+50][j-ima[7]+50]/100]*add[jiumap[i-ima[6]+50][j-ima[7]+50]%100];
						mmap_en[i][j]=ani_eng[jiumap[i-ima[6]+50][j-ima[7]+50]/100];
					}
				}
				jiumap[i-ima[6]+50][j-ima[7]+50]=0;
			}
		}
		txt_write();
		ll dsxijzjicdiodqp=10;//记录本回合恢复血量增加情况(例如休息加五成回血) 
		in="first_enter_notdothis"; 
		in=" ";
		inc=')';
		while(in!="a" && in!="s" && in!="d" && in!="w" && in!="break_while"){
			if(inc!=')') change_colour(1),printf("输入无效!\n"),change_colour(8);
			print_watch();
			print_mski();
			printf("请输入:(按下【/】建查看选项)\n");
			//cin >> in; 
			inc= _getch();
			in[0]=inc;
			if(in=="/"){
				system("cls");
				printf("w:向上\na:向左\ns:向下\nd:向右\n(攻击其他生物的方法:若你试图走到其他生物所在格,该生物一般会受到你造成的伤害)\ni:查看背包\np:查看角色\nl:离开\nq:查询附近生物\nn:铭文\nx:使用技能\nr:休息(本回合己方全部角色恢复力增加5成)\nb:搜索生物信息");
				inc= _getch();
				in=" ";
				inc=')';
			}
			if(in=="i"){	
				system("cls");
				print_ima();
				inc= _getch();
				in=" ";
				inc=')';
			}
			if(in=="p"){
				system("cls");
				print_army();
				inc= _getch();
				in=" ";
				inc=')';
			}
			if(in=="l"){
				system("cls");
				printf("你确定要离开吗?确定请输入yes\n");
				cin >> in;
				if(in=="yes") {
					end_player();
					return 0;
				}
				in=" ";
				inc=')';
			}
			if(in=="q"){
				pfind();
				if(mmap[pfind_x][pfind_y]>10000) system("cls"),print_ani_ima(mmap[pfind_x][pfind_y]/100-100),inc= _getch();
				in=" ";
				inc=')';
			}
			if(in=="n"){
				system("cls");
				printf("【铭文】\n| ");
				for(ll i=1;i<=ins_mb;i++){
					cout << i << ":" << ins_name[i] << " | ";
				}
				printf("\n");
				for(ll i=1;i<=ima[8];i++){
					printf("[%lld] ",i);
					for(ll j=1;j<=ins_mb;j++){
						cout << ins_name[j] << ":Lv." << gar_ins_lv[i][j] << " ";
					}
					printf("\n\n");
				}
				printf("____________________________________________________\n请输入要升级的位置(输入其他退出):");
				cin >> in;
				ll sduaydiadrin=s_to_ll(in);
				if(sduaydiadrin>0 && sduaydiadrin<=ima[8]){
					printf("请选择要升级哪一项:");
					cin >> in;
					rin=s_to_ll(in);
					if(rin>0 && rin<=ins_mb){
						printf("你将耗费%lld点升级点,按下y确认升级\n",ins_high[rin][gar_ins_lv[sduaydiadrin][rin]+1]);
						inc= _getch();
						if(inc=='y'){
							if(pay(14,ins_high[rin][gar_ins_lv[sduaydiadrin][rin]+1])){
								gar_ins_lv[sduaydiadrin][rin]++;
								printf("升级成功!"),waiting(2);
							}
							else waiting(2);
						}
					}
					else printf("输入有误!"),waiting(2);
				}
				
				in=" ";
				inc=')';
			}
			
			if(in=="x"){
				printf("输入你要使用的技能所属角色位置:");
				cin >> in;
				ll jhjkdadidx=s_to_ll(in);
				if(jhjkdadidx>0 && jhjkdadidx<=ima[8]){
					if(gar_hp[jhjkdadidx]>0){
						printf("技能序号:");
						cin >> in;
						ll sgxygsuih=s_to_ll(in);
						if(sgxygsuih>0 && sgxygsuih<=ani_mski_mb[gar[jhjkdadidx]]){
							if(gar_cd[jhjkdadidx][sgxygsuih]==0){
								if(ani_mski[gar[jhjkdadidx]][sgxygsuih]==1) {
									pfind();
									if(mmap[pfind_x][pfind_y]==2){
										if(max(pfind_x-ima[6],ima[6]-pfind_x)+max(pfind_y-ima[7],ima[7]-pfind_y)<=3){
											mmap[pfind_x][pfind_y]=11300+gar_lv[jhjkdadidx];
											mmap_hp[pfind_x][pfind_y]=ani_hp[13]*add[gar_lv[jhjkdadidx]];
											mmap_en[pfind_x][pfind_y]=ani_eng[13];
											gar_cd[jhjkdadidx][sgxygsuih]=mski_cd[ani_mski[gar[jhjkdadidx]][sgxygsuih]];
											in="break_while";
											
										}
										else printf("你只能在三格以内放置!\n"),inc= _getch();
									}
									else printf("你只能在草地上放置!\n"),inc= _getch();
								}
							}
							else printf("请等待技能冷却结束……\n"),inc= _getch();
						}
						else printf("未找到对应技能!\n"),inc= _getch();
					}
					else printf("该角色已阵亡!\n"),inc= _getch();
				}
				else printf("未找到对应角色!\n"),inc= _getch();
				
				if(in!="break_while") in=" ";
				inc=')';
			}
			else if(in=="r"){
				dsxijzjicdiodqp+=5; 
				in="break_while";
				inc='(';
			}
			else if(in=="b"){
				search_ani();
				in=" ";
				inc='(';
			}
			system("cls");
			printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
		}
		system("cls");
		hjhjhjhjhjhjdkfh=-1/*你在该回合攻击生物的伤害*/,hfsdjhvfivi=-1/*你在该回合攻击生物的种类*/,ncdndkefr=-1/*你在该回合是否击杀了生物*/,cdedfcsa=-1/*你在该回合攻击生物的等级*/;
		if((x_walk(in)-2)*(y_walk(in)-2)!=0){
			string djhjkfsfd=in;
			if(into_building(mmap[ima[6]+x_walk(in)][ima[7]+y_walk(in)],ima[6]+x_walk(in),ima[7]+y_walk(in))){
				ima[6]+=x_walk(djhjkfsfd);
				ima[7]+=y_walk(djhjkfsfd);
			}
		}
		system("cls");
		printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
		print_watch();
		print_mski();
		printf("等待中……\n");
		//ll fdu=0;
		for(ll i=ani_main_bron*100+1;i<=ani_main_bron*100+100;i++){
			for(ll j=1;j<=myl;j++){
				if(mmap[i][j]<10000){
					if(true){
						if(find_ani(i,j)){
							ll grtgtr=0;
							ll nearl=-1;
							for(ll k=0;k<4;k++){
								if(mmap[i+dx[k]][j+dy[k]]<10000){
									if(building_cha[mmap[i+dx[k]][j+dy[k]]]!=-1){
										nearl=mmap[i+dx[k]][j+dy[k]];
									}
								}
							}
							if(nearl==-1){
								if(building_ani_rel_mb[mmap[i][j]]>0){
									ll ooppooppoo=lrand(10000);
									if(ooppooppoo<building_re[mmap[i][j]]){
										grtgtr=building_ani_rel_an[mmap[i][j]];
										ll opoopo=faster_lrand(grtgtr);
										//printf("%lld ",opoopo);
										bool grtgtryy=true;
										for(ll k=1;k<=building_ani_rel_mb[mmap[i][j]] && grtgtryy;k++){
											if(opoopo>=ani_rel[building_ani_rel[mmap[i][j]][k]/100][building_ani_rel[mmap[i][j]][k]%100]) opoopo-=ani_rel[building_ani_rel[mmap[i][j]][k]/100][building_ani_rel[mmap[i][j]][k]%100];
											else grtgtr=k,grtgtryy=false;
										}
										mmap_hp[i][j]=ani_hp[building_ani_rel[mmap[i][j]][grtgtr]/100]*add[building_ani_rel[mmap[i][j]][grtgtr]%100];
										mmap_en[i][j]=ani_eng[building_ani_rel[mmap[i][j]][grtgtr]/100];
										mmap[i][j]=10000+building_ani_rel[mmap[i][j]][grtgtr];
										ll sdgjhdsuid=ani_gat[mmap[i][j]/100-100]-1;
										for(ll k=0;k<8 && sdgjhdsuid>0;k++){
											if(mmap[i+dx[k]][j+dy[k]]==ani_live[mmap[i][j]/100-100]){
												sdgjhdsuid--;
												mmap[i+dx[k]][j+dy[k]]=mmap[i][j];
												mmap_hp[i+dx[k]][j+dy[k]]=mmap_hp[i][j];
												mmap_en[i+dx[k]][j+dy[k]]=mmap_en[i][j];
											}
										}
										//printf("%lld ",mmap[i][j]);
										
										//if(fdu==0)printf("%lld %lld\n",i,j),cin>> in;
										//fdu=1;
									}
								}
								
								
							}
							else{
								grtgtr=0;
								ll ooppooppoo=lrand(10000);
								if(ooppooppoo<building_cha[nearl]){
									for(ll k=1;k<=building_ani_mb[nearl];k++){
										grtgtr+=building_cre[nearl][k];
									}
									ll opoopo=faster_lrand(grtgtr);
									//printf("%lld ",opoopo);
									bool grtgtryy=true;
									for(ll k=1;k<=building_ani_mb[nearl] && grtgtryy;k++){
										if(opoopo>=building_cre[nearl][k]) opoopo-=building_cre[nearl][k];
										else grtgtr=k,grtgtryy=false;
									}
									mmap_hp[i][j]=ani_hp[building_ani[nearl][grtgtr]/100]*add[building_ani[nearl][grtgtr]%100];
									mmap_en[i][j]=ani_eng[building_ani[nearl][grtgtr]/100];
									mmap[i][j]=10000+building_ani[nearl][grtgtr];
									ll sdgjhdsuid=ani_gat[mmap[i][j]/100-100]-1;
									for(ll k=0;k<8 && sdgjhdsuid>0;k++){
										if(mmap[i+dx[k]][j+dy[k]]==ani_live[mmap[i][j]/100-100]){
											sdgjhdsuid--;
											mmap[i+dx[k]][j+dy[k]]=mmap[i][j];
											mmap_hp[i+dx[k]][j+dy[k]]=mmap_hp[i][j];
											mmap_en[i+dx[k]][j+dy[k]]=mmap_en[i][j];
										}
									}
									//printf("%lld ",mmap[i][j]);
									
									//if(fdu==0)printf("%lld %lld\n",i,j),cin>> in;
									//fdu=1;
								}
								
								
								/*
								ll building_ani_mb[nearl];//将更改的个数 
ll building_cha[nearl];//该地周围更改后生物出生概率之和  -1为不更改  n/10000
ll building_ani[nearl][100];//建筑周围生物刷新概率  building_ani[i][j]表示i建筑周围第j个将更改出生概率的生物种类
ll building_cre[nearl][100];//更改后的概率 
								*/
							}
						}
					}
				}
				
			}
		}
		system("cls");
		printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
		for(ll i=1;i<=ima[8];i++){
			if(gar_hp[i]<get_hp(i) && gar_hp[i]!=0 && ani_hea[gar[i]]>0){
				add_gar_hp(i,get_hea(i)*dsxijzjicdiodqp/10);
			}
		}
		
		if(hfsdjhvfivi>0) {
			cout << "你对 " << ani_name[hfsdjhvfivi] << "·" << lv_name[cdedfcsa] << "造成了" << hjhjhjhjhjhjdkfh << "点伤害\n";
			if(mmap_en[hurt_living_x][hurt_living_y]>=100 && mmap_en[hurt_living_x][hurt_living_y]-ani_den[hfsdjhvfivi]<100) cout << ani_name[hfsdjhvfivi] << "·" << lv_name[cdedfcsa] << "发怒了!\n";
		}
		if(ncdndkefr>0){
			cout << "你击杀了" << ani_name[hfsdjhvfivi] << "·" << lv_name[cdedfcsa] << "!\n";
			for(ll i=1;i<=ani_drop_mb[hfsdjhvfivi];i++){
				ll dsapido=lrand(10000);
				if(dsapido<ani_drop_rel[hfsdjhvfivi][i]/10){
					if(ani_drop[hfsdjhvfivi][i]>10000) {
						if(cdedfcsa-20+ani_drop[hfsdjhvfivi][i]%100>=0){
							printf("你获得了%lld个",ani_drop_amo[hfsdjhvfivi][i]+ani_drop_amo[hfsdjhvfivi][i]*(_pow(cdedfcsa,3)-1)*(ani_drop_rel[hfsdjhvfivi][i]%10));
							cout << lv_name[cdedfcsa-20+ani_drop[hfsdjhvfivi][i]%100] << "阶" << lv_ima_name[ani_drop[hfsdjhvfivi][i]/100-100] << endl;
							get(10000+(ani_drop[hfsdjhvfivi][i]/100-100)*100+cdedfcsa-20+ani_drop[hfsdjhvfivi][i]%100,ani_drop_amo[hfsdjhvfivi][i]+ani_drop_amo[hfsdjhvfivi][i]*(_pow(cdedfcsa,3)-1)*(ani_drop_rel[hfsdjhvfivi][i]%10));
						}
						
					}
					else{
						printf("你获得了%lld个",ani_drop_amo[hfsdjhvfivi][i]+ani_drop_amo[hfsdjhvfivi][i]*(_pow(cdedfcsa,3)-1)*(ani_drop_rel[hfsdjhvfivi][i]%10));
						cout << ima_name[ani_drop[hfsdjhvfivi][i]] << endl;
						get(ani_drop[hfsdjhvfivi][i],ani_drop_amo[hfsdjhvfivi][i]+ani_drop_amo[hfsdjhvfivi][i]*(_pow(cdedfcsa,3)-1)*(ani_drop_rel[hfsdjhvfivi][i]%10));
					}
				}
			}
		} 
		for(ll i=1;i<=mxl;i++){
			for(ll j=1;j<=myl;j++){
				wwwmap[i][j]=0;
			}
		}
		if(pl_data[1]>0){
			change_colour(1);
			printf("蚀毒发作!\n");
			change_colour(8);
			for(ll i=1;i<=ima[8];i++){
				one_get_hurt(i,pl_data[1]/ima[8],-1);
			}
		}
		for(ll k=0;k<4;k++){
			if(mmap[ima[6]+dx[k]][ima[7]+dy[k]]>10000){
				if(ani_ski[mmap[ima[6]+dx[k]][ima[7]+dy[k]]/100-100][2]>0){
					jiumap[49][50]=1000+mmap[ima[6]+dx[k]][ima[7]+dy[k]]%100;
					jiumap[51][50]=1000+mmap[ima[6]+dx[k]][ima[7]+dy[k]]%100;
					jiumap[50][49]=1000+mmap[ima[6]+dx[k]][ima[7]+dy[k]]%100;
					jiumap[50][51]=1000+mmap[ima[6]+dx[k]][ima[7]+dy[k]]%100;
				}
			}
		}//ski2
		wwwmap[ima[6]][ima[7]]=1;
		for(ll i=-50;i<=50;i++){
			for(ll j=-50;j<=50;j++){
				if(mmap[ima[6]+i][ima[7]+j]<10000) wwwmap[ima[6]+i][ima[7]+j]=0;
				else {
					if(abs(i)+abs(j)<=ani_dam_area[mmap[ima[6]+i][ima[7]+j]/100-100]){
						wwwmap[ima[6]+i][ima[7]+j]=2;
						//伤害
						if(mmap_en[ima[6]+i][ima[7]+j]>=100){
							pl_data[1]+=ani_ski[(mmap[ima[6]+i][ima[7]+j]-10000)/100][3]*add[mmap[ima[6]+i][ima[7]+j]%100];
							printf("在你 ");
							print_der(0,0,i,j);
							printf(" 面的");
							cout << ani_name[(mmap[ima[6]+i][ima[7]+j]-10000)/100];
							printf("对你发出了%lld点伤害!\n",ani_dam[(mmap[ima[6]+i][ima[7]+j]-10000)/100]*add[mmap[ima[6]+i][ima[7]+j]%100]);
							get_hurt(ani_dam[(mmap[ima[6]+i][ima[7]+j]-10000)/100]*add[mmap[ima[6]+i][ima[7]+j]%100],ani_att[(mmap[ima[6]+i][ima[7]+j]-10000)/100]);
							printf("\n");
						} 
						
					}
					
				}
			}
			
		}
		wwwmap[ima[6]][ima[7]]=1;
		ll adsagfadsjgfadsahgfadshgfjdsjgfdsjgfadshgfdsajgfdshgfadsjgfdsjgfdteydxsyjhdhgcy=50;
		while(adsagfadsjgfadsahgfadshgfjdsjgfdsjgfadshgfdsajgfdshgfadsjgfdsjgfdteydxsyjhdhgcy--){
			for(ll i=ima[6]-50;i<=ima[6]+50;i++){
				for(ll j=ima[7]-50;j<=ima[7]+50;j++){
					if(wwwmap[i][j]==0 && i_right(i,j)){
						ll b_opdwa=0;
						ll eftu[4]={0,0,0,0}; 
						for(ll k=0;k<4;k++){
							if(wwwmap[i+dx[k]][j+dy[k]]==1){
								if(mmap[i+dx[k]][j+dy[k]]==mmap[i][j] && mmap[i][j]<10000){
									wwwmap[i][j]=1;
								}
								else if(mmap[i][j]>10000 && mmap[i+dx[k]][j+dy[k]]==ani_live[(mmap[i][j]-10000)/100]){
									eftu[k]=1;
									wwwmap[i][j]=2;
									b_opdwa=1;
								//	printf("fdfd\n");
								}
								
							}
						} 
						if(mmap[i][j]>10000 && b_opdwa==1 && ani_dgr[(mmap[i][j]-10000)/100]>=max(ima[6]-i,i-ima[6])+max(ima[7]-j,j-ima[7]) && mmap_en[i][j]>=100 && ani_spe[(mmap[i][j]-10000)/100]>0){
							ll opoprty=lrand(eftu[0]+eftu[1]+eftu[2]+eftu[3]);
							for(ll k=0;k<4;k++){
								if(opoprty>0 && eftu[k]==1) opoprty--; 
								else if(eftu[k]==1) opoprty=k,k=4;
							}
							
							if(mmap[i+dx[opoprty]][j+dy[opoprty]]==ani_live[(mmap[i][j]-10000)/100]){
							//	printf("%lld",opoprty);
								mmap[i+dx[opoprty]][j+dy[opoprty]]=mmap[i][j];
								mmap[i][j]=ani_live[(mmap[i][j]-10000)/100];
								mmap_hp[i+dx[opoprty]][j+dy[opoprty]]=mmap_hp[i][j];
								mmap_hp[i][j]=0;
								mmap_en[i+dx[opoprty]][j+dy[opoprty]]=mmap_en[i][j];
								mmap_en[i][j]=0;
								wwwmap[i][j]=1;
							} 
						}
					}
					
				}
			}
		}
		//printf("\n\nggb\n");
	//	cin >> in;
		
	//	waiting(1);
	
		ll sityaisdu=0;//记录受伤成员个数 
		for(ll i=1;i<=ima[8];i++){
			if(gar_hp[i]<ani_hp[gar[i]]*add[gar_lv[i]] && gar_hp[i]>0){
				sityaisdu++;
			}
		}
		if(sityaisdu>0){
			for(ll i=1;i<=ima[8];i++){
				if(get_reh(i)>0){
					rin=lrand(sityaisdu);
					for(ll j=1;j<=ima[8];j++){
						if(gar_hp[j]<get_hp(i) && gar_hp[i]>0){
							rin--;
							if(rin<0){
								change_colour(4);
								cout << "你的" << ani_name[gar[i]] << "[" << i << "] 发出了治疗!\n";
								add_gar_hp(j,get_reh(i));
								change_colour(8);
								j=ima[8]+1;
							}
						}
					}
				}
			}//治疗 
		}
		
	
		for(ll i=1;i<=mxl;i++){
			for(ll j=1;j<=myl;j++){
				if(mmap[i][j]>10000){
					if(mmap_hp[i][j]<ani_hp[mmap[i][j]/100-100]*add[mmap[i][j]%100]){
						if(ani_live[mmap[i][j]/100-100]!=mmap[ima[6]][ima[7]]) mmap_hp[i][j]=ani_hp[mmap[i][j]/100-100]*add[mmap[i][j]%100];
						if(ani_hea[mmap[i][j]/100-100]*add[mmap[i][j]%100]>0){
							ani_ah(i,j,ani_hea[mmap[i][j]/100-100]*add[mmap[i][j]%100]);
						}
					}
					
					if(ani_ski[mmap[i][j]/100-100][4]>0) {
						out_hurt(ani_ski[mmap[i][j]/100-100][4]*add[mmap[i][j]%100],i,j,false);
					}
				}
			}
		}
		for(ll i=1;i<=ima[8];i++){
			for(ll j=1;j<=ani_mski_mb[gar[i]];j++){
				if(gar_cd[i][j]>0) gar_cd[i][j]--;
			}
		}
		ani_main_bron=(ani_main_bron+1)%10;
	}
	return 0;
}

//line770