florr突围

#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
using namespace std;
typedef BOOL (WINAPI *PROCSETCONSOLEFONT)(HANDLE, DWORD);
PROCSETCONSOLEFONT SetConsoleFont;
/*
普通图(普通、封锁、强化封锁):
农场-Garden
山谷-Desert
北部山区-Ocean
军港-Ant Hell
矿区-Jungle

高级图(封锁,强化封锁):
前线要塞-Sewer
电视台-Hel
*/
void Color(int a){//白 绿 黄 蓝 紫 红 青 粉 淡绿 
    if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    
    if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN); 
    
    if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    
    if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE); 
    
    if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
    
    if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
    
    if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE); 
    
    if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE); 
    
    if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN); 
}
string level[9]={"空","Common","Unusual","Rare","Epic","Legendary","Mythic","Ultra","Super"};
double mer[9]={0,7000,4000,1500,500,100,30,1,0};

int prize[9]={0,10,100,1000,5000,25000,100000,750000,1500000};//卡牌价格 
int cost[9]={0,0,7,11,19,34,65,128,253};//神使制作的成本 

int m_s[8]={0,10,14,16,8,20,10,8};//地图大小 

int baolv[8][9]={//概率计算以万分之一为基础单位,此为普通
	{0,0,0,0,0,0,0,0,0},
	{0,10000,5000,1500,100,1,0,0,0},
	{0,10000,4500,1750,150,2,0,0,0},
	{0,10000,4750,1800,175,2,0,0,0},
	{0,10000,5500,2000,200,5,1,0,0},
	{0,10000,5000,2000,175,3,1,0,0},
	{0,0,10000,2500,250,6,3,1,0},
	{0,0,10000,3000,500,8,4,1,0}
};
int f_c(int ply,double mul){//捡到卡牌等级,危险区*1.2,封锁*1.5,强封*1.7 
	for(int i=8;i>=1;i--){
		if((double)(rand()%10000+1) <= (double)baolv[ply][i]*mul){
			return i;
		}
	}
}

int e_mob[8][9]={//生成概率计算以万分之一为基础单位,此为普通
	{0,0,0,0,0,0,0,0,0},
	{0,10000,5000,1500,400,1,0,0,0},
	{0,10000,4500,1750,450,2,0,0,0},
	{0,10000,4750,1800,475,3,1,0,0},
	{0,10000,5500,2000,500,10,3,1,0},
	{0,10000,5000,2000,475,5,2,1,0},
	{0,0,10000,5000,600,400,70,7,1},
	{0,0,10000,5500,1000,500,100,10,2}
};
int ec_m(int ply,double mul){//怪物等级,危险区*1.2,封锁*1.4,强封*1.7 
	for(int i=8;i>=1;i--){
		if((double)(rand()%10000+1) <= (double)e_mob[ply][i]*mul){
			return i;
		}
	}
}

int e_human_lv[4][8]={
	{0,0,0,0,0,0,0,0},
	{0,1,7,7,13,10,0,0},
	{0,15,20,25,35,30,50,60},
	{0,75,90,100,200,150,400,450}
};
int e_human_card[8][9]={//卡牌携带计算以万分之一为基础单位,此为普通
	{0,0,0,0,0,0,0,0,0},
	{0,10000,4000,700,200,1,1,0,0},
	{0,10000,6000,1000,300,2,2,1,0},
	{0,10000,6500,1500,400,3,2,1,0},
	{0,10000,7500,3000,750,10,4,3,1},
	{0,10000,7000,2000,600,5,2,2,1},
	{0,0,0,10000,5000,1500,450,40,5},
	{0,0,0,10000,6000,2000,500,50,7}
};
int ec_h(int ply,double mul){//人机玩家携带卡牌的的等级,危险区*1.2,封锁*1.63,强封*1.79 
	if(mul==1.5 || mul==1.8){
		mul/=1.5;
		mul*=1.63;
	}
	else if(mul==1.7 || mul==2.04){
		mul/=1.7;
		mul*=1.79;
	}
	for(int i=8;i>=1;i--){
		if((double)(rand()%10000+1) <= (double)e_human_card[ply][i]*mul){
			return i;
		}
	}
}

