#include<bits/stdc++.h>
#include<conio.h>
#include<stdio.h>
#include "windows.h"
using namespace std;

#define ll long long

const int MAXN=1e3+5;
string in;
char inc;
ll rin; 
string player_name;

ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};


void change_colour(int new_colour){
	if(new_colour==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
	if(new_colour==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	if(new_colour==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_RED);
	if(new_colour==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
	if(new_colour==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	if(new_colour==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
	if(new_colour==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	if(new_colour==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
	if(new_colour==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);
}

void print_colour(int new_colour){
	if(new_colour==0) printf("黑");
	if(new_colour==1) printf("红");
	if(new_colour==2) printf("橙");
	if(new_colour==3) printf("黄");
	if(new_colour==4) printf("绿");
	if(new_colour==5) printf("青");
	if(new_colour==6) printf("蓝");
	if(new_colour==7) printf("紫");
	if(new_colour==8) printf("白");
}

void waiting(int x){
	int start = time(0),end = time(0);
	while(end - start < x) end = time(0);
	return;
}

void print_percent(ll per_a,ll per_b){
	if(per_b>=100000000000000 || per_b<per_a){
		printf("---");
	}
	else if(per_a==per_b){
		change_colour(4);
		printf("+++");
		change_colour(8);
	}
	else{
		printf("%lldPC",per_a*100/per_b);
	}
	return;
}//a/b

void e_num(ll e_num_kk){
	if(e_num_kk==0) {
		printf("  0 ");
		return;
	}
	ll e_num_kkp;
	ll e_num_i;
	for(ll i=1;i<=1000000000000;i*=1000){
		if(e_num_kk>=i && e_num_kk<i*1000){
			e_num_kkp=e_num_kk/i;
			e_num_i=i;
		}
	}
	if(e_num_kkp<10) printf("");
	else if(e_num_kkp<100) printf(" ");
	printf("%lld",e_num_kkp);
	if(e_num_kkp<10 && e_num_i>1) printf(".%lld",e_num_kk/(e_num_i/10)%10);
	if(e_num_kk<1000) printf(" ");
	else if(e_num_kk<1000000) printf("k");
	else if(e_num_kk<1000000000) printf("M");
	else if(e_num_kk<1000000000000) printf("B");
	else if(e_num_kk<1000000000000000) printf("T");
	return;
}

ll s_to_ll(string trri){
	ll trri_ans=0;
	ll trri_u=1;
	for(ll i=trri.length()-1;i>=0;i--){
		if(trri[i]>='0' && trri[i]<='9'){
			if(trri_u>=10000000000000000){
				return 0;
			}
			trri_ans+=(trri[i]-'0')*trri_u;
			trri_u*=10;
		}
	}
	return trri_ans;
}

ll lrand(ll youuuo){
//	srand(time(NULL));
	ll dwuhkhwad=0;
	dwuhkhwad+=(rand()%100)*10000000000;
//	srand(time(NULL));
	dwuhkhwad+=(rand()%100)*100000000;
//	srand(time(NULL));
	dwuhkhwad+=(rand()%100)*1000000;
//	srand(time(NULL));
	dwuhkhwad+=(rand()%100)*10000;
//	srand(time(NULL));
	dwuhkhwad+=(rand()%100)*100;
//	srand(time(NULL));
	dwuhkhwad+=rand()%100;
	if(1000000000000%youuuo>1000000000000-dwuhkhwad) return lrand(youuuo);
	return dwuhkhwad%youuuo;
}

ll x_walk(string oytuiop){
	if(oytuiop=="a") return 0;
	if(oytuiop=="d") return 0;
	if(oytuiop=="s") return 1;
	if(oytuiop=="w") return -1;
	return 2;
}

ll y_walk(string oytuiop){
	if(oytuiop=="a") return -1;
	if(oytuiop=="d") return 1;
	if(oytuiop=="s") return 0;
	if(oytuiop=="w") return 0;
	return 2;
}

void die(){
	while(true){
		system("cls");
		change_colour(1);
		printf("你死了!!!\n");
		cin >> in;
	}
	return;
}//已弃用 

//境界构造
string lv_name[11];//大境界名
string llv_name[4];//小境界名

ll add[11]={1,3,10,40,200,1500,15000,300000,10000000,500000000,5000000000};//等级增幅 
// (废除)    ll ladd[4]={10,12,15,20};//小境界增幅  0 前期   1 中期   2 后期   3 巅峰 

ll broke[10]={5000,4000,3000,2000,1000,334,80,30,6,1};//突破瓶颈概率 n/10000 

ll bro_rock[11];//特殊物品:进阶石   突破至每个境界前期需要9个该境界升级石(有概率失败);突破至每个境界中期需要2个该境界升级石;突破至每个境界后期需要3个该境界升级石;突破至每个境界巅峰需要5个该境界升级石 

//掉落等级降低概率  n/10000
ll less_0[11]={10000,9000,7500,5000,3334,1250, 500, 160, 100,  40,   0};  //不降级
ll less_1[11]={    0,1000,2500,5000,6666,8750,2500, 840, 400, 160, 800};  //降一级
ll less_2[11]={    0,   0,   0,   0,   0,   0,7000,9000,9500,9800,9200};  //降两级 


void build_lv(){
	lv_name[0]="尘"; 
	lv_name[1]="人";
	lv_name[2]="荒";
	lv_name[3]="洪";
	lv_name[4]="宙";
	lv_name[5]="宇";
	lv_name[6]="黄";
	lv_name[7]="玄";
	lv_name[8]="地";
	lv_name[9]="天";
	lv_name[10]="神";
	for(ll i=1;i<11;i++){
		bro_rock[i]=0;
	}
	return;
}


//生物构造

ll ani_mb;
string ani_name[MAXN];//生物名称 
ll ani_dam[MAXN];//攻击力 
ll ani_hp[MAXN];//血量
ll ani_hea[MAXN];//恢复力
ll ani_reh[MAXN];//治疗力
ll ani_spe[MAXN];//速度  0/1
ll ani_eng[MAXN];//初始仇恨度    当其小于0时,生物将试图逃跑  当其大于等于0且小于100时,生物将不会有反应   当其大于等于100时,生物会追着你 
ll ani_den[MAXN];//每被攻击一次增加仇恨值
ll ani_dan[MAXN];//当血量不足一半时突增仇恨度 
ll ani_live[MAXN];//生物适应地形
ll ani_rel[MAXN][20];//生物在该地形刷新概率  (综合所有生活在该地生物出生概率后决定)  j为等级 
ll ani_dgr[MAXN];//生物的仇恨范围 
ll ani_ski[MAXN][100];//生物技能数据  0代表没有该技能 
ll ani_v[MAXN];//生物被打中的概率 (综合其他生物被打中的概率后决定) 
string ski_name[100];//数据所属技能名称 
string ski_itd[100];//数据所属技能介绍 
ll ani_drop_mb[MAXN];//掉落种类数量 
ll ani_drop[MAXN][100];//生物掉落  大于10000代表掉落的是等级物品  换算:(n-10000)/100   个位十位代表改变等级  20为0点   例:18就是跌落2级  21就是增长1级
ll ani_drop_rel[MAXN][100];//对应掉落概率   (n/10) /10000(一万)   个位数对应掉落是否有阶级增幅 0无 1有 
ll ani_drop_amo[MAXN][100];//掉落数量 
ll ani_get_mb[MAXN];//合成种类数量
ll ani_get[MAXN][100];//合成 大于10000代表掉落的是等级物品  换算:(n-10000)/100   个位十位代表等级  
ll ani_get_amo[MAXN][100];//合成数量 
ll ani_high_mb[MAXN];//晋级种类数量
ll ani_high[MAXN][100];//晋级 大于10000代表掉落的是等级物品  换算:(n-10000)/100   个位十位代表改变等级  20为0点   例:18就是跌落2级  21就是增长1级     *最终结果再加1000000000(十亿)代表其受到等级增幅 
ll ani_high_amo[MAXN][100];//晋级数量 
void build_print_skill(){
	for(ll i=0;i<100;i++){
		ski_name[i]="不存在该技能";
	}
	ski_name[1]="圣之召唤";
	ski_itd[1]="每走一格在原位置上留下一个同级圣卫兵";
	ski_name[2]="蛛网围城";
	ski_itd[2]="当你靠近它时,会在你周围生成毒蛛网";
	ski_name[3]="蚀毒";
	ski_itd[3]="当它对你造成伤害时,会对你造成对应蚀毒伤害";
}//技能介绍 

void build_ani(){
	ani_mb=0;
	for(ll i=0;i<MAXN;i++){
		ani_dam[i]=0;
		ani_hp[i]=0;
		ani_hea[i]=0;
		ani_reh[i]=0;
		ani_spe[i]=1;
		ani_eng[i]=100;
		ani_den[i]=100;
		ani_dan[i]=100;
		ani_live[i]=0;
		for(ll j=0;j<=19;j++){
			ani_rel[i][j]=0;
		}
	    
	    ani_dgr[i]=0;
	    ani_v[i]=0;
	    for(ll j=0;j<100;j++){
	    	ani_ski[i][j]=0;
		} 
		
		ani_drop_mb[i]=0;
		ani_get_mb[i]=0;
	}
	
	ani_mb++;
	ani_name[ani_mb]=" 勇士 ";//	1
	ani_dam[ani_mb]=80;
	ani_hp[ani_mb]=600;
	ani_hea[ani_mb]=12; 
	ani_live[ani_mb]=3;
	ani_v[ani_mb]=10000;
	ani_drop_mb[ani_mb]=0;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=20001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=10;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=1;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=30;
	ani_high_mb[ani_mb]=0;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=10120;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=1000000001;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=10;
	 
	ani_mb++;
	ani_name[ani_mb]="暗纹虎";
	ani_dam[ani_mb]=125;
	ani_hp[ani_mb]=800;
	ani_hea[ani_mb]=0; 
	ani_live[ani_mb]=2;
	ani_rel[ani_mb][0]=10000;
	ani_rel[ani_mb][1]=4000;
	ani_rel[ani_mb][2]=2500;
	ani_rel[ani_mb][4]=500;
	ani_rel[ani_mb][5]=133;
	ani_rel[ani_mb][6]=13;
	ani_rel[ani_mb][7]=4;
	ani_dgr[ani_mb]=5;
	ani_v[ani_mb]=2000;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=15001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=3;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10220;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=5000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10320;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10320;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10320;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=10200;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_high_mb[ani_mb]=0;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=10220;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=10515;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=1000000001;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=10;
		
	ani_mb++;
	ani_name[ani_mb]=" 圣灵 ";//3
	ani_dam[ani_mb]=66;
	ani_hp[ani_mb]=5800;
	ani_hea[ani_mb]=1000; 
	ani_live[ani_mb]=2;
	ani_dgr[ani_mb]=10;
	ani_ski[ani_mb][1]=1;
	ani_v[ani_mb]=500;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=3300;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11220;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=20000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11220;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=20000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11220;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=20000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11220;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=20000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11220;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=20000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11320;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=100000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11420;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=5001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11420;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=5001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11420;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=5001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11520;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=1001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=11;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_mb++;
	ani_name[ani_mb]="圣卫兵";//4
	ani_dam[ani_mb]=100;
	ani_hp[ani_mb]=750;
	ani_hea[ani_mb]=50; 
	ani_live[ani_mb]=2;
	ani_dgr[ani_mb]=15;
	ani_v[ani_mb]=20000;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=9;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_mb++;
	ani_name[ani_mb]=" 翟蕤 ";//5
	ani_dam[ani_mb]=45;
	ani_hp[ani_mb]=1600;
	ani_hea[ani_mb]=10; 
	ani_live[ani_mb]=2;
	ani_rel[ani_mb][1]=4000;
	ani_rel[ani_mb][2]=500;
	ani_rel[ani_mb][4]=100;
	ani_rel[ani_mb][5]=33;
	ani_rel[ani_mb][6]=3;
	ani_rel[ani_mb][7]=1;
	ani_dgr[ani_mb]=5;
	ani_v[ani_mb]=4000;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=10001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=3;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=2001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=10;	
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=10400;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=9;
	ani_high_mb[ani_mb]=0;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=10420;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=1000000001;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=30;
	ani_mb++;
	ani_name[ani_mb]="地玄菟";
	ani_dam[ani_mb]=60;
	ani_hp[ani_mb]=200;
	ani_hea[ani_mb]=100; 
	ani_eng[ani_mb]=60;
	ani_live[ani_mb]=2;
	ani_rel[ani_mb][0]=1000;
	ani_rel[ani_mb][1]=2500;
	ani_rel[ani_mb][2]=300;
	ani_rel[ani_mb][3]=103;
	ani_rel[ani_mb][4]=20;
	ani_rel[ani_mb][5]=3;
	ani_dgr[ani_mb]=5;
	ani_v[ani_mb]=4000;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=10001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=3;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=2001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=10;	
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=9;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_mb++;
	ani_name[ani_mb]="连叶草";//7
	ani_dam[ani_mb]=10;
	ani_hp[ani_mb]=100;
	ani_hea[ani_mb]=12; 
	ani_live[ani_mb]=2;
	ani_rel[ani_mb][0]=800;
	ani_rel[ani_mb][1]=1000;
	ani_rel[ani_mb][2]=12500;
	ani_rel[ani_mb][4]=500;
	ani_rel[ani_mb][5]=133;
	ani_rel[ani_mb][6]=10;
	ani_dgr[ani_mb]=1;
	ani_v[ani_mb]=2000;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=10001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10620;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=100000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10719;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=3000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10818;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10819;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=10000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10820;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=5000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=9;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_high_mb[ani_mb]=0;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=9;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
	ani_mb++;
	ani_name[ani_mb]="青铜卫";
	ani_dam[ani_mb]=250;
	ani_hp[ani_mb]=700;
	ani_hea[ani_mb]=0; 
	ani_live[ani_mb]=0;
	ani_rel[ani_mb][0]=10000;
	ani_rel[ani_mb][1]=5000;
	ani_rel[ani_mb][2]=1250;
	ani_rel[ani_mb][4]=500;
	ani_rel[ani_mb][5]=133;
	ani_rel[ani_mb][6]=100;
	ani_rel[ani_mb][7]=33;
	ani_dgr[ani_mb]=10;
	ani_v[ani_mb]=5800;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10920;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=10000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10920;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=10000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=10920;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=10000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11020;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=5000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11120;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=33000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11120;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=33000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11120;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=33000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=9;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_high_mb[ani_mb]=0;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=9;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
	ani_mb++;
	ani_name[ani_mb]="九眼蛛";
	ani_dam[ani_mb]=300;
	ani_hp[ani_mb]=1500;
	ani_hea[ani_mb]=120; 
	ani_live[ani_mb]=2;
	ani_dgr[ani_mb]=10;
	ani_eng[ani_mb]=50;
	ani_v[ani_mb]=10000;
	ani_ski[ani_mb][2]=1;
	ani_ski[ani_mb][3]=80; 
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=70001;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=10;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11620;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=100000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11720;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=15000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11820;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11820;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11820;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=50000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=11920;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=1100;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=1;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=9;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_high_mb[ani_mb]=0;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=9;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
	ani_mb++;
	ani_name[ani_mb]="毒蛛网";//10
	ani_dam[ani_mb]=80;
	ani_hp[ani_mb]=600;
	ani_live[ani_mb]=2;
	ani_dgr[ani_mb]=1;
	ani_v[ani_mb]=10000;
	ani_ski[ani_mb][3]=20; 
	ani_spe[ani_mb]=0; 
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=12020;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=30000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=3;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=12020;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=30000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=3;
		ani_drop_mb[ani_mb]++;
		ani_drop[ani_mb][ani_drop_mb[ani_mb]]=12020;
		ani_drop_rel[ani_mb][ani_drop_mb[ani_mb]]=30000;
		ani_drop_amo[ani_mb][ani_drop_mb[ani_mb]]=3;
	ani_get_mb[ani_mb]=0;
		ani_get_mb[ani_mb]++;
		ani_get[ani_mb][ani_get_mb[ani_mb]]=9;
		ani_get_amo[ani_mb][ani_get_mb[ani_mb]]=1;
	ani_high_mb[ani_mb]=0;
		ani_high_mb[ani_mb]++;
		ani_high[ani_mb][ani_high_mb[ani_mb]]=9;
		ani_high_amo[ani_mb][ani_high_mb[ani_mb]]=1;
	return;
}
//构造拥有战力
ll gar[50];//记录出战生物种类 
ll gar_lv[50];//记录出战生物等级 
ll gar_hp[50];//记录出战生物血量 
ll ar[MAXN][20];//记录你拥有生物 

void build_ar(){
	for(ll i=1;i<MAXN;i++){
		for(ll j=0;j<=10;j++){
			ar[i][j]=0;
		}
	}
	ar[1][0]=30;
	for(ll i=1;i<50;i++){
		gar[i]=0;
		gar_lv[i]=0;
		gar_hp[i]=1;
	}
	return;
}




// 构建资源/信息 

ll ima_mb;//货币数量种类 
string ima_name[MAXN];//信息、资源名称
ll ima[MAXN];//该信息、资源量值
//带等级物品 
ll lv_ima_mb;
string lv_ima_name[MAXN]; 
ll lv_ima[MAXN][20];


/*交易*/ 
ll ex_mb;//交易数量 
ll ex_out[MAXN];//交易代价种类 (-n 代表 n阶源晶) 
ll ex_out_mb[MAXN];//交易代价数量
ll ex_in[MAXN];//交易物品种类  (-n 代表 n阶源晶) 
ll ex_in_mb[MAXN];//交易物品数量

ll get_life_xplace=665;//复活点X坐标
ll get_life_yplace=665;//复活点Y坐标 

void build_ima(){
	for(ll i=0;i<MAXN;i++){
		ima[i]=0;
		for(ll j=1;j<20;j++){
			lv_ima[i][j]=0;
		}
	}
	ima_mb=0;//初始化
	
	ima_mb++;
	ima_name[ima_mb]="下品灵石";//1
	ima_mb++;
	ima_name[ima_mb]="中品灵石";//2
	ima_mb++;
	ima_name[ima_mb]="上品灵石";//3
	ima_mb++;
	ima_name[ima_mb]="极品灵石";//4
	ima_mb++;
	ima_name[ima_mb]="基础感知力";//5
	ima[ima_mb]=3;
	ima_mb++;
	ima_name[ima_mb]="横坐标";//6
	ima[ima_mb]=665;
	ima_mb++;
	ima_name[ima_mb]="纵坐标";//7
	ima[ima_mb]=665;
	ima_mb++;
	ima_name[ima_mb]="可控位置";//8
	ima[ima_mb]=3;
	ima_mb++;
	ima_name[ima_mb]="万界禁湏";//9
	ima_mb++;
	ima_name[ima_mb]="显示模式";//10
	ima[ima_mb]=1;
	ima_mb++;
	ima_name[ima_mb]="圣魂珠";//11
	ima_mb++;
	ima_name[ima_mb]="显示附带效果";//12
	ima[ima_mb]=1;
	
	
	
	
	lv_ima_mb=0;
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="残魂";
	lv_ima[lv_ima_mb][0]=3;
	lv_ima[lv_ima_mb][1]=1;
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="暗涌凝核";//2
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="暗纹虎皮";//3 
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="通心草";//4 
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="邪神之血";//5
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="连叶草籽";//6
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="草之结晶";//7
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="青草碎片";//8
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="古铜碎片";//9
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="守护之念";//10
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="鬼铜块";//11
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="神圣光辉";//12
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="圣之灵";//13
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="圣明石";//14
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="圣灵残骸";//15
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="九眼蛛遗骸";//16
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="恶魂之眼";//17
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="红金生质";//18
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="血红骨";//19 
	lv_ima_mb++;
	lv_ima_name[lv_ima_mb]="剧毒蛛丝";//20 
	return; 
} 

//构建建筑

ll building_mb; 
string building_name_a[MAXN];
string building_name_u[MAXN];
ll building_ani_mb[MAXN];//将更改的个数 
ll building_cha[MAXN];//该地周围更改后生物出生概率之和  -1为不更改  n/10000
ll building_ani[MAXN][100];//建筑周围生物刷新概率  building_ani[i][j]表示i建筑周围第j个将更改出生概率的生物种类
ll building_cre[MAXN][100];//更改后的概率 
ll building_re[MAXN];//该地刷新所有生物概率之和  n/10000(一万) 
ll building_ani_rel[MAXN][100];//该地可能出生的生物列表
ll building_ani_rel_an[MAXN];//生物列表数值之和 
ll building_ani_rel_mb[MAXN];//上一行的列表项数 
void build_building(){
	building_mb=-1;
	for(ll i=0;i<MAXN;i++){
		building_ani_mb[i]=0;
		for(ll j=0;j<100;j++){
			building_ani[i][j]=-1;
			building_cre[i][j]=0;
		} 
		building_cha[i]=-1;
		building_re[i]=100;
	}
	 
	building_mb++;
	building_name_a[building_mb]="      ";
	building_name_u[building_mb]="      ";//空格 0
	building_mb++;
	building_name_a[building_mb]="XXXXXX";
	building_name_u[building_mb]="XXXXXX";//障碍 1
	building_mb++;
	building_name_a[building_mb]="#-#--#";
	building_name_u[building_mb]="-#--#-";//草地 2
	building_re[building_mb]=250;
	building_mb++;
	building_name_a[building_mb]="||||||";
	building_name_u[building_mb]="||||||";//安全地 3
	building_mb++;
	building_name_a[building_mb]=" 神圣 ";
	building_name_u[building_mb]=" 之树 ";//神圣之树 4
		building_cha[building_mb]=3334;
		building_ani_mb[building_mb]=0;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=200;
		building_cre[building_mb][building_ani_mb[building_mb]]=0;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=303;
		building_cre[building_mb][building_ani_mb[building_mb]]=100;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=304;
		building_cre[building_mb][building_ani_mb[building_mb]]=50;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=305;
		building_cre[building_mb][building_ani_mb[building_mb]]=35;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=306;
		building_cre[building_mb][building_ani_mb[building_mb]]=15;
	building_mb++;
	building_name_a[building_mb]=" 旅者 ";
	building_name_u[building_mb]=" 之屋 ";//复活点 5
	building_mb++;
	building_name_a[building_mb]="传灵塔";
	building_name_u[building_mb]="      ";//传灵塔 6 
	building_mb++;
	building_name_a[building_mb]="~ ~~~ ";
	building_name_u[building_mb]=" ~~  ~";//水 7
	building_re[building_mb]=500;
	building_mb++;
	building_name_a[building_mb]=" 九眼 ";
	building_name_u[building_mb]=" 蛛穴 ";//九眼蛛穴 8 
		building_cha[building_mb]=10000;
		building_ani_mb[building_mb]=0;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=200;
		building_cre[building_mb][building_ani_mb[building_mb]]=0;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=901;
		building_cre[building_mb][building_ani_mb[building_mb]]=1;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=902;
		building_cre[building_mb][building_ani_mb[building_mb]]=3;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=903;
		building_cre[building_mb][building_ani_mb[building_mb]]=2;
		building_ani_mb[building_mb]++;
		building_ani[building_mb][building_ani_mb[building_mb]]=904;
		building_cre[building_mb][building_ani_mb[building_mb]]=1;
		
	building_ani_rel_mb[MAXN];//该地列表最新指针 
	for(ll i=0;i<=building_mb;i++){
		building_ani_rel_mb[i]=0;
	}
	//printf("%lld\n",ani_mb);
	for(ll i=1;i<=ani_mb;i++){
		//printf("xdcdcdcsdcsdcsdcs\n");
		for(ll j=0;j<11;j++){
			
			if(ani_rel[i][j]>0){
				
				building_ani_rel_mb[ani_live[i]]++;
				building_ani_rel[ani_live[i]][building_ani_rel_mb[ani_live[i]]]=i*100+j;
			}
		}
		
	}
	for(ll i=0;i<=building_mb;i++){
		building_ani_rel_an[i]=0;
		for(ll k=1;k<=building_ani_rel_mb[i];k++){
			building_ani_rel_an[i]+=ani_rel[building_ani_rel[i][k]/100][building_ani_rel[i][k]%100];
		}
	}
	return;
}





// 构建地图
ll mxl=1000,myl=1000;//地图大小 

ll mmap[MAXN][MAXN];//主地图 
ll mmap_hp[MAXN][MAXN];//记录主地图中生物血量 
ll mmap_en[MAXN][MAXN];//记录生物仇恨度 
 /*在此处添加地图数据包  QwQ*/


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;
	}
}

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;
	}
	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] << " ";
		}
		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(){
	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 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){
	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){
//	printf("%lld\n",amount_hurt);
	ll wadfhgdw=0;
	for(ll i=1;i<=ima[8];i++){
		if(gar_hp[i]>0)wadfhgdw+=ani_v[gar[i]];
	} 
	if(wadfhgdw==0) return;
	ll dwhhjopp=lrand(wadfhgdw);
	
	for(ll i=1;i<=ima[8];i++){
		if(gar_hp[i]>0){
			if(dwhhjopp>=ani_v[gar[i]]) dwhhjopp-=ani_v[gar[i]];
		else dwhhjopp=i,i=ima[8]+1;
		}
	}
	
	one_get_hurt(dwhhjopp,amount_hurt);
	
	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]>ani_hp[gar[gar_number]]*add[gar_lv[gar_number]]) printf("%lld",ah_amount-gar_hp[gar_number]+ani_hp[gar[gar_number]]*add[gar_lv[gar_number]]);
	else printf("%lld",ah_amount);
	printf("点血量\n");
	if(gar_hp[gar_number]>ani_hp[gar[gar_number]]*add[gar_lv[gar_number]]) gar_hp[gar_number]=ani_hp[gar[gar_number]]*add[gar_lv[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(ani_hp[gar[i]]*add[gar_lv[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]=ani_hp[gar[i]]*add[gar_lv[i]];
	}
	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 gar_num){
	for(ll i=1;i<=ani_high_mb[gar[gar_num]];i++){
		if(ani_high[gar[gar_num]][i]%1000000000<10000){
			if(ima[ani_high[gar[gar_num]][i]%1000000000]<ani_high_amo[gar[gar_num]][i]+ani_high_amo[gar[gar_num]][i]*(add[gar_lv[gar_num]+1]-1)*(ani_high[gar[gar_num]][i]/1000000000)) return false;
		}
		else{
			if(ani_high[gar[gar_num]][i]%100-20+gar_lv[gar_num]+1>=0){
				if(lv_ima[ani_high[gar[gar_num]][i]/100-100][ani_high[gar[gar_num]][i]%100-20+gar_lv[gar_num]+1]<ani_high_amo[gar[gar_num]][i]+ani_high_amo[gar[gar_num]][i]*(add[gar_lv[gar_num]+1]-1)*(ani_high[gar[gar_num]][i]/1000000000)) return false;
			}
			
		}
	}
	return true;
}
void inc_ani(ll gar_num){
	if(!i_inc_ani(gar_num)) 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]*(add[gar_lv[gar_num]+1]-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]*(add[gar_lv[gar_num]+1]-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;
}//合成生物 

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[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]*(add[gar_lv[rin]+1]-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]*(add[gar_lv[rin]+1]-1)*(ani_high[gar[rin]][i]/1000000000));
								if(i!=ani_high_mb[gar[rin]]) printf("、");
								else printf("\n");
							}
							
						
						
					}
					if(i_inc_ani(rin)){
						
						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);
			}
			if(inc!='r') inc= _getch();
		}
		
		
	} 
	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+=ani_dam[gar[i]]*add[gar_lv[i]];
		}
		out_hurt(all_out_hurt,into_x,into_y,true);
		return false;
	}
	
	return true;
}//进入建筑物 



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(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(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();
}
ll wwwmap[1010][1010];
ll jiumap[101][101];//召唤技能               
int main(){
	cin >> in;
	srand(time(NULL));
	//printf("\nfdgf\n");
	build_lv();
	//printf("sax00\n");
	build_ani();
	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();
	for(ll i=1;i<=ima[8];i++){
		gar_hp[i]=ani_hp[gar[i]]*add[gar_lv[i]];
	}	
	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();
		in="first_enter_notdothis"; 
		in=" ";
		inc=')';
		while(in!="a" && in!="s" && in!="d" && in!="w"){
			if(inc!=')') change_colour(1),printf("输入无效!\n"),change_colour(8);
			print_watch();
			printf("请输入:\n");
			//cin >> in; 
			inc= _getch();
			in[0]=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=')';
			}
			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();
		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(building_ani_rel_mb[mmap[i][j]]>0){
						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){
								ll ooppooppoo=lrand(10000);
								if(ooppooppoo<building_re[mmap[i][j]]){
									grtgtr=building_ani_rel_an[mmap[i][j]];
									ll opoopo=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];
									//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=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];
									//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]<ani_hp[gar[i]]*add[gar_lv[i]] && gar_hp[i]!=0){
				add_gar_hp(i,ani_hea[gar[i]]*add[gar_lv[i]]);
			}
		}
		
		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]*(add[cdedfcsa]-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]*(add[cdedfcsa]-1)*(ani_drop_rel[hfsdjhvfivi][i]%10));
						}
						
					}
					else{
						printf("你获得了%lld个",ani_drop_amo[hfsdjhvfivi][i]+ani_drop_amo[hfsdjhvfivi][i]*(add[cdedfcsa]-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]*(add[cdedfcsa]-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]);
			}
		}
		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 k=0;k<4;k++){
			if(mmap[ima[6]+dx[k]][ima[7]+dy[k]]<10000) wwwmap[ima[6]+dx[k]][ima[7]+dy[k]]=1;
			else {
				wwwmap[ima[6]+dx[k]][ima[7]+dy[k]]=2;
				//伤害
				if(mmap_en[ima[6]+dx[k]][ima[7]+dy[k]]>=100){
					pl_data[1]+=ani_ski[(mmap[ima[6]+dx[k]][ima[7]+dy[k]]-10000)/100][3]*add[mmap[ima[6]+dx[k]][ima[7]+dy[k]]%100];
					printf("在你 ");
					if(k==0) printf("南");
					if(k==1) printf("东");
					if(k==2) printf("北");
					if(k==3) printf("西");
					printf(" 面的");
					cout << ani_name[(mmap[ima[6]+dx[k]][ima[7]+dy[k]]-10000)/100];
					printf("对你发出了%lld点伤害!\n",ani_dam[(mmap[ima[6]+dx[k]][ima[7]+dy[k]]-10000)/100]*add[mmap[ima[6]+dx[k]][ima[7]+dy[k]]%100]);
					get_hurt(ani_dam[(mmap[ima[6]+dx[k]][ima[7]+dy[k]]-10000)/100]*add[mmap[ima[6]+dx[k]][ima[7]+dy[k]]%100]);
					printf("\n");
				} 
				
			}
		}
		
		ll adsagfadsjgfadsahgfadshgfjdsjgfdsjgfadshgfdsajgfdshgfadsjgfdsjgfdteydxsyjhdhgcy=25;
		while(adsagfadsjgfadsahgfadshgfjdsjgfdsjgfadshgfdsajgfdshgfadsjgfdsjgfdteydxsyjhdhgcy--){
			for(ll i=ima[6]-25;i<=ima[6]+25;i++){
				for(ll j=ima[7]-25;j<=ima[7]+25;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);
		for(ll i=1;i<=mxl;i++){
			for(ll j=1;j<=myl;j++){
				if(mmap[i][j]>10000){
					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(mmap_hp[i][j]<ani_hp[mmap[i][j]/100-100]*add[mmap[i][j]%100] && 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]);
					}
				}
			}
		}
		ani_main_bron=(ani_main_bron+1)%10;
	}
	return 0;
}

//line770