POINT Windowpos(){
    POINT pt;
    GetCursorPos(&pt);
    HWND h=GetForegroundWindow();
    ScreenToClient(h,&pt);
    pt.x/=8;pt.y/=16;
    return pt;
}

void SetPos(int x,int y){
    COORD pos;
    pos.X=x,pos.Y=y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}

int wh[9],bp[9],wp[11],kl,lv=1,Exp,money=5000;
bool flag;

void game(int p_m,int dgr);
void fight_m(int elv);
void fight_p(int elv,int at,int x,int y);
void liaison(int who);

void Read(){
	double qwq=0;
	int iakioi;
    ifstream in("florr突围存档.txt");
    in>>lv>>kl>>Exp;
    if(!lv){
    	in.close();
    	return ;
    }
    qwq+=lv*0.37+kl*0.73+Exp*1.14;
    for(int i=1;i<=8;i++){
    	in>>wh[i];
    	qwq+=wh[i]*4.29;
    }
    for(int i=1;i<=10;i++){
    	in>>wp[i];
    	qwq+=wp[i]*8.12;
    }
    in>>money;
    qwq+=money*7.62;
    in>>iakioi;
    in.close();
    if((int)qwq!=iakioi){
    	cout<<"因为版本问题或擅自修改代码,存档无法正常读取。"<<endl;
    	Sleep(500);
    	cout<<"没事的,我会尽力保证这份存档还可以继续使用,但是我希望你自己没有改存档。"<<endl;
		Sleep(500); 
		cout<<"这边如果是版本问题的话,个人建议您重开一个档,不然可能会发生运行错误"<<endl;
		Sleep(1000); 
    }
}
void Save(){
	double qwq=0;
    ofstream out("florr突围存档.txt");
    out<<lv<<' '<<kl<<' '<<Exp<<endl;
    qwq+=lv*0.37+kl*0.73+Exp*1.14;
    for(int i=1;i<=8;i++){
    	out<<wh[i]<<' ';
    	qwq+=wh[i]*4.29;
    }
    out<<endl;
    for(int i=1;i<=10;i++){
    	out<<wp[i]<<' ';
    	qwq+=wp[i]*8.12;
    }
    out<<endl<<money;
    qwq+=money*7.62;
    out<<endl<<(int)qwq;
    out.close();
}

char xxx;
int main(){
	CONSOLE_CURSOR_INFO cursor_info={1,0}; 
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
	srand(time(NULL));
	int cnt=0,x,y,hcsl;
	kl=5;
	for(int i=1;i<=5;i++){
		wp[i]=1;
		wh[1]++;
	}
	cout<<"是否读档?y/n"<<endl;
	cin>>xxx;
	if(xxx=='y'){
		Read(); 
	}
	Sleep(500);
	while(1){
		system("cls");
		cout<<"1.仓库"<<endl<<"2.合成"<<endl<<"3.联络人"<<endl<<"4.进入florr"<<endl;
		cnt=0;
		while(cnt<1 || cnt>4){
			cin>>cnt;
		}
		if(cnt==1){
			while(1){
				system("cls");
				cout<<"你的等级:"<<lv<<' '<<"你所拥有的Coin数量:"<<money<<endl;
				Sleep(50);
				cout<<"你目前携带的卡牌配置为:"<<endl;
				for(int i=1;i<=kl;i++){
					cout<<i<<": ";
					Color(wp[i]);
					cout<<level[wp[i]];
					Color(0);
					cout<<endl;
				}
				Sleep(100);
				cout<<"你现在仓库内所有的卡牌:"<<endl;
				for(int i=1;i<=8;i++){
					cout<<i<<".";
					Color(i);
					cout<<level[i];
					Color(0);
					cout<<": "<<wh[i]<<"张"<<endl;
				}
				Sleep(100);
				cout<<"请输入你要替换的卡牌(两个数字),输入0退出"<<endl;
				cin>>x;
				if(x==0){
					break;
				}
				cin>>y;
				if(x<1 || x>kl || y<1 || y>8 || wh[y]==0){
					cout<<"替换失败";
					Sleep(500);
					continue;
				}
				wh[y]--;
				wh[wp[x]]++;
				wp[x]=y;
				cout<<"替换成功!";
				Sleep(500);
			}
			Save();
		}
		else if(cnt==2){
			while(1){
				system("cls");
				cout<<"你现在仓库内所有的卡牌:"<<endl;
				for(int i=1;i<=8;i++){
					cout<<i<<".";
					Color(i);
					cout<<level[i];
					Color(0);
					cout<<": "<<wh[i]<<"张"<<endl;
				}
				cout<<"请输入你要合成的卡牌,输入0退出"<<endl;
				x=-1;
				while(x<0 || x>7){
					cin>>x;
				}
				if(x==0){
					break;
				}
				if(wh[x]<5){
					cout<<"卡牌不足";
				}
				else{
					hcsl=0;
					cout<<"1.合成一次 2.一键合成"<<endl;
					cnt=0;
					while(cnt<1 || cnt>2){
						cin>>cnt;
					}
					if(cnt==1){
						wh[x]-=5;
						if(rand()%20000+2>=20000-mer[x]*2){
							hcsl++;
						}	
						else{
							wh[x]+=1+rand()%4;
						}
					}
					else{
						while(wh[x]>=5){
							wh[x]-=5;
							if(rand()%20000+2>=20000-mer[x]*2){
								hcsl++;
							}
							else{
								cnt=1+rand()%4;
								wh[x]+=cnt;
							}
						}
					}
					cout<<"你获得了"<<hcsl<<"张";
					Color(x+1);
					cout<<level[x+1];
					Color(0);
					cout<<"等级的卡牌!";
					wh[x+1]+=hcsl;
					Sleep(500);
					Save();
				}
			}
		}
		else if(cnt==3){
			while(1){
				system("cls");
				cout<<"1.Trader"<<endl<<"2.Oracle"<<endl<<"0.退出"<<endl;
				cnt=-1;
				while(cnt<0 || cnt>2){
					cin>>cnt;
				}
				if(cnt==0){
					break;
				}
				liaison(cnt);
			}
		}
		else if(cnt==4){
			system("cls");
			cout<<"请选择要进入的模式,输入0退出"<<endl<<"1.战术行动"<<endl<<"2.封锁区(入场费1500Coin)"<<endl<<"3.强化封锁(入场费5000Coin)"<<endl;
			y=-1;
			while(y<0 || y>3){
				cin>>y;
			}
			if(y==0){
				continue;
			}
			else{
				if(y==1){
					cout<<"请选择要进入的地图,输入0退出"<<endl<<"1.Garden"<<endl<<"2.Desert"<<endl<<"3.Ocean"<<endl<<"4.Ant Hell"<<endl<<"5.Jungle"<<endl;
					x=-1;
					while(x<0 || x>5){
						cin>>x;
					}
					if(x==0){
						continue;
					}
				}
				else{
					if((y==2 && money<1500)||(y==3 && money<5000)){
						cout<<"入场费不足,无法进入!"<<endl;
						Sleep(1000);
            continue;
					}
					cout<<"请选择要进入的地图,输入0退出"<<endl<<"1.Garden"<<endl<<"2.Desert"<<endl<<"3.Ocean"<<endl<<"4.Ant Hell"<<endl<<"5.Jungle"<<endl<<"6.Sewer"<<endl<<"7.Hel"<<endl;
					x=-1;
					while(x<0 || x>7){
						cin>>x;
					}
					if(x==0){
						continue;
					}
				}
				if(y==2){
					money-=1500;
				}
				if(y==3){
					money-=5000;
				}
				game(x,y);
				Save();
			}
		}
	}
	return 0;
}
void fight_m(int elv){
	flag=1;
	int hp=175+lv*25,ehp=pow(3,elv-1)*(50-10+rand()%21),cnt,at=1,dam=0;
	while(hp>0 && ehp>0){
		system("cls");
		cout<<"你的血量:"<<hp<<"怪物血量:"<<ehp;
		Sleep(500);
		if(at){
			cout<<endl<<"1.攻击 2.迂回偷袭(概率失败) 3.逃跑"<<endl;
			cnt=0;
			while(cnt<1 || cnt>3)
				cin>>cnt;
			if(cnt==1){
				if(rand()%1000<=950){
					for(int i=1;i<=kl;i++){
						dam+=pow(3,wp[i]-1)*(5+rand()%11);
					}
					cout<<"你打出了"<<dam<<"点伤害!";
					ehp-=dam;
				}
				else{
					cout<<"怪物躲过了你的攻击!";
				}
			}
			else if(cnt==2){
				if(rand()%5000<=1500){
					for(int i=1;i<=kl;i++){
						dam+=pow(3,wp[i]-1)*(15+rand()%26);
					}
					cout<<"偷袭成功,对怪物造成了"<<dam<<"点伤害!";
					ehp-=dam;
				}
				else{
					dam=pow(2,elv-1)*(1+rand()%10);
					cout<<"偷袭失败,怪物对你造成了"<<dam<<"点伤害!";
					hp-=dam; 
				}
			}
			else{ 
				if(rand()%1000<=elv*125){
					cout<<"你逃跑了...";
					return ;
				}
				else{
					cout<<"怪物紧追不舍...";
				}
			}
		}
		else{
			if(rand()%1000<=850){
				dam=pow(3,elv-1)*(5+rand()%21);
				cout<<endl<<"怪物对你造成了"<<dam<<"点伤害!";
				hp-=dam;
			}
			else{
				cout<<endl<<"你躲过了怪物的攻击!";
			}
		}
		at=!at;
		Sleep(1000);
	}
	if(hp<1){
		Color(5);
		cout<<endl<<"你被怪物击败了!";
		Sleep(1000);
		Color(0);
		cout<<endl<<"你身上携带的所有卡牌全部丢失";
		for(int i=1;i<=kl;i++){
			wp[i]=0;
		}
		for(int i=1;i<=8;i++){
			bp[i]=0;
		}
		Sleep(1000);
		flag=0;
	}
	else{
		cnt=pow(2,elv)*(rand()%5+1);
		Color(2);
		cout<<endl<<"你击败了怪物!";
		Sleep(500);
		cout<<endl<<"你获得了"<<cnt<<"点经验值!"<<endl;
		Sleep(500);
		Exp+=cnt;
		while(Exp>=(5+5*lv)){
			cout<<"你升级了!"<<endl;
			Exp-=(5+5*lv);
			lv++;
			Sleep(250);
		}
		Color(0);
		cout<<endl<<"你获得了以下战利品:";
		cnt=(rand()%1000)%2+1;
		Color(elv);
		cout<<endl<<level[elv];
		Color(0);
		cout<<"卡牌"<<cnt<<"张";
		bp[elv]+=cnt;
		cnt=pow(2,elv);
		if(elv!=8 && rand()%(cnt*2)==cnt){
			Sleep(500);
			Color(elv+1);
			cout<<endl<<level[elv+1];
			Color(0);
			cout<<"卡牌1张";
			bp[elv+1]++;
		}
		Sleep(1000);
	}
}

int wp_e[9];

void fight_p(int elv,int at,int x,int y){
	flag=1;
	int hp=175+lv*25,ehp=175+elv*25,cnt,dam=0;
	for(int i=1;i<=kl;i++){
		wp_e[i]=ec_h(x,y);
	}
	while(hp>0 && ehp>0){
		system("cls");
		cout<<"你的血量:"<<hp<<"对方血量:"<<ehp<<endl<<"对方卡牌配置:"<<endl;;
		for(int i=1;i<=kl;i++){
			Color(wp_e[i]);
			cout<<level[wp_e[i]]<<endl;
		}
		Color(0);
		Sleep(500);
		if(at){
			cout<<endl<<"1.攻击 2.迂回偷袭(概率失败) 3.逃跑"<<endl;
			cnt=0;
			while(cnt<1 || cnt>3)
				cin>>cnt;
			if(cnt==1){
				if(rand()%2000<=1700-elv){
					cnt=rand()%kl+1;
					for(int i=1;i<=cnt;i++){
						dam+=pow(3,wp[i]-1)*(5+rand()%11);
					}
					cout<<"你打出了"<<dam<<"点伤害!";
					ehp-=dam;
				}
				else{
					cout<<"敌人躲过了你的攻击!";
				}
			}
			else if(cnt==2){
				if(rand()%10000<=3000){
					for(int i=1;i<=kl;i++){
						dam+=pow(3,wp[i]-1)*(15+rand()%26);
					}
					cout<<"偷袭成功,对敌人造成了"<<dam<<"点伤害!";
					ehp-=dam;
				}
				else{
					cout<<"敌人躲过了你的偷袭!";
				}
			}
			else{ 
				cout<<"你逃跑了...";
				return ;
			}
		}
		
		else{
			if(hp>=ehp*3){
				if(rand()%5000<=1500){
					for(int i=1;i<=kl;i++){
						dam+=pow(3,wp_e[i]-1)*(15+rand()%26);
					}
					cout<<"敌人偷袭了你,造成了"<<dam<<"点伤害!";
					hp-=dam;
				}
				else{
					cout<<"你躲过了敌人的偷袭!";
				}
			}
			else{
				if(rand()%2000<=1700-lv){
					cnt=rand()%kl+1;
					for(int i=1;i<=cnt;i++){
						dam+=pow(3,wp_e[i]-1)*(5+rand()%11);
					}
					cout<<endl<<"敌人对你造成了"<<dam<<"点伤害!";
					hp-=dam;
				}
				else{
					cout<<endl<<"你躲过了敌人的攻击!";
				}
			}
		}
		at=!at;
		Sleep(1000);
	}
	if(hp<1){
		Color(5);
		cout<<endl<<"你被敌人击败了!";
		Sleep(1000);
		Color(0);
		cout<<endl<<"你身上携带的所有卡牌全部丢失";
		for(int i=1;i<=kl;i++){
			wp[i]=0;
		}
		for(int i=1;i<=8;i++){
			bp[i]=0;
		}
		Sleep(1000);
		flag=0;
	}
	else{
		cnt=elv*5+5;
		Color(2);
		cout<<endl<<"你击败了敌人!";
		Sleep(500);
		cout<<endl<<"你获得了"<<cnt<<"点经验值!"<<endl;
		Sleep(500);
		Exp+=cnt;
		while(Exp>=(5+5*lv)){
			cout<<"你升级了!"<<endl;
			Exp-=(5+5*lv);
			lv++;
			Sleep(250);
		}
		Color(0);
		cout<<"你获得了如下战利品:";
		for(int i=1;i<=kl;i++){
			Color(wp_e[i]);
			cout<<endl<<level[wp_e[i]];
			Color(0);
			cout<<"卡牌一张;";
			bp[wp_e[i]]++;
		}
		cnt=rand()%kl+1;
		Color(wp_e[cnt]);
		cout<<endl<<level[wp_e[cnt]];
		Color(0);
		cout<<"卡牌一张;";
		bp[wp_e[cnt]]++;
		
		Color(0);
		Sleep(1000);
		flag=1;
	}
}

void game(int p_m,int dgr){
	int hp=90+10*lv,cnt,rage=rand()%5+m_s[p_m]-2,card,clocknum,x,y;
	double mul;
	if(dgr==1){
		mul=1;
	}
	else if(dgr==2){
		mul=1.4;
	}
	else{
		mul=1.7;
	}
	while(hp>0){
		system("cls");
		cout<<"你离撤离点还有"<<rage<<"单位距离"<<endl;
		if(rage==m_s[p_m]/2){
			Color(5);
			cout<<"你现在处于危险区域!敌人强度和爆率均有提升!"<<endl;
			Color(0);
		}
		Sleep(250);
		cout<<"1.在附近闲逛 2.向撤离点移动 3.整理背包"<<endl;
		cnt=0;
		while(cnt<1 || cnt>3)
			cin>>cnt;
		if(cnt==1){
			cout<<"闲逛中...";
			Sleep(500);
			if(rand()%1000<=600){
				card=f_c(p_m,mul);
				if(rage==m_s[p_m]/2){
					card=f_c(p_m,mul*1.2);
				}
				cout<<endl<<"你在闲逛途中捡到了一张";
				Color(card);
				cout<<level[card];
				Color(0);
				cout<<"等级的卡牌!"; 
				bp[card]++;
			} 
			else if(rand()%1000<=700){
				cnt=ec_m(p_m,mul);;
				if(rage==m_s[p_m]/2){
					cnt+=ec_m(p_m,mul*1.2);
				}
				cout<<endl<<"你遭遇了一只";
				Color(cnt);
				cout<<level[cnt];
				Color(0);
				cout<<"等级的怪物!";
				Sleep(1000);
				fight_m(cnt); 
				if(!flag){
					return ;
				}
			}
			else if(rand()%1000<=500){
				cnt=e_human_lv[dgr][p_m]-2+rand()%5;
				if(cnt<1) cnt=1;
				cout<<endl<<"你遭遇了一名"<<cnt<<"级的敌人!";
				Sleep(1000);
				fight_p(cnt,rand()%2,p_m,mul); 
				if(!flag){
					return ;
				}
			}
			else{
				cout<<"...但是无事发生";
				Sleep(1000); 
			}
		}
		else if(cnt==2){
			cout<<"正在移动中..."<<endl;
			Sleep(500);
			if(rand()%1000<=250 && rage!=1){
				card=f_c(p_m,mul);
				cout<<endl<<"你在路上捡到了一张";
				Color(card);
				cout<<level[card];
				Color(0);
				cout<<"等级的卡牌!"; 
				bp[card]++;
			} 
			
			if(rand()%1000<=600 && rage!=1){
				cnt=ec_m(p_m,mul);
				cout<<endl<<"你遭遇了一只";
				Color(cnt);
				cout<<level[cnt];
				Color(0);
				cout<<"等级的怪物!";
				Sleep(1000);
				fight_m(cnt); 
				if(!flag){
					return ;
				}
			}
			else if(rand()%1000<=300 && rage!=1){
				cnt=e_human_lv[dgr][p_m]-2+rand()%5;
				if(cnt<1) cnt=1;
				if(rage==5){
					cnt+=rand()%3+1;
				}
				cout<<endl<<"你遭遇了一名"<<cnt<<"级的敌人!";
				Sleep(1000);
				fight_p(cnt,1,p_m,mul); 
				if(!flag){
					return ;
				}
			}
			rage--;
			if(rage==0){
				cout<<"你已经抵达撤离点,正在等待传送..."<<endl;
				Sleep(1000);
				for(int i=10;i>=1;i--){
					system("cls");
					cout<<"撤离倒计时:"<<i;
					clocknum=clock();
					while(clock()-clocknum<1000);
					if(rand()%1000<=(11-i)*20){
						cnt=ec_m(p_m,mul);
						cout<<endl<<"你遭遇了一只";
						Color(cnt);
						cout<<level[cnt];
						Color(0);
						cout<<"等级的怪物!";
						Sleep(1000);
						fight_m(cnt); 
						if(!flag){
							return ;
						}
					}
					else if(rand()%1000<=(11-i)*10){
						cnt=e_human_lv[dgr][p_m]-2+rand()%5;
						if(cnt<1) cnt=1;
						cout<<endl<<"你遭遇了一名"<<cnt<<"级的敌人!";
						Sleep(1000);
						fight_p(cnt,rand()%2,p_m,mul); 
						if(!flag){
							return ;
						}
					}
				}
				system("cls");
				cout<<"撤离成功!!"<<endl;
				Sleep(1000);
				cout<<"你带出了如下物资:"<<endl;
				for(int i=1;i<=8;i++){
					if(bp[i]!=0){
						Sleep(1000);
						Color(i);
						cout<<endl<<level[i];
						Color(0);
						cout<<"卡牌"<<bp[i]<<"张;";
						wh[i]+=bp[i];
						bp[i]=0;
					}
				}
				Sleep(1000);
				return ; 
			}
		}
		else{
			while(1){
				system("cls");
				cout<<"你的等级:"<<lv<<"   距离下次升级还需要:"<<5+(5*lv)-Exp<<endl;
				Sleep(50);
				cout<<"你目前的卡牌配置为:"<<endl;
				for(int i=1;i<=kl;i++){
					cout<<i<<": ";
					Color(wp[i]);
					cout<<level[wp[i]];
					Color(0);
					cout<<endl;
				}
				Sleep(100);
				cout<<"你现在背包内所有的卡牌:"<<endl;
				for(int i=1;i<=8;i++){
					if(bp[i]){
						cout<<i<<".";
						Color(i);
						cout<<level[i];
						Color(0);
						cout<<": "<<bp[i]<<"张"<<endl;
					}
				}
				Sleep(100);
				cout<<"请输入你要替换的卡牌(两个数字),输入0退出"<<endl;
				cin>>x;
				if(x==0){
					break;
				}
				cin>>y;
				if(x<1 || x>kl || y<1 || y>8 || bp[y]==0){
					cout<<"替换失败";
					Sleep(500);
					continue;
				}
				bp[y]--;
				bp[wp[x]]++;
				wp[x]=y;
				cout<<"替换成功!";
				Sleep(500);
			}
		}
		Sleep(500);
	}
}

void liaison(int who){
	int cnt,x;
	char xxx;
	cout<<"正在连线中...";
	Sleep(500);
	
	if(who==1){
		while(1){
			system("cls");
			cout<<"嗨!我是Trader,缺卡还是缺钱,我都能解决!"<<endl;
			cout<<"请问您有什么需要?"<<endl<<"1.购买卡牌"<<endl<<"2.售卖卡牌"<<endl<<"0.离开"<<endl;
			cnt=-1;
			while(cnt<0 || cnt>2){
				cin>>cnt;
			}
			if(cnt==0){
				cout<<"好吧,那记得常来看看啊!说不定哪天你就需要什么了。";
				Sleep(1000);
				break ;
			}
			if(cnt==1){
				while(1){
					system("cls");
					cout<<"那你可找对人了!至于价格嘛,嘿嘿,那就要看我随机翻出来的那张卡有多贵啦。"<<endl;
					cout<<"你所拥有的Coin数量:"<<money<<endl; 
					for(int i=1;i<=8;i++){
						cout<<i<<".购买一张";
						Color(i);
						cout<<level[i];
						Color(0);
						cout<<"卡牌"<<endl;
					}
					cout<<"0.退出"<<endl;
					cnt=-1;
					while(cnt<0 || cnt>8){
						cin>>cnt;
					}
					if(cnt==0){
						cout<<"如果又需要卡了,随时来啊!";
						Sleep(1000); 
						break;
					}
					x=(int)((double)prize[cnt]*(rand()%41+80)/100.0);
					cout<<"这张";
					Color(cnt);
					cout<<level[cnt];
					Color(0);
					cout<<"卡牌的价值是"<<x<<"个Coin,要不要?(y/n)"<<endl;
					cin>>xxx;
					if(xxx=='y'){
						if(money<x){
							cout<<"额,抱歉啦哥们儿,你买不起。";
						}
						else{
							cout<<"好嘞!您拿好啦。";
							money-=x;
							wh[cnt]++; 
							Save();
						}
					}
					else{
						cout<<"好吧,你说不定要再考虑一下。";
					}
					Sleep(1000);
				}
			}
			else if(cnt==2){
				while(1){
					system("cls");
					cout<<"想要卖卡?来吧,品质决定我出的钱。"<<endl;
					cout<<"你所拥有的Coin数量:"<<money<<endl; 
					for(int i=1;i<=8;i++){
						cout<<i<<".出售库存为"<<wh[i]<<"张的";
						Color(i);
						cout<<level[i];
						Color(0);
						cout<<"卡牌"<<endl;
					}
					cout<<"0.退出"<<endl;
					cnt=-1;
					while(cnt<0 || cnt>8){
						cin>>cnt;
					}
					if(cnt==0){
						cout<<"好吧,下次有什么用不着的好货记得来找我哟!";
						Sleep(1000); 
						break;
					}
					if(wh[cnt]==0){
						cout<<"抱歉啦,你似乎没有这种卡牌";
						Sleep(750);
						continue; 
					}
					cout<<"1.出售一张(大概获得:"<<(int)((double)prize[cnt]/1.2)<<"Coin)"<<endl<<"2.全部出售(大概获得:"<<(int)((double)prize[cnt]/1.2)*wh[cnt]<<"Coin)"<<endl<<"0.不出售"<<endl;
					x=-1;
					while(x<0 || x>2)
						cin>>x;
					if(x==0){
						cout<<"好吧,你说不定要再考虑一下。";
					}
					else if(x==1){
						x=(int)((double)prize[cnt]*(rand()%41+80)/120.0);
						cout<<"好嘞!这是你应得的钱。"<<endl<<"你获得了"<<x<<"个Coin!";
						money+=x;
						wh[cnt]--; 
						Save();
					}
					else{
						x=0;
						for(int i=1;i<=wh[cnt];i++){
							x+=(int)((double)prize[cnt]*(rand()%41+80)/120.0);
						}
						cout<<"好嘞!这是你应得的钱。"<<endl<<"你获得了"<<x<<"个Coin!";
						money+=x;
						wh[cnt]=0; 
						Save();
					}
					Sleep(1000);
				}
			}
		}
	}
	if(who==2){
		while(1){
			system("cls");
			cout<<"当人们考虑到某个特定的未来时,就是一种模糊的异常,这种事真是令人烦恼..."<<endl;
			cout<<"一次,一次,又一次...小心你的愿望,陌生人。"<<endl;
			cout<<"1.兑换卡牌"<<endl<<"0.退出"<<endl;
			cnt=-1;
			while(cnt<0 || cnt>1){
				cin>>cnt;
			}
			if(cnt==0){
				cout<<"为不可预见的后果做好准备,陌生人...我能看见未来。";
				Sleep(1000);
				break;
			}
			else if(cnt==1){
				while(1){
					system("cls");
					cout<<"我们可以公平地交换..."<<endl;
					cout<<"陌生人,你最好明智地做选择。"<<endl;
					for(int i=1;i<=8;i++){
						cout<<i<<".";
						Color(i);
						cout<<level[i];
						Color(0);
						cout<<"卡牌,库存"<<wh[i]<<"张   ";
						if(i==1){
							cout<<"(无法兑换)"<<endl;
						}
						else{
							cout<<"(需要"<<cost[i]<<"张";
							Color(i-1);
							cout<<level[i-1];
							Color(0);
							cout<<"卡)"<<endl;
						}
					}
					cout<<"0.退出"<<endl<<"(输入你想要兑换的卡牌)"<<endl;
					cnt=-1;
					while(cnt<0 || cnt>8){
						cin>>cnt;
					}
					if(cnt==0){
						cout<<"‘如果’并不是一个我常用的词...但如果不是现在,又是什么时候呢...";
						Sleep(1000);
						break; 
					}
					if(cnt==1){
						cout<<"我似乎患有盲点...陌生人,解释一下...";
						Sleep(1000);
						continue;
					}
					cout<<"(确定花费"<<cost[cnt]<<"张";
					Color(cnt-1);
					cout<<level[cnt-1];
					Color(0);
					cout<<"卡牌来兑换一张";
					Color(cnt);
					cout<<level[cnt];
					Color(0);
					cout<<"卡牌吗?  y/n)"<<endl; 
					cin>>xxx;
					if(xxx=='y'){
						if(wh[cnt-1]<cost[cnt]){
							cout<<"(你的库存似乎不支持你兑换这张卡)";
						}
						else{
							cout<<"我一直在等待这一刻...";
							Sleep(500);
							cout<<endl<<"早有人寓言,这就是那一刻..."<<endl;
							Sleep(500);
							cout<<"(你获得了一张";
							Color(cnt);
							cout<<level[cnt];
							Color(0);
							cout<<"卡牌!)"; 
							wh[cnt-1]-=cost[cnt];
							wh[cnt]++;
							Save();
						}
					}
					else{
						cout<<"不要害怕承诺,陌生人...";
					}
					Sleep(1000);
				}
			}
		}
	}
}

原文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值