Bootstrap

c++ 小游戏大全

MC

#include <iostream>
#include <conio.h>
#include <string>
#include <map>
#include <cmath>
#include <windows.h>
#include <time.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
int fallspeed;
int jumpspeed = -3;
int gravity = 1;
int y = 400, x = 500;
int restartposy, restartposx, face, health = 1000, lasthealth = 1000, breath = 100, hungry = 1000, dienum;
bool attack, defense, hurt, mode;
struct TNT
{
	int y;
	int x;
	int time;
	bool issave;
};
struct BLOCK
{
	int color;
	string ch;
	string type;
};
struct MOB
{
	int fallspeed;
	int health;
	bool hurt;
	int y;
	int x;
	int attack;
	string shap;
	bool isenemy;
	int color;
	string name;
};
struct ARROW
{
	string shap;
	double y;
	double x;
	double fallspeed;
	double plusx;
};
TNT tnt[20];
string die;
ARROW arrow[100];
MOB mobs[50] = {
	{0,1000,0,0,0,100,"危",true,7,"危"},
	{0,10,0,0,0,10,"  ",true,7,"  "},
	{0,1000,0,0,0,100,"MM",false,7,"MM"},
	{0,100000,0,90,70,-100,"AC",true,7,"Accept"},
	{0,10000,0,90,70,500,"BO",true,7,"BOSS"},
	{0,100000,0,90,70,-1000,"AK",true,7,"AK"},
};
MOB mob[100] = {
	{0,1000,0,92,4,100,"WA",true,7,"Wrong Anwser"},
	{0,1000,0,92,4,100,"TL",true,7,"Time Limit Error"},
	{0,2000,0,92,4,300,"CE",true,7,"Compile Error"},
	{0,1000,0,45,9,100,"WA",true,7,"Wrong Anwser"},
	{0,100000,0,90,70,-100,"AC",true,7,"Accept"},
	{0,100000,0,90,70,-1000,"AK",true,7,"AK"},
	{0,10000,0,90,70,500,"UK",true,7,"Unknown Error"},
	{0,1000,0,92,3,0,"MM",false,7,"MM"},
	{0,1000,0,92,3,0,"MM",false,7,"MM"},
	{0,1000,0,90,15,0,"MM",false,7,"MM"},
	{0,1000,0,90,80,0,"MM",false,7,"MM"},
};
BLOCK block[32] = {
	{0,"  ","air"},//空气
	{6,"██","block"},//土块
	{8,"██","block"},//石头
	{2,"██","block"},//草方块
	{15,"██","block"},//雪块
	{4,"██","block"},//岩浆块
	{14,"▓▓","fallblock"},//沙块
	{8,"II","fallblock"},//铁砧
	{9,"██","water"},//水
	{9,"▇▇","water"},//水
	{9,"▆▆","water"},//水
	{9,"▅▅","water"},//水
	{9,"▄▄","water"},//水
	{9,"▃▃","water"},//水
	{9,"▂▂","water"},//水
	{9,"▁▁","water"},//水
	{12,"██","lava"},//岩浆
	{12,"▇▇","lava"},//岩浆
	{12,"▆▆","lava"},//岩浆
	{12,"▅▅","lava"},//岩浆
	{12,"▄▄","lava"},//岩浆
	{12,"▃▃","lava"},//岩浆
	{12,"▂▂","lava"},//岩浆
	{12,"▁▁","lava"},//岩浆
	{12,"危","background"},//危
	{6,"██","background"},//木头
	{10,"▓▓","background"},//树叶
	{15,"▓▓","background"},//带雪树叶
	{15,"▅▅","bomb"},//TNT爆炸
	{12,"Ⅲ","TNT"},//TNT
	{7,"Ⅲ","TNT"},//TNT2
	{6,"∷","ladder"},//梯子
};
int board[1005][1005];
int setboard[1005][1005];
int bag[100];
int clear_buffer()
{
	while(kbhit())
	{
		if(getch() != EOF);
		for(int i = 1; i <= 256; i++)
		{
			if(GetAsyncKeyState(i));
		}
	}
	return 0;
}
void color(int a)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
/*	1	深蓝色
	2	深绿色
	3	深青色
	4	深红色
	5	深粉色
	i	黄色
	7	深白色
	8	灰色
	9	浅蓝色
	10	浅绿色
	11	浅青色
	12	浅红色
	13	浅粉色
	14	浅黄色
	15	浅白色
	背景
	1~15		黑色
	16~31		深蓝色
	32~47		深绿色
	48~63		深青色
	64~79		深红色
	'S'~95		深粉色
	96~111		深黄色
	112~127 	深白色
	128~143 	灰色
	144~159 	浅蓝色
	160~1'A' 	浅绿色
	176~191 	浅青色
	192~207 	浅红色
	208~223 	浅粉色
	224~239 	浅黄色
	240~255 	浅白色
*/
}
int init()//听说有人要我增加地图生成的注释,所以我就写了。
{
	for(int j = 0; j < 100; j++)
	{
		bag[j] = 0;//这个...初始化背包
	}
	for(int i = 0; i < 1000; i++)
	{
		for(int j = 0; j < 1000; j++)
		{
			board[i][j] = 0;//初始化地图 (我们的y是倒着来的)
		}
	}
	double lasty = rand() % 101 + 400;//lasty代表上一个我们选择的点的高度。
	for(int i = 5; i < 1000; i += 5)//i每次加5,每隔5个点连一条线
	{
		double y = rand() % 21 - 10 + lasty;//y代表这个点我们选择的高度,为了不出现太陡峭的山,我们只允许这个高度在刚才的点的高低10格内。
		y = min(450.0, y);//这是最小高度,防止整个地图都在水里。
		double high = lasty;//这个high是用来统计当前高度的,用double可以更加精确。
		int dirt = rand() % 5 + 2;//dirt代表这一列上泥土高度。
		for(int j = i - 5; j < i; j++)
		{
			high += (y - lasty) / 5;//high每次增加差距的1/5。
			for(int k = 999; k >= (int)high; k--)
			{
				if(k == (int)high)//如果是最高点
				{
					setboard[k][j] = 3;//就用草地
					if(high <= 350)//如果high比较高
					{
						setboard[k][j] = 4;//就用雪地
					}
				}
				else if(k - dirt <= (int)high)//泥土
				{
					setboard[k][j] = 1;
				}
				else
				{
					setboard[k][j] = 2;//石头
				}
			}
		}
		lasty = y;//赋值
	}
	//再来一边,填满最后几格
	int dirt = rand() % 5 + 2;
	double high = lasty;
	for(int j = 995; j < 999; j++)
	{
		for(int k = 999; k >= (int)high; k--)
		{
			if(k == (int)high)
			{
				setboard[k][j] = 3;
				if(high <= 350)
				{
					setboard[k][j] = 4;
				}
			}
			else if(k - dirt <= (int)high)
			{
				setboard[k][j] = 1;
			}
			else
			{
				setboard[k][j] = 2;
			}
		}
	}
	//填满水,这里默认把海平面高度设为410。
	for(int i = 0; i < 1000; i++)
	{
		for(int j = 600; j >= 410; j--)
		{
			if(setboard[j][i] == 0)
			{
				setboard[j][i] = 8;
			}
		}
	}
	//沙子
	for(int i = 0; i < 1000; i++)
	{
		bool a = 0;
		for(int j = 999; j >= 0; j--)
		{
			if(a && setboard[j][i] != 0  && setboard[j][i] != 8)
			{
				setboard[j][i] = 6;
				continue;
			}
			if(setboard[j][i] == 8)
			{
				continue;
			}
			if(setboard[j][i + 3] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j][i + 2] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j][i + 1] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j][i - 1] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j][i - 2] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j][i - 3] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j - 2][i] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j - 1][i] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j - 3][i] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
			if(setboard[j - 4][i] == 8)
			{
				a = true;
				setboard[j][i] = 6;
			}
		}
	}
	//树
	for(int i = 0; i < 1000; i++)
	{
		for(int j = 0; j < 1000; j++)
		{
			if(setboard[j][i] == 0 && block[setboard[j + 1][i]].type == "block")
			{
				if(rand() % 10 == 1)
				{
					setboard[j][i] = 25;
					setboard[j - 1][i] = 25;
					setboard[j - 2][i] = 25;
					setboard[j - 3][i] = 25;
					setboard[j - 3][i + 1] = 26;
					setboard[j - 3][i - 1] = 26;
					setboard[j - 4][i + 2] = 26;
					setboard[j - 4][i + 1] = 26;
					setboard[j - 4][i] = 26;
					setboard[j - 4][i - 1] = 26;
					setboard[j - 4][i - 2] = 26;
					setboard[j - 5][i + 2] = 26;
					setboard[j - 5][i + 1] = 26;
					setboard[j - 5][i] = 26;
					setboard[j - 5][i - 1] = 26;
					setboard[j - 5][i - 2] = 26;
					setboard[j - 6][i + 1] = 26;
					setboard[j - 6][i] = 26;
					setboard[j - 6][i - 1] = 26;
					if(j <= 350)
					{
						setboard[j - 3][i + 1] = 27;
						setboard[j - 3][i - 1] = 27;
						setboard[j - 4][i + 2] = 27;
						setboard[j - 4][i + 1] = 27;
						setboard[j - 4][i] = 27;
						setboard[j - 4][i - 1] = 27;
						setboard[j - 4][i - 2] = 27;
						setboard[j - 5][i + 2] = 27;
						setboard[j - 5][i + 1] = 27;
						setboard[j - 5][i] = 27;
						setboard[j - 5][i - 1] = 27;
						setboard[j - 5][i - 2] = 27;
						setboard[j - 6][i + 1] = 27;
						setboard[j - 6][i] = 27;
						setboard[j - 6][i - 1] = 27;
					}
				}
			}
		}
	}
	//地洞
	for(int j = 999; j >= 700; j--)
	{
		if(rand() % 20 == 1)
		{
			setboard[j - 3][2] = 0;
			setboard[j - 2][2] = 0; setboard[j - 2][3] = 0;
			setboard[j - 1][2] = 0; setboard[j - 1][3] = 0; setboard[j - 1][4] = 0;
			setboard[j][2] = 0; setboard[j][3] = 0; setboard[j][4] = 0; setboard[j][5] = 0;
			setboard[j + 1][2] = 0; setboard[j + 1][3] = 0; setboard[j + 1][4] = 0;
			setboard[j + 2][2] = 0; setboard[j + 2][3] = 0;
			setboard[j + 3][2] = 0;
		}
	}
	for(int i = 3; i < 997; i++)
	{
		for(int j = 996; j >= 500; j--)
		{
			if(block[setboard[j + 3][i]].type == "block" && block[setboard[j - 3][i]].type == "block" && setboard[j][i] == 0 && setboard[j + 1][i] == 0 && setboard[j + 2][i] == 0 && setboard[j - 1][i] == 0  && setboard[j - 2][i] == 0)
			{
				j += rand() % 5 - 2;
				j = max(3, j);
				j = min(996, j);
				if(rand() % 500 <= 499)
				{
					setboard[j - 3][i] = 0;
					setboard[j - 2][i - 1] = 0; setboard[j - 2][i] = 0; setboard[j - 2][i + 1] = 0;
					setboard[j - 1][i - 2] = 0; setboard[j - 1][i - 1] = 0; setboard[j - 1][i] = 0; setboard[j - 1][i + 1] = 0; setboard[j - 1][i + 2] = 0;
					setboard[j][i - 3] = 0; setboard[j][i - 2] = 0; setboard[j][i - 1] = 0; setboard[j][i] = 0; setboard[j][i + 1] = 0; setboard[j][i + 2] = 0; setboard[j][i + 3] = 0;
					setboard[j + 1][i - 2] = 0; setboard[j + 1][i - 1] = 0; setboard[j + 1][i] = 0; setboard[j + 1][i + 1] = 0; setboard[j + 1][i + 2] = 0;
					setboard[j + 2][i - 1] = 0; setboard[j + 2][i] = 0; setboard[j + 2][i + 1] = 0;
					setboard[j + 3][i] = 0;
					if(rand() % 20 == 1)
					{
						for(int k = 0; k < 100; k++)
						{
							if(mob[k].shap == "")
							{
								mob[k] = {0,1000,0,0,0,100,"SS",true,7,"僵尸"};
								mob[k].x = i;
								mob[k].y = j;
								break;
							}
						}
					}
				}
			}
			else if(block[setboard[j + 3][i]].type == "block" && block[setboard[j + 2][i]].type == "block" && block[setboard[j + 1][i]].type == "block" && block[setboard[j][i]].type == "block" && block[setboard[j - 1][i]].type == "block" && block[setboard[j - 2][i]].type == "block" && block[setboard[j - 3][i]].type == "block")
			{
				if(rand() % 500 == 1)
				{
					setboard[j - 3][i] = 0;
					setboard[j - 2][i - 1] = 0; setboard[j - 2][i] = 0; setboard[j - 2][i + 1] = 0;
					setboard[j - 1][i - 2] = 0; setboard[j - 1][i - 1] = 0; setboard[j - 1][i] = 0; setboard[j - 1][i + 1] = 0; setboard[j - 1][i + 2] = 0;
					setboard[j][i - 3] = 0; setboard[j][i - 2] = 0; setboard[j][i - 1] = 0; setboard[j][i] = 0; setboard[j][i + 1] = 0; setboard[j][i + 2] = 0; setboard[j][i + 3] = 0;
					setboard[j + 1][i - 2] = 0; setboard[j + 1][i - 1] = 0; setboard[j + 1][i] = 0; setboard[j + 1][i + 1] = 0; setboard[j + 1][i + 2] = 0;
					setboard[j + 2][i - 1] = 0; setboard[j + 2][i] = 0; setboard[j + 2][i + 1] = 0;
					setboard[j + 3][i] = 0;
				}
			}
		}
	}
	//出生点
	bool a = false;
	for(int i = 400; i < 1000; i++)
	{
		for(int j = 0; j < 1000; j++)
		{
			if(setboard[j][i] == 0 && block[setboard[j + 1][i]].type == "block" && (setboard[j + 1][i] == 3 || setboard[j + 1][i] == 4))
			{
				restartposy = j;
				restartposx = i;
				y = j;
				x = i;
				a = true;
				break;
			}
		}
		if(a)
		{
			break;
		}
	}
	return 0;
}
int Arrowmove()
{
	for(int i = 0; i < 100; i++)
	{
		if(arrow[i].shap == "")
		{
			continue;
		}
		arrow[i].x += (int)arrow[i].plusx;
		arrow[i].plusx -= 0.1;
		for(int j = (int)arrow[j].y + 1; j <= (int)arrow[j].y + (int)arrow[j].fallspeed; j++)
		{
			if(block[board[j][(int)arrow[j].x]].type == "block" || block[board[j][(int)arrow[j].x]].type == "fallblock")
			{
				arrow[i].fallspeed = 0;
				return 0;
			}
		}
		arrow[i].y += arrow[i].fallspeed;
		arrow[i].fallspeed += 0.1;
		if(arrow[i].y > 999)
		{
			arrow[i].shap = "";
		}
		if(block[board[(int)arrow[i].y + 1][(int)arrow[i].x]].type == "block" || block[board[(int)arrow[i].y + 1][(int)arrow[i].x]].type == "fallblock")
		{
			arrow[i].shap = "";
		}
	}
	return 0;
}
int mobmove()
{
	for(int j = 0; j < 100; j++)
	{
		if(mob[j].shap == "")
		{
			continue;
		}
		mob[j].hurt = false;
		mob[j].color = 7;
		if(mob[j].health <= 0 || mob[j].y > 999)
		{
			mob[j].shap = "";
			mob[j].color = 7;
			continue;
		}
		if(block[board[mob[j].y][mob[j].x]].type == "lava")
		{
			mob[j].health -= 200;
			mob[j].hurt = true;
		}
		else if((board[mob[j].y + 1][mob[j].x] == 5) || ((mob[j].y == y || mob[j].y == y - 1) && (mob[j].x == x + 1 || mob[j].x == x || mob[j].x == x - 1) && KEY_DOWN(' ')))
		{
			mob[j].health -= 100;
			mob[j].hurt = true;
		}
		if(mob[j].y == y && mob[j].x == x && mob[j].isenemy)
		{
			health -= mob[j].attack;
			hurt = true;
			die = "被 " + mob[j].name + " 杀死了";
		}
		for(int i = mob[j].y - 1; i >= mob[j].y + mob[j].fallspeed; i--)
		{
			if(block[board[i - 1][mob[j].x]].type == "block")
			{
				mob[j].fallspeed = 0 - mob[j].y + i + 1;
				return 0;
			}
		}
		for(int i = mob[j].y + 1; i <= mob[j].y + mob[j].fallspeed; i++)
		{
			if(block[board[i][mob[j].x]].type == "block" || block[board[i][mob[j].x]].type == "fallblock")
			{
				if(mob[j].fallspeed >= 5 && block[board[i - 1][mob[j].x]].type == "water")
				{
					mob[j].health -= 50 * (mob[j].fallspeed - 4);
					mob[j].hurt = true;
				}
				mob[j].fallspeed = 0;
				return 0;
			}
		}
		mob[j].y += mob[j].fallspeed;
		mob[j].fallspeed += gravity;
		if(mob[j].isenemy)
		{
			if(mob[j].y > y && (block[board[mob[j].y + 1][mob[j].x]].type == "block" || block[board[mob[j].y + 1][mob[j].x]].type == "fallblock"))
			{
				if(mob[j].y > y + 50)
				{
					mob[j].fallspeed = -7;
				}
				mob[j].fallspeed = -3;
			}
			if(mob[j].x < x)
			{
				if(block[board[mob[j].y][mob[j].x + 1]].type != "block" || block[board[mob[j].y][mob[j].x + 1]].type != "fallblock")
				{
					mob[j].x++;
				}
				else if(block[board[mob[j].y + 1][mob[j].x]].type == "block" || block[board[mob[j].y + 1][mob[j].x]].type != "fallblock")
				{
					mob[j].fallspeed = -3;
				}
			}
			else if(mob[j].x > x)
			{
				if(block[board[mob[j].y][mob[j].x - 1]].type != "block" || block[board[mob[j].y][mob[j].x - 1]].type != "fallblock")
				{
					mob[j].x--;
				}
				else if(block[board[mob[j].y + 1][mob[j].x]].type == "block" || block[board[mob[j].y + 1][mob[j].x]].type != "fallblock")
				{
					mob[j].fallspeed = -3;
				}
			}
		}
		else
		{
			if(rand() % 3 == 0)
			{
				if(block[board[mob[j].y][mob[j].x + 1]].type != "block" || block[board[mob[j].y][mob[j].x + 1]].type != "fallblock")
				{
					mob[j].x++;
				}
				else if(block[board[mob[j].y + 1][mob[j].x]].type == "block" || block[board[mob[j].y + 1][mob[j].x]].type != "fallblock")
				{
					mob[j].fallspeed = -3;
				}
			}
			else if(rand() % 3 == 1)
			{
				if(block[board[mob[j].y][mob[j].x - 1]].type != "block" || block[board[mob[j].y][mob[j].x - 1]].type != "fallblock")
				{
					mob[j].x--;
				}
				else if(block[board[mob[j].y + 1][mob[j].x]].type == "block" || block[board[mob[j].y + 1][mob[j].x]].type != "fallblock")
				{
					mob[j].fallspeed = -3;
				}
			}
		}
		if(mob[j].hurt)
		{
			mob[j].color = 12;
		}
	}
	return 0;
}
int print()
{
	if(!mode)
	{
		color(8);
		cout << "HP:";
		color(12);
		cout << health << endl;
		for(int i = 0; i < health; i += 100)
		{
			cout << "◆";
		}
		color(7);
		for(int i = health; i < lasthealth; i += 100)
		{
			cout << "◇";
		}
		cout << endl;
		color(8);
		cout << "AIR:";
		color(11);
		cout << breath << endl;
		for(int i = 0; i < breath; i += 10)
		{
			cout << "●";
		}
		for(int i = breath; i < 91; i += 10)
		{
			cout << "○";
		}
		cout << endl;
		color(8);
		cout << "HUNGRY:";
		color(14);
		cout << hungry << endl;
		for(int i = 0; i < hungry; i += 100)
		{
			cout << "§";
		}
		cout << endl;
	}
	color(8);
	cout << "DIENUM:";
	color(4);
	cout << dienum << endl;
	for(int i = y - 6; i <= y + 6; i++)
	{
		for(int j = x - 6; j <= x + 6; j++)
		{
			bool ismob = false;
			for(int s = 0; s < 100; s++)
			{
				if(mob[s].shap == "")
				{
					continue;
				}
				else if(mob[s].x == j && mob[s].y == i)
				{
					color(mob[s].color);
					cout << mob[s].shap;
					ismob = true;
					break;
				}
			}
			if(ismob)
			{
				continue;
			}
			for(int s = 0; s < 100; s++)
			{
				if(arrow[s].shap == "")
				{
					continue;
				}
				else if((int)arrow[s].x == j && (int)arrow[s].y == i)
				{
					color(7);
					cout << arrow[s].shap;
					ismob = true;
					break;
				}
			}
			if(ismob)
			{
				continue;
			}
			else if(i == y && j == x)
			{
				if (KEY_DOWN('S'))
				{
					color(14);
					if(hurt)
					{
						color(12);
					}
					cout << "()";
				}
				else
				{
					color(9);
					if(hurt)
					{
						color(12);
					}
					cout << "∏";
				}
			}
			else if(i == y - 1 && j == x)
			{
				if (!KEY_DOWN('S'))
				{
					color(14);
					if(hurt)
					{
						color(12);
					}
					cout << "()";
				}
				else
				{
					color(block[board[i][j]].color);
					cout << block[board[i][j]].ch;
				}
			}
			else
			{
				if(i < 0 || i >= 1000 || j < 0 || j >= 1000)
				{
					cout << "  ";
					continue;
				}
				color(block[board[i][j]].color);
				cout << block[board[i][j]].ch;
			}
		}
		cout << endl;
	}
	color(7);
	cout << "Y:";
	color(6);
	cout << 1000 - y << endl;
	color(7);
	cout << "X:";
	color(6);
	cout << x << endl;
	return 0;
}
int move()
{
	if(board[y][x] == 31)
	{
		y += fallspeed;
		return 0;
	}
	if(block[board[y][x]].type == "water")
	{
		if(fallspeed > 1)
		{
			fallspeed = 1;
		}
	}
	else
	{
		for(int i = y - 1; i >= y + fallspeed; i--)
		{
			if(block[board[i - 1][x]].type == "block" || block[board[i - 1][x]].type == "fallblock")
			{
				fallspeed = 0 - y + i + 1;
				return 0;
			}
		}
	}
	for(int i = y + 1; i <= y + fallspeed; i++)
	{
		if(block[board[i][x]].type == "block" || block[board[i][x]].type == "fallblock")
		{
			if(fallspeed >= 5 && block[board[i - 1][x]].type != "water")
			{
				health -= 50 * (fallspeed - 4);
				if(fallspeed >= 7)
				{
					die = "落地过猛!";
				}
				else
				{
					die = "从高处摔了下来!";
				}
				hurt = true;
			}
			fallspeed = 0;
			return 0;
		}
	}
	y += fallspeed;
	fallspeed += gravity;
	return 0;
}
int bomb()
{
	for(int i = 0; i < 20; i++)
	{
		if(tnt[i].time == 0)
		{
			int atk = 0;
			if(abs(x - tnt[i].x) + abs(y - tnt[i].y) == 4)
			{
				atk = 50;
				fallspeed -= 1;
				x += x - tnt[i].x;
			}
			if(abs(x - tnt[i].x) + abs(y - tnt[i].y) == 3)
			{
				atk = 100;
				fallspeed -= 2;
				x += x - tnt[i].x;
			}
			if(abs(x - tnt[i].x) + abs(y - tnt[i].y) == 2)
			{
				atk = 300;
				fallspeed -= 4;
				x += 2 * (x - tnt[i].x);
			}
			if(abs(x - tnt[i].x) + abs(y - tnt[i].y) == 1)
			{
				atk = 500;
				fallspeed -= 7;
				x += 5 * (x - tnt[i].x);
			}
			if(abs(x - tnt[i].x) + abs(y - tnt[i].y) == 0)
			{
				atk = 800;
				fallspeed -= 10;
			}
			tnt[i].time--;
			if(!tnt[i].issave)
			{
				health -= atk;
			}
			die = "被TNT炸死了";
			if(atk > 0 && !tnt[i].issave)
			{
				hurt = true;
			}
			if(!tnt[i].issave)
			{
				for(int yy = tnt[i].y - 3; yy <= tnt[i].y + 3; yy++)
				{
					for(int xx = tnt[i].x - 3; xx <= tnt[i].x + 3; xx++)
					{
						if((int)(sqrt(abs(yy - tnt[i].y) * abs(yy - tnt[i].y) + abs(xx - tnt[i].x) * abs(xx - tnt[i].x)) + 0.9999) == 3)
						{
							setboard[yy][xx] = 28;
						}
						if((int)(sqrt(abs(yy - tnt[i].y) * abs(yy - tnt[i].y) + abs(xx - tnt[i].x) * abs(xx - tnt[i].x)) + 0.9999) < 3)
						{
							setboard[yy][xx] = 0;
						}
					}
				}
			}
		}
		else if(tnt[i].time == -1)
		{
			setboard[tnt[i].y][tnt[i].x] = 0;
			if(!tnt[i].issave)
			{
				for(int yy = tnt[i].y - 3; yy <= tnt[i].y + 3; yy++)
				{
					for(int xx = tnt[i].x - 3; xx <= tnt[i].x + 3; xx++)
					{
						if((int)(sqrt(abs(yy - tnt[i].y) * abs(yy - tnt[i].y) + abs(xx - tnt[i].x) * abs(xx - tnt[i].x)) + 0.9999) <= 3)
						{
							setboard[yy][xx] = 0;
						}
					}
				}
			}
			tnt[i].time--;
		}
		else if(tnt[i].time > 0)
		{
			tnt[i].time--;
			if(tnt[i].time % 2 == 0)
			{
				setboard[tnt[i].y][tnt[i].x] = 29;
			}
			else
			{
				setboard[tnt[i].y][tnt[i].x] = 30;
			}
		}
	}
	return 0;
}
int check()
{
	for(int i = 0; i < 1000; i++)
	{
		for(int j = 0; j < 1000; j++)
		{
			if(block[board[i][j]].type == "water" && board[i][j] != 15)
			{
				if(board[i + 1][j] == 0)
				{
					setboard[i + 1][j] = board[i][j];
					setboard[i + 1][j] = 8;
				}
				else if(block[board[i + 1][j]].type == "lava")
				{
					setboard[i + 1][j] = 2;
				}
				else if(block[board[i + 1][j]].type == "block" || block[board[i + 1][j]].type == "fallblock")
				{
					if(board[i][j + 1] == 0)
					{
						setboard[i][j + 1] = board[i][j] + 1;
					}
					else if(block[board[i][j + 1]].type == "lava")
					{
						setboard[i][j + 1] = 2;
					}
					if(board[i][j - 1] == 0)
					{
						setboard[i][j - 1] = board[i][j] + 1;
					}
					else if(block[board[i][j - 1]].type == "lava")
					{
						setboard[i][j - 1] = 2;
					}
				}
			}
			if(block[board[i][j]].type == "lava" && board[i][j] != 23)
			{
				if(board[i + 1][j] == 0)
				{
					setboard[i + 1][j] = board[i][j];
					setboard[i + 1][j] = 16;
				}
				else if(block[board[i + 1][j]].type == "water")
				{
					setboard[i + 1][j] = 2;
				}
				else if(block[board[i + 1][j]].type == "block" || block[board[i + 1][j]].type == "fallblock")
				{
					if(board[i][j + 1] == 0)
					{
						setboard[i][j + 1] = board[i][j] + 1;
					}
					else if(block[board[i][j + 1]].type == "water")
					{
						setboard[i][j + 1] = 2;
					}
					if(board[i][j - 1] == 0)
					{
						setboard[i][j - 1] = board[i][j] + 1;
					}
					else if(block[board[i][j - 1]].type == "water")
					{
						setboard[i][j - 1] = 2;
					}
				}
			}
			if(block[board[i][j]].type == "fallblock")
			{
				if(board[i + 2][j] == 0 && board[i + 1][j] == 0 && i + 2 < 100)
				{
					setboard[i][j] = 0;
					setboard[i + 2][j] = board[i][j];
					if(board[i][j] == 7 && j == x && i + 2 == y)
					{
						health -= 600;
						hurt = true;
						die = "被压扁了";
					}
				}
				else if(board[i + 1][j] == 0 && i + 1 < 100)
				{
					setboard[i][j] = 0;
					setboard[i + 1][j] = board[i][j];
					if(board[i][j] == 7 && j == x && i + 1 == y)
					{
						health -= 600;
						hurt = true;
						die = "被压扁了";
					}
					else if(board[i][j] == 7 && j == x && i + 2 == y)
					{
						health -= 600;
						hurt = true;
						die = "被压扁了";
					}
				}
			}
		}
	}
	for(int i = 0; i < 1000; i++)
	{
		for(int j = 0; j < 1000; j++)
		{
			board[i][j] = setboard[i][j];
		}
	}
}
int main()
{
	srand((int)time(0));
	for(int i = 0; i < 20; i++)
	{
		tnt[i].time = -2;
	}
	init();
	while(1)
	{
		system("cls");
		if(!mode)
		{
			move();
		}
		if(KEY_DOWN('F'))
		{
			setboard[y + 1][x] = 2;
		}
		check();
		bomb();
		Arrowmove();
		mobmove();
		if(mode)
		{
			hurt = false;
		}
		print();
		Sleep(30);
		hungry--;
		hungry = max(hungry, 0);
		if(hungry == 0)
		{
			die = "被饿死了";
			hurt = true;
			health -= 10;
		}
		if(mode)
		{
			health = 1000;
		}
		if(health <= 0)
		{
			Sleep(500);
			system("cls");
			color(12);
			cout << "           GAME OVER           " << endl;
			color(7);
			cout << "   STEVE " << die << endl;
			dienum++;
			Sleep(2000);
			x = restartposx;
			y = restartposy;
			health = 1000;
			hungry = 1000;
			breath = 100;
			fallspeed = 0;
		}
		health += (hungry + 201) / 300;
		if(health > 1000)
		{
			health = 1000;
		}
		if(attack)
		{
			attack = 0;
		}
		if(defense)
		{
			defense = 0;
		}
		if(hurt)
		{
			hurt = false;
			lasthealth = health;
		}
		if(block[board[y][x]].type == "water")
		{
			fallspeed = 1;
			if(KEY_DOWN('W'))
			{
				fallspeed = -1;
			}
		}
		if(block[board[y - 1][x]].type == "water")
		{
			die = "被水淹死了!";
			breath--;
		}
		else
		{
			breath++;
			if(breath > 100)
			{
				breath = 100;
			}
		}
		if(board[y][x] == 31)
		{
			fallspeed = 0;
			if(KEY_DOWN('W'))
			{
				fallspeed = -1;
			}
			if(KEY_DOWN('S'))
			{
				fallspeed = 1;
			}
		}
		if(block[board[y][x]].type == "lava")
		{
			fallspeed = 1;
			if(KEY_DOWN('W'))
			{
				fallspeed = -1;
			}
			die = "试图在岩浆里游泳!";
			hurt = true;
			health -= 100;
		}
		if (KEY_DOWN('W') && !KEY_DOWN('S'))
		{
			if(mode)
			{
				y--;
			}
			else
			{
				if(block[board[y][x]].type != "water" && board[y][x] != 31)
				{
					if(block[board[y + 1][x]].type == "block" || block[board[y + 1][x]].type == "fallblock")
					{
						fallspeed = jumpspeed;
					}
				}
			}
		}
		if (KEY_DOWN('A'))
		{
			if((block[board[y][x - 1]].type != "block" && block[board[y][x - 1]].type != "fallblock") || mode)
			{
				if(KEY_DOWN('S') || (block[board[y - 1][x - 1]].type != "block" && block[board[y - 1][x - 1]].type != "fallblock") || mode)
				{
					x -= 1;
				}
			}
			face = -1;
		}
		if (KEY_DOWN('D'))
		{
			if((block[board[y][x + 1]].type != "block" && block[board[y][x + 1]].type != "fallblock") || mode)
			{
				if(KEY_DOWN('S') || (block[board[y - 1][x + 1]].type != "block"  && block[board[y - 1][x + 1]].type != "fallblock") || mode)
				{
					x += 1;
				}
			}
			face = 1;
		}
		if(KEY_DOWN('S'))
		{
			if(mode)
			{
				y++;
			}
			else
			{
				fallspeed += 1;
			}
		}
		if(KEY_DOWN(' '))
		{
			attack = true;
		}
		if(KEY_DOWN('E'))
		{
			system("cls");
			color(7);
			cout << "┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐" << endl;
			for(int i = 0; i < 9; i++)
			{
				color(7);
				cout << "│";
				for(int j = 0; j < 10; j++)
				{
					color(block[bag[i * 10 + j]].color);
					cout << block[bag[i * 10 + j]].ch;
					color(7);
					cout << "│";
				}
				cout << endl;
				color(7);
				cout << "├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤" << endl;
			}
			color(7);
			cout << "│";
			for(int j = 0; j < 10; j++)
			{
				color(block[bag[90 + j]].color);
				cout << block[bag[90 + j]].ch;
				color(7);
				cout << "│";
			}
			color(7);
			cout << endl;
			cout << "└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘" << endl;
			Sleep(3000);
		}
		if(KEY_DOWN('C'))
		{
			hungry += 100;
			hungry = min(hungry, 1000);
		}
		if(KEY_DOWN('Q'))
		{
			for(int i = 0; i < 20; i++)
			{
				if(tnt[i].time == -2)
				{
					tnt[i] = {y, x, 10, 0};
					break;
				}
			}
		}
		if(KEY_DOWN('i'))
		{
			for(int i = 0; i < 20; i++)
			{
				if(tnt[i].time == -2)
				{
					tnt[i] = {y, x, 10, 1};
					break;
				}
			}
		}
		if(KEY_DOWN('8'))
		{
			for(int i = 0; i < 20; i++)
			{
				if(tnt[i].time == -2)
				{
					tnt[i] = {y, x, 10, 2};
					break;
				}
			}
		}
		if(KEY_DOWN('9'))
		{
			for(int i = 0; i < 20; i++)
			{
				if(tnt[i].time == -2)
				{
					tnt[i] = {y, x, 10, 3};
					break;
				}
			}
		}
		if(KEY_DOWN('0'))
		{
			for(int i = 0; i < 20; i++)
			{
				if(tnt[i].time == -2)
				{
					tnt[i] = {y, x, 10, 4};
					break;
				}
			}
		}
		if(KEY_DOWN('I'))
		{
			for(int i = 0; i < 20; i++)
			{
				if(tnt[i].time == -2)
				{
					tnt[i] = {y, x, 10, 5};
					break;
				}
			}
		}
		if(KEY_DOWN('Z'))
		{
			setboard[y + 1][x] = 0;
		}
		if(KEY_DOWN('X'))
		{
			setboard[y][x] = 24;
		}
		if(KEY_DOWN('3'))
		{
			setboard[y + 1][x] = 6;
		}
		if(KEY_DOWN('4'))
		{
			setboard[y + 1][x] = 7;
		}
		if(KEY_DOWN('1'))
		{
			setboard[y + 1][x] = 8;
		}
		if(KEY_DOWN('2'))
		{
			setboard[y + 1][x] = 16;
		}
		if(KEY_DOWN('5'))
		{
			if(face == 1)
			{
				for(int i = 0; i < 100; i++)
				{
					if(arrow[i].shap == "")
					{
						arrow[i] = {"→",y,x,-0.7,2};
						break;
					}
				}
			}
			else
			{
				for(int i = 0; i < 100; i++)
				{
					if(arrow[i].shap == "")
					{
						arrow[i] = {"←",y,x,-0.7,-2};
						break;
					}
				}
			}
		}
		if(KEY_DOWN('T'))
		{
			clear_buffer();
			system("cls");
			cout << "请输入指令:" << endl;
			string a;
			cin >> a;
			if(a == "kill")
			{
				die = "失败了。";
				hurt = true;
				health = 0;
			}
			if(a == "full_health")
			{
				health = 1000;
			}
			if(a == "creativemode")
			{
				mode = !mode;
			}
			if(a == "move")
			{
				cin >> y >> x;
				y = 1000 - y;
			}
			if(a == "summom")
			{
				int a;
				cin >> a;
				for(int i = 0; i < 100; i++)
				{
					if(mob[i].shap == "")
					{
						mob[i] = mobs[a];
						mob[i].x = x;
						mob[i].y = y;
						break;
					}
				}
			}
		}
		if(KEY_DOWN('O'))
		{
			for(int i = 0; i < 1000; i++)
			{
				for(int j = 0; j < 1000; j++)
				{
					setboard[i][j] = 0;
				}
			}
		}
		if(KEY_DOWN('P'))
		{
			for(int i = 0; i < 1000; i++)
			{
				for(int j = 0; j < 1000; j++)
				{
					setboard[i][j] = 2;
				}
			}
		}
		if(y > 1000)
		{
			die = "掉出了这个世界!";
			hurt = true;
			health -= 200;
		}
		if(breath <= 0)
		{
			breath = 0;
			hurt = true;
			health -= 10;
		}
		if(!KEY_DOWN('S') && block[board[y - 1][x]].type == "block")
		{
			die = "在墙里窒息死亡!";
			hurt = true;
			health -= 50;
		}
		if(board[y + 1][x] == 5)
		{
			hurt = true;
			die = "发现了地板是熔岩做的。";
			health -= 30;
		}
		clear_buffer();
	}
	return 0;
}

2048

#include<iostream>
#include<vector>
#include<ctime>
#include<cstdlib>
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
class Game_2048
{
public:
    Game_2048();
    ~Game_2048();
    void introduction();
    void color();                                //改变输出颜色
    bool judgeOver();                            //判断游戏是否结束
    void reSize();
    void printBoard();                           //打印函数
    void getRand();                              //随机在棋盘上生成2,4;
    void slide();                                //滑动
private:
    int m=4, n=4;
    char op;                                   //用户操作
    vector< vector<int> >     board;                                //棋盘
    vector<int>  row;
    bool judgeInsert(int x,int y);
    bool judgeSlide();                               //判断是否能滑动,(未写完)
    void copyBoard(vector< vector<int> > &newBoard,vector< vector<int> > &board);
    void inputOp();
    char getOp();                            //返回操作符

    bool judgeLeftSlide(bool mark=true);
    void leftSlide();                            //左滑动

    bool judgeRightSlide(bool mark = true);
    void rightSlide();

    bool judgeUpSlide(bool mark = true);
    void upSlide();

    bool judgeDownSlide(bool mark = true);
    void downSlide();

    void reStart();
    void enlarge();                             //将值扩大二倍
};

int main()
{
    Game_2048 NB;
    NB.introduction();
    NB.getRand();
    NB.printBoard();
    while (!NB.judgeOver())
    {
        NB.slide();
        NB.getRand();
        NB.printBoard();
    }
    cout << "游戏结束!!!\n";
    system("pause");
    return 0;

}

void color(int x)
{
	switch(x)
	  {
	    case  1:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY );break;//灰
	    case  2:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN|FOREGROUND_BLUE |FOREGROUND_RED);break;//白
		case  3:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED  |FOREGROUND_BLUE );break;//粉
		case  4:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE |FOREGROUND_GREEN);break;//青
		case  5:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED  |FOREGROUND_GREEN);break;//黄
	    case  6:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED  );break;//红
		case  7:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE );break;//蓝
	    case  8:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);break;//绿
		case  9:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HENDLE), FOREGROUND_INTENSITY |FOREGROUND_RED |FOREGROUND_RED);break;
//        default:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN|FOREGROUND_BLUE |FOREGROUND_RED);break;//白
	  }
}
void Game_2048::introduction()
{
    cout << "这是一个2048游戏,规则如下:\n";
    cout << "上划:W;\n下滑:S;\n左划:A;\n右划:D;\n退出:Q;\n重新开始:R;\n请输入下次操作,\n";
}

void Game_2048::slide()
{
    inputOp();
    switch (getOp())
    {
	    case 'a':
	    case 'A':
	        if (judgeLeftSlide())
	            do{
	                leftSlide();
	            }while (judgeLeftSlide(false));
	        else
	        {
	            cout << "无法左滑动,请重试!!!\n";
	            slide();
	        }
	        break;
	    case 'd':
	    case 'D':
	        if (judgeRightSlide())
	            do{
	                rightSlide();
	        	}while (judgeRightSlide(false));
	        else
	        {
	            cout << "无法右滑动,请重试!!!\n";
	            slide();
	        }
	        break;
	    case 'w':
	    case 'W':
	        if(judgeUpSlide())
	            do{
	            	upSlide();
	        	}while (judgeUpSlide(false));
	        else
	        {
	            cout << "无法上滑动,请重试!!!\n";
	            slide();
	        }
	        break;
	    case 's':
	    case 'S':
	        if(judgeDownSlide())
	            do{
	                downSlide();
	            }while (judgeDownSlide(false));
	        else
	        {
	            cout << "无法下滑动,请重试!!!\n";
	            slide();
	        }
	        break;
	    case 'p':
	    case 'P':
	        enlarge();
	        break;
	    case 'q':
	    case 'Q':
	        exit(0);
	        break;
	    case 'r':
	    case 'R':
	        reStart();
	        break;
	    default:
	        cout << "输入错误,作为惩罚,随机生成一个数!\n";
	        break;
    }
}


void Game_2048::reStart()
{
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n; j++) {
            board[i][j] = 0;
        }
}

void Game_2048::enlarge()
{
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n; j++)
        {
            board[i][j] *= 2;
        }
}


char Game_2048::getOp()
{
    return op;
}

void Game_2048::upSlide()
{
    for (int j = 0; j < n; j++)
        for (int i = m - 1; i > 0; i--) {                             //n-1!!
            if (board[i][j] != 0 && board[i - 1][j] == 0)            //移动
            {
                    board[i - 1][j] = board[i][j];
                    board[i][j] = 0;
            }
        }
    for (int j = 0; j < n; j++)
        for (int i = m - 1; i > 0; i--) {
            if (board[i][j] != 0 && board[i-1][j] == board[i][j])  //覆盖
            {
                board[i-1][j] += board[i][j];
                board[i][j] = 0;
            }
        }
}

bool Game_2048::judgeUpSlide(bool mark)
{
    if (mark)
    {
        for (int i = 0; i < m; i++)
            for (int j = n - 1; j > 0; j--)
            {
                if (board[i][j] == 0)
                return true;
            }
    }
    for (int j = 0; j < n; j++)
        for (int i = m - 1; i > 0; i--) {                            //n-1!!
            if (board[i][j] != 0 && board[i - 1][j] == 0)            //移动
                return true;
            if (board[i][j] != 0 && board[i - 1][j] == board[i][j])  //覆盖
                return true;
        }
    return false;
}

bool Game_2048::judgeDownSlide(bool mark)
{
    if (mark) {
        for (int i = 0; i < m; i++)
            for (int j = n - 1; j > 0; j--)
                {
                    if (board[i][j] == 0)
                        return true;
                }

    }
    for (int j = 0; j < n; j++)
                for (int i = 0; i < m - 1; i++) {                            //n-1!!
                    if (board[i][j] != 0 && board[i + 1][j] == 0)            //移动
                        return true;
                    if (board[i][j] != 0 && board[i + 1][j] == board[i][j])  //覆盖
                        return true;

                }
    return false;
}

void Game_2048::downSlide()
{
    for (int j = 0; j < n; j++)
        for (int i = 0; i < m - 1; i++) {
            if (board[i][j] != 0 && board[i + 1][j] == 0)            //移动
            {
                    board[i + 1][j] = board[i][j];
                    board[i][j] = 0;
            }
        }
    for (int j = 0; j < n; j++)
        for (int i = 0; i < m - 1; i++) {
            if (board[i][j] != 0 && board[i + 1][j] == board[i][j])  //覆盖
            {
                board[i + 1][j] += board[i][j];
                board[i][j] = 0;
            }
        }
}


void Game_2048::rightSlide()
{
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n - 1; j++) {                            //n-1!!
            if (board[i][j] != 0 && board[i][j + 1] == 0)            //移动
            {
                    board[i][j + 1] = board[i][j];
                    board[i][j] = 0;
            }
        }
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n - 1; j++) {
            if (board[i][j] != 0 && board[i][j + 1] == board[i][j])  //覆盖
            {
                board[i][j + 1] += board[i][j];
                board[i][j] = 0;
            }
        }
}

bool Game_2048::judgeRightSlide(bool mark )
{
    if (mark) {
        for (int i = 0; i < m; i++)
            for (int j = n - 1; j > 0; j--)
            {
                if (board[i][j] == 0)
                    return true;
            }
    }
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n - 1; j++) {                            //n-1!!
            if (board[i][j] != 0 && board[i][j + 1] == board[i][j])  //覆盖
                return true;
            if (board[i][j] != 0 && board[i][j + 1] == 0)
                return true;
        }
    return false;
}

void Game_2048::leftSlide()
{
    for (int i = 0; i < m; i++)
        for (int j = 1; j < n; j++) {                                //n-1!!
            if (board[i][j] != 0 && board[i][j - 1] == 0)            //移动
            {
                    board[i][j - 1] = board[i][j];
                    board[i][j] = 0;
            }
        }
    for (int i = 0; i < m; i++)
        for (int j = 1; j < n; j++) {
            if (board[i][j] != 0 && board[i][j - 1] == board[i][j])  //覆盖
            {
                board[i][j - 1] += board[i][j];
                board[i][j] = 0;
            }
        }
}

bool Game_2048::judgeLeftSlide(bool mark)
{
    if (mark) {
        for (int i = 0; i < m; i++)
                for (int j = n - 1; j > 0; j--)
                {
                    if (board[i][j] == 0)
                        return true;
                }
    }
    for (int i = 0; i < m; i++)
        for (int j = n - 1; j > 0; j--) {                            //n-1!!
            if (board[i][j] != 0 && board[i][j - 1] == 0)            //移动
                return true;
            if (board[i][j] != 0 && board[i][j - 1] == board[i][j])  //覆盖
                return true;
        }
    return false;
}

bool Game_2048::judgeOver()
{
    if (op == 'q' || op == 'Q')
        return true;
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n; j++) {
            if (board[i][j] == 2048)
            {
                printBoard();
                cout << "有数字达到了2048,恭喜!!!\n";
                return true;
            }
        }

    for (int i = 0; i < m; i++)
        for (int j = 0; j < n; j++) {
             if (board[i][j] == 0)
                return false;
        }
    if (judgeSlide())
        return false;
    else
    {
        cout << "无法再滑动\n";
        return true;
    }

}

bool Game_2048::judgeSlide()
{
    vector< vector<int> >     copyBoard;                                //棋盘
    vector<int>  copyRow;
    for (int i = 0; i < n; i++) {
        copyRow.push_back(0);
    }
    for (int i = 0; i < m; i++) {
        copyBoard.push_back(copyRow);
    }
    copyBoard = board;
    upSlide();
    downSlide();
    leftSlide();
    rightSlide();
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n; j++)
        {
            if (board[i][j] == 0) {
                board = copyBoard;
                return true;
            }
        }
    return false;
}

void Game_2048::copyBoard(vector< vector<int> >& newBoard, vector< vector<int> >&     board)
{
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n; j++)
            newBoard[i][j] = board[i][j];
}

bool Game_2048::judgeInsert(int x,int y)
{
    if (board[x][y] == 0)
        return true;
    else
        return false;
}
void Game_2048::getRand()
{
    srand(time(0));
    int x, y,val;
    do
    {
        x = rand() % m;
        y = rand() % n;
    } while (!judgeInsert(x,y));
    val = (rand() % 2 + 1)*2;
    board[x][y] = val;

}

void Game_2048::inputOp()
{
    cin >> op;
}
void Game_2048::reSize()
{
    cout << "请输入棋盘大小m*n\n";
    cin >> m >> n;
    Game_2048();
}

Game_2048::~Game_2048()
{
}

Game_2048::Game_2048()
{
    for (int i = 0; i < n; i++){
        row.push_back(0);
    }
    for (int i = 0; i < m; i++){
        board.push_back(row);
    }
}
void Game_2048::printBoard()
{
    cout << "\n--------------\n";
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
        	if(board[i][j] == 2)color(1);
        	if(board[i][j] == 4)color(2);
        	if(board[i][j] == 8)color(3);
        	if(board[i][j] == 16)color(4);
        	if(board[i][j] == 32)color(5);
        	if(board[i][j] == 64)color(6);
        	if(board[i][j] == 128)color(7);
        	if(board[i][j] == 256)color(8);
        	if(board[i][j] == 512)color(9);
//        	if(board[i][j] == 1024)color(10);
//        	if(board[i][j] == 2048)color(11);
            cout << board[i][j];
            if (j < n-1)
            {
                cout << "—";
            }
            if (j == n-1 && i < m-1)
            {
                cout << endl;
                int count = 0;
                while (count++ < n-1)
                {
                    cout << "|  ";
                }
                cout << "|" << endl;
            }
        }
    }

    cout << "\n--------------\n" ;
}

俄罗斯方块

#include<iostream>
#include<string>
#include<cstdlib>
#include<windows.h>
#include<ctime>
#include<conio.h>
#include<cstdio>
using namespace std;

class Tetris
{
private:
  int rank;        //游戏难度等级
  int score;        // 得分
  int id;          //图形ID
  int point[2];      //两基点
  int top;          //最高点高度
public:
  Tetris();
  void Welocme();      //首界面
  void DrawMap();      //游戏界面
  void SetColor(int);    //控制颜色
  void Draw(int, int, int);    //画图形
  void Run();        //运行游戏
  void ReDraw(int, int, int);      //清除图形
  bool Judge(int, int, int);
  void Turn(int);        //旋转
  void Updata();        // 更新界面
  void Pause();        //游戏暂停
  void Input_score();
};

const int sharp[15][8] =          //组成图形的各个点的各个坐标,先纵后横
{
{0,0,1,0,2,0,3,0},{0,0,0,1,0,2,0,3},
{0,0,1,0,0,1,1,1},
{0,0,1,0,1,1,1,2},{0,1,1,1,2,0,2,1},{0,0,0,1,0,2,1,2},{0,0,0,1,1,0,2,0},
{1,0,1,1,1,2,0,2},{0,0,0,1,1,1,2,1},{0,0,0,1,0,2,1,0},{0,0,1,0,2,0,2,1},
{0,0,0,1,1,1,1,2},{0,1,1,0,1,1,2,0},
{0,1,0,2,1,0,1,1},{0,0,1,0,1,1,2,1}
};

const int high[15] = { 4,1,2,2,3,2,3,2,3,2,3,2,3,2,3 };
int map[28][16];

#define a1  0      //条形
#define a2  1
#define b 2          // 方块

#define c1 3          //L形
#define c2 4
#define c3 5
#define c4 6

#define d1 7          //T形
#define d2 8
#define d3 9
#define d4 10

#define e1 11        //闪电1形
#define e2 12

#define f1 13        //闪电2形
#define f2 14

Tetris::Tetris()        //构造函数, 初始化各个值
{
  point[0] = 0;
  point[1] = 5;
  score = 0;
  top = 25;
}

void Tetris::Turn(int num)        //旋转函数
{
  switch (num)
  {
  case a1: id = a2; break;          //条形互换
  case a2: id = a1; break;

  case b: id = b; break;          //方块无法旋转

  case c1: id = c2; break;          //各种L形互换
  case c2: id = c3; break;
  case c3: id = c4; break;
  case c4: id = c1; break;

  case d1: id = d2; break;          //各种T形互换
  case d2: id = d3; break;
  case d3: id = d4; break;
  case d4: id = d1; break;

  case e1: id = e2; break;          //两种闪电形互换
  case e2: id = e1; break;

  case f1: id = f2; break;
  case f2: id = f1; break;
  }
}

void SetPos(int i, int j)      //控制光标位置, 列, 行
{
  COORD pos = { i,j };
  SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

void Tetris::Pause()        // 暂停函数
{
  SetPos(32, 10);
  cout << "游戏暂停!" << endl;
  SetPos(30, 11);
  cout << "你的分数为 " << score;
  char temp;
  while (1)
  {
    while (1)
    {
      if (_kbhit())
      {
        temp = _getch();
        break;
      }
    }
    if (temp == 32)
      break;
  }
  SetPos(32, 10);          // 清除暂停时显示的信息
  cout << "         ";
  SetPos(30, 11);
  cout << "              ";
}

void Tetris::Updata()          //更新函数
{
  int i, flag;
  int nx, ny;
  for (i = 0; i < 4; i++)
  {
    nx = point[0] + sharp[id][i * 2];
    ny = point[1] + sharp[id][i * 2 + 1];
    SetPos((ny + 1) * 2, nx + 1);
    SetColor(0);
    cout << "■";
    map[nx][ny] = 1;          //界面各个点是否为空的更新
  }

  if (point[0] < top)
    top = point[0];          //最高点的更新

  for (i = point[0]; i < point[0] + high[id]; i++)      //消除行
  {
    flag = 1;
    for (int j = 0; j < 13; j++)          //判定某一行是否满, 用flag来标记
      if (map[i][j] == 0)
        flag = 0;
    if (flag == 1)
    {
      for (int k = i; k >= top; k--)
      {
        for (int p = 0; p < 13; p++)
        {
          map[k][p] = map[k - 1][p];
          SetPos((p + 1) * 2, k + 1);
          if (map[k][p] == 1)
            cout << "■";
          else cout << " ";

        }
      }
      score += 10;
      Input_score();
    }
  }
}

void Tetris::Input_score()
{
  SetColor(3);
  SetPos(30, 19);
  cout << "得分: " << score;
}

void Tetris::Welocme()      //欢迎界面
{
  SetColor(1);
  char x;
  while (1)
  {
    system("cls");
    cout << "■■■■■■■■■■■■■■■■■■■■■" << endl;
    cout << "    俄罗斯方块    " << endl;
    cout << "■■■■■■■■■■■■■■■■■■■■■" << endl;
    cout << "    操作方式:" << endl;
    cout << "    ↑ - 旋转" << endl;
    cout << "    ↓ - 加速下移" << endl;
    cout << "    ← - 左移" << endl;
    cout << "    → - 右移" << endl;
    cout << "    空格 - 暂停" << endl;
    cout << "■■■■■■■■■■■■■■■■■■■■■" << endl;
    cout << "■ 按1—3选择难度■" << endl;
    SetPos(20, 10);
    x = getchar();
    if (x <= '9' && x >= '0')
    {
      rank = x - '0';
      break;
    }
  }
}

void Tetris::SetColor(int color_num)      //设置颜色
{
  int n;
  switch (color_num)
  {
  case 0: n = 0x08; break;
  case 1: n = 0x0C; break;
  case 2: n = 0x0D; break;
  case 3: n = 0x0E; break;
  case 4: n = 0x0A; break;
  }
  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n);
}

void Tetris::DrawMap()        //画游戏时界面
{
  int i;
  SetColor(0);

  for (i = 0; i < 24; i++)    //宽24格
  {
    SetPos(i * 2, 0);
    cout << "■";
    SetPos(i * 2, 26);
    cout << "■";
  }

  for (i = 0; i < 26; i++)    //高26格
  {
    SetPos(0, i);
    cout << "■";
    SetPos(28, i);
    cout << "■";
    SetPos(46, i);
    cout << "■";
  }

  for (i = 14; i < 24; i++)
  {
    SetPos(i * 2, 16);
    cout << "■";
  }

  SetColor(3);
  Input_score();
  SetPos(30, 21);
  cout << "难度等级: " << rank;
  SetPos(32, 2);
  cout << "下一图形";
}

void Tetris::Draw(int x, int y, int num)        //画图形
{
  int nx, ny;

  for (int i = 0; i < 4; i++)
  {
    nx = x + sharp[num][2 * i];
    ny = y + sharp[num][2 * i + 1];
    SetPos((ny + 1) * 2, nx + 1);
    SetColor(i + 1);
    cout << "■";
  }
}

void Tetris::ReDraw(int x, int y, int num)        //为更新图形的位置清除图形
{
  int nx, ny;

  for (int i = 0; i < 4; i++)
  {
    nx = x + sharp[num][2 * i];
    ny = y + sharp[num][2 * i + 1];
    SetPos((ny + 1) * 2, nx + 1);
    cout << " ";
  }
}

bool Tetris::Judge(int x, int y, int num)        //判定在x, y 所指位置是否可画编号为
{                          //num 的图形, 若不可画则反回true
  int nx, ny;
  for (int i = 0; i < 4; i++)
  {
    nx = x + sharp[num][2 * i];
    ny = y + sharp[num][2 * i + 1];
    if (!(nx < 25 && nx >= 0 && ny < 13 && ny >= 0 && !map[nx][ny]))
      return true;
  }
  return false;
}

void Tetris::Run()          //运行游戏
{
  int next_id;
  srand((int)time(0));

  id = rand() % 15;
  next_id = rand() % 15;

  Draw(point[0], point[1], id);
  Draw(5, 16, next_id);

  int count;
  if (rank == 1)
    count = 150;
  else if (rank == 2)
    count = 100;
  else if (rank==3)
    count = 50;
  else
    count = 5;
  int i = 0;  //不同等级对应不同count

  while (1)
  {
    if (!(i < count))        //i 与 count 用于控制时间
    {
      i = 0;
      if (Judge(point[0] + 1, point[1], id))      //在某一位置不能下落的话
      {
        Updata();
        id = next_id;

        ReDraw(5, 16, next_id);
        next_id = rand() % 15;

        point[0] = 0; point[1] = 5;
        Draw(point[0], point[1], id);
        Draw(5, 16, next_id);

        if (Judge(point[0], point[1], id))
        {
          system("cls");
          SetPos(20, 10);
          cout << "游戏结束!" << endl;
          SetPos(20, 11);
          cout << "你的分数为 " << score << endl;
          system("pause");
          exit(1);
        }
      }
      else          //继续下落
      {
        ReDraw(point[0], point[1], id);
        point[0]++;
        Draw(point[0], point[1], id);
      }
    }

    if (_kbhit())        //键盘输入值时
    {
      int key, key2;
      key = _getch();
      if (key == 224)
      {
        key2 = _getch();

        if (key2 == 72)      //按向上方向键时
        {
          int temp = id;
          Turn(id);
          if (Judge(point[0], point[1], id))
            id = temp;
          ReDraw(point[0], point[1], temp);
          Draw(point[0], point[1], id);
        }
        if (key2 == 80)        //按向下方向键时
        {
          if (!Judge(point[0] + 2, point[1], id))
          {
            ReDraw(point[0], point[1], id);
            point[0] += 2;
            Draw(point[0], point[1], id);
          }
        }
        else if (key2 == 75)        //按向左方向键时
        {
          if (!Judge(point[0], point[1] - 1, id))
          {
            ReDraw(point[0], point[1], id);
            point[1]--;
            Draw(point[0], point[1], id);
          }
        }
        else if (key2 == 77)          //按向右方向键时
        {
          if (!Judge(point[0], point[1] + 1, id))
          {
            ReDraw(point[0], point[1], id);
            point[1]++;
            Draw(point[0], point[1], id);
          }
        }
      }
      else if (key == 32)          // 按下空格暂停
        Pause();
    }

    Sleep(1);    //等待1毫秒
    i++;        //控制下落间隔
  }
}

int main()
{
  Tetris game;
  game.Welocme();
  system("cls");        //清除欢迎界面
  game.DrawMap();
  game.Run();
}

生化危机

#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<conio.h>
using namespace std;
int mzhg,zd,swhm,qxs,swx,sn,mp,tongguan,sw1,zd1,sn1,mz1,mp1,zbbj,ccg,mzzd,mz,tongguan1,sw,x,s,cdd,jg,qiang,gun,by,vv,gjj[100],hjj[100],zjj[100];
void Read()
{
    ifstream in("丧尸危机存档.in");
    in>>mzhg>>zd>>swhm>>qxs>>swx>>sn>>mp>>tongguan>>sw1>>zd1>>sn1>>mz1>>mp1>>zbbj>>ccg>>mzzd>>mz>>tongguan1>>sw>>x>>s>>cdd>>jg>>qiang>>gun>>by>>vv;
    for(int i=0;i<=99;i++) in>>gjj[i];
    for(int i=0;i<=99;i++) in>>hjj[i];
    for(int i=0;i<=99;i++) in>>zjj[i];
    in.close();
}
void Save()
{
    ofstream out("丧尸危机存档.in");
    out<<mzhg<<' '<<zd<<' '<<swhm<<' '<<qxs <<' '<<swx<<' '<<sn<<' '<<mp<<' '<<tongguan<<' '<<sw1<<' '<<zd1<<' '<<sn1<<' '<<mz1<<' '<<mp1<<' '<<zbbj<<' '<<ccg<<' '<<mzzd<<' '<<mz<<' '<<tongguan1<<' '<<sw<<' '<<x<<' '<<s<<' '<<cdd<<' '<<jg<<' '<<qiang<<' '<<gun<<' '<<by<<' '<<vv<<'\n';
    for(int i=0;i<=99;i++) out<<' '<<gjj[i];out<<'\n';
    for(int i=0;i<=99;i++) out<<' '<<hjj[i];out<<'\n';
    for(int i=0;i<=99;i++) out<<' '<<zjj[i];out<<'\n';
    out.close();
}
void Slowsay(string a)
{
	int l=a.size();
	for(int i=0;i<l;i++)
	{
		cout<<a[i];
		if(vv==0) Sleep(20);
	}
	printf("\n");
	if(vv==1) Sleep(100);
}
int read()
{
    char ch=_getch();
    while(ch>'9'||ch<'0') ch=_getch();
    return ch-48;
}
void qp()
{
    system("cls");if(swx==2) Slowsay("王,"),zd+=99999,sw+=99999;
    Slowsay("当前你的状态是\n");
    printf("子弹 %d,食物 %d\n",zd,sw);
}
int esl()
{
    system("cls");
    char ch;
    Slowsay("你,饿死了。\n");
    if(vv==0) ch=_getch();
    hjj[1]=1;
    Slowsay("Bad End  1\n");
    ch=_getch();
    s++;
    return 0;
}
int mzd()
{
    hjj[2]=1;
    system("cls");
    char ch;
    Slowsay("你,被丧尸咬死了。\n");
    if(vv==0) ch=_getch();
    Slowsay("Bad End   2\n");
    ch=_getch();
    s++;
    return 0;
}
int hd1()
{
    system("cls");
    Slowsay("在某一天,你家门口响起了敲门声,你打开门,外面的发现让你欣喜若狂\n");
    Slowsay("政府的救援部队已经消灭了这个城市的丧尸,\n他们在这个城市的各个角落搜索着可能存在的幸存者.\n");
    Slowsay("Happy End-----苟到最后\n");Sleep(1000);gjj[1]=1;
    return 0;
}
int hd2()
{
    system("cls");
    int sw;
    char ch;
    Slowsay("在与妹子相处的这些时间里,你与她相爱了\n");
    Slowsay("你们的生活是那样的幸福\n");
    Slowsay("直到有一天......\n");
    Slowsay("基地首领希望你去执行一个任务,你选择\n");
    Slowsay("1.独自一人前往\n");
    Slowsay("2.和妹子一起去\n");
    while(true)
    {
        int x;
        x=read();
        if(x<1||x>2)
        {
            Slowsay("请重新输入\n");
            continue;
        }
        if(x==1)
        {
            Slowsay("当你完成任务回来的时候,发现——\n");
            Slowsay("基地被丧尸攻破了\n");
            Slowsay("这个基地的所有人都被丧尸杀了,一个人都没跑出来\n");
            hjj[4]=1;
            Slowsay("Bad End    4");
            s++;
        }
        if(x==2)
        {
            Slowsay("当你和妹子完成任务回来时,\n");
            Slowsay("基地已经变成一片废墟了\n");
            Slowsay("你和妹子没有办法,只能到处流浪\n");
            Slowsay("不过,两个人总比一个人要好\n");
            gjj[2]=1;
            Slowsay("Happy End------神仙眷侣");
        }
        break;
    }    Sleep(1000);
    return 0;
}
int hd3()
{
    system("cls");
    char ch;
    Slowsay("你就这样平静的生活在这个基地里\n");
    Slowsay("直到某一天,大量的丧尸进攻了这里\n");
    if(zd>9)
    {
        Slowsay("每个人都在尽自己的努力去守卫基地\n");
        Slowsay("每个人都做到了自己能做到的\n");
        Slowsay("最后,奇迹出现了\n");
        Slowsay("大家成功守住了基地\n");
        Slowsay("而你,也因为在守卫过程中立下大功成为了这个基地的英雄\n");
        Slowsay("顺便说一句,到死了你也没女朋友\n");
        gjj[3]=1;
        Slowsay("Happy End-----英雄不朽");
        return 0;
    }
    Slowsay("丧尸的数量实在太多了,\n");
    Slowsay("尽管基地的大家都在尽全力防守\n");
    Slowsay("可基地还是被攻破了\n");
    Slowsay("而你,也死在了这里\n");
    s++;
    hjj[5]=1;
    Slowsay("Bad End     5"); Sleep(1000);
}
int hd4()
{
    system("cls");
    Slowsay("在于少年相处的这些时间里");
    Slowsay("你尽力地保护着他");
    Slowsay("而他也常常给你带来惊喜");
    Slowsay("慢慢的,你开始认清你自己");
    Slowsay("你是个gay");
    Slowsay("于是,你就和少年性福快乐的生活在了一起");
    Slowsay("Happy End-----认清自己");
    gjj[4]=1;  Sleep(1000);
}
int td()
{
    system("cls");
    char ch;
    Slowsay("那箱饼干与你的枪一起发出了强光\n");
    Slowsay("紧接着,他们融为了一体\n");
    Slowsay("当光芒散去时,整个世界都发生了变化\n");
    Slowsay("所有的丧尸都变回了人类\n");
    Slowsay("伟大的勇士!丧尸危机终于解除了!!接下来,是普天同庆的大狂欢!!!\n");
    Slowsay("True End-----拯救世界\n");Sleep(1000);
    Slowsay("???????????????????????????????????");
    Slowsay("......这是怎么回事......");
    Slowsay("......为什么......");
    Slowsay("......不是普通的......");
    Slowsay("......从何而来......");Sleep(1000);
    Slowsay("。 。 。 。 。 。是谁。 。 。 。 。 。");
    Slowsay("你陷入沉思。");
    if(zjj[1]!=1)
    {
        Slowsay("获得线索-----奇特的枪与饼干");
    }
    zjj[1]=1; Sleep(1000);
}
int td2()
{
    system("cls");
    char ch;
    Slowsay("你的变异已经开始了");
    Slowsay("你开始疯狂的进食,直到把自己的胃撑破");
    Slowsay("然后,就眼前一黑失去意识");
    Slowsay("再次醒来时,你已经是一个丧尸了");
    Slowsay("奇怪的是,你还保留着自己的意识");
    Slowsay("你感觉到自己的力气变得更大,速度变得更快");
    Slowsay("或许变成丧尸也不错————你这样想着");
    Slowsay("True End-----认清!·本我");
    if(zjj[2]!=1)
    {
        Sleep(2000);
        Slowsay("获得线索-----延迟变异!·少年");
    }
    zjj[2]=1; Sleep(1000);
}
int bd8()
{
    Slowsay("坐在椅子上的是一个15岁左右的少年");
    Slowsay("正在你因为他的年龄而惊讶时");
    Slowsay("少年却站了起来,看向了你身后的妹子");
    Slowsay("“差不多了吧”,妹子这样说道");
    Slowsay("“可以了”,这是少年的回答");
    Slowsay("然后,你就感到脖子一阵剧痛");Sleep(1000);
    Slowsay("在你失去意识前,妹子一直没有松口。");
    s++;
    Slowsay("Bad End     8");
    if(hjj[8]==0)
    {
        Sleep(2000);
        Slowsay("获得线索-----早已变异!·妹子");
    }
    hjj[8]=1;  Sleep(1000);
}
int td3()
{
    system("cls");
    Slowsay("你和妹子冲出了丧尸的围杀,");
    Slowsay("可是当你们来到那个幸存者基地时");
    Slowsay("却发现那个基地有一些不对");
    Slowsay("所有人都死气沉沉的");
    Slowsay("你们直接走向了首领的房间");Sleep(1000);
    if(zjj[2]==1&&zjj[3]==1)
    {
        bd8();
        return 0;
    }
    Slowsay("换完子弹的你想离开");
    Slowsay("就在你快要离开的时候,妹子抓住了你的手");
    Slowsay("“我喜欢你,别走”,她这样说");
    Slowsay("于是,你留了下来");
    Slowsay("你们的生活是那样的幸福");
    Slowsay("直到有一天......");Sleep(1000);
    Slowsay("基地首领希望你去执行一个任务,\n");
    Slowsay("在执行任务的过程中");
    Slowsay("妹子曾被丧尸咬到过一口");
    Slowsay("她以为你没有发现");
    Slowsay("而你却在远处看到了这一幕");
    Slowsay("奇怪的是,她却并没有变异\n");
    Slowsay("那一刹那你突然想起,");
    Slowsay("你们的房间里,总是弥漫着一股血腥的味道......");Sleep(1000);
    Slowsay("Happy End------神仙眷侣");Sleep(1000);
    Slowsay("???????????????????????????????????");
    Slowsay("True End------认清?·妹子");
    if(zjj[3]==0)
    {
        Sleep(2000);
        Slowsay("获得线索-----不变异?·妹子");
    }
    zjj[3]=1;Sleep(1000);
}
int td4()
{
    system("cls");
    Slowsay("当丧尸危机爆发时,你正呆在家里\n");
    char ch=_getch();
    if(vv==0) ch=_getch();
    system("cls");
    Slowsay("当丧*#******丧尸危机*$*&*^&*机爆发时,**你正呆***&*爆发******#在家里**\n");Sleep(1000);
    Slowsay("***检*#******测到*不**丧尸危**88机*$匹*$**机爆发时,**配***#在家里****\n");Sleep(2000);
    Slowsay("L当****#OG****I危机*$N**E机爆***(RR*8%#404)**发时,**你O*****#在家R里!\n");Sleep(2000);
    system("cls");
    if(vv==0) ch=_getch();
    Slowsay("有什么不对劲");
    Slowsay("你这样想着");
    Slowsay("过去了好多天,\n你还是一个人都没有遇到,\n除了丧尸就是丧尸");
    Slowsay("为什么他们......不见了?");
    Slowsay("\n");
    Slowsay("True End------验证失败");
    zjj[4]=1;
    if(zbbj==0)
        Slowsay("进阶线索-----乱码,废弃与失联"),zbbj=1;Sleep(1000);
}
int td5()
{
    system("cls");
    Slowsay("当少年死去后,整个世界好像变得不同了");
    Slowsay("所有的活人在一瞬间消失");
    Slowsay("所有的丧尸当场去世");
    Slowsay("你的眼前只剩下了黑暗");
    Slowsay("不知道过去了多久,你死了");
    Slowsay("Bad End......");Sleep(1000);
    Slowsay("不,还没有结束");
    Slowsay("虽然好像和往常死去之后的感觉一样");
    Slowsay("但是。。。好像。。。");Sleep(1000);
    Slowsay("有延迟?。。。");
    Slowsay("。。。在这段时间里,你的思考一直没停。。。");
    Slowsay("True End-----死亡姗姗来迟");
    s++;
    if(zjj[5]==0)
        Slowsay("进阶线索-----少年之死");
    zjj[5]=1;   Sleep(1000);
}
int tg3()
{
    Slowsay("当你再次睁开眼时");
    Slowsay("你发现自己躺在一个营养仓内");
    Slowsay("你无比的确认这就是真实的世界");
    Slowsay("脑中的一切开始明晰起来");
    Slowsay("你认为自己知道了一切的真相");
    Slowsay("去杀光人类吧!!!!");
    Slowsay("你这样想着");
    Slowsay("在身着白大褂的丧尸们的欢呼声中");
    Slowsay("你打碎了玻璃,跑出了营养仓");
    Slowsay("来到了外面这个被战争破坏得满目疮痍的世界");
    Slowsay("战火硝烟,炮声隆隆");
    Slowsay("你熟练的发出嘶吼,呼唤着周围的丧尸");
    Slowsay("你指挥着他们,毁掉了一个又一个人类的基地");
    Slowsay("最后,在这场世纪战争中,丧尸们艰难地取得了胜利");
    Slowsay("作为它们的英雄,你自豪的统治着世界。");
    Slowsay("虽然,其实,在那些你不知道的地方");
    Slowsay("一个个一样的营养仓中,装着一个个一样的你。");
    Slowsay("---------------游戏终极剧情通关-------------");
    tongguan1=2; Save(); Sleep(1000);
}
int tg2()
{
    Slowsay("当你再次睁开眼时");
    Slowsay("你发现自己躺在一个营养仓内");
    Slowsay("你无比的确认这就是真实的世界");
    Slowsay("可是你却发现自己没法操纵身体");
    Slowsay("隔着玻璃,一个黑色的身影正在操作着");
    Slowsay("你清晰的看见那个人的大脑裸露出来,与你的接在一起");
    Slowsay("这时,又有一大波记忆涌入脑海。");
    Slowsay("“少年与妹子......是以“成功者”“英雄”“神话传说”为原型创造的人物......”");
    Slowsay("“游戏中的情节与场景......取材于现实世界真实案例......”");
    Slowsay("再往后,你的脑中一片混乱。");
    Slowsay("“...舍弃.........熟练..我....智慧..学习........获得.....”");
    Slowsay("“.....种族...探索.......杀...进化.........帮助..需要.....”");
    Slowsay("“...成熟....兵器.....无敌..下风.......战争...伟大.....英雄.....”");
    Slowsay("激昂的声音一直回荡着。");
    Slowsay("---------------游戏进阶剧情通关-------------");
    tongguan1=1; Sleep(1000);
}
int td6()
{
    Slowsay("一天以后,少年回来了");
    Slowsay("一起回来的还有妹子");
    Slowsay("“找到了......”");
    Slowsay("少年的手中拿着一个破损的铭牌");
    Slowsay("铭牌上的字迹很诡异,但写着熟悉的内容:");
    Slowsay("【22-08-03...】");
    Slowsay("“你的......”");
    Slowsay("妹子神色复杂的看了你一眼");
    Slowsay("“我们是一类人......”");
    Slowsay("“现在,让我把你带出去吧。”");
    if(qxs==1&&swx==0)
    {
        tg2();
        return 0;
    }
    else
    {
        Slowsay("一股强烈的撕扯感出现到了你身上");
        if(swx==1) Slowsay("此时的你,是如此渴望着死亡与结局\n你大笑着张开双臂,迎接了死亡。");
        else Slowsay("此时的你并不能接受如此巨大的伤害"),Slowsay("你死了。");
        Slowsay("Bad End      14");
        if(hjj[14]==0)
            Slowsay("进阶线索-----外面的世界");
        hjj[14]=1;
        s++;
    }Sleep(1000);
}

int bd6()
{
    system("cls");
    Slowsay("你感觉到自己正在变异,");
    Slowsay("意识开始逐渐模糊起来");
    Slowsay("你的肚子正无比渴望着食物,你啃噬着触及的一切!");
    Slowsay("但是不够,你的身躯饿得干枯,你甚至开始食用自己的躯体!");
    Slowsay("接着,你眼前一黑,再也没有醒来......");
    s++;
    hjj[6]=1;
    Slowsay("Bad End      6");Sleep(1000);
}

int bd3()
{
    system("cls");
    char ch;
    Slowsay("长久的等待终于让你失去了理智,你疯了。\n");
    Slowsay("Bad End   3\n");
    hjj[3]=1;
	Sleep(1000);
    if(mp==-1)
    {
        Slowsay("当政府的救援队打开你家的门时,你嘶吼着扑了上去");
        if(zd>0)
            Slowsay("他们试图将你击毙,却被你提前一枪击倒");
        else
        {
            Slowsay("你被他们击毙了");
            Slowsay("Bad End       12");
            s++;
            hjj[12]=1;
            return 0;
        }
        Slowsay("你如同一个熟练的猎手,狩猎着救援队");
        Slowsay("当他们全部死去后,你开始享用起你的大餐");
        Slowsay("Bad End           13");
        if(by==0)
            Sleep(2000),Slowsay("进阶线索-----早已变异!·本我"),by=1;
        hjj[13]=1;
        return 0;
    }
    s++;
}
int bd7()
{
    s++;
    system("cls");
    Slowsay("你,被狗咬死了");
    Slowsay("Bad End      7");
    hjj[7]=1;Sleep(1000);
}

int bd15()
{
    s++;
    Slowsay("你发现这笔迹有些不对");
    Slowsay("就好像是新写上去的一样");
    Slowsay("认字迹的话,好像还十分熟悉");  Sleep(1000);
    Slowsay("正当你想的入迷的时候,你的脖子被咬住了");
    Slowsay("在死前,你隐约听到了少年的声音,“Again.”");
    Slowsay("Bad End     15");
    if(hjj[15]==0)
    {
        Sleep(2000);
        Slowsay("进阶线索-----伪造......");
    }
    hjj[15]=1; Sleep(1000);
}
int tgg3()
{
    system("cls");
    Slowsay("你杀掉了少年,并吃掉了他的尸体");
    Slowsay("世界开始崩塌");
    tg3(); Sleep(1000);
}
int bd9()
{
    s++;
    system("cls");
    Slowsay("诡异的是,当你杀光了跟来的丧尸后,发现地下室里并没有丧尸");
    Slowsay("这里有的,只是一个穿着白大褂的尸体");
    Slowsay("在尸体的衣服口袋中,你找到了一个笔记本");
    Slowsay("****(无法辨认)1号****进展*****永生**");
    Slowsay("今********,*号诞生了,他比其*****更*");
    Slowsay("有些不对,*****的发育*****太快***");
    Slowsay("2号的**被***出有*****强感染性*****");
    Slowsay("**********************************");
    Slowsay("***瓶颈,或许我们**应该****活体样本");
    Slowsay("**,**样本*****失去活性,*****但**在动\n");
    if(mp==-1)
    {
        bd15();
        return 0;
    }
    Slowsay("正当你看的入迷的时候,你的脖子被咬住了");
    Slowsay("在死前,你隐约听到了少年的声音,“Again.”");
    Slowsay("Bad End     9");
    if(hjj[9]==0)
    {
        Sleep(2000);
        Slowsay("获得线索-----实验体·1号和2号");
    }
    hjj[9]=1;Sleep(1000);
}

int tg()
{
    system("cls");
    Slowsay("不知为何,当你走到这里时,感到世界在一瞬间发生了变化");
    Slowsay("你不知道这个变化发生在那里,你只知道,现在的世界十分违和");
    Slowsay("或许,这个世界不是真实的");
    Slowsay("当你的脑中出现了这个的时候,你眼前的世界,蹦塌了");
    Slowsay("于此同时,大量记忆冲进了你的脑海");
    Slowsay("不,它们只是回来了,这本身就是你的记忆");
    Slowsay("他们在一开始被一些虚假的记忆所替换");
    Slowsay("从记忆中,你得知你此时正在玩一个vr游戏");
    Slowsay("少年与妹子则是游戏的npc");
    Slowsay("这款游戏号称有着超强的代入感");
    Slowsay("你在发售当天就买来玩了");
    Slowsay("“这游戏真是了不起啊”,你这样想着,“再玩一次吧”");
    Slowsay("...是啊,没错,这一切只是游戏,游戏。............");Sleep(1000);
    Slowsay("躺在仓中的你,自始至终,都没有睁开眼。");
    Slowsay("---------------游戏基础剧情通关-------------");
    cdd=0;
    tongguan=1;Sleep(1000);
}
int cg()
{
    system("cls");
    Slowsay("你感觉到违和感在不断加深");
    Slowsay("世界好像不再是真实的");
    Slowsay("你现在脑中只有一种想法\n");Sleep(1000);
    Slowsay("活下去!越久越好!!!"); Sleep(1000);
}
int cg2()
{
    system("cls");
    system("Color C");
    Slowsay("违和感在此时已经聚集到了顶峰\n");
    Slowsay("你的脑中想清楚了一切\n");
    Slowsay("1.那么,下一步是  杀光他们\n");
    Slowsay("2.那么,下一步是  团结起来\n");
    x=read();
    if(x==1)
        Slowsay("已立起尸王线flag,接下来,去打通全 15 badend!"),swx=1,qxs=1;
    else
        Slowsay("“看来你还是没懂啊......”背后传来冷冷的声音\n\n“ A  G  A  I  N   . ”");
    system("Color F");Sleep(1000);
}
int Swx()
{
    system("cls");
    Slowsay("哈。。。哈。。。哈。。。。。。");
    Slowsay("我。。。已经完成了。。。");
    Slowsay("所有的死法。。。我都体验了一遍了。。。");
    Slowsay("我。。。一直是只丧尸吧。。。");
    Slowsay("无论被打倒多少次。。。我都会站起来继续。。。");
    Slowsay("只要是我想通的结局。。。我便一定会通掉它。。。");
    Slowsay("只要是我想杀的人。。。我便一定会杀死他。。。");
    Slowsay("只要是我想知道的真相。。。我便一定会知晓它。");
    Slowsay("我。。。已经不是以前的那个懦弱无能的我了。。。");
    Slowsay("这一轮。。。我。。。要成为王!!!\n");
    Slowsay("在实验室中,为首者发出低哑的嘶吼:");
    Slowsay("所有人员一级戒备!实验,进入最后阶段!!");
    Slowsay("------------终极剧情-尸王线开启!------------");cdd=0;
}
int bd10()
{
    system("cls");
    Slowsay("你发现了另一个基地");
    Slowsay("弹尽粮绝的你选择加入了他们");
    Slowsay("之后的每一天都十分单调");
    Slowsay("外出寻找物资,然后天黑了回家睡觉");
    Slowsay("应该是这样吗?");
    Slowsay("也许吧");
    Slowsay("Bad End     10");
    hjj[10]=1; Sleep(1000);
}
int hd5()
{
    Slowsay("没关系的,一切都会过去的");
    Slowsay("你这样说的");
    Slowsay("他似乎感觉到了你的善意,一点一点向你靠近");
    Slowsay("你紧紧的抱住了他");
    Slowsay("我会保护好你的");
	Sleep(1000);
    Slowsay("Happy End-----跨越物种的gay~");
	Sleep(1000);
}
int sswj()
{
	Save();
    system("cls");
    int w=0;
    mp=0;
    if(tongguan==1&&zjj[4]==0)
    {
        Slowsay("检测到你已通关,是否领取特殊物品\n");
        Slowsay("1.领取");
        Slowsay("2.不领取");
        while(true)
        {
            x=read();
            if(x==1)
                mp=-1;
            if(x==2)
            {
                td4();
                return 0;
            }
            break;
        }
    }
    else if(tongguan==1)
    {
        Slowsay("检测到你已通关,已领取特殊物品\n");mp=-1;
    }
    char ch;
    if(cdd==1)
    {
        Slowsay("是否读取存档\n");
        Slowsay("1.读取\n");
        Slowsay("2.不读取\n");
        x=read();
        if(x==1)
        {
            sw=sw1;
            zd=zd1;
            sn=sn1;
            mz=mz1;
            mp=mp1;
            goto cddd1;
        }
    }
    system("cls");
    Slowsay("当丧尸危机爆发时,你正呆在家里\n");if(vv==0) ch=_getch();
    Slowsay("你有10点物资可以分配到子弹和食物上");
    if(swx==2) Slowsay("...\n\n但是!不!我已经不会再惧怕食物短缺与丧尸小兵了!\n\n我,应当是世界的王!!\n"),zd=99999,sw=99999;
    else{if(vv==0) ch=_getch();
    int x,y;
    qiang=0;gun=0;zd=0;sw=0;mz=0;mzzd=0;sn=0;mzhg=0;
    Slowsay("\n请输入你的选择(此次输入需键入回车,例:5 5 )\n");
    while(true)
    {
        scanf("%d%d",&x,&y);
        zd=x;sw=y;
        if(x+y!=10||x<0||y<0)
        {
            if(x==666666&&y==5201314)
            {
                Slowsay("启用秘籍\n");
                Slowsay("请输入你真正需要的子弹数和食物数(上限:999 )\n");
		        scanf("%d%d",&x,&y);
		        zd=min(x,999);sw=min(y,999);
                break;
            }
            Slowsay("请重新输入\n");
            w++;
            if(w>5)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                Slowsay("行了行了,这只是第一个选择而已\n"),
                Slowsay("有必要这么皮吗\n"),
                Slowsay("自动分配食物3个子弹7个\n");
                if(vv==0) ch=_getch();
                sw=3,zd=7;
                break;
            }
        }
        else break;
    }
    }
    Slowsay("你的家里是个较为安全的地方,你可以选择搜索你家的物资或是去邻居家看看\n");
    if(vv==0) ch=_getch();
    Slowsay("1.留在家中\n");
    Slowsay("2.前往邻居家\n");
    while(true)
    {
        x=read();
        if(x!=1&&x!=2)
            Slowsay("请重新输入\n");
        else
            if(x==1)
            {
				if(swx==2) {Slowsay("饿啊!为什么我还呆在家里!!");break;}
	            else {
	                Slowsay("在二楼,你发现了一些食物食物+3\n");
	                if(vv==0) ch=_getch();
	                Slowsay("在家里过了一夜,食物-1\n");
	                sw=sw+2;
	                break;
	            }
			}
            else
            {
				if(swx==2) {Slowsay("可恶!为什么邻居家里没有人!!");break;}
	            else {
	                Slowsay("在前往邻居家的路上,你遇到了丧尸\n");
	                if(vv==0) ch=_getch();
	                if(zd<1)
	                {
	                    Slowsay("你朝他开了一枪,不过枪里没有子弹,你被他咬死了\n");
	                    if(vv==0) ch=_getch();
	                    hjj[11]=1;
	                    Slowsay("Bad End      11\n");
	                    s++;
	                    if(vv==0) ch=_getch();
	                    Slowsay("另外在说一句,一个子弹都不带,还到处乱浪,你是真的作");
	                    return 0;
	                }
	                else
	                {
	                    Slowsay("你用你手中的枪结束了他的生命,子弹-1\n");
	                    zd=zd-1;
	                    if(vv==0) ch=_getch();
	                    Slowsay("邻居家里不知为何并没有人,你在仔细搜索后发现了一个弹夹,里面有4发子弹\n");
	                    zd+=4;
	                    if(vv==0) ch=_getch();
	                    Slowsay("在邻居家过了一夜后,食物-2\n");
	                    sw=sw-2;
	                    if(sw<0)
	                    {
	                        esl();
	                        return 0;
	                    }
	                }
	                break;
	            }
			}
    }
    if(vv==0) ch=_getch();
    qp();
    Slowsay("你回想起这附近有一座商场,你决定\n");
    if(vv==0) ch=_getch();
    Slowsay("1.前往商场\n");
    Slowsay("2.到处乱走\n");
    Slowsay("3.留在屋子里\n");
    while(true)
    {
        x=read();
        if(x!=1&&x!=2&&x!=3)
        {
            Slowsay("请重新输入\n");
            continue;
        }
        if(swx==2&&x==1) {system("cls"),Slowsay("你循着残存的记忆前往商场,找到了适合你膨胀体型的衣服,可以继续隐藏下去。\n\n"),mz=1;break;}
        else if(swx==2&&x==2) {system("cls"),Slowsay("你到处乱走,见人即杀,丧尸与人类的血混合着溅满了街道,\n惨叫连连,火光接天,如同末世一般。\n你站在尸山上狂笑,不屑于看那些渺小的灵魂。\n\n然而,你丝毫没有注意,一个娇小的身影远远的看到了你,捂着嘴逃之夭夭。\n\n"),mz=10086;break;}
        else if(swx==2&&x==3) {system("cls");Slowsay("你如一名老练的猎手忍耐着饥饿,终于等来了敲门声。\n你得意洋洋的屠杀着这送上门来的大餐\n并跟踪着逃兵进入了幸存者基地。\n那一天,残阳似血,为浸染大地的红再镶上一道道金光。\n\n");Sleep(1000);return 0;}
        else if(x==3)
        {
            if(sw<2)
            {
                esl();
                return 0;
            }
            Slowsay("无聊正在逐渐消磨你的意志,但你还是坚持了下来。食物-2\n");
            sw=sw-2;
            if(vv==0) ch=_getch();
            Slowsay("之后的每一天你都是这样,独自一人在家中等待救援\n");
            if(vv==0) ch=_getch();
            Slowsay("在过了好久之后\n");cout<<mp;
            if(sw<6)
            {
                esl();
                return 0;
            }
            x=rand()%2;
            if(x==1&&mp==0) {hd1();return 0; }
            else {bd3();return 0;}
        }
        else if(x==2)
        {
            int xx=rand()%3;
            if(xx!=0)
            {
                Slowsay("在到处乱走的过程中,你遇到了来自世界各地的丧尸,子弹-2\n");
                if(zd<2)
                {
                    mzd();
                    return 0;
                }
                zd=zd-2;
            }
            else
            {
                Slowsay("在到处乱走的过程中,你走入了一处曾为战场的废墟\n");
                if(vv==0) ch=_getch();
                Slowsay("你循着硝烟味,终于找到了军队残留的弹药箱,子弹+6\n");
                zd+=6;
            }
            break;
        }
        else if(x==1)
        {
            if(zd<4)
            {
                mzd();
                return 0;
            }
            Slowsay("在前往商场的过程中,你遇到了丧尸,子弹-4\n");
            zd=zd-4;
            if(vv==0) ch=_getch();
            Slowsay("你在商场发现了食物与子弹,食物+3,子弹+2\n");
            sw=sw+3;zd=zd+2;
            break;
        }
    }
    if(mz!=10086)
    {Slowsay("你在回家的路上发现了一个女幸存者\n");
    if(vv==0) ch=_getch();
    Slowsay("她试图向你讨要食物,你的选择是\n");
    Slowsay("1.不给\n");
    Slowsay("2.给她2份食物\n");
    Slowsay("3.给她2份子弹\n");
    Slowsay("4.给她一枪\n");
    while(true)
    {
        x=read();
        if(x<1||x>4)
        {
            Slowsay("请重新输入。\n");
            continue;
        }
        if(x==1)
        {
            Slowsay("妹子生气的走了。\n");
            if(vv==0) ch=_getch();
        }
        if(x==2)
        {
            if(sw<2)
            {
                Slowsay("食物不足\n");
                continue;
            }
            sw=sw-2;
            mzhg++;
            Slowsay("你的食物-2,妹子好感度+1\n");
            if(vv==0) ch=_getch();
        }
        if(x==3)
        {
            if(zd<2)
            {
                Slowsay("子弹不足\n");
                continue;
            }
            mzzd=1;
            Slowsay("你给了妹子两份子弹,妹子离开了\n"),zd=zd-2;
            if(vv==0) ch=_getch();
        }
        if(x==4)
        {
            if(zd<1)
            {
                Slowsay("子弹不足\n");
                continue;
            }
            zd=zd-1;
            Slowsay("你一枪杀死了妹子,并从她的尸体上找到了4份食物\n");
            sw=sw+4;
            mzhg=-1;
            if(swx==2) Slowsay("你吃掉了妹子的尸体,真是人间佳肴!\n"),mzhg=-10086;
        }
        if(swx==2&&x!=4) Slowsay("你看着妹子的背影在心中狂笑\n"),mzhg=10086;
        break;
    }}
    Slowsay("又过了一夜,你的食物-2\n");
    if(vv==0) ch=_getch();
    qp();
    sw=sw-2;
    if(sw<0)
    {
        esl();
        return 0;
    }
    if(mzhg==1) Slowsay("那个妹子又来找到了你,并邀请你加入他们的幸存者基地\n");
    else Slowsay("你在附近发现了一个幸存者基地\n");
    if(swx!=2){
    Slowsay("在前往基地的途中,你遇到了丧尸\n");
    Slowsay("你且战且退,大量丧尸把你逼进了一家商店\n");
    Slowsay("门口的丧尸越来越多,你选择\n");
    Slowsay("1.杀出去\n");
    Slowsay("2.守在这\n");
    while(true)
    {
        x=read();
        if(x<1||x>2)
        {
            Slowsay("请重新输入\n");
            continue;
        }
        if(x==1)
        {
            int res=0;
            if(mzhg>0)
                res=1;
            else res=3;
            if(zd<res)
            {
                mzd();
                return 0;
            }
            zd=zd-res;
            printf("你消耗了一些子弹冲了出去,子弹-%d\n",res);
            if(mzzd==1&&mp==-1)
            {
                Slowsay("妹子在她杀死的丧尸的尸体上找到了许多物资,子弹+7,食物+3\n");
                zd=zd+7;sw=sw+3;
                mz=1;
                break;
            }
            x=rand()%5;
            if(res==1&&x!=3)
                Slowsay("妹子为了帮你突围,被丧尸咬到,然后自杀了。\n"),mzhg=-1;
            if(x==3&&res==1)
            {
                td3();
                return 0;
            }
        }
        else
        if(x==2)
        {
            if(zd<5)
            {
                mzd();
                return 0;
            }
            zd=zd-5;
            Slowsay("你守在这家商店里直到杀死了所有找来的丧尸,子弹-5\n");
            if(mzhg==1)
            {
                Slowsay("妹子在商店中发现了一把无限子弹的枪,子弹+10086\n");
                zd+=10086;
                if(vv==0) ch=_getch();
                Slowsay("但是妹子在翻找货架的时候被沾了丧尸血的货架划伤\n");
                Slowsay("妹子自杀了\n");
                mzhg=-1;
            }
        }
        break;
    }}
    if(vv==0) ch=_getch();
    qp();
    Slowsay("你来到了这个幸存者基地\n");
    if(mz==10086) {system("cls");Slowsay("人们在一位年轻首领的带领下顽强的与你战斗\n每个人都在尽自己的努力去守卫基地\n哪怕战友们一个个倒下\n哪怕首领被你愤怒的捏爆脑袋\n没有一个人放弃战斗,没有一个人抛弃希望\n\n最后,奇迹出现了\n\n在基地的废墟中,你的尸体沉重的倒下。\n\n");s++;Sleep(1000);return 0;}
    Slowsay("这个基地的首领表示可以用子弹交换你手中的食物\n");
    printf("你还有%d份食物,%d份子弹\n",sw,zd);
    if(vv==0) ch=_getch();
    Slowsay("请输入你需要的子弹数(0-9)\n");
    while(true)
    {
        x=read();
        if(x<0||x>sw)
        {
            Slowsay("请重新输入\n");
            continue;
        }
        sw=sw-x;
        zd=zd+x;
        if(x>=1)
        {
            Slowsay("首领很开心你能提供稀缺的食物,多给了你1份子弹\n");
            zd=zd+2;
        }
        break;
    }
    if(vv==0) ch=_getch();
    qp();
    Slowsay("又过了一天,食物-2");
    sw=sw-2;
    if(sw<0)
    {
        esl();
        return 0;
    }
    if(vv==0) ch=_getch();
    system("cls");
    Slowsay("基地首领希望你加入这个基地\n");
    Sleep(500);
    Slowsay("你的选择是\n");
    Sleep(500);
    system("Color C");
    Slowsay("1.留在这");
    Slowsay("2.离开");
    while(true)
    {
        x=read();
        if(x<1||x>2)
        {
            Slowsay("请重新输入\n");
            continue;
        }
        system("Color F");
        if(swx==2&&x==1){system("cls");Slowsay("在一个月黑风高的夜里,你终于忍不住袭击了营地。\n年轻首领被你梦中封喉。\n人们顽强的与你战斗\n每个人都在尽自己的努力去守卫基地\n没有一个人放弃战斗,没有一个人抛弃希望\n但是他们失败了。\n在基地的废墟中,英雄们的尸体沉重的倒下。\n\n而你狂笑着吞噬着一切。\n\n");Sleep(1000);return 0;}
        else if(x==1)
        {
            if(mzhg>-1) hd2();
            else hd3();
            return 0;
        }
        else if(x==2)
        {
            Slowsay("你决定\n");
            Slowsay("1.当天离开\n");
            Slowsay("2.再停留一天\n");
            while(true)
            {
                x=read();
                if(x<1||x>2)
                {
                    Slowsay("请重新输入\n");
                    continue;
                }
                if(x==1) break;
                if(x==2)
                {
                      if(vv==0) ch=_getch();
                     qp();
                    Slowsay("这个基地的首领表示可以用子弹交换你手中的食物\n");
                    printf("你还有%d份食物,%d份子弹\n",sw,zd);
                    if(vv==0) ch=_getch();
                    Slowsay("请输入你需要的子弹数\n");
                    while(true)
                    {
                        x=read();
                        if(x<0||x>sw)
                        {
                            Slowsay("请重新输入\n");
                            continue;
                        }
                        sw=sw-x;
                        zd=zd+x;
                        if(x>=3)
                        {
                            Slowsay("首领很开心你能提供稀缺的食物,多给了你3份子弹\n");
                            zd=zd+3;
                        }
                        break;
                    }
                    sw=sw-2;
                    if(sw<0)
                    {
                        esl();
                        return 0;
                    }
                    Slowsay("又过了一夜,食物-2\n");
                }
                break;
            }
            Slowsay("在你离开的时候,一个少年跑了过来。\n");
            Slowsay("他说,他想要和你一起走\n");
            Slowsay("1.带上他\n");
            Slowsay("2.不带他\n");
            while(true)
            {
                x=read();
                if(x<1||x>2)
                {
                    Slowsay("请重新输入\n");
                    continue;
                }
                if(x==2)
                {
                    Slowsay("少年生气的离开了");
                    if(swx!=2) Slowsay(",当他走远了,你才发现\n\n在刚刚的接触中,他偷走了你所有的子弹\n");
                    else Slowsay("\n当你走远后,你才发现,少年一直冷笑着跟在你的身后\n"),sn=1;
                    zd=0;
                }
                if(x==1)
                {
                    Slowsay("你选择上少年一起走\n");
                    Slowsay("少年将他身上带着的一份食物交给了你\n");
                    sw=sw+1;
                    Slowsay("食物消耗+1,少年入队\n");
                    sn=1;
                }
                break;
            }
        }
        break;
    }
    if(vv==0) ch=_getch();
    qp();
    printf("你在路边的一座没人的房子里过了一夜,食物-%d\n",2+sn);
    sw=sw-2-sn;
    if(vv==0) ch=_getch();
    if(sn==1&&swx==2)
    {
        Slowsay("\n1.杀了少年,这时没人可以阻止你!\n");
        Slowsay("2.我决定在少年面前一直隐瞒到底\n");
        x=read();
        if(x==1){Slowsay("少年不见了,难道他发现了......\n\n你一回头,少年咯咯笑着咬住你的脖子\n\n你应该等我虚弱时再下手啊.....\n\n");s++;return 0;}
    }
    if(sw<0)
    {
        esl();
        return 0;
    }
    Slowsay("是否存档?\n");
    Slowsay("1.存档(记录当前进度,只能有一个存档)\n");
    Slowsay("2.不存\n");
    x=read();
    if(x==1)
    {
        cdd=1;
        sw1=sw;
        zd1=zd;
        mp1=mp;
        mz1=mz;
        sn1=sn;
        Slowsay("存档成功");
    }
cddd1:
    qp();
    if(sn==1)
    {
        vv=0;
        Slowsay("今天一早你就被少年叫醒了,\n");
        if(vv==0) ch=_getch();
        Slowsay("他在床底下发现了一箱方便面,食物+8\n");
        sw=sw+8;
        Slowsay("少年向你讨要武器,你决定\n");
        Slowsay("1.把枪给他\n");
        Slowsay("2.把捡到的水管给他\n");
        Slowsay("3.什么都不给他\n");
        while(true)
        {
            x=read();
            if(x<1||x>3)
            {
                Slowsay("请重新输入\n");
                continue;
            }
            if(x==1) gun=0,qiang=2;
            if(x==2) gun=2,qiang=1;
            if(x==3) gun=0,qiang=1;
            break;
        }
    }
    else
    {
        Slowsay("你在冰箱里发现了几包巧克力\n");
        if(vv==0) ch=_getch();
        Slowsay("希望它们还没过期吧,食物+3\n");
        sw=sw+3;
    }
    if(vv==0) ch=_getch();
    Slowsay("今天你们来到了一家大商场\n");
    Slowsay("你决定\n");
    Slowsay("1.独自探索1楼\n");
    Slowsay("2.独自探索2楼\n");
    if(sn==1)
    {
        Slowsay("3.和少年一起探索2楼");
    }
    while(true)
    {
        x=read();
        if(x<1||x>3)
        {
            Slowsay("请重新输入\n");
            continue;
        }
        if(x==1)
        {
            Slowsay("你在一楼发现了一些子弹,子弹+3\n");
            zd=zd+3;
            Slowsay("奇怪的是,一只丧尸都没有看到\n");
            if(vv==0) ch=_getch();
            if(sn>0)
            {
                if(qiang==2)
                {
                    Slowsay("当你来到二楼时,发现了一地尸体\n");
                    Slowsay("少年就倒在这尸体中间,他死前手还紧紧握着枪\n");
                    Slowsay("你把枪拿了回来,并在少年的尸体下面发现了一箱压缩饼干\n");
                    Slowsay("食物+10086\n");
                    if(vv==0) ch=_getch();
                    sw=10086;
                    if(sw>10000&&zd>9000)
                    {
                        td();
                        return 0;
                    }
                    sn=0;
                    qiang=1;
                }
                else
                {
                    Slowsay("当你来到二楼时,发现了少年的尸体\n");
                    if(vv==0) ch=_getch();sn=0;
                    Slowsay("你紧紧握着手中的枪,猛地一回头\n");
                    Slowsay("四周大量的丧尸向你涌来\n");
                    if(vv==0) ch=_getch();
                    zd=zd-5;
                    if(zd<0)
                    {
                        mzd();
                        return 0;
                    }
                    Slowsay("你杀光了这些丧尸,子弹-5\n");
                    if(vv==0) ch=_getch();
                    Slowsay("你在二楼找到了食物,食物+3\n");
                    sw+=3;
                }
            }
        }
        if(x==2)
        {
            Slowsay("你来到了二楼,数之不尽的丧尸忽然从阴影中窜出\n");
            if(qiang==2)
            {
            Slowsay("尽管你没了枪也尽力抵抗,可丧尸的数量实在太多。\n");
                mzd();
                return 0;
            }
            if(vv==0) ch=_getch();
            zd-=5;
            if(zd<0)
            {
            	Slowsay("尽管你尽力抵抗,可丧尸的数量实在太多。\n");
                mzd();
                return 0;
            }
            Slowsay("你杀光了这些丧尸,子弹-5\n");
            if(vv==0) ch=_getch();
            Slowsay("你在二楼找到了食物,食物+3\n");
            sw+=3;
            if(sn==1)
            {
                Slowsay("少年在一楼找到了子弹,子弹+3\n");
                zd=zd+3;
            }
        }
        if(x==3&&sn==1)
        {
            system("cls");
            Slowsay("你们来到了二楼\n");
            if(vv==0) ch=_getch();
            system("Color C");
            Slowsay("数之不尽的丧尸从阴影中窜出");
            Slowsay("尽管你们尽力抵抗,可丧尸的数量实在太多。");
            if(gun!=2&&qiang!=2)
            {
                Slowsay("没有武器的少年被当场咬死。");
                if(mp==-1&&mz==0)
                {
                    td5();
                    return 0;
                }
                sn=0;
            }
            Slowsay("其中一只丧尸趁你不注意冲到了你的旁边");
            if(gun==2) Slowsay("就在你要被咬死的时候,少年扔出了手中的水管\n,救下了你");
            else if(qiang!=2)
            {
                zd=zd-3;
                if(zd<0)
                {
                    mzd();
                    return 0;
                }
                Slowsay("你赶忙回头几枪补掉了这只丧尸,子弹-3");
            }
            zd=zd-3;
            if(qiang==2||zd<0)
            {
                system("Color F");
                mzd();
                return 0;
            }
            system("Color F");
            Slowsay("经过了一番苦战,你们终于战胜了所有丧尸,子弹-3");
            if(vv==0) ch=_getch();
        }
        break;
    }
    if(vv==0) ch=_getch();
    qp();
    if(vv==0) ch=_getch();
    printf("又过了一夜,食物-%d\n",sn+2);
    sw=sw-2-sn;
    if(sw<0)
    {
        esl();
        return 0;
    }
    qp();
    Slowsay("今天在出门的时候\n");
    Slowsay("你遇到了一条流浪狗\n");
    Slowsay("1.用枪打死它\n");
    Slowsay("2.用食物打发它\n");
    while(true)
    {
        x=read();
        if(x<1||x>2)
        {
            Slowsay("请重新输入\n");
            continue;
        }
        if(x==1)
        {
            zd=zd-1;
            if(zd<0)
            {
                bd7();
                return 0;
            }
            Slowsay("你一枪打死了这条狗,子弹-1\n");
            if(sn==0) break;
            Slowsay("在打死了狗之后,你忽然发现少年的脸色不太好\n");
            if(vv==0) ch=_getch();
            Slowsay("原来,在昨天的商场中,少年早就被咬了一口");
            Slowsay("他一直瞒着你,不敢说出来");
            Slowsay("此时,他闻到了血腥味,看到了尸体,已经忍不住,濒临变异了!!");
            Slowsay("你决定\n");
            Slowsay("1.杀了他\n");
            Slowsay("2.不杀他\n");int a3=0;
            if(gjj[4]==1&&zd<4)
            {
                Slowsay("3.安抚他\n");a3=1;
            }
            while(1)
            {
                x=read();
                if(x<1||x>3||(x==3&&a3==0))
                {
                    Slowsay("请重新输入\n");
                    continue;
                }
                if(x==1)
                {
                    if(swx==2)
                    {
                        if(mzhg<-1000) tgg3();
                        else Slowsay("\n“杀我还早的很呢......”\n\n少年咯咯笑着挡下了你所有的攻击\n\n“因为你还不是一个优秀的丧尸......”"),Sleep(1000),mzd();
                        return 0;
                    }
                    if(vv==0) ch=_getch();
                    if(mp==-1&&mz==0)
                    {
                        Slowsay("奇怪的是,你直接秒掉了他。\n");Sleep(1000);
                        sn=0;
                        td5();
                        return 0;
                    }
                    else if(mp==-1&&mz!=0)
                    {
                        Slowsay("突然,妹子出现了。\n");
                        Slowsay("“放着我来!”,妹子与少年搏斗起来,妹子的力气极大,竟然真的压制住了少年!\n");
                        Slowsay("在你的惊恐目光下,少年的皮肤渐渐变淡,重新变回了“人”!\n");
                        Slowsay("这时,你才注意到少年的声音一直带着点沙哑,如同低吼一般\n");
                        Slowsay("“我没事。”他说。\n");
                    }
                    else
                    {
                    system("Color C");
                    Slowsay("你试着向他开枪,子弹穿过了他的身体\n");
                    Slowsay("你十分惊恐,疯狂地倾泻着手中的弹药\n");
                    Slowsay("“没有用的。”少年咯咯笑着向你走进,\n");
                    Slowsay("而他的伤口却以肉眼可见的速度愈合!\n");
                    Slowsay("怎么可能!怎么可能,怎么可能......\n");
                    system("Color F");
                        mzd();
                        if(zjj[9]==0)
                        {
                            Slowsay("获得线索-----无敌变异!·少年\n");Sleep(1000);
                            zjj[9]=1;
                        }
                        return 0;
                    }
                }
                if(x==2)
                {
                    system("Color C");
                    Slowsay("你看着少年变异\n");
                    Slowsay("奇怪的是,他变异后并没有像其他的丧尸一样,向你扑过来\n");
                    Slowsay("而是躲在墙角瑟瑟发抖\n");
                    Slowsay("你慢慢的走过去\n");
                    Slowsay("就在你走近的时候,少年突然暴起\n");
                    Slowsay("狠狠地咬住了你的手臂\n");
                    Slowsay("你赶忙用枪打死他,可是为时已晚\n");
                    system("Color F");
                    sn=0;
                    if(sw>=6){td2();return 0;}
                    else{bd6();return 0;}
                }
                break;
            }
            if(x==3&&gjj[4]==1)
            {
                gjj[5]=1;
                hd5();
                return 0;
            }
        }
        if(x==2)
        {
            sw=sw-1;
            if(sw<0){bd7();return 0;}
            Slowsay("你用一份食物引开了这条狗,食物-1\n");
        }
        break;
    }
	if(swx==2)
    {
		system("cls");
		if(sn==1) Slowsay("少年的变异的很突然,但身为丧尸的你没有受到攻击\n你们结伴一起狩猎着人类\n只是,与少年相处的越久,你就越发感受到他的强大。\n你只好收起杀心跟在他后面。\n应该是这样吗?"),Sleep(1000),Slowsay("\n\n“我错过了机会”\n");
    	else Slowsay("少年死后,你无聊的屠杀着一切,\n在接下来的几天里,你轻松的杀掉了城中所有的生物\n之后,你只能天天游荡,无助的面对着这座死城\n应该是这样吗?\n"),Sleep(1000),Slowsay("\n“我走错了路。”");
	    Sleep(1000);
		return 0;
	}
    if(vv==0) ch=_getch();
    if(sn==1&&sw>=4&&gun==2&&zd>5){hd4();return 0;}
    if(sn==1)
    {
        Slowsay("又过了一天,食物-2\n");
        sw=sw-2;
        if(sw<0){esl();return 0;}
        if(vv==0) ch=_getch();
            system("cls");
        Slowsay("今天早上,你发现少年不见了\n");
        Slowsay("你决定\n");
        Slowsay("1.去寻找他\n");
        Slowsay("2.不去找他\n");
        while(true)
        {
            x=read();
            if(x<1||x>2)
            {
                Slowsay("请重新输入\n");
                continue;
            }
            if(x==1)
            {
            	system("cls");qp();
                Slowsay("你通过蛛丝马迹一路追踪,来到了一座大厦前\n");
                Slowsay("在路上,你遭遇了丧尸,子弹-2\n");
                zd=zd-2;
                if(zd<0)
                {
                    mzd();
                    return 0;
                }
                Slowsay("你决定\n");
                system("Color C");
                Slowsay("1.破门!冲入大厦\n");
                Slowsay("2.悄悄开门,潜入大厦\n");
                Slowsay("3.寻找其它的入口\n");
                while(true)
                {
                    x=read();
                    if(x<1||x>3)
                    {
                        Slowsay("请重新输入\n");
                        continue;
                    }
                    if(x==1)
                    {
                        int xx=rand()%4;
                        Slowsay("你进入大厦才发现这里几乎充满了丧尸!");
                        Slowsay("丧尸似乎被你惊醒,如同海啸般向你涌来!");
                        system("Color F");
                        if(zd>6) Slowsay("怎么回事!!你一路且战且退来到了地下室"),zd-=6,bd9();
                        else if(xx==0) Slowsay("幸运的是,你退后的脚碰到了地下室的暗门,Thanks God!"),bd9();
                        else Sleep(1000),mzd();
                        return 0;
                    }
                    if(x==2)
                    {
                        int xx=rand()%6;
                        Slowsay("你进入大厦才发现这里几乎充满了丧尸!");
                        system("Color F");
                        Slowsay("怎么回事!!你害怕得定在原地,奇怪的是它们并没有向你扑来,只是疲惫的看着你。");
                        Slowsay("定睛一看,丧尸们个个躯体畸形,断手断脚者不乏其数");
                        Slowsay("再一看,这些丧尸们被奇怪的机器束缚,不得踏出大厦一步。");
                        Slowsay("你大着胆子靠近一个丧尸,发现它的头上有着模糊的字迹");
                        Slowsay("【21.7.29,失败】");Sleep(1000);
                        Slowsay("瞬间,那个丧尸惊恐地捂住头上的字,发出奇怪的吼声!");
                        Slowsay("其它丧尸如同被激怒,海啸般向你涌来!");
                        if(zd>6) Slowsay("怎么回事!!你一路且战且退来到了地下室"),zd-=6,bd9();
                        else if(xx==0) Slowsay("幸运的是,你退后的脚碰到了地下室的暗门,Thanks Good!"),bd9();
                        else Sleep(1000),mzd();
                        return 0;
                    }
                    if(x==3)
                    {
                        system("Color F");
                        Slowsay("你走入刚刚的大街,你的老相识开心地吐着舌头看着你");
                        Slowsay("......后面跟着它的一堆朋友......");
                        Slowsay("......你被讨食的狗狗们追着跑过了两条大街,不停地扔出食物来减缓它们的攻势......");
                        if(sw>5) Slowsay("终于,它们全部满足的趴倒在了地上。\n领头狗如同可以听懂人话一样,将你带到了一个隐蔽的地道口前......"),sw-=5,bd9();
                        else bd7();
                        return 0;
                    }
                    break;
                }
            }
            break;
        }
    }
    qp();
    if(vv==0) ch=_getch();
    if(mz==1&&sn==1&&swx==0){td6();return 0;}
    Slowsay("又过了一天,食物-2");
    sw=sw-2;if(sw<0){esl();return 0;}
    Sleep(500);
    Slowsay("遭遇丧尸,子弹-3");
    zd=zd-3;if(zd<0){mzd();return 0;}
    Sleep(500);
    Slowsay("又过了一天,食物-2");
    sw=sw-2;if(sw<0){esl();return 0;}
    Sleep(500);
    Slowsay("遭遇丧尸,子弹-2");
    zd=zd-2;if(zd<0){mzd();return 0;}
    Sleep(500);
    if(ccg==1){tg(); return 0;}
    else{bd10();return 0;}
}
int main()
{
    srand(time(0));
    Read();
    int go=0;
    while(tongguan1!=2)
    {
        int v=0;
        char ch;
        mp=0;
        if(go==1){
        	Sleep(1000);
    		if(vv==0)
				ch=_getch();
        	system("cls");Save();
		}
		go=1;
        Slowsay("1.进行游戏\n");
        Slowsay("2.查看成就\n");
        Slowsay("3.查看线索(获得全部线索后通关游戏)\n");
        Slowsay("4.获得一条随机的提示\n");
        Slowsay("5.游戏相关\n");
        Slowsay("6.极速模式\n");
        Slowsay("7.退出游戏\n");
        x=read();
        if(x==1)
        {
            sswj();
            if(s>50&&swhm==0)
            {
                swhm=1;
                Slowsay("又死了啊......");
                Slowsay("这已经是第几次了呢......");
                Slowsay("一个柔和的声音从耳边传来");
                Slowsay("或许早该放弃了");
				Sleep(1000);
                Slowsay("获得线索-----计数者");
            }
        }
        if(x==2)
        {
            int v1=0;
            system("cls");
            if(tongguan1==2) Slowsay("\n已通关终极剧情\n");
            if(tongguan1==1) Slowsay("\n已通关进阶剧情(进阶不重要!终极才是王道!)\n");
            if(tongguan==1) Slowsay("\n已通关基础剧情\n");
            int v=0;
            Slowsay("\nHappy Bnd 达成\n");
            if(gjj[1]==1) Slowsay("苟到最后\n");else Slowsay("未达成\n");
            if(gjj[2]==1) Slowsay("神仙眷侣\n");else Slowsay("未达成\n");
            if(gjj[3]==1) Slowsay("英雄不朽\n");else Slowsay("未达成\n");
            if(gjj[4]==1) Slowsay("认清自己\n");else Slowsay("未达成\n");
            if(gjj[5]==1) Slowsay("跨越物种的gay\n");else Slowsay("未达成\n");
            Slowsay("\n");
            Slowsay("Bad End 达成(共15个)\n");
            for(int i=1;i<=17;i++)
                if(hjj[i]==1)
                    printf("%d ",i),v1++;
            if(v1>=15&&swx==1)
                swx=2,cdd=0,Swx();
            Slowsay("\n");
            printf("当前死亡次数:%d",s);
            Slowsay("\n");
            Slowsay("True End 达成\n");
            if(zjj[1]==1) Slowsay("拯救世界\n");else Slowsay("未达成\n");
            if(zjj[3]==1) Slowsay("认清?·妹子\n");else Slowsay("未达成\n");
            if(zjj[2]==1) Slowsay("认清!·本我\n"); else Slowsay("未达成\n");
            if(zjj[4]==1) Slowsay("验证失败\n");else Slowsay("未达成\n");
            if(zjj[5]==1) Slowsay("死亡姗姗来迟\n");else Slowsay("未达成\n");
            Slowsay("\n");
            if(vv==0) char ch=_getch();
        }
        if(x==3)
        {
            system("cls");
            int v=0;
            Slowsay("基础线索\n");
            if(zjj[1]==1) Slowsay("    奇特的枪与饼干\n"),v++;else Slowsay("    ?????\n");
            if(zjj[2]==1) Slowsay("    延迟变异?·少年\n"),v++;else Slowsay("    ?????\n");
            if(zjj[9]==1) Slowsay("    无敌变异!·少年\n"),v++;else Slowsay("    ?????\n");
            if(zjj[3]==1) Slowsay("    不变异?  ·妹子\n"),v++; else Slowsay("    ?????\n");
            if(hjj[8]==1) Slowsay("    早已变异!·妹子\n"),v++; else Slowsay("    ?????\n");
            if(hjj[9]==1) Slowsay("    实验体·1号和2号\n"),v++; else Slowsay("    ?????\n");
            if(v>=6&&ccg==0)
            {
                Sleep(2000);
                cdd=0;cg();ccg=1;
            }
            Slowsay("进阶线索\n");
            if(swhm==1) Slowsay("    计数者\n"),v++; else Slowsay("    ?????\n");
            if(zbbj==1) Slowsay("    乱码,废弃与失联\n"),v++; else Slowsay("    ?????\n");
            if(by==1) Slowsay("    早已变异!·本我\n"),v++; else Slowsay("    ?????\n");
            if(hjj[15]==1) Slowsay("    伪造......\n"),v++; else Slowsay("    ?????\n");
            if(zjj[5]==1) Slowsay("    少年之死\n"),v++; else Slowsay("    ?????\n");
            if(hjj[14]==1) Slowsay("    外面的世界\n"),v++; else Slowsay("    ?????\n");
            if(v>=12&&qxs==0)
            {
                Sleep(2000);
                cg2();cdd=0;Sleep(1000);
                Slowsay("-------- 游戏进阶结局已解锁(快前往达成吧)--------");qxs=1;
            }
            if(vv==0) ch=_getch();
        }
        if(x==4)
        {
            system("cls");
            int y=rand()%3;
            if(y==0){
				Slowsay("【稀有提示】"); x=rand()%14;
	            if(x==0) Slowsay("【稀有结局提示】 试试 0 10 开局!");
	            else if(x==1) Slowsay("【稀有结局提示】 最好的爱总要先错过~");
	            else if(x==2) Slowsay("【剧情提示】 二周目:少年变异后有新剧情!");
	            else if(x==3) Slowsay("【剧情提示】 不变异的妹子总有一天会在营地暴露!再来一遍!");
	            else if(x==4) Slowsay("【剧情提示】 弹尽粮绝之时,变异的少年会记起上辈子的爱情!再来一遍!");
	            else if(x==5) Slowsay("【剧情提示】 第二天,和首领换更多子弹,他会更开心!");
	            else if(x==6) Slowsay("【剧情提示】 在家里等待疯掉?再来一遍!");
	            else if(x==7) Slowsay("【剧情提示】 二周目:再次进入实验室吧!");
	            else if(x==8) Slowsay("【剧情提示】 二周目:神枪手妹子...");
	            else if(x==9) Slowsay("【剧情提示】 二周目:不带子弹!等待救援!");
	            else if(x==10) Slowsay("【通关方式】 二周目:在获得所有线索后前往“外面的世界”。");
	            else if(x==11) Slowsay("【通关方式】 三周目:(都提示这么明显了)吃掉妹子,杀掉少年。");
	            else if(x==12) Slowsay("【线索提示】 死亡很多次后......(有个地方可以刷死亡次数)");
	            else Slowsay("【???】 666666,5201314(会错过一些线索与结局!)");
            }
			else{
				x=rand()%14;
	            if(x==0) Slowsay("加了好感后,妹子有几率不死");
	            else if(x==1) Slowsay("少年喜欢子弹");
	            else if(x==2) Slowsay("乱走有时可以获得子弹");
	            else if(x==3) Slowsay("冲进去活下来几率更大");
	            else if(x==4) Slowsay("分头探商店可以获得更多资源");
	            else if(x==5) Slowsay("有一些结局只能通关后触发");
	            else if(x==6) Slowsay("有一些结局要脸好才能触发");
	            else if(x==7) Slowsay("有一些结局要通其他结局后才能触发");
	            else if(x==8) Slowsay("大多数时候,你认为一个地方没有好结局只是因为你食物/子弹不够");
	            else if(x==9) Slowsay("绝大多数的线索来自结局");
	            else if(x==10) Slowsay("三大重叠剧情线路:普通,进阶,尸王线");
	            else if(x==11) Slowsay("本游戏是一个剧情严谨,人物丰满,细思极恐的好!游!戏!~");
	            else if(x==12) Slowsay("事实证明剧情游戏是最难调的!有Bug一定要去博客说出来啊!(luogu.com.cn/blog/z1e2k3i4/)");
	            else Slowsay("完成目标后,需要在线索,成就界面开启新剧情哦");
            }
            if(vv==0) char ch=_getch();continue;
        }
        if(x==5)
        {
            system("cls");
            Slowsay("作者:小小小苗\n");
            Slowsay("改错,调试,搬运,游玩:胎神大大(就是在游戏论坛翻到的宝藏而已emm......)\n");
        }
        if(x==6)
        {
            system("cls");
            if(vv==0) vv=1,Slowsay("已开启极速模式");
            else vv=0,Slowsay("已关闭极速模式");
        }
        if(x==7)
        {
            system("cls");
            Slowsay("想退?死吧!!");s++;
        }
    }
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    Slowsay("Thanks for playing......");Sleep(1000);
    Slowsay("您已通关,我亲爱的 终极丧尸,成功者,杀人机器,你还没杀够吗?......");system("Color C");
}

忍者必须死

#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#define Nor if(B[b].x<5) B[b].x=5;
#define Out1 Bx1-Bvx1<=6||Bx1-Bvx1>=28||By1-Bvy1<=7||By1-Bvy1>=27
#define Out2 Bx2-Bvx2<=6||Bx2-Bvx2>=28||By2-Bvy2<=7||By2-Bvy2>=27
#define Chang1 {Bwhat1=0;Bvx1=Bvy1=0;memset(Bgo1,0,sizeof(Bgo1));}
#define Chang2 {Bwhat2=0;Bvx2=Bvy2=0;memset(Bgo2,0,sizeof(Bgo2));}
#define Chang3 {Bwhat3=0;Bvx3=Bvy3=0;memset(Bgo3,0,sizeof(Bgo3));}
using namespace std;
int ti(float a) {return ((int)(a*10+5))/10;}
void Setpos(float x,float y){COORD pos;pos.X=ti(y*4)/2;pos.Y=ti(x);SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}
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_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);if(a==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_BLUE);if(a==10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_BLUE);if(a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);if(a==12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);if(a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);if(a==14) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_BLUE);}
int Blomax,Ren,Exp,Expmax,Lv,Lvl,Ice,Drug,ar1,ar2,Tar1,Tar2,bl,br,Win,T,Tb,Sy,Up,Upt,Down,u1,u2,Kill,Killb,L,Ll[4],Li,D,Gd[10],Biao,Fire,Fir,Water,Thun,Wind,Magne,I[20][2],ib,Dis,Disb,Dis1,Disb1,Boss,Bblo,Bblomax,Bwhat1,Bwhat2,Bwhat3,Bgo1[10],Bgo2[10],Bgo3[10],Bbr,Bbl,Bl[4];
float X,Y,Vx,Vy,Ding,Blo,Hui,Bx1,By1,Bx2,By2,Bx3,By3,Bvx1,Bvy1,Bvx2,Bvy2,Bvx3,Bvy3,Bway[1001][2];
struct bullet{float x,y,vx,vy;int what;int a,t,How;int life;bool kill;}B[100001];
void Map(int a,int b);
void Pan(int a,float x,float y,int b){
    float Nox[4],Noy[4];Nox[0]=X,Noy[0]=Y;
    if(Down==1&&X==22) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;else if(Down==2) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;else if(Down==1||X<18) Nox[1]=X-1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;else Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;
    for(int i=0;i<3;i++){
        if(a==-1){if(abs(x-Nox[i])+abs(y-Noy[i])<1.5) {if(B[b].what==-10)Exp+=2;if(B[b].what==-11)Exp+=1;B[b].life=0;if(B[b].life==0&&b==bl) bl++;Map(3,b);break;}}
        if(a==-2){if(abs(x-Nox[i])+abs(y-Noy[i])<2.5) {if(B[b].what==-2)Exp+=5,Biao+=5;if(B[b].what==-3)Fire=300,Ice=0,Fir=3;if(B[b].what==-4)Water=200;if(B[b].what==-5){Wind=70;Ding=28.25;Ice=0;if(Y<Ding-1)Vy=5;else Vy=0;if(Up>=1) Vx=-5;if(Down==2) Vx=5;}if(B[b].what==-6){Thun=200;system("color 1F");Sleep(20);system("color 6F");Sleep(10);system("color 0F");}if(B[b].what==-7)Magne=300;if(B[b].what==-8)Ice=0,Drug=0,Blo=fmin((float)Blomax,Blo+20);if(B[b].what==-9)Exp=fmin((float)Expmax,Exp+20);B[b].life=0;if(B[b].life==0&&b==bl) bl++;Map(3,b);break;}}
    }if(Wind==0&&Thun==0&&(B[b].kill!=0||Killb>=15||Ren==1&&Killb>0)) return;
    for(int i=0;i<3;i++){
        if((Wind>=1||Thun>=1)&&abs(x-Nox[i])+abs(y-Noy[i])<2.5) {if(B[b].what<98)Exp+=2;B[b].life=0;Map(3,b);break;}
        if(a==1) {if(abs(x-Nox[i])<0.5&&abs(y-Noy[i])<1) {if(B[b].what>=99)Blo-=10;if(B[b].what==14)Blo-=15,Ice=100,B[b].life=0;else if(B[b].what==15)Blo-=20,Ice=0,B[b].life=0;else if(B[b].what==17)Blo-=5,Drug=100,B[b].life=0;else if(B[b].what>=13&&B[b].what<=17)Blo-=10,B[b].life=0;else Blo-=15;B[b].kill=1,Killb=20;Kill=1;Map(3,b);break;}}
        if (a==2||a==6||a==8||a==9||a==10||a==11||a==12) {
            if(abs(x-Nox[i])+abs(y-Noy[i])<1.5) {
                if(a==2)Blo-=20;
                else if(a==8)Blo-=10;
                else Blo-=15;B[b].kill=1,Killb=20;Kill=1;if(a!=2){B[b].life=0;if(B[b].life==0&&b==bl) bl++;Map(3,b);break;}}}
        if(a==4) {if((Wind>=1||Thun>=1)&&abs(x-Nox[i])<1.5&&Noy[i]-y<=0&&Noy[i]-y>=-8) {if(B[b].what<98)Exp+=2;B[b].life=0;Map(3,b);break;}if(abs(x-Nox[i])<1&&Noy[i]-y<=0&&Noy[i]-y>=-8) {Blo-=25,B[b].kill=1,Killb=20;Kill=1;Vy=-1;Y-=0.5;break;}}
    }
}
void Map(int a,int b){
    Color(0);
    if(a==-1){
        if(Boss==1||Boss==6){if(Bwhat1==5){if(ti(Bx1)==20)Setpos(Bx1,By1),cout<<"==";else Setpos(Bx1,By1),cout<<"  ";}else{Setpos(Bx1-1,By1-0.5),cout<<"    ";Setpos(Bx1,By1-1),cout<<"      ";Setpos(Bx1+1,By1-0.5),cout<<"    ";if(abs(ti(Bx1)-20)<=1)Setpos(20,By1-1),cout<<"======";}}
        if(Boss==2||Boss==6){Setpos(Bx2-1,By2-1);cout<<"    ";Setpos(Bx2,By2-1);cout<<"      ";Setpos(Bx2+1,By2-1),cout<<"      ";Color(0);if(abs(ti(Bx2)-20)<=1)Setpos(20,By2-1),cout<<"======";}
        if(Boss==3||Boss==6){Setpos(Bx3-1,By3-0.5);cout<<"     ";Setpos(Bx3,By3);cout<<"  ";Setpos(Bx3+1,By3-1),cout<<"      ";Color(0);if(abs(ti(Bx3)-20)<=1)Setpos(20,By3-1),cout<<"=======";}
        if(X<0)return;if(X>=17&&X<=19){Setpos(X-1,Y);cout<<"  ";Setpos(X,Y-1);cout<<"   ";Setpos(X+1,Y-1),cout<<"   ";}else if(X<=23&&X>=21){Setpos(X+1,Y);cout<<"  ";Setpos(X,Y-1);cout<<"   ";Setpos(X-1,Y-1),cout<<"    ";}else if(X>23){Setpos(X,Y-1);cout<<"    ";Setpos(X-1,Y-0.5),cout<<"   ";}else if(X<17&&Upt!=0){Setpos(X,Y-1);cout<<"    ";Setpos(X+1,Y-1.5),cout<<"    ";}else if(X<17){Setpos(X,Y-1);cout<<"    ";Setpos(X+1,Y-0.5),cout<<"   ";}if(Thun>0){Setpos(X-2,Y-1),cout<<"    ";Setpos(X+2,Y-1),cout<<"    ";Setpos(X,Y+2),cout<<"  ";Setpos(X,Y-2.5),cout<<"  ";Setpos(X-1,Y+1),cout<<"  ";Setpos(X+1,Y+1),cout<<"  ";Setpos(X-1,Y-2),cout<<"  ";Setpos(X+1,Y-2),cout<<"  ";Setpos(20,Y-2.5),cout<<"============";}if(Wind!=0){Setpos(X+1,Y-5);cout<<"        ";Setpos(X,Y-5);cout<<"        ";Setpos(X-1,Y-5);cout<<"        ";Setpos(20,Y-5),cout<<"========";}if(Water!=0){Setpos(X,Y-4);cout<<"       ";Setpos(X+2,Y-3.5);cout<<"     ";Setpos(X-2,Y-3.5);cout<<"     ";Setpos(X+1,Y-3.5);cout<<"     ";Setpos(X-1,Y-3.5);cout<<"     ";Setpos(20,Y-5),cout<<"========";}if(Fire!=0){Setpos(X,Y+1),cout<<"  ";Setpos(X+1,Y),cout<<"  ";Setpos(X-1,Y-1),cout<<"  ";Setpos(20,Y-1);cout<<"======";}
    }
    if(a==0){
        if(Boss==1||Boss==6){if(Bwhat1==5)Color(5),Setpos(Bx1,By1),cout<<"█",Color(0);else if(Bwhat1==4&&Bgo1[1]>6&&Bgo1[1]<11)Color(4),Setpos(Bgo1[5]-1,Bgo1[6]),cout<<"︻",Setpos(Bgo1[5],Bgo1[6]-1),cout<<"【",Setpos(Bgo1[5],Bgo1[6]+1),cout<<"】",Setpos(Bgo1[5]+1,Bgo1[6]),cout<<"︼",Color(0);else{Setpos(Bx1-1,By1-0.5),Color(0),cout<<"●●";Setpos(Bx1,By1-1);if(Bwhat1==2&&Bgo1[1]<=5)Color(1);else if(Bwhat1==3&&Bgo1[1]<=5)Color(5);else if(Bwhat1==6&&Bgo1[1]<=5)Color(8); else Color(4);if(Bwhat1==4) Setpos(Bx1,By1-0.5),cout<<"██(";else cout<<")██(";Setpos(Bx1+1,By1-0.5),cout<<"……";Color(0);}}
        if(Boss==2||Boss==6){Setpos(Bx2-1,By2-1);Color(0),cout<<"\\ ";Color(0);cout<<"●";Setpos(Bx2,By2-1);Color(3);cout<<"◥";Color(5),cout<<"JJJ";Color(0),cout<<">";Color(3);Setpos(Bx2+1,By2-1),cout<<"◢█◣";Color(0);}
        if(Boss==3||Boss==6){Setpos(Bx3-1,By3-0.5);if(Bwhat3==3||Bwhat3==9) Color(1);else if(Bwhat3==4||Bwhat3==10) Color(4);else if(Bwhat3==5||Bwhat3==11) Color(5);if(Bwhat3==11)cout<<' ';else if(Bwhat3==6) Color(3);else Color(2);cout<<"●-";Setpos(Bx3,By3);if(Bwhat3==11)cout<<"/";else cout<<"┃";Color(0);Setpos(Bx3+1,By3-1),cout<<"●●●";}
        if(X<0)return;if(Ren==2) Color(12);if(Ren==3) Color(1);if(Ren==4) Color(3);if(Ren==5) Color(4);if(Ren==6) Color(2);if(Drug!=0&&T%5!=0) Color(11);if(Drug!=0&&T%5==0) Color(11);if(Ice!=0) Color(6);if(b==1) Color(8);if(Li!=0) Color(5);if(Ren==1&&Killb>0&&T%4<2) Color(13);if(Wind>0&&T%4<=1) Color(1);if(Wind>0&&T%4>=2) Color(0);if(Thun>0&&T%4<=1) Color(1);if(Thun>0&&T%4>=2) Color(6);
        if(X>=17&&X<=19){Setpos(X-1,Y);cout<<"●";Setpos(X,Y-1);cout<<"━/";if(T%10<3) Setpos(X+1,Y-1),cout<<"┛╲";else if(T%10<6) Setpos(X+1,Y-1),cout<<"┦ ";else Setpos(X+1,Y-1),cout<<"╯>";if(Wind>0&&T%3==0) Setpos(X+1,Y-1),cout<<"┛╲";else if(Wind>0&&T%3==1) Setpos(X+1,Y-1),cout<<"┦ ";else if(Wind>0&&T%3==2)Setpos(X+1,Y-1),cout<<"╯>";}else if(X<=23&&X>=21){Setpos(X+1,Y);cout<<"●";Setpos(X,Y-1);cout<<"━\\";if(T%10<3) Setpos(X-1,Y-1),cout<<"┓╱";else if(T%10<6) Setpos(X-1,Y-1),cout<<"┪ ";else Setpos(X-1,Y-1),cout<<"╮>";if(Wind>0&&T%3==0) Setpos(X-1,Y-1),cout<<"┓╱";else if(Wind>0&&T%3==1) Setpos(X-1,Y-1),cout<<"┪ ";else if(Wind>0&&T%3==2)Setpos(X-1,Y-1),cout<<"╮>";}else if(X>23){Setpos(X,Y-1);cout<<"━ ●";Setpos(X-1,Y-0.5),cout<<"│>";}else if(X<17&&Upt!=0){Setpos(X,Y-1);cout<<"━ ●";Setpos(X+1,Y-1.5),cout<<"╱ >";}else if(X<17){Setpos(X,Y-1);cout<<"━ ●";Setpos(X+1,Y-0.5),cout<<"│>";}if(Thun>0){Setpos(X-2,Y-1),cout<<"▄▄";Setpos(X+2,Y-1),cout<<"▄▄";Setpos(X,Y+2),cout<<"▌";Setpos(X,Y-2.5),cout<<"▌";Setpos(X-1,Y+1),cout<<"█";Setpos(X+1,Y+1),cout<<"█";Setpos(X-1,Y-2),cout<<"█";Setpos(X+1,Y-2),cout<<"█";}if(Magne>0&&T%7<2)Setpos(X,Y),Color(5),cout<<"★";if(Wind>1){if(T%6<2)Color(1);else Color(0);if(T%8<=1){Setpos(X+1,Y-5);cout<<"----  --";Setpos(X,Y-5);cout<<"-  --- -";Setpos(X-1,Y-5);cout<<"--- - --";}else if(T%8<=3){Setpos(X+1,Y-5);cout<<"------  ";Setpos(X,Y-5);cout<<" --  ---";Setpos(X-1,Y-5);cout<<"----- - ";}else if(T%8<=5){Setpos(X+1,Y-5);cout<<"  ------";Setpos(X,Y-5);cout<<"-- --  -";Setpos(X-1,Y-5);cout<<"- ----- ";}else if(T%8<=7){Setpos(X+1,Y-5);cout<<"--  ----";Setpos(X,Y-5);cout<<" --- -- ";Setpos(X-1,Y-5);cout<<"- - ----";}}if(Water!=0){Color(1);if(T%20<5){Setpos(X+2,Y-3);cout<<"■";Setpos(X+1,Y-3.5);cout<<"■";Setpos(X-1,Y-2.5);cout<<"■";Setpos(X-2,Y-3);cout<<"■";}else if(T%20<10||T%20>=15){Setpos(X+2,Y-3);cout<<"■";Setpos(X,Y-4);cout<<"■■";Setpos(X-2,Y-3);  cout<<"■";}else if(T%20<15){Setpos(X+2,Y-3.5);cout<<"■";Setpos(X+1,Y-3);cout<<"■";Setpos(X-1,Y-3.5);cout<<"■";Setpos(X-2,Y-3);cout<<"■";}}if(Fire!=0){if(T%6<3)Color(4);else Color(5);if(Fir>=1)Setpos(X,Y+1),cout<<"●";if(Fir>=2)Setpos(X+1,Y),cout<<"●";if(Fir>=3)Setpos(X-1,Y-1),cout<<"●";}
    }
    if(a==1||a==3){
        if(B[b].what==1){Nor;Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<"      ";if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(B[b].How<=1) Color(13);else Color(4);cout<<"●";if(a==1) Pan(1,B[b].x,B[b].y,b);}}
        if(B[b].what==2){Nor;Setpos(B[b].x-1,B[b].y-1);if(ti(B[b].x-1)==20)cout<<"======";else cout<<"      ";Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<"      ";Setpos(B[b].x+1,B[b].y-1);if(ti(B[b].x+1)==20)cout<<"======";else cout<<"      ";if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);Color(5);if(B[b].How==0){Setpos(B[b].x-1,B[b].y),cout<<"↑";Setpos(B[b].x,B[b].y-1),cout<<"←┼ →";Setpos(B[b].x+1,B[b].y),cout<<"↓";}else if(B[b].How==1){Setpos(B[b].x-1,B[b].y-1),cout<<"↖  ↗";Setpos(B[b].x,B[b].y),cout<<"╳";Setpos(B[b].x+1,B[b].y-1),cout<<"↙  ↘";} if(a==1) Pan(2,B[b].x,B[b].y,b);}}
        if(B[b].what==3||B[b].what==5){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<"  ";if(B[b].life!=0){B[b].y-=B[b].vy;B[b].x-=B[b].vx;Setpos(B[b].x,B[b].y);if(B[b].How==1) Color(5);else Color(4);cout<<"◎";}}
        if(B[b].what==4){Nor;Setpos(B[b].x,fmax((float)0,B[b].y-8));if(ti(B[b].x)==20){for(int i=max(0,(int)B[b].y-8);i<=B[b].y;i++)cout<<"==";}else {for(int i=max(0,(int)B[b].y-8);i<=B[b].y;i++)cout<<"  ";}if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,fmax((float)0,B[b].y-8));Color(6); for(int i=max(0,(int)B[b].y-8);i<=B[b].y;i++)cout<<"═"; if(a==1) Pan(4,B[b].x,B[b].y,b);}}
        if(B[b].what==6||B[b].what==8||B[b].what==9){Nor;Setpos(B[b].x-1,B[b].y);if(ti(B[b].x)-1==20)cout<<"==";else cout<<"  ";Setpos(B[b].x+1,B[b].y);if(ti(B[b].x)+1==20)cout<<"==";else cout<<"  ";Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<"      ";if(B[b].life!=0){B[b].y-=B[b].vy;B[b].x-=B[b].vx;Setpos(B[b].x,B[b].y-1);if(B[b].what==6){if(B[b].How<=1) Color(1); else Color(6);}if(B[b].what==9){if(B[b].How<=1) Color(4); else Color(8);}if(B[b].what==8)Color(5);Setpos(B[b].x-1,B[b].y);cout<<"︹";Setpos(B[b].x+1,B[b].y);cout<<"︺";Setpos(B[b].x,B[b].y-1);if(B[b].How%2==1) cout<<"〔●〕"; else cout<<"﹝○﹞"; if(a==1) Pan(6,B[b].x,B[b].y,b);}}
        if(B[b].what==7){Nor;Setpos(B[b].x,B[b].y);if(B[b].How<0) for(int i=19;i>=20+B[b].How;i--) {Setpos(i,B[b].y);cout<<"  ";}if(B[b].How>0) for(int i=21;i<=20+B[b].How;i++) {Setpos(i,B[b].y);cout<<"  ";}if(B[b].life!=0){B[b].y-=B[b].vy;if(B[b].How<0) for(int i=19;i>=20+B[b].How;i--) {Setpos(i,B[b].y);cout<<"║"; if(a==1) Pan(7,i,B[b].y,b);}if(B[b].How>0) for(int i=21;i<=20+B[b].How;i++) {Setpos(i,B[b].y);cout<<"║"; if(a==1) Pan(7,i,B[b].y,b);}}}
        if(B[b].what==10||B[b].what==11||B[b].what==12){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<"  ";if(B[b].life!=0){B[b].x-=B[b].vx;B[b].y-=B[b].vy;if(B[b].How==1){B[b].vy-=0.2;}else B[b].vx-=0.35;if(B[b].x>=25) B[b].x=25,B[b].vx*=-0.8;if(B[b].what==11&&B[b].y<=1) B[b].y=1,B[b].vy*=-1;if(B[b].what==12&&B[b].y<=1) B[b].y=1,B[b].vx=0,B[b].vy=-0.5,B[b].How=1;Setpos(B[b].x,B[b].y);if(B[b].what==11)Color(1);else if(B[b].what==12)Color(5);else Color(0);if(B[b].t%4<2)cout<<"▃";else cout<<"▍";if(a==1) Pan(B[b].what,B[b].x,B[b].y,b);}}
        if(B[b].what>=13&&B[b].what<=17){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"====";else cout<<"    ";if(B[b].life!=0){B[b].x-=B[b].vx;B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(B[b].what==14) Color(1);else if(B[b].what==15) Color(4);else if(B[b].what==16) Color(5);else if(B[b].what==17) Color(3);else Color(2);cout<<"●";if(B[b].what==14)cout<<"*";if(B[b].what==15)cout<<"";if(B[b].what==16)cout<<"<";if(B[b].what==17)cout<<"X";} if(a==1) Pan(1,B[b].x,B[b].y,b);}
        if(B[b].what==98&&B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(ti(B[b].x==20))cout<<"==";else cout<<"  ";if(B[b].y<=3)B[b].life=0;}
        if(B[b].what>=99){if(B[b].y<=3)B[b].life=0;if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);Color(5);if(B[b].what==99)cout<<"█";if(B[b].what>=100&&B[b].what<200){if(B[b].what%5==0)cout<<"我";if(B[b].what%5==1)cout<<"是";if(B[b].what%5==2)cout<<"最";if(B[b].what%5==3)cout<<"强";if(B[b].what%5==4)cout<<"的";}if(B[b].what>=200&&B[b].what<300){if(B[b].what%6==0)cout<<"神";if(B[b].what%6==1)cout<<"级";if(B[b].what%6==2)cout<<"怪";if(B[b].what%6==3)cout<<"物";if(B[b].what%6==4)cout<<"之";if(B[b].what%6==5)cout<<"光";}if(B[b].what>=300&&B[b].what<400){if(B[b].what%8==0)cout<<"颤";if(B[b].what%8==1)cout<<"抖";if(B[b].what%8==2)cout<<"吧";if(B[b].what%8==3)cout<<"无";if(B[b].what%8==4)cout<<"能";if(B[b].what%8==5)cout<<"的";if(B[b].what%8==6)cout<<"人";if(B[b].what%8==7)cout<<"类";}if(B[b].what>=400&&B[b].what<500){if(B[b].what%8==0)cout<<"还";if(B[b].what%8==1)cout<<"不";if(B[b].what%8==2)cout<<"快";if(B[b].what%8==3)cout<<"跪";if(B[b].what%8==4)cout<<"倒";if(B[b].what%8==5)cout<<"在";if(B[b].what%8==6)cout<<"朕";if(B[b].what%8==7)cout<<"前";}if(B[b].what>=500&&B[b].what<600){if(B[b].what%8==0)cout<<"看";if(B[b].what%8==1)cout<<"懂";if(B[b].what%8==2)cout<<"这";if(B[b].what%8==3)cout<<"句";if(B[b].what%8==4)cout<<"话";if(B[b].what%8==5)cout<<"的";if(B[b].what%8==6)cout<<"是";if(B[b].what%8==7)cout<<"猪";} if(a==1) Pan(1,B[b].x,B[b].y,b);}}
        if(B[b].what==-1){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<"  ";if(Boss==0) B[b].life=0;else if(((Boss==1&&abs(B[b].x-Bx1)+abs(B[b].y-By1)<1.5)||(Boss==2&&abs(B[b].x-Bx2)+abs(B[b].y-By2)<1.5)||(Boss==3&&abs(B[b].x-Bx3)+abs(B[b].y-By3)<1.5)||(B[b].t==10))&&B[b].life==1) Bblo-=8+Lv*2,B[b].life=0;if(B[b].life!=0){if(Boss==1)B[b].x=B[b].x+(Bx1-B[b].x)/(10-B[b].t)*1.0,B[b].y=B[b].y+(By1-B[b].y)/(10-B[b].t)*1.0;if(Boss==2)B[b].x=B[b].x+(Bx2-B[b].x)/(10-B[b].t)*1.0,B[b].y=B[b].y+(By2-B[b].y)/(10-B[b].t)*1.0;if(Boss==3)B[b].x=B[b].x+(Bx3-B[b].x)/(10-B[b].t)*1.0,B[b].y=B[b].y+(By3-B[b].y)/(10-B[b].t)*1.0;Setpos(B[b].x,B[b].y);Color(7);if(B[b].t%2==0) cout<<"+";else cout<<"×";}}
        if(B[b].what<=-2&&B[b].what>=-9){Nor;Setpos(B[b].x-1,B[b].y);if(ti(B[b].x)-1==20)cout<<"==";else cout<<"  ";Setpos(B[b].x+1,B[b].y);if(ti(B[b].x)+1==20)cout<<"==";else cout<<"  ";Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<"      ";if(B[b].life!=0){B[b].y-=B[b].vy;B[b].x-=B[b].vx;if(B[b].what<=-3&&B[b].what>=-7){if(B[b].x<=7)B[b].x=7;if(B[b].x>=28)B[b].x=28;else if(B[b].x>=B[b].a+1&&B[b].How==1)B[b].How=0;else if(B[b].x<=B[b].a-1&&B[b].How==0)B[b].How=1;if(B[b].How==1&&B[b].vx>=-1)B[b].vx-=0.2;if(B[b].How==0&&B[b].vx<=1)B[b].vx+=0.2;}if(B[b].what==-2) Color(3);if(B[b].what==-3) Color(4);if(B[b].what==-4) Color(1);if(B[b].what==-5) Color(0);if(B[b].what==-6) Color(6);if(B[b].what==-7) Color(5);if(B[b].what==-8) Color(2);if(B[b].what==-9) Color(14);if(T%7<=1&&B[b].what==-5)Color(1);else if(T%7<=1)Color(0);Setpos(B[b].x-1,B[b].y);cout<<"︹";Setpos(B[b].x+1,B[b].y);cout<<"︺";Setpos(B[b].x,B[b].y-1);if(B[b].what==-2) cout<<"﹝镖﹞";if(B[b].what==-3) cout<<"﹝火﹞";if(B[b].what==-4) cout<<"﹝水﹞";if(B[b].what==-5) cout<<"﹝风﹞";if(B[b].what==-6) cout<<"﹝雷﹞";if(B[b].what==-7) cout<<"﹝磁﹞";if(B[b].what==-8) cout<<"﹝血﹞";if(B[b].what==-9) cout<<"﹝忍﹞"; if(a==1) Pan(-2,B[b].x,B[b].y,b);}}
        if(B[b].what==-11||B[b].what==-12){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<"  ";if(B[b].life!=0){if(Magne>0)B[b].How++,B[b].x=B[b].x+(X-B[b].x)/(10-B[b].How)*1.0,B[b].y=B[b].y+(Y-B[b].y)/(10-B[b].How)*1.0;B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(B[b].what==-10) Color(5);if(B[b].what==-11) Color(7);if(T%7<=1)Color(0);cout<<"◆"; if(a==1) Pan(-1,B[b].x,B[b].y,b);}}
        if(B[b].what==-13){Nor;Setpos(B[b].x,B[b].y-0.5);if(ti(B[b].x)==20)cout<<"===";else cout<<"   ";if(B[b].life!=0){if(B[b].a==13880086){if(Boss==0) B[b].life=0;else if(((Boss==1&&abs(B[b].x-Bx1)+abs(B[b].y-By1)<1.5)||(Boss==2&&abs(B[b].x-Bx2)+abs(B[b].y-By2)<1.5)||(Boss==3&&abs(B[b].x-Bx3)+abs(B[b].y-By3)<1.5)||(B[b].t==5))&&B[b].life==1) Bblo-=8+Lv*2,B[b].life=0;if(B[b].life!=0){if(Boss==1)B[b].x=B[b].x+(Bx1-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(By1-B[b].y)/(5-B[b].t)*1.0;if(Boss==2)B[b].x=B[b].x+(Bx2-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(By2-B[b].y)/(5-B[b].t)*1.0;if(Boss==3)B[b].x=B[b].x+(Bx3-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(By3-B[b].y)/(5-B[b].t)*1.0;}}else{if(B[B[b].a].life==0) B[b].life=0;else if((abs(B[b].x-B[B[b].a].x)+abs(B[b].y-B[B[b].a].y)<1.5||(B[b].t==5))&&B[b].life==1) Exp+=2,B[B[b].a].life=B[b].life=0;if(B[b].life!=0){B[b].x=B[b].x+(B[B[b].a].x-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(B[B[b].a].y-B[b].y)/(5-B[b].t)*1.0;}}Setpos(B[b].x,B[b].y-0.5);if(T%6<3)Color(5);else Color(4);cout<<"●";}}
    }if(br<bl) {br=-1,bl=0;memset(B,0,sizeof(B));}Color(0);
}
void Move(){
    if(X<3) X=3;if(Y<1) Y=1,Vy=0;if(Y>29) Y=29,Vy=0;
    if(Ice!=0){X-=Vx/2.0;Y+=Vy/2.0;Vy=fmax(Vy-0.025,(float)0);if(T%6==0&&Up==0&&Y<Ding) Y+=0.25;if(T%6==3&&Up==0&&Y>=Ding) Y-=0.25;if(Up==0&&Y<=Ding-1.25) Vy=0.25;if(Up==0&&Y>=Ding+1.25&&Wind==0) Vy=-0.25;if(Up==0&&Down==0&&Vx>0&&X<=18) Up=0,Down=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2&&X<=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up==0&&Down==1&&Vx<0&&X>=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up>0&&Down==0&&X>18) Up=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2) Vx+=0.175;else if(Up>0&&Upt==0) Vx-=0.175;else if(Up>0&&Upt>0) {Vx=fmax(Vx-0.125,(float)0);if(Upt==1&&T%2==0)Map(-1,0);if(T%2==0)Upt--;}}
    else{X-=Vx;Y+=Vy;Vy=fmax(Vy-0.05,(float)0);if(Wind==0){if(T%6==0&&Up==0&&Y<Ding) Y+=0.5;if(T%6==3&&Up==0&&Y>=Ding) Y-=0.5;}else{if(T%2==0&&Up==0&&Y<Ding) Y+=0.5;if(T%2==1&&Up==0&&Y>=Ding) Y-=0.5;}if(Up==0&&Y<=Ding-1.25) Vy=0.5;if(Up==0&&Y>=Ding+1.25&&Wind==0) Vy=-0.5;if(Up==0&&Down==0&&Vx>0&&X<=18) Up=0,Down=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2&&X<=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up==0&&Down==1&&Vx<0&&X>=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up>0&&Down==0&&X>18) Up=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2) Vx+=0.35;else if(Up>0&&Upt==0) Vx-=0.35;else if(Up>0&&Upt>0) {Vx=fmax(Vx-0.25,(float)0);if(Upt==1)Map(-1,0); Upt--;}}
    for(int i=bl;i<=br;i++){
        if(B[i].what<98)if(B[i].x-B[i].vx<=5||B[i].x-B[i].vx>=30||B[i].y-B[i].vy<=0||B[i].y-B[i].vy>=30){B[i].life=0;Map(1,i);}
        for(int j=0;j<20;j++)if(B[i].what>0&&B[i].life!=0&&abs(B[i].x-I[j][0])<2&&B[i].y-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<"   ";I[j][0]=I[j][1]=-1;B[i].life=0;Exp+=2;}
        if(B[i].t>=100)B[i].life=0;if(B[i].life==0&&i==bl) bl++;
        Map(1,i);if(B[i].life==0) continue;
        else{B[i].t++;
            if(B[i].what==1){if(B[i].y<=25&&B[i].How==0) B[i].vy=0,B[i].How=1;if(B[i].t==30) B[i].y+=1.5,B[i].How=2;if(B[i].t==35) B[i].vy=1.5,B[i].How=3;}
            if(B[i].what==2){if(B[i].t%3==0) B[i].How=!B[i].How;}
            if(B[i].what==3||B[i].what==5){if(B[i].what==3&&B[i].y<=20) B[i].vy=0;if(B[i].what==5&&B[i].y<=21) B[i].vy=0;if(B[i].t>30&&B[i].t%2==0) B[i].How=!B[i].How;if(B[i].what==5&&B[i].t<=30&&B[i].x<X) B[i].vx=-0.2;else if(B[i].what==5&&B[i].t<=70&&B[i].x>X) B[i].vx=0.2;else B[i].vx=0;if(B[i].t==45){B[i].life=0;br++;B[br].what=4;B[br].x=B[i].x;B[br].y=32;B[br].vy=3;B[br].life=1;}}
            if(B[i].what==6||B[i].what==8||B[i].what==9){if(B[i].vx<0.25&&B[i].vy<0.25&&B[i].t>=50){B[i].life=0;if(B[i].life==0&&i==bl) bl++;Map(1,i);break;}if(B[i].t%5==0) B[i].How=rand()%4;if(B[i].what==9){if(B[i].t==7){X9:float xx=(rand()%41)/40.0,yy=(rand()%41)/40.0;if(xx<=0.5&&yy<=0.5) goto X9;for(int j=1;j<=4;j++){br++,B[br].what=9;B[br].t=11;B[br].x=B[i].x,B[br].y=B[i].y,B[br].vx=xx,B[br].vy=yy;if(j%2==0)swap(B[br].vx,B[br].vy),B[br].vy*=-1;if(j<=2)B[br].vx*=-1,B[br].vy*=-1;B[br].life=1;}B[i].life=0;}}if(B[i].what==8){if(B[i].x>X&&B[i].vx<1.2) B[i].vx+=fmax((float)0,0.2-B[i].t/25);if(B[i].x<X&&B[i].vx>-1.2) B[i].vx-=fmax((float)0,0.2-B[i].t/25);if(B[i].y>Y&&B[i].vy<1.2) B[i].vy+=fmax((float)0,0.2-B[i].t/25);if(B[i].y<Y&&B[i].vy>-1.2) B[i].vy-=fmax((float)0,0.2-B[i].t/25);}}
            if(B[i].what>=13&&B[i].what<=15&&B[i].How!=0){if(B[i].x==B[i].How)B[i].vx=0,B[i].How=0;}
            if(B[i].what==16){if(B[i].x<X&&B[i].vx>=-1) B[i].vx-=0.2;else if(B[i].x>X&&B[i].vx<=1) B[i].vx+=0.2;}
        }
        if(B[i].life==1&&B[i].a==0&&B[i].what>0){if(B[i].y>Y&&abs(B[i].x-X)<=3&&((B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y))<Dis) Dis=(B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y),Disb=i;else if(((B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y))<Dis1) Dis1=(B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y),Disb1=i;}
    }
}
void Guai(int R,int r){
    if(R==-1){br++;B[br].what=-1;B[br].x=X+rand()%3-1;B[br].y=Y+rand()%3-1;B[br].life=1;}
    if(R<=-2&&R>=-11){br++;B[br].what=R;B[br].x=B[br].a=r;B[br].y=29;if(R<=-3&&R>=-7)B[br].vx=-1;B[br].vy=1;B[br].life=1;}
    if(R==0){br++;B[br].what=1;B[br].x=r;B[br].y=29;B[br].vy=1;B[br].life=1;}
    if(R==1){br++;B[br].what=2;B[br].x=r;B[br].y=29;B[br].vy=1;B[br].life=1;}
    if(R==2||R==3){br++;B[br].what=2*R-1;B[br].x=r;B[br].y=29;B[br].vy=1;B[br].life=1;}
    if(R==4){br++;B[br].what=6;if(r<5)r=5;if(r>30)r=30;B[br].x=r;if(r==11||r==25) B[br].y=29-(rand()%20);else B[br].y=29;X4:B[br].vx=(rand()%21-10)/30.0;B[br].vy=(rand()%25)/30.0;if(B[br].vx<=0.8&&B[br].vy<=0.8)goto X4;int rx=rand()%50;if(rx==0) B[br].vx=0;B[br].life=1;}
    if(R==5){br++;B[br].How=r;B[br].what=7;if(B[br].How<0) B[br].x=19;if(B[br].How>0) B[br].x=21;B[br].y=29;B[br].vy=1;B[br].life=1;}
}
void CpGuai(int R,float x,float y,float xx,float yy){
    if(R==4){br++;B[br].what=6;B[br].x=x;B[br].y=y;B[br].vx=xx;B[br].vy=yy;B[br].life=1;}
    if(R==6||R==7||R==8){br++;B[br].what=4+R;B[br].x=x;B[br].y=y;B[br].vx=xx;B[br].vy=yy;B[br].life=1;}
}
void MesGuai(int a,int rr){
    int R=rand()%rr,r=-10086;
    if(R==0){if(a==1) r=(5+rand()%8)*2;if(a<=3&&a!=1) r=10+rand()%16;if(a==4) r=rand()%75-20;if(a==5) r=2+rand()%4;if(r!=-10086) Guai(a,r);}
}
void NorGuai(int a,int b){
    if(a==1) {if(b==1||b==41) Guai(0,15),Guai(0,17),Guai(0,19);if(b==21||b==61) Guai(0,21),Guai(0,23),Guai(0,25);if(b==81) Guai(0,11),Guai(0,13),Guai(0,15),Guai(0,17),Guai(0,19);if(b==101||b==141) Guai(0,17),Guai(0,19),Guai(0,21),Guai(0,23),Guai(0,25);if(b==121) Guai(0,15),Guai(0,17),Guai(0,19),Guai(0,21),Guai(0,23);if(b>=160&&b<=260&&b%10==0) Guai(0,b/10-1);if(b>=270&&b<=370&&b%10==0) Guai(0,52-b/10);if(b>=460&&b<=560&&b%10==0) Guai(0,b/10-37),Guai(0,b/10-36),Guai(0,b/10-35);if(b>=570&&b<=670&&b%10==0) Guai(0,78-b/10),Guai(0,77-b/10),Guai(0,76-b/10);if(b>=760&&b<=960&&b%10==0) Guai(0,b/10-66),Guai(0,b/10-65),Guai(0,103-b/10),Guai(0,104-b/10);if(b>=1000&&b<=1300) MesGuai(0,30-b/50);}
    if(a==2) {if(b<=200&&b%30==1) {int r=rand()%4;if(r==1) r=0;for(int i=0;i<4;i++) if(i!=r) Guai(1,i*4+9);}if(b>200&&b<=220&&b%5==1) Guai(1,18);if(b>220&&b<=300&&b%7==1) Guai(1,b/5-26);if(b>350&&b<=370&&b%5==1) Guai(1,22);if(b>370&&b<=450&&b%7==1) Guai(1,96-b/5);if(b==461||b==501||b==541) Guai(1,13),Guai(1,17),Guai(1,21);if(b==481||b==521||b==561) Guai(1,17),Guai(1,21),Guai(1,25);if(b>=561&&b<=861&&b%20==1) Guai(1,b/40+5);if(b>=561&&b<=861&&b%20==11) Guai(1,35-b/40);if(b>=801&&b<=961&&b%15==1) Guai(1,20);if(b>=1000&&b<=1300) MesGuai(1,30-b/50);}
    if(a==3) {if(b==1||b==61) Guai(3,15),Guai(2,17),Guai(2,19);if(b==31||b==91) Guai(2,21),Guai(2,23),Guai(3,25);if(b>=120&&b<=220&&b%10==0) Guai(2,b/10+3);if(b>=240&&b<=340&&b%10==0) Guai(2,49-b/10);if(b>=360&&b<=460&&b%20==0) Guai(2,b/10-21),Guai(2,61-b/10);if(b>=480&&b<=580&&b%20==0) Guai(3,b/10-33),Guai(3,73-b/10);if(b>=600&&b<750&&b%30==0) {for(int i=0;i<5;i++) Guai(3,i*3+10);}if(b>=750&&b<830&&b%10==0) if(b<=200&&b%40==1) Guai(2,X);if(b>=830&&b<910&&b%20==0) Guai(2,X);if(b>=910&&b<980&&b%10==0) Guai(2,X);if(b>=1000&&b<=1300) MesGuai(rand()%2+2,40-b/50);}
    if(a==4) {if(b==1) CpGuai(4,10,29,-0.4,0.7),CpGuai(4,14,29,-0.2,0.7),CpGuai(4,21,29,0,0.65);if(b==41) CpGuai(4,10,29,-0.2,0.7),CpGuai(4,14,29,-0.1,0.7),CpGuai(4,18,29,0,0.65);if(b==81) CpGuai(4,5,20,-0.4,0.35),CpGuai(4,10,29,-0.4,0.7),CpGuai(4,14,29,-0.2,0.7),CpGuai(4,30,20,0.25,0.4),CpGuai(4,21,29,0,0.65);if(b==121) CpGuai(4,5,20,-0.2,0.35),CpGuai(4,10,29,-0.2,0.7),CpGuai(4,14,29,-0.1,0.7),CpGuai(4,30,20,0.4,0.4),CpGuai(4,18,29,0,0.65);if(b==161) CpGuai(4,10,29,-0.4,0.7),CpGuai(4,14,29,-0.2,0.7),CpGuai(4,21,29,0,0.6),CpGuai(4,10,29,-0.2,0.7),CpGuai(4,14,29,-0.1,0.7),CpGuai(4,18,29,0,0.65);if(b>=200&&b<=500&&b%40==1) {float r=0,rr;for(int i=1;i<=5;i++){X5:rr=0.7+(rand()%5)/10.0;if(rr==r)goto X5;r=rr;CpGuai(4,i*3+7,29,0,0.5+(rand()%50)/80.0);}}if(b>540&&b<=565&&b%5==1) CpGuai(4,5,8,-2,0.2);if(b>590&&b<=615&&b%5==1) CpGuai(4,30,8,1.5,0.2);if(b>640&&b<=665&&b%5==1) CpGuai(4,5,8,-1.5,0.3);if(b>690&&b<=715&&b%5==1) CpGuai(4,30,8,2,0.3);if(b>=750&&b<=950&&b%20==1) {float r=0,rr;for(int i=1;i<=3;i++){X6:rr=0.7+(rand()%5)/10.0;if(rr==r)goto X6;r=rr;CpGuai(4,i*5+7+(rand()%3),29,0,0.5+(rand()%50)/200.0);}}if(b>=1000&&b<=1300) MesGuai(4,5);}
}
void RandGood(){
    if(Biao>0){Biao--;Guai(-1,0);}
    if(Gd[1]==0){Gd[1]=rand()%1000+1;if(Win==7)Gd[1]=10086;Gd[3]=rand()%16+8;}
    else if(Gd[1]<=5){Guai(-2-Gd[1],Gd[3]);memset(Gd,0,sizeof(Gd));}
    else if(Gd[1]>=20&&Gd[1]<27){Guai(-8,Gd[3]);memset(Gd,0,sizeof(Gd));}
    else if(Gd[1]>=30&&Gd[1]<37){Guai(-9,Gd[3]);memset(Gd,0,sizeof(Gd));}
    else if(Gd[1]>=40&&Gd[1]<70){Gd[2]++;if(Gd[2]%2==1)Guai(-10,Gd[3]);if(Gd[2]>=9)memset(Gd,0,sizeof(Gd));}
    else if(Gd[1]>=70&&Gd[1]<100){Gd[2]++;if(Gd[2]%2==1)Guai(-11,Gd[3]);if(Gd[2]>=9)memset(Gd,0,sizeof(Gd));}
    else if(Boss!=0&&Gd[1]>=450&&Gd[1]<=500){Guai(-2,Gd[3]);memset(Gd,0,sizeof(Gd));}
    else Gd[1]=0;
    for(int i=0;i<20;i++){if(I[i][0]==-1) continue;Setpos(I[i][0],I[i][1]);Color(0);if(I[i][0]==20) cout<<"===";else cout<<"   ";I[i][1]++;if(I[i][0]>=28||I[i][0]<=0||I[i][1]>=29) I[i][0]=I[i][1]=-1;else Color(1),Setpos(I[i][0],I[i][1]),cout<<"■";Color(0);}
}
void Panboss(int bx,int by){
    float Nox[4],Noy[4];Nox[0]=X,Noy[0]=Y;
    if(Down==1&&X==22) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;
    else if(Down==2) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;
    else if(Down==1||X<18) Nox[1]=X-1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;
    else Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;
    for(int i=0;i<3;i++){if((Boss==1||Boss==6)&&Wind==0&&Thun==0&&abs(Nox[i]-bx)<1&&abs(Noy[i]-by)<1&&Bgo1[4]==0) Blo-=20,Bgo1[4]=1,Killb=20,Kill=1;if((Boss==2||Boss==6)&&Wind==0&&Thun==0&&abs(Nox[i]-bx)<1&&abs(Noy[i]-by)<1&&Bgo2[8]==0) Blo-=20,Bgo2[8]=1,Killb=20,Kill=1;}
}
void Boss1(){
    for(int j=0;j<20;j++)if(abs(Bx1-I[j][0])<2&&By1-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<"   ";I[j][0]=I[j][1]=-1;Bblo-=8+Lv*2;Exp+=2;}
    if(Bbr==Bbl&&Bbr!=0) Bbr=Bbl=0;
    for(int i=1;i<=3+(Bbl-Bbr)/5;i++)if(Bbr<Bbl){Setpos(Bway[Bbr][0],Bway[Bbr][1]);if(Bway[Bbr][0]==20) cout<<"==";else cout<<"  ";Bbr++;}
    if(Bwhat1==5){int bx,by;Color(5);for(int i=0;i<10;i++){bx=Bx1-i*Bvx1/10.0;by=By1-i*Bvy1/10.0;Setpos(bx,by),cout<<"█";Bbl++;Bway[Bbl][0]=bx;Bway[Bbl][1]=by;}Color(0);}
    Bx1-=Bvx1;By1-=Bvy1;
    if(Bwhat1==0){X2:Bwhat1=rand()%7;if(Bwhat1==2||Bwhat1==3){if(By1<=10||By1>25) goto X2;}if(Bwhat1==4){if(By1<=15||Bx1<20) goto X2;Bgo1[2]=Bx1;Bgo1[3]=By1-1;}if(Bwhat1==5) {X0:Bgo1[3]=rand()%4+1;Bvx1=(rand()%101)/20.0;Bvy1=(rand()%101)/20.0;if(Bgo1[3]<=2) Bvx1*=-1;if(Bgo1[3]%2==1) Bvy1*=-1;if(abs(Bvx1)+abs(Bvy1)<=3||Out1)goto X0;}if(Bwhat1==6){if(By1<=17||By1>25) goto X2;}}
    if(Bwhat1==1){Bgo1[1]++,Bgo1[2]++;int R=rand()%(5-Bgo1[1]),r=rand()%(10-Bgo1[2]);if(Out1) R=0;if(R==0) {int vx=Bvx1,vy=Bvy1;Bgo1[1]=0;Bvx1=(rand()%101-20)/50.0;Bvy1=(rand()%101-20)/50.0;if(Bgo1[3]<=2) Bvx1*=-1;if(Bgo1[3]%2==1) Bvy1*=-1;if(Out1) r=0;} if(r==0) Chang1 }
    if(Bwhat1==2){Bgo1[1]++;if(Bgo1[1]>6){Bvy1=-0.3;br++;B[br].x=Bx1,B[br].y=By1-1;B[br].what=6;X3:B[br].vx=(rand()%21-10)/40.0;B[br].vy=(rand()%25)/30.0;if(B[br].vx<=0.8&&B[br].vy<=0.8)goto X3;int rx=rand()%50;if(rx==0) B[br].vx=0;B[br].life=1;}if(Bgo1[1]>8) Chang1}
    if(Bwhat1==3){Bgo1[1]++;if(Bgo1[1]>6&&Bgo1[1]%3==0){Bvy1=-0.3;br++;B[br].x=Bx1,B[br].y=By1-1;B[br].what=8;B[br].life=1;}if(Bgo1[1]>15) Chang1}
    if(Bwhat1==4){Bgo1[1]++;if(Bgo1[1]<=8){Setpos(Bgo1[2],Bgo1[3]);if(Bgo1[1]==1)cout<<" ";else if(Bgo1[1]>1&&Bgo1[2]==20) cout<<"==";else cout<<"  ";Bgo1[2]--;Setpos(Bgo1[2],Bgo1[3]);int r=rand()%4;if(r%2==0) Color(6);else Color(9);if(r<2) cout<<") ";else cout<<"】";Color(0);}if(Bgo1[1]==6) Bgo1[5]=X,Bgo1[6]=Y;if(Bgo1[1]==11){Map(0,(bool)Kill);Setpos(Bgo1[5],Bgo1[6]+1),cout<<"  ";Setpos(Bgo1[5],Bgo1[6]-1),cout<<"  ";Setpos(Bgo1[5]+1,Bgo1[6]),cout<<"  ";Setpos(Bgo1[5]-1,Bgo1[6]),cout<<"  ";int bx,by,bvx=Bgo1[2]-Bgo1[5],bvy=Bgo1[3]-Bgo1[6];Color(6);int i=0;while(1){bx=Bgo1[2]-i*bvx/30.0;by=Bgo1[3]-i*bvy/30.0;if(bx<=5||bx>=30||by<0||by>=29) break;Panboss(bx,by);Setpos(bx,by),cout<<"█";Bbl++;Bway[Bbl][0]=bx;Bway[Bbl][1]=by;i++;}Color(0);Map(-1,0);Chang1}}
    if(Bwhat1==5){Bgo1[1]++,Bgo1[2]++;int R=rand()%(5-Bgo1[1]),r=rand()%(10-Bgo1[2]);if(Out1) R=0;if(R==0) {int vx=Bvx1,vy=Bvy1;Bgo1[1]=0;X1:Bvx1=(rand()%101-20)/20.0;Bvy1=(rand()%101-20)/20.0;if(Bgo1[3]<=2) Bvx1*=-1;if(Bgo1[3]%2==1) Bvy1*=-1;if(abs(Bvx1)+abs(Bvy1)<=3||abs(Bvx1-vx)<=1||abs(Bvy1-vy)<=1)goto X1;if(Out1) r=0;} if(r==0) Chang1 }
    if(Bwhat1==6){Bgo1[1]++;if(Bgo1[1]>6&&Bgo1[1]%10==0){By1-=1;br++;B[br].x=Bx1,B[br].y=By1-1;B[br].what=9;X30:B[br].vy=1;B[br].life=1;}if(Bgo1[1]>31) Chang1}
}
void Boss2(){
    for(int j=0;j<20;j++)if(abs(Bx2-I[j][0])<2&&By2-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<"   ";I[j][0]=I[j][1]=-1;Bblo-=8+Lv*2;Exp+=2;}
    if(Bbr==Bbl&&Bbr!=0) Bbr=Bbl=0;
    for(int i=1;i<=3+(Bbl-Bbr)/5;i++)if(Bbr<Bbl){Setpos(Bway[Bbr][0],Bway[Bbr][1]);if(Bway[Bbr][0]==20) cout<<"==";else cout<<"  ";Bbr++;}
    Bx2-=Bvx2;By2-=Bvy2;
    if(Bwhat2==0){X21:Bwhat2=rand()%7;if(Bwhat2==2){X31:for(int i=1;i<=3;i++){Bgo2[i*2+1]=rand()%28+1,Bgo2[i*2]=rand()%25+5;if((abs(Bgo2[i*2]-Bx2)<=2&&abs(Bgo2[i*2+1]-By2)<=2)||(abs(Bgo2[i*2]-X)<=2&&abs(Bgo2[i*2+1]-Y)<=2))goto X31;}if(Bgo2[2]==Bgo2[4]||Bgo2[2]==Bgo2[6]||Bgo2[6]==Bgo2[4]||Bgo2[5]==Bgo2[3]||Bgo2[3]==Bgo2[7]||Bgo2[5]==Bgo2[7]) goto X31;}if(Bwhat2==3){Bgo2[2]=rand()%2;}if(Bwhat2==4||Bwhat2==5||Bwhat2==6){Bvy2=-1.5;Bvx2=-0.5;}}
    if(Bwhat2==1){Bgo2[1]++,Bgo2[2]++;int R=rand()%(5-Bgo2[1]),r=rand()%(30-Bgo2[2]);if(Out2) R=0;if(R==0) {int vx=Bvx2,vy=Bvy2;Bgo2[1]=0;Bvx2=(rand()%101-20)/50.0;Bvy2=(rand()%101-20)/50.0;if(Bgo2[3]<=2) Bvx2*=-1;if(Bgo2[3]%2==1) Bvy2*=-1;if(Out2) r=0;} if(r==0) Chang2 }
    if(Bwhat2==2){Bgo2[1]++;float bx,by,bvx,bvy;if(Bgo2[1]<21){for(int i=1;i<=3;i++){bvx=Bgo2[i*2]-Bx2,bvy=Bgo2[i*2+1]-By2;if(Bgo2[1]<=10){Setpos(Bx2+(Bgo2[1]-1)*bvx/10.0,By2+(Bgo2[1]-1)*bvy/10.0);if(abs(Bx2+(Bgo2[1]-1)*bvx/10.0-20)<0.5)cout<<"==";else cout<<"  ";bx=Bx2+Bgo2[1]*bvx/10.0;by=By2+Bgo2[1]*bvy/10.0;Setpos(bx,by);}else Setpos(Bgo2[i*2],Bgo2[i*2+1]);int r=rand()%4;if(r%2==0) Color(3);else Color(10);if(r<=1) cout<<"×";else cout<<"+";Color(0);}}if(Bgo2[1]==21){Map(0,(bool)Kill);Color(3);int j=0;for(int j=0;j<=30;j++)for(int i=1;i<=3;i++)for(int k=1;k<=4;k++){if(k==1) bvx=j,bvy=0;if(k==2) bvx=-j,bvy=0;if(k==3) bvx=0,bvy=j;if(k==4) bvx=0,bvy=-j;bx=Bgo2[i*2]+bvx,by=Bgo2[i*2+1]+bvy;if(bx<=5||bx>=30||by<0||by>=30) {continue;}Panboss(bx,by);Setpos(bx,by),cout<<"█";Bbl++;Bway[Bbl][0]=bx;Bway[Bbl][1]=by;}Color(0);Map(-1,0);Chang2}}
    if(Bwhat2==3){Bgo2[1]++;if(Bgo2[1]<=18){if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<"  ",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<"  ",Color(0),Setpos(20,Bgo2[5]),cout<<"==";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3.5),cout<<"    ",Setpos(Bgo2[4],Bgo2[5]+2.5),cout<<"    ",Color(0),Setpos(20,Bgo2[5]+2.5),cout<<"====",Setpos(20,Bgo2[5]-3.5),cout<<"====";if(Bgo2[1]%4==0)Bgo2[3]=!Bgo2[3];if(Bgo2[1]%6<3)Color(3);else Color(5);if(Bgo2[3]==0) Setpos(X-3,Y),cout<<"▼",Setpos(X+3,Y),cout<<"▲",Bgo2[4]=(int)(X+0.5),Bgo2[5]=(int)(Y+0.5);if(Bgo2[3]==1) Setpos(X,Y-3),cout<<" ",Setpos(X,Y+3),cout<<" ",Bgo2[4]=(int)(X+0.5),Bgo2[5]=(int)(Y+0.5);Color(0);}if(Bgo2[1]==18){if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<"  ",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<"  ",Color(0),Setpos(20,Bgo2[5]),cout<<"==";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3.5),cout<<"    ",Setpos(Bgo2[4],Bgo2[5]+2.5),cout<<"    ",Color(0),Setpos(20,Bgo2[5]+2.5),cout<<"====",Setpos(20,Bgo2[5]-3.5),cout<<"====";}if(Bgo2[1]>18&&Bgo2[1]<=25){Bgo2[3]=Bgo2[2];if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<"  ",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<"  ",Color(0),Setpos(20,Bgo2[5]),cout<<"==";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3.5),cout<<"    ",Setpos(Bgo2[4],Bgo2[5]+2.5),cout<<"    ",Color(0),Setpos(20,Bgo2[5]+2.5),cout<<"====",Setpos(20,Bgo2[5]-3.5),cout<<"====";if(Bgo2[1]%4<2)Color(3);else Color(5);if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<"▼",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<"▲";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3),cout<<" ",Setpos(Bgo2[4],Bgo2[5]+3),cout<<" ";Color(0);}if(Bgo2[1]==25){if(Bgo2[2]==0){Color(3);for(int i=4;i<=29;i++){Setpos(i,Bgo2[5]),cout<<"█";Bbl++;Panboss(i,Bgo2[5]);Bway[Bbl][0]=i;Bway[Bbl][1]=Bgo2[5];}}if(Bgo2[2]==1){Color(3);for(int i=0;i<=28;i++){Setpos(Bgo2[4],i),cout<<"█";Bbl++;Panboss(Bgo2[4],i);Bway[Bbl][0]=Bgo2[4];Bway[Bbl][1]=i;}}Chang2}}
    if(Bwhat2==4||Bwhat2==5||Bwhat2==6){Bgo2[1]++;if(By2>27)Bvy2=0;if(Bx2>23)Bvx2=0;if(Bgo2[1]>13&&Bgo2[1]%3==0){float t=By2-Y,g=0.35;if(Boss==6) t/=2.0;CpGuai(Bwhat2+2,Bx2,By2,(Bx2-X)/t*1.0+(t-1)*g/2.0,1);}if(Bgo2[1]>20) Chang2}
}
void Boss3(){
    #define Bean br++;B[br].what=13;B[br].x=Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;
    for(int j=0;j<20;j++)if(abs(Bx3-I[j][0])<2&&By3-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<"   ";I[j][0]=I[j][1]=-1;Bblo-=8+Lv*2;Exp+=2;}
    Bx3-=Bvx3;By3-=Bvy3;
    if(Bwhat3<=8){if(Bx3>X&&Bvx3<1.5) Bvx3+=0.3;if(Bx3<X&&Bvx3>-1.5) Bvx3-=0.3;}
    if(Bwhat3==0){X22:Bwhat3=rand()%12;if(Bwhat3==11&&abs(Bx3-20)<=1)goto X22;if(Bwhat3==11)Bgo3[2]=rand()%5;}
    if(Bwhat3==1){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].what=13;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=1;B[br].How=(int)Bx3-4;B[br].life=1;br++;B[br].what=13;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=-1;B[br].How=(int)Bx3+2;B[br].life=1;br++;B[br].what=13;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;Chang3}}
    if(Bwhat3>=2&&Bwhat3<=6){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].what=11+Bwhat3;B[br].vy=0.5+(rand()%100)/80.0;if(Bwhat3==5)B[br].vy=B[br].vy*3/4.0;B[br].life=1;Chang3}}
    if(Bwhat3==7){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].what=14;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=1;B[br].How=(int)Bx3-4;B[br].life=1;br++;B[br].what=14;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=-1;B[br].How=(int)Bx3+2;B[br].life=1;br++;B[br].what=14;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;Chang3}}
    if(Bwhat3==8){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].what=15;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=1;B[br].How=(int)Bx3-4;B[br].life=1;br++;B[br].what=15;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=-1;B[br].How=(int)Bx3+2;B[br].life=1;br++;B[br].what=15;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;Chang3}}
    if(Bwhat3==9){Bvx3=0;Bgo3[1]++;if(Bgo3[1]==6||Bgo3[1]==8){Bean}if(Bgo3[1]>=8)Chang3}
    if(Bwhat3==10){Bvx3=0;Bgo3[1]++;if(Bgo3[1]==6||Bgo3[1]==8||Bgo3[1]==10||Bgo3[1]==12){Bean}if(Bgo3[1]>=12)Chang3}
    if(Bwhat3==11){Bvx3=0;Bgo3[1]++;if(Bgo3[1]>=8)for(int i=1;i<=4;i++){br++;B[br].what=80+100*Bgo3[2]+Bgo3[1]*4+i;B[br].x=Bx3-1,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=99;B[br].x=Bx3,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=99;B[br].x=Bx3-2,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;}if(Bgo3[1]>=20){for(int i=1;i<=4;i++){br++;B[br].what=98;B[br].x=Bx3-1,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3-2,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;}Chang3}}
}
void Ball(int ball){
    if(ball==1){if(Fir<3&&T%8==0) Fir++;if(Fir>0){br++;B[br].what=-13;B[br].x=X;B[br].y=Y+rand()%3-1;B[br].life=1;if(Dis<=30) B[br].a=Disb,B[Disb].a=1,Fir--;else if(Boss!=0) B[br].a=13880086,Fir--;else if(Dis!=13880087) B[br].a=Disb,B[Disb].a=1,Fir--;else if(Dis1!=13880087) B[br].a=Disb1,B[Disb1].a=1,Fir--;else B[br].life=0;Dis=Dis1=13880087;}}
    if(ball==2){if(T%4==0)ib=(ib+1)%20,I[ib][1]=Y-2;if(T%16==0)I[ib][0]=X;if(T%16==4)I[ib][0]=X-1;if(T%16==8)I[ib][0]=X+1;if(T%16==12)I[ib][0]=X-2;if(T%12==9)I[ib][0]=X+2;if(Water==1){for(int i=X-6;i<=X+6;i++)ib=(ib+1)%20,I[ib][0]=i,I[ib][1]=Y-2-0.5*abs(i-X);}}
    if(ball==3){if(Wind>5){if(Y<Ding-1)Vy=5;else Vy=0;if(Up>=1) Vx=-5;if(Down==2) Vx=5;}if(Wind<5){if(Y>Ding-1)Vy=-5;else Vy=0;if(Up>=1) Vx=-5;if(Down==2) Vx=5;}if(Wind==5){if(Boss==2) Ding=12.25;else Ding=6.25;if(Boss!=0) Bblo-=16+Lv*4;if(Boss==1) Chang1 if(Boss==2) Chang2 if(Boss==3) Chang3 system("color 3F");Sleep(20);system("color 6F");Sleep(10);system("color 0F");system("cls");for(int i=bl;i<=br;i++)if(B[i].what>0)B[i].life=0;Setpos(20,0);for(int i=1;i<=60;i++) printf("=");}}
    if(ball==4){if(Thun==1){if(Boss!=0) Bblo-=16+Lv*4;if(Boss==1) Chang1 if(Boss==2) Chang2 if(Boss==3) Chang3 system("color 9F");Sleep(20);system("color 6F");Sleep(10);system("color 0F");system("cls");for(int i=bl;i<=br;i++)if(B[i].what>0)B[i].life=0;Setpos(20,0);for(int i=1;i<=60;i++) printf("=");}}
    if(ball==5){system("cls"); Color(5);Setpos(10,10);cout<<"新天赋!";Y:int rr=rand()%4+2;Setpos(12,10);if(rr==Ren) goto Y;if(rr==2)cout<<"瞬跳";if(rr==3)cout<<"空之舞";if(rr==4)cout<<"三段跳";if(rr==5)cout<<"反重力跳跃";Setpos(14,10);cout<<"当前天赋:";if(Ren==1)cout<<"小无敌";if(Ren==2)cout<<"瞬跳";if(Ren==3)cout<<"空之舞";if(Ren==4)cout<<"三段跳";if(Ren==5)cout<<"反重力跳跃";Setpos(16,10);cout<<"换否?(y/n)";G:char g=_getch();if(g=='y')Ren=rr;else if(g!='n')goto G;system("cls");Setpos(20,0);Color(0);for(int i=1;i<=60;i++) printf("=");}
    if(ball==6){Color(4);for(float i=1;i<=Bblo;i+=Bblomax/20.0)cout<<"▄";Color(0);cout<<' '<<Bblo<<"                              ";Color(0);}
    if(ball==7){Color(1);if(Win==7&&T%6<3)Color(3);for(float i=1;i<=Blo;i+=Blomax/20.0)cout<<"▄";Color(0);if(Win==7&&T%6<3)Color(3);printf(" %0.1f                              ",Blo);}
}
int main(){
    system("mode con cols=60 lines=37");CONSOLE_CURSOR_INFO cursor_info={1,0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);srand((unsigned)time(NULL));
    Win=0;Ren=1;Lv=1;Blo=Blomax=100;Expmax=300;Hui=15;X=18,Y=6;
    ReStart:system("cls");memset(B,0,sizeof(B));memset(I,-1,sizeof(I));T=0;bl=0;br=-1;Upt=0;
    Start:Blo=Blomax * 100;Ding=6.25;
    memset(Bgo1,0,sizeof(Bgo1));memset(Bgo2,0,sizeof(Bgo2));memset(Bgo3,0,sizeof(Bgo3));
    if(Win%2==0) T=0;if(Win%2==0&&D==0){if(Win>0)Ball(5);Boss=0;lL:L=rand()%4+1;for(int i=0;i<=Win/2-1;i++)if(L==Ll[i]) goto lL;Ll[Win/2]=L;}if(Win%2==1&&D==0){if(Win==7)Boss=6,T=0,Blomax+=100;else{bl:Boss=rand()%3+1;for(int i=0;i<=3;i++)if(Boss==Bl[i]) goto bl;}Bl[Win/2]=Boss;Bwhat1=Bwhat2=Bwhat3=0,Bx1=10,By1=20,Bx2=15,By2=20,Bx3=21,By3=20;system("color 4C");Sleep(20);system("color 0F");Map(0,1);Sleep(1000);}if(Win%2==1){Bblomax=500+(Win/2)*500;Bblo=Bblomax;if(Boss==2) Ding=12.25;}
    while(1){
        T++;
        if(Wind==0){if(GetAsyncKeyState(VK_LEFT)&0x8000) Vy=-(10-abs(Ding-Y)*1.5)/20.0;if(GetAsyncKeyState(VK_RIGHT)&0x8000) Vy=(10-abs(Ding-Y)*1.5)/20.0;}if(GetAsyncKeyState(VK_UP)&0x8000&&u1==0) {u1++;if(Down==1){Down=0;Up=0;if(Ren==2)Map(-1,0),Vx=0,X=18,Li=5;else Vx=7,Vy=0.3;}else if(Up==0&&Wind==0) {Down=0;Up=1;if(Ren==2)Map(-1,0),Vx=1,X=10,Map(0,3),Li=5;else Vx=2,Vy=0.1;}else if(Up==1&&Wind==0) {Down=0;Up=2;if(Ren==2)Map(-1,0),Vx=1,X-=6,Map(0,3),Li=5;else Vx=1.5,Vy=0.1;}else if(Ren==3&&Up==2&&Wind==0) {Down=0;Up=3;Vx=1;Vy=0.5;Upt=30;}else if(Ren==4&&Up==2&&Wind==0) {Down=0;Up=3;Vx=1.8;Vy=0.1;}}if(GetAsyncKeyState(VK_DOWN)&0x8000&&u2==0) {u2++;if(Down==1&&Ren==5){Down=2;Up=0;Vx=-1.7;}else {Down=1;Up=0;if(Ren==2)Map(-1,0),Vx=0,X=22,Map(0,3),Li=5;else {if(Upt!=0) Map(-1,0),Upt=0;Vx=-7;}}}if((GetAsyncKeyState(VK_UP)&0x8000) ?0:1) u1=0;if((GetAsyncKeyState(VK_DOWN)&0x8000) ?0:1) u2=0;if(kbhit()){char g=_getch();if(g==' ') Sleep(100),Setpos(4,1),Sy++,system("pause");}if(Sy==1) Setpos(4,1),printf("                           "),Sy--;
        if(Drug==0) Blo=fmin((float)Blomax,Blo+Hui/100.0);else if(T%10==0)Blo--;if(T%20==0) {if(Kill!=0) Kill=0;if(Lvl!=0) Lvl=0;}if(Killb>0) Killb--;if(Li>0) Li--;if(Ice>0) Ice--;if(Drug>0) Drug--;if(Magne>0) Magne--;
        if(Fire>0) Ball(1),Fire--;if(Water>0) Ball(2),Water--;if(Wind>0) Ball(3),Wind--;if(Thun>0) Ball(4),Thun--;
        if(Boss==0) NorGuai(L,T%1500);RandGood();if(T%20==1)Exp++;
        if(T%50==1){Exp++;system("cls");Setpos(20,0);Color(0);for(int i=1;i<=60;i++) printf("=");if(Win==0&&T<300){Setpos(4,6);cout<<"↑/↓ 跳跃/下翻,←→ 些微移动(松手即返回)"; Setpos(8,6);cout<<"球可以开启特殊效果,经验积满(300)可提升级别。";Setpos(8,6);cout<<"打败 7 波即胜利,打败 BOSS 有新天赋。";Setpos(10,15);cout<<"空格可以暂停。";}}
        Map(-1,0);
        if(Boss==1) Boss1();if(Boss==2) Boss2();if(Boss==3) Boss3();if(Boss==6) Boss1(),Boss2(),Boss3();
        Move();Map(0,(bool)Kill);Color(0);
        Setpos(1,1);Blo=fmin(Blo,(float)Blomax);if(Boss==0)cout<<"血量: "<<(int)Blo<<"  ";Color(0);Setpos(1,9),cout<<"死亡次数: "<<D<<"  ";Setpos(2,1);Exp=min(Exp,Expmax);if(Exp>=Expmax)Exp=0,Lv++,Lvl++,Hui++,Blomax+=5;if(Lvl>0)Color(5);cout<<"级别: "<<Lv;Color(0);Setpos(2,9);cout<<"经验: "<<Exp<<"  ";if(Boss>0) Setpos(3,1),cout<<"血量     : ",Ball(7);if(Boss>0&&Boss!=6) Setpos(4,1),cout<<"怪物血量: ",Ball(6);if(Boss==6) Setpos(1,9),printf("时间: %0.1f s  ",T/15.0);
        if(Win==0) Sleep(55);if(Win==1) Sleep(50);if(Win==2) Sleep(35);if(Win==3) Sleep(40);if(Win==4) Sleep(25);if(Win==5) Sleep(30);if(Win==6) Sleep(20);if(Win>=7) Sleep(17);
        if(Boss==3&&Bblo<=0){for(int i=1;i<=4;i++){br++;B[br].what=98;B[br].x=Bx3-1,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3-2,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;}}
        if((Win%2==0&&T>=1400)||(Win%2==1&&Bblo<=0)||(Win==7&&T>=450)||Blo<=0) {Map(-1,0);break;}
    }
    if(Blo<=0){
        Sleep(1000);
        D++;
        system("color 7F");
        Setpos(15,11);
        Color(4);
        cout<<"GAME OVER...";
        Sleep(2000);
        goto ReStart;
    }
    else if(Win==6){
        system("color 7F");
        Setpos(15,11);
        Color(4);
        cout<<"坚持30秒 !";
        Sleep(2000);
        Setpos(30,0);
        Win++;
        D=0;
    }
    else if(Win==7){
        Sleep(1000);
        system("color 6E");
        Setpos(15,11);
        Color(5);
        cout<<"YOU WIN !";
        Sleep(2000);
        Setpos(30,0);
        return 0;
    }else Sleep(1000),Win++,D=0;
    goto Start;
}

斗破苍穹

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h> //SLEEP函数
using namespace std;
int boss1=0,boss2=0;
struct Player{//玩家结构体,并初始化player
	char name[21];
	int attack;
	int defense;
	int health;
	long int max_health;
	int level;
	int exp;
	int range_exp;
	long int max_exp;
} player= {"勇者",100,80,200,200,1,0,0,100};
struct Enemy {//怪的结构体,并初始化各种怪
	char name[20];
	char wupin[20];
	int attack;
	int defense;
	int health;
	int money;
	long int exp;
	int wupin_sign;
	int wupinpro;
	int double_attack;
	int miss;
}
//怪,拿格伦石人举例
// 怪变量  怪名     掉落的装备 攻   防  血  金币 经验 掉落装备编号 掉落概率 真伤(被防御后的破甲伤害)   不能改
//  gl= {"格伦石人","石铠甲",  30, 150,1000,500, 250,      11,       7,        1,                         0},
    gl= {"格伦石人","石铠甲",30,150,1000,500,250,11,7,1,0},
    zhizhu= {"洞穴蜘蛛","蜘蛛毒剑",140,20,250,400,200,12,5,1,0},
    ymr= {"野蛮人","粗制石剑",20,20,150,100,50,13,5,1,0},
    nz= {"牛仔","战斗马甲",80,20,250,500,250,14,10,1,0},
    strongman= {"森林巨人","传说圣甲",50,50,580,200,100,1,5,1,0},
    witch= {"兽人","重甲",35,55,250,50,50,2,4,1,1},
    xiyi= {"毒蜴","鳞甲",20,25,80,30,35,3,8,2,2},
    huolong= {"喷火龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},
    lion= {"皇家士兵","尚方宝剑",100,30,380,200,100,5,5,1,0},
    horse= {"独眼巨人","碧血战锤",50,22,360,50,50,6,5,1,1},
    bee= {"剑客","西洋剑",27,11,60,30,35,7,5,2,2},
    shitu= {"凋零女巫","凋零通行证",1400,500,15000,10000,5000,15,10,1,0},
    dljs= {"凋零巨兽","凋零之心",1200,700,20000,10000,5000,10,7,1,0},
    pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},
    dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},
    cl= {"熔岩飞龙","\0",450,50*10,2000,3500,2500,0,0,1,0},
    jl= {"裂凯金龙","金龙铠",500,40*20,5000,8000,4500,9,6,6,1},
    gst={"凋零共生体","命令之书",1800,65*10,15000,0,10000,16,10,1,0},
    dlkl= {"凋零骷髅","\0",3000,30*10,12000,0,10000,0,0,1,0},
    dlfb= {".+*凋零风暴*+.","\0",9000,1500,49000,0,500000,17,10,1,0},
    guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;int he=0;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=400,fang5n=0,fang6=150,fang6n=0,fang7=60,fang7n=0,fang4X=550,fang4Xn=0,mfang=1000,mfangn=0;
int gong=0,gong1=10,gong1n=0,gong2=20,gong2n=0,gong3=45,gong3n=0,gong4=100,gong4n=0,gong5=300,gong5n=0,gong6=150,gong6n=0,gong7=45,gong7n=0,gong4X=500,gong4Xn=0,mgong=1000,mgongn=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
int diaolingxinhave=0,diaolingxin=0,mingshu=0;
char gongname[20]="无",fangname[20]="无";
char proof;
void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);
int main(){
MessageBox (NULL, "欢迎来到斗破苍穹 2.11.1 正式版 !", "斗破苍穹 2.11.1 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(500);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("                _.+=*^--{|欢迎来到 [斗破苍穹] 2.11.1 正式版|}--^*=+.              ");system("color 89");
printf("                          ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                      \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(500);
printf("这里是斗破苍穹(苍穹世界)! 契晋赫苟国的漓嘉茜公主被神秘人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
Sleep(500);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0){
	printf("\n\n\n封印多年的官方血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");
	player.attack=99999;
	player.defense=99999;
	player.health=999999;
	player.max_health=999999;
}
getchar();
OrdinaryAct();
return 0;
}
int SuiJi(){
srand((unsigned)time(NULL));
return rand()%10;
}
int SuiJi100(){
srand((unsigned)time(NULL));
return rand()%100;
}
void ChooseWupin(){//选择物品 并使用
printf("物品: 1,止血草%d个\n\t2,急救包%d个\n\t3,云南白药%d个\n\t4,超级云南白药%d个\n\t5,手雷%d个\n\t6,毒标%d个\n\t7,手抛式原子弹%d个\n\t8,经验草%d个\n\t9,经验包%d个\n\t10,经验石%d个\n\t11,巨龙晶石%d个\n\t12,免死金牌%d个\n\t13,凋零之心%d个\n\t0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi,diaolingxin);system("color 8A");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(cao>0){
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0){
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0){
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0){
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle){//在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
if(boom>0){
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle){ //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
if(dubiao>0){
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle){ //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
if(atom_boom>0){
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200){
printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60;
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1){
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200){
if(player.level>197&&player.level<200){
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20;
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else{
printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100;
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1){
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200){
if(player.level>192&&player.level<200){
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20;
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200;
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<500)
{
if(player.level>482&&player.level<500)
{
int sheng;
sheng=500-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20;
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400;
player.attack+=60;
player.defense+=40;
player.health=player.max_health;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过500级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
cout<<"使";Sleep(50);
cout<<"用";Sleep(50);
cout<<"免";Sleep(50);
cout<<"死";Sleep(50);
cout<<"金";Sleep(50);
cout<<"牌";Sleep(50);
cout<<"HP";Sleep(50);
cout<<"满";Sleep(50);
system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
break;
case 13:
if(diaolingxin>0)
{
printf("使用凋零之心\nHP上限+100  攻击+100\n\n\n");system("color 8b");
diaolingxin--;
player.max_health+=100;
player.attack+=100;
}else printf("没有凋零之心了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult(){ //攻击结果:判断是否获胜 是否获得物品 和 是否升级
	if(guai.health<=0){
	battle=0;
	printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
	player.exp+=guai.exp;
	player.range_exp+=guai.exp;
	money+=guai.money;
	s=SuiJi();
	if(s<guai.wupinpro){
		cout<<"从";Sleep(100);
		cout<<"敌";Sleep(100);
		cout<<"人";Sleep(100);
		cout<<"尸";Sleep(100);
		cout<<"骸";Sleep(100);
		cout<<"中";Sleep(100);
		cout<<"发";Sleep(100);
		cout<<"现";Sleep(100);
		system("color 8C");
		printf("%s\n\n\n",guai.wupin);
		AddWupin(guai.wupin_sign);
	}
	WhetherLevelUp();
	if(strcmp(guai.name,"*凋零巨兽*")==0){
	printf("你把公主救了出来\n\n你从公主口中得知了一个更大的阴谋,你可以进入凋零世界\n\n");
	system("color 8C");
	}
	return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();

if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{

switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
case 10:
diaolingxin++;
break;
case 11:
fang6n++;
break;
case 12:
gong6n++;
break;
case 13:
gong7n++;
break;
case 14:
fang7n++;
break;
case 15:
diaolingxinhave++;
boss1++;
break;
case 16:
mingshu++;
break;
case 17:
boss2++;
break;
default:
printf("AddWupin error\n\n\n");
}

}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/150;
int l2=player.range_exp/300;
int l3=player.range_exp/600;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
player.level+=l1;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100*l1;
}
}
else if(player.level<=40&&l2>0)
{
if(l2==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
player.level+=l2;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300*l2;
}
}
else if(l3>0)
{
if(l3==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{

while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,后台 8,合成台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
//printf("  ");
cout<<"1,小郑子酒吧  ";Sleep(150);
cout<<"2,诺亚方舟酒店  ";Sleep(150);
cout<<"3,北朝商会  ";Sleep(150);
cout<<"4,红玉拍卖行  ";Sleep(150);
cout<<"5,冒险荒野\n\n\n";Sleep(150);system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 \n 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n");system("color 89");
cout<<"1,攻击装备 ";Sleep(50);
cout<<"2,防御装备 ";Sleep(50);
cout<<"3,一次性伤害武器\n\n\n";Sleep(50);
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;

}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,鳞甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}

break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("鳞甲+1\n");system("color 89");
printf("鳞甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;

}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}

break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%n 4,碧血战锤:%d个 5,蜘蛛毒剑:%n个 6,尚方宝剑:%d个 7,皮卡大剑:%d个\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,鳞甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,金龙铠:%d个 15,巨龙晶石:%d个\n 0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong7n>=shu)
{
gong7n=gong7n-shu;
money=money+shu*800;
printf("粗制石剑:%d\n",gong7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong6n>=shu)
{
gong6n=gong6n-shu;
money=money+shu*1000;
printf("蜘蛛毒剑:%d\n",gong6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("鳞甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang7n>=shu)
{
fang7n=fang7n-shu;
money=money+shu*1000;
printf("战斗马甲:%d\n",fang7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 12:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang6n>=shu)
{
fang6n=fang6n-shu;
money=money+shu*2000;
printf("石凯甲:%d\n",fang6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 13:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}

case 14:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("金龙铠:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 15:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}
break;
case 5:
int yewai;
while(1){
puts("=============================================================================");
printf("要去哪冒险呢?");system("color 8c");
printf("\n\n");
cout<<"1,神秘沼泽 危险程度:★\n\n";Sleep(50);system("color 8c");
cout<<"2,星耀草原 危险程度:★★★\n\n";Sleep(50);
cout<<"3,诡异森林 危险程度:★★★\n\n";Sleep(50);
cout<<"4,荒漠矿场 危险程度:★★★★\n\n";Sleep(50);
cout<<"5,炽热炎洞 危险程度:★★★★★\n\n";Sleep(50);
cout<<"6,皮卡营地 危险程度:★★★★★★\n\n";Sleep(50);
cout<<"7,花朵宫殿 危险程度:★★★★★★\n\n";Sleep(50);
cout<<"8,熔岩龙穴 危险程度:★★★★★★★\n\n";Sleep(50);
cout<<"9,凋零宇宙 危险程度:★★★★★★★★\n\n";Sleep(50);
cout<<"0,离开\n";Sleep(150);
system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<4)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
battle=1;
guai=zhizhu;
printf("可怕的%s爬了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<=3){
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=huolong;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
} else if(s<8){
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=zhizhu;
printf("可怕的%s扑爬了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<=3){
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else if(s<8){
battle=1;
guai=ymr;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7){
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();}
else{
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 6:
s=SuiJi();
if(s<7){
battle=1;
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9){
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1;
guai=cl;
printf("一条飞龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1;
guai=huolong;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的飞龙盘旋空中,,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<5){
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<7||boss1==0){
battle=1;
if(strongman_arm>=1){
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 9:
s=SuiJi();
if(diaolingxinhave!=0){
if(s==1&&boss2==0){
battle=1;
guai=dlfb;
printf("一个巨大的黑暗物体,周围环绕着大量的由破碎方块组成的黑色颗粒云环的%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}else if(s>=2 && s<=4)
{
battle=1;
guai=dlkl;
printf("手持凋零剑的黑色凶恶%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s>=5&&s<=7){
battle=1;
guai=gst;
printf("一个巨大的触手向你打来,你挡了下来%s扑了过来!\n\n\n",guai.name);
BattleAct();
} else{
battle=1;
guai=dljs;
printf("一只巨大的猛兽%s冲了过来!\n\n\n",guai.name);
BattleAct();
}
}if(diaolingxinhave==0){
cout<<"你没有击败过凋零女巫,请去花朵宫殿击败凋零女巫。" <<endl;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}

}
break;

case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");

}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;

}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%d个 4,碧血战锤:%d个 5,蜘蛛毒剑:%d个 6,尚方宝剑:%d个 7,雷霆之刃:%d个 8,X尚方宝剑X:%d个 9,命令之剑:%d个\n\n\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n,gong4Xn,mgongn);system("color 89");
printf("防御装备: 10,布衣:%d个 11,鳞甲:%d个 12,战斗马甲:%d个 13,重甲:%d个 14,石铠甲:%d个 15,传说圣甲:%d个 16,金龙铠:%d个 17,X传说圣甲X:%d个 18,命令之甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n,fang4Xn,mfangn);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong7n>=1){
printf("拿起了粗制石剑\n\n\n");
gong=gong7;
strcpy(gongname,"粗制石剑");
}
else printf("你没有粗制石剑可以装备\n\n\n");
break;
case 4:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 5:
if(gong6n>=1){
printf("拿起了蜘蛛毒剑\n\n\n");
gong=gong6;
strcpy(gongname,"蜘蛛毒剑");
}
else printf("你没有蜘蛛毒剑可以装备\n\n\n");
break;
case 6:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 7:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 8:
if(gong4Xn>=1){
printf("拿起了X尚方宝剑X\n\n\n");
gong=gong4X;
strcpy(gongname,"X尚方宝剑X");
}
else printf("你没有X尚方宝剑X可以装备\n\n\n");
break;
case 9:
if(mgongn>=1){
printf("拿起了命令之剑\n\n\n");
gong=mgong;
strcpy(gongname,"命令之剑");
}
else printf("你没有命令之剑可以装备\n\n\n");
break;
case 10:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 11:
if(fang2n>=1){
printf("穿上了鳞甲\n\n\n");
fang=fang2;
strcpy(fangname,"鳞甲");
}
else printf("你没有鳞甲可以装备\n\n\n");
break;
case 12:
if(fang7n>=1){
printf("穿上了战斗马甲\n\n\n");
fang=fang7;
strcpy(fangname,"战斗马甲");
}
else printf("你没有战斗马甲可以装备\n\n\n");
break;
case 13:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 14:
if(fang6n>=1){
printf("穿上了石铠甲\n\n\n");
fang=fang6;
strcpy(fangname,"石凯甲");
}
else printf("你没有石凯甲可以装备\n\n\n");
break;
case 15:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 16:
if(fang5n>=1){
printf("穿上了金龙铠\n\n\n");
fang=fang5;
strcpy(fangname,"金龙铠");
}
else printf("你没有金龙铠可以装备\n\n\n");
break;
case 17:
if(fang4Xn>=1){
printf("穿上了X传说圣甲X\n\n\n");
fang=fang4X;
strcpy(fangname,"X传说圣甲X");
}
else printf("你没有X传说圣甲X可以装备\n\n\n");
break;
case 18:
if(mfangn>=1){
printf("穿上了命令之甲\n\n\n");
fang=mfang;
strcpy(fangname,"命令之甲");
}
else printf("你没有命令之甲可以装备\n\n\n");
break;
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩斗破苍穹(苍穹世界)。");
cout<<"为了给您更好的游戏体验,";Sleep(250);
cout<<"zty时不时会优化本游戏,";Sleep(250);
cout<<"优化后会尽快发布在网上。";Sleep(250);
cout<<"关于外挂方面,";Sleep(250);
cout<<"开启外挂的方式是设定勇者姓名时,";Sleep(250);
cout<<"输入";Sleep(250);
cout<<"“";Sleep(250);
cout<<"z";Sleep(250);
cout<<"t";Sleep(250);
cout<<"y";Sleep(250);
cout<<"”";Sleep(250);
cout<<"(不包括双引号)。";Sleep(250);
cout<<"我们在";Sleep(250);
cout<<"2.";Sleep(250);
cout<<"10";Sleep(250);
cout<<"版本内容";Sleep(250);
cout<<"的基础上进行更新·,";Sleep(250);
cout<<"主要内容为命令武器装备和合成功能";Sleep(250);
cout<<"已更新完毕,。";Sleep(250);
cout<<"希望大家喜欢。";Sleep(250);
cout<<"在这里要感谢";Sleep(250);
cout<<"吴";Sleep(250);
cout<<"昊";Sleep(250);
cout<<"同学,";Sleep(250);
cout<<"他给了我许多宝贵的建议,";Sleep(250);
cout<<"谢";Sleep(250);
cout<<"谢";Sleep(250);
cout<<"。\n";Sleep(250);
system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
case 8:
printf("合成台:                   0:退出\n\n");system("color 89");
cout<<"命令之书:"<<mingshu<<"\n1: 命令之剑   需要材料:1*X尚方宝剑X + 1*命令之书\n\n";Sleep(150);
cout<<"2:X尚方宝剑X  需要材料:1* 尚方宝剑  + 1*命令之书\n\n";Sleep(150);
cout<<"3: 命令之甲   需要材料:1*X传说圣甲X + 1*命令之书\n\n";Sleep(150);
cout<<"4:X传说圣甲X  需要材料:1* 传说圣甲  + 1*命令之书\n\n";Sleep(150);
cin>>he;
if(he==1)
if(he==1&&gong4Xn>=1&&mingshu>=1){
	gong4Xn--;
	mingshu--;
	mgongn++;
	cout<<"恭喜获得命令之剑\n";
}else cout<<"材料不足\n\n";
if(he==2)
if(he==2&&gong4n>=1&&mingshu>=1){
	gong4n--;
	mingshu--;
	gong4Xn++;
	cout<<"恭喜获得X尚方宝剑X\n";
}else cout<<"材料不足\n\n";
if(he==3)
if(he==3&&fang4Xn>=1&&mingshu>=1){
	fang4Xn--;
	mingshu--;
	mfangn++;
	cout<<"恭喜获得命令之甲\n";
}else cout<<"材料不足\n\n";
if(he==4)
if(he==4&&fang4n>=1&&mingshu>=1){
	fang4n--;
	mingshu--;
	fang4Xn++;
	cout<<"恭喜获得X传说圣甲X\n";
}else cout<<"材料不足\n\n";
if(he==0) break;
break;
case 7:
	int mi;
	cout<<"=====*【后台 开挂 测试Bug】*==================\n请输入密码=============*【想要后台密码问郑桐羽,只能输数字,否则死循环】*=========\n密码:";
	cin>>mi;
	if(mi%20120913==0&&mi!=0){
		cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加999999\n2.血量上限加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n0.退出\n=======================\n输入>>> "<<endl;
		cin>>htsr;
		if(htsr==1){
			cout<<"成功获得效果 *金币加9999\n";
			money+=999999;
		}
		if(htsr==2){
			cout<<"成功获得效果 *血量加9999\n";
			player.health+=9999;
		}
		if(htsr==3){
			cout<<"成功获得效果 *血量上限加9999\n";
			player.max_health+=9999;
		}
		if(htsr==4){
			cout<<"成功获得效果 *攻击加9999\n";
			player.attack+=9999;
		}
		if(htsr==5){
			cout<<"成功获得效果 *防御加9999\n";
			player.defense+=9999;
		}
		if(htsr==0){
			cout<<"成功退出\n";
			continue;
		}
    }
	else{
	    cout<<"输入错误!请检查!"<<endl;
	    continue;
    }

    break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,使用物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
}

坦克大战

下面为图片以及音频资源的百度网盘链接:
链接:https://pan.baidu.com/s/1oVby950ePiM0vF49DZPqnw
提取码:s5tt

将图片以及音频保存在生成的.cpp 所在的文件中即可

#include <graphics.h>         //引用easyX图形库
#include <Windows.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <MMSystem.h>
#pragma comment(lib,"winmm.lib")           //导入声音库

#define ENENMY_TANK_NUMBER 10
bool flag = 1;
enum DIRECTION {UP,DOWN,LEFT,RIGHT};        //坦克的方向
	  //坦克结构体

struct TANK
{
	int tank_x;
	int tank_y;
	int direction;          //判断坦克方向,从而确定子弹的飞行轨迹    1 为上 ,2为下 , 3为左, 4为右
	bool state;
};
	 //子弹结构体
struct BULLET
{
	int bullet_x;
	int bullet_y;
	DIRECTION direction;
	bool state;
};
//0 为空 1为可消除墙  2为不可消除墙  3,4为老家
int map[26][26] = {
	{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
	{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,2,2,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,2,2,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0 },
	{ 0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0 },
	{ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1 },
	{ 2,2,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,2,2 },
	{ 0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0 },
	{ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,1,1,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,0,0 },
	{ 0,0,0,0,0,0,0,0,0,0,0,1,3,4,1,0,0,0,0,0,0,0,0,0,0,0 },
	{ 0,0,0,0,0,0,0,0,0,0,0,1,4,4,1,0,0,0,0,0,0,0,0,0,0,0 }
};

	//*******************  游戏首界面   **********************
void outputPage1()
{
	IMAGE logoImg;
	loadimage(&logoImg, _T("logo.bmp"), 433, 147);
	putimage(113, 40, &logoImg);

	IMAGE illustrate;
	loadimage(&illustrate, _T("illustrate.jpg"), 300, 300);
	settextcolor(RGB(255, 255, 255));
	settextstyle(30, 0, _T("微软雅黑"));
	rectangle(195, 200, 275, 240);
	rectangle(375, 200, 455, 240);
	outtextxy(210, 205, _T("说 明"));
	outtextxy(390, 205, _T("开 始"));

	//****************  检测鼠标事件  *********************
	MOUSEMSG m;
	while (1)
	{
		m = GetMouseMsg();
		switch (m.uMsg)
		{
			case WM_MOUSEMOVE:
				if ((m.x >= 195 && m.x <= 275) && (m.y >= 200 && m.y <= 240))
				{
					putimage(150, 250, &illustrate);
				}
				else
				{
					setfillcolor(BLACK);
					solidrectangle(150, 250, 450, 550);
				}
				break;

			case WM_LBUTTONDOWN:
				if ((m.x >= 375 && m.x <= 455) && (m.y >= 200 && m.y <= 240))
				{
					cleardevice();
					return;
				}
				break;

		}

	}

}

//***************** 游戏初始化界面 ****************
void outputPage2()
{
	IMAGE brick1;
	IMAGE brick2;
	IMAGE home;
	loadimage(&home, _T("home.jpg"), 50, 50);
	loadimage(&brick1, _T("wall1.jpg"), 25, 25);
	loadimage(&brick2, _T("wall2.jpg"), 25, 25);
	for (int i=0; i < 26; i++)
	{
		for(int j=0;j<26;j++)
		{
			switch (map[i][j])
			{
			case 1:putimage(25 * j, 25 * i, &brick1); break;
			case 2:putimage(25 * j, 25 * i, &brick2); break;
			case 3:
				putimage(25 * j, 25 * i, &home);
				map[i][j] = 4;
				break;
			}
		}
	}
	return;
}
//********** 修改地图数组参数函数 ************
void map_par(TANK *tank,int n)
{
	map[tank->tank_y][tank->tank_x] = n;
	map[tank->tank_y + 1][tank->tank_x] = n;
	map[tank->tank_y][tank->tank_x + 1] = n;
	map[tank->tank_y + 1][tank->tank_x + 1] = n;
}
//***************  坦克移动  *****************
int tankMove(TANK *tank, DIRECTION direction, IMAGE *img,int n)
{
	map_par(tank,0);
	setfillcolor(BLACK);
	solidrectangle(tank->tank_x * 25, tank->tank_y * 25, tank->tank_x * 25 + 50, tank->tank_y * 25 + 50);  //覆盖坦克原来位置
	if (direction == UP)
	{
		tank->tank_y --;
	}
	else if (direction == DOWN)
	{
		tank->tank_y ++;
	}
	else if (direction == LEFT)
	{
		tank->tank_x --;
	}
	else if (direction == RIGHT)
	{
		tank->tank_x ++;
	}
	else
	{
		return 0;
	}
	map_par(tank, n);
	putimage(tank->tank_x * 25, tank->tank_y * 25, img);              //输出坦克移动后位置

}

// *****************************   使敌方坦克朝着目标的方向前进 *********************
DIRECTION enemyMove(TANK *Etank, int x, int y)
{
	int r = rand() % 100;
	if (y < Etank->tank_y )
	{
		if (x < Etank->tank_x)
		{
			if(r<50)
				return UP;
			else
				return LEFT;
		}
		else if(x > Etank->tank_x)
		{
				if (r<50)
					return UP;
				else
					return RIGHT;
		}
		else if(x == Etank->tank_x)
		{
			if (map[Etank->tank_y - 1][Etank->tank_x] == 2)
			{
				if (r < 50)
					return LEFT;
				else
					return RIGHT;
			}
			return UP;
		}
	}
	else if (y > Etank->tank_y)
	{
		if (x < Etank->tank_x)
		{
			if (r<50)
				return DOWN;
			else
				return LEFT;
		}
		else if(x > Etank->tank_x)
		{
				if (r<50)
					return DOWN;
				else
					return RIGHT;
		}
		else if (x == Etank->tank_x)
		{
			if (map[Etank->tank_y + 2][Etank->tank_x] == 2)
			{
				if (r < 50)
					return LEFT;
				else
					return RIGHT;
			}
			return DOWN;
		}
	}
	else if (y == Etank->tank_y)
	{
		if (x < Etank->tank_x)
			return LEFT;
		else
			return RIGHT;
	}
}

//**********************  游戏结束 ********************
void putGameOver()
{
	IMAGE gameOver;
	loadimage(&gameOver,_T("gameover.jpg"), 600, 400);
	for (int i = 0; i < 130; i++)
	{
		cleardevice();
		putimage(25, i, &gameOver);
		Sleep(15);
	}
	system("pause");

}
void victory()
{
	cleardevice();
	settextcolor(RED);
	settextstyle(300, 70, _T("微软雅黑"));
	outtextxy(80, 150, _T("Victory"));
}
void tankFire(TANK *tank, BULLET *bullet,bool need)
{
	if (bullet->state == 0)          //坦克状态为0(即子弹已不存在)方可再次射击
	{
		if (need)
		{
			PlaySound(_T("boom.wav"), NULL, SND_FILENAME | SND_ASYNC);
		}
		switch (tank->direction)
		{
		case UP:
			bullet->bullet_x = tank->tank_x * 25 + 25;
			bullet->bullet_y = tank->tank_y * 25 - 3;
			break;
		case DOWN:
			bullet->bullet_x = tank->tank_x * 25 + 25;
			bullet->bullet_y = tank->tank_y * 25 + 53;
			break;
		case LEFT:
			bullet->bullet_x = tank->tank_x * 25 - 3;
			bullet->bullet_y = tank->tank_y * 25 + 25;
			break;
		case RIGHT:
			bullet->bullet_x = tank->tank_x * 25 + 53;
			bullet->bullet_y = tank->tank_y * 25 + 25;
			break;

		}
		bullet->state = 1;
		bullet->direction = DIRECTION(tank->direction);
	}
}
void putTankBoom(int x,int y)
{
	IMAGE img[8];
 /* char name[32];
	for (int i = 0; i < 8; i++)
	{
		sprintf_s(name, 32, "blast%d.gif", i + i);
		loadimage(&img[i], name, 50, 50);
	}     */
	loadimage(&img[0], _T("blast1.gif"), 50, 50);
	loadimage(&img[1], _T("blast2.gif"), 50, 50);
	loadimage(&img[2], _T("blast3.gif"), 50, 50);
	loadimage(&img[3], _T("blast4.gif"), 50, 50);
	loadimage(&img[4], _T("blast5.gif"), 50, 50);
	loadimage(&img[5], _T("blast6.gif"), 50, 50);
	loadimage(&img[6], _T("blast7.gif"), 50, 50);
	loadimage(&img[7], _T("blast8.gif"), 50, 50);
	for (int i = 0; i < 8; i++)
	{
		putimage(x*25, y*25, &img[i]);
		Sleep(10);
	}
}
//  ***************************  对子弹进行碰撞检测  **************************
void  bulletMove(BULLET *bullet,bool &flag,int tell,TANK *tank,int &enemyAlive)
{
	IMAGE Wall2;
	loadimage(&Wall2, _T("wall2.jpg"), 25, 25);
	setfillcolor(BLACK);
	solidcircle(bullet->bullet_x, bullet->bullet_y, 2);
	int x1, y1, x2, y2;
	x1 = bullet->bullet_x / 25;
	y1 = bullet->bullet_y / 25;
	switch (bullet->direction)              //判断子弹方向
	{
	case UP:
		bullet->bullet_y -= 3;
		x2 = x1 - 1;
		y2 = y1;
		break;
	case DOWN:
		bullet->bullet_y += 3;
		x2 = x1 - 1;
		y2 = y1;
		break;
	case LEFT:
		bullet->bullet_x -= 3;
		x2 = x1;
		y2 = y1 - 1;
		break;
	case RIGHT:
		bullet->bullet_x += 3;
		x2 = x1;
		y2 = y1 - 1;
		break;
	}

	if (bullet->bullet_x < 0 || bullet->bullet_x>650 || bullet->bullet_y < 0 || bullet->bullet_y>650)
	{
		bullet->state = 0;
		return ;
	}
//***************  子弹碰到可消除墙,消除墙,同时让子弹的状态变为 0
	if (map[y1][x1] == 1 && map[y2][x2]==1)
	{
		setfillcolor(BLACK);
		solidrectangle(x1 * 25, y1 * 25, x1 * 25 + 25, y1 * 25 + 25);
		solidrectangle(x2 * 25, y2 * 25, x2 * 25 + 25, y2 * 25 + 25);
		map[y1][x1] = 0;
		map[y2][x2] = 0;
		bullet->state = 0;
		return ;
	}
	else if (map[y1][x1] == 1 && map[y2][x2] == 0)
	{
		setfillcolor(BLACK);
		solidrectangle(x1 * 25, y1 * 25, x1 * 25 + 25, y1 * 25 + 25);
		map[y1][x1] = 0;
		bullet->state = 0;
		return ;
	}
	else if (map[y1][x1] == 0 && map[y2][x2] == 1)
	{
		setfillcolor(BLACK);
		solidrectangle(x2 * 25, y2 * 25, x2 * 25 + 25, y2 * 25 + 25);
		map[y2][x2] = 0;
		bullet->state = 0;
		return ;
	}
	else if (map[y1][x1] == 2 && map[y2][x2]==2)   //子弹碰到不可消除墙,重新绘制白墙图片,否则墙上会有弹坑,并且令子弹状态为0
	{
		putimage(x1 * 25, y1 * 25, &Wall2);
		putimage(x2 * 25, y2 * 25, &Wall2);
		bullet->state = 0;
		return ;
	}
	else if (map[y1][x1] == 2 && map[y2][x2] != 2)
	{
		putimage(x1 * 25, y1 * 25, &Wall2);
		bullet->state = 0;
		return ;
	}
	else if (map[y1][x1] != 2 && map[y2][x2] == 2)
	{
		putimage(x2 * 25, y2 * 25, &Wall2);
		bullet->state = 0;
		return ;
	}
	if (map[y1][x1] == 4 && map[y2][x2] == 4)
	{
		flag = 0;
	}
	if (tell)                 //如果tell 不为0   为我方坦克子弹碰撞检测
	{
		if ((map[y1][x1] >= 100 && map[y1][x1] <= 109) || (map[y2][x2] >= 100 && map[y2][x2] <= 109))
		{
			PlaySound(_T("hit.wav"), NULL, SND_FILENAME | SND_ASYNC);
			setfillcolor(BLACK);
			TANK *Tank = NULL;
			bullet->state = 0;
			if (map[y1][x1] >= 100 && map[y1][x1] <= 109)
			{
				Tank = map[y1][x1] - 100 + tank;
			}
			else if(map[y2][x2] >= 100 && map[y2][x2] <= 109)
			{
				Tank = map[y2][x2] - 100 + tank;
			}
			Tank->state = 0;
			map_par(Tank , 0);
			enemyAlive--;
			putTankBoom(Tank->tank_x, Tank->tank_y);
			solidrectangle(Tank->tank_x * 25, Tank->tank_y * 25, Tank->tank_x * 25 + 50, Tank->tank_y * 25 + 50);
		}
	}
	else                         //如果tell为0  为敌方坦克检测
	{
		if ((map[y1][x1] == 200 && map[y1][x1] == 200) || (map[y2][x2] == 200 && map[y2][x2] == 200))
		{
			bullet->state = 0;
			map_par(tank, 0);
			enemyAlive--;
			tank->state = 0;
			putTankBoom(tank->tank_x, tank->tank_y);
			flag = 0;
			return;
		}
		else if ((map[y1][x1] >= 100 && map[y1][x1] <= 109) || (map[y2][x2] >= 100 && map[y2][x2] <= 109))
		{
			bullet->state = 0;
		}
	}
	if (bullet->state == 1)
	{
		setfillcolor(WHITE);
		solidcircle(bullet->bullet_x, bullet->bullet_y, 2);
	}
}

// ******************************* 坦克移动控制 *****************************
void allTankMove(TANK *tank, DIRECTION direction, IMAGE *img,int n)
{
	switch (direction)
	{                                   //坦克向前
	case UP:
		if (tank->direction == UP && (tank->tank_y - 1) >= 0 && map[tank->tank_y - 1][tank->tank_x] == 0 && map[tank->tank_y - 1][tank->tank_x + 1] == 0)
		{
			tankMove(tank, UP, img,n);
		}
		else if (tank->direction != UP)
		{
			tank->direction = UP;
			putimage(tank->tank_x * 25, tank->tank_y * 25, img);
		}
		break;                                       //坦克向后
	case DOWN:
		if (tank->direction == DOWN && (tank->tank_y + 2) <= 25 && map[tank->tank_y + 2][tank->tank_x] == 0 && map[tank->tank_y + 2][tank->tank_x + 1] == 0)
		{
			tankMove(tank, DOWN, img,n);
		}
		else if (tank->direction != DOWN)
		{
			tank->direction = DOWN;
			putimage(tank->tank_x * 25, tank->tank_y * 25, img);
		}
		break;                                           //坦克向左
	case LEFT:
		if (tank->direction == LEFT && (tank->tank_x - 1) >= 0 && map[tank->tank_y][tank->tank_x - 1] == 0 && map[tank->tank_y + 1][tank->tank_x - 1] == 0)
		{
			tankMove(tank, LEFT, img,n);
		}
		else if (tank->direction != LEFT)
		{
			tank->direction = LEFT;
			putimage(tank->tank_x * 25, tank->tank_y * 25, img);
		}
		break;                                               //坦克向右
	case RIGHT:
		if (tank->direction == RIGHT && (tank->tank_x + 2) <= 25 && map[tank->tank_y][tank->tank_x + 2] == 0 && map[tank->tank_y + 1][tank->tank_x + 2] == 0)
		{
			tankMove(tank, RIGHT, img,n);
		}
		else if (tank->direction != RIGHT)
		{
			tank->direction = RIGHT;
			putimage(tank->tank_x * 25, tank->tank_y * 25, img);
		}
		break;
	}
}
//*********************   游戏开始控制我方坦克  ********************
void gameStart()
{
	srand((unsigned)time(NULL));
	int times = 0;                            //记录当前程序的休眠次数
	int enemyTotal = 0;
	int enemyAlive = 10;
	//PlaySound(TEXT("background.wav"), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
	//***********************  我方坦克 ********************
	TANK myTankMove;                              //己方坦克
	BULLET myBulletMove;                           //己方子弹
	IMAGE myTank_img[4];
	loadimage(&myTank_img[UP], _T("tank_up.jpg"), 50, 50);
	loadimage(&myTank_img[DOWN], _T("tank_down.jpg"), 50, 50);
	loadimage(&myTank_img[LEFT], _T("tank_left.jpg"), 50, 50);
	loadimage(&myTank_img[RIGHT], _T("tank_right.jpg"), 50, 50);
	myTankMove.tank_x = 8;                           //初始化己方坦克位置
	myTankMove.tank_y = 24;
	myTankMove.direction = UP;
	myTankMove.state = true;
	map_par(&myTankMove, 200);
	putimage(myTankMove.tank_x*25, myTankMove.tank_y*25, &myTank_img[myTankMove.direction]);                           //初始化己方坦克方向
	myBulletMove.direction =DIRECTION (myTankMove.direction);
	myBulletMove.state = 0;
	//***************************  敌方坦克 *********************
	TANK enemyTank[ENENMY_TANK_NUMBER];
	BULLET enemyBUllet[ENENMY_TANK_NUMBER];
	IMAGE enemyTank_img[4];
	loadimage(&enemyTank_img[UP], _T("enemy_tank_up.gif"), 50, 50);
	loadimage(&enemyTank_img[DOWN], _T("enemy_tank_down.gif"), 50, 50);
	loadimage(&enemyTank_img[LEFT], _T("enemy_tank_left.gif"), 50, 50);
	loadimage(&enemyTank_img[RIGHT], _T("enemy_tank_right.gif"), 50, 50);
	for (int i = 0; i < ENENMY_TANK_NUMBER; i++)
	{
		enemyTank[i].tank_y = 0;
		if (i % 3 == 0)
		{
			enemyTank[i].tank_x = 0;
		}
		else if (i % 3 == 1)
		{
			enemyTank[i].tank_x = 12;
		}
		else if (i % 3 == 2)
		{
			enemyTank[i].tank_x = 24;
		}
		enemyTank[i].state = true;
		enemyTank[i].direction = DOWN;
		enemyBUllet[i].direction = DIRECTION(enemyTank[i].direction);
		enemyBUllet[i].state = 0;
	}
	for (int i = 0; i < 3; i++)
	{
		map_par(&enemyTank[i], 100 + i);
		putimage(enemyTank[i].tank_x * 25, enemyTank[i].tank_y * 25, &enemyTank_img[DOWN]);
	}
	enemyTotal = 3;
	// ***************   检测键盘事件  *******************
	bool Flag = 1;
	while (1)
	{
		//其他坦克出场
		if (times % 400 == 0 && times != 0&&enemyTotal<= ENENMY_TANK_NUMBER)
		{
			//increase++;
			map_par(&enemyTank[enemyTotal], 100 + enemyTotal);
			putimage(enemyTank[enemyTotal].tank_x * 25, enemyTank[enemyTotal].tank_y * 25, &enemyTank_img[DOWN]);
			enemyTotal++;
		}
		// 控制地方坦克改变方向
		if (times % 200 == 0)
		{
			for (int i = 0; i < enemyTotal; i++)
			{
				if (enemyTank[i].state)
				{
					DIRECTION NowDirection;
					if (i % 2 == 0)        //双数坦克攻击我方老巢
					{
						NowDirection = enemyMove(&enemyTank[i], 12, 24);
						allTankMove(&enemyTank[i], NowDirection, &enemyTank_img[NowDirection], 100 + i);
					}
					else                    //单数坦克攻击我方坦克
					{
						NowDirection = enemyMove(&enemyTank[i], myTankMove.tank_x, myTankMove.tank_y);
						allTankMove(&enemyTank[i], NowDirection, &enemyTank_img[NowDirection], 100 + i);
					}
					tankFire(&enemyTank[i], &enemyBUllet[i],false);
				}
			}
		}
		else if (times % 50 == 0)   //控制敌方坦克移动
		{
				for (int i = 0; i < enemyTotal; i++)
				{
						if (enemyTank[i].state)
						{
							allTankMove(&enemyTank[i], DIRECTION(enemyTank[i].direction), &enemyTank_img[enemyTank[i].direction], 100 + i);
						}
				}

		}
		// *********************************   我方坦克移动、射击控制 ****************************
		if (_kbhit())
		{
			char key = _getch();                           //获取键盘输入值
			switch (key)
			{
			case 'w':                                   //坦克向前
			case 'W':
				allTankMove(&myTankMove, UP, &myTank_img[UP],200);
				break;
			case 's':                                        //坦克向后
			case 'S':
				allTankMove(&myTankMove, DOWN, &myTank_img[DOWN],200);
				break;
			case 'a':                                           //坦克向左
			case 'A':
				allTankMove(&myTankMove, LEFT, &myTank_img[LEFT],200);
				break;
			case 'd':                                               //坦克向右
			case 'D':
				allTankMove(&myTankMove, RIGHT, &myTank_img[RIGHT],200);
				break;
			case 'p':                                                   //暂停游戏,按任意键开始
			case 'P':
				system("pause");
				break;
			case 'j':                                                //射击
			case 'J':
				tankFire(&myTankMove, &myBulletMove,true);
				break;
			}
		}
		for (int i = 0; i < enemyTotal; i++)
		{
			if (enemyBUllet[i].state == 1)            //子弹存在时,更新敌方子弹飞行位置
			{
				bulletMove(&enemyBUllet[i], flag,0,&myTankMove,enemyAlive);
				if (!flag)
				{
					Flag = 0;
				}
			}
		}
		if (!Flag)
			break;
		if (myBulletMove.state == 1)            //子弹存在时,更新我方子弹飞行位置
		{
			bulletMove(&myBulletMove,flag,1,enemyTank,enemyAlive);
			if (!flag)
			{
				break;

			}
		}
		if (enemyAlive == 0)
			break;
		times++;
		Sleep(15);
	}
}
int main()
{
	initgraph(650, 650);                  //初始化界面
	outputPage1();
	outputPage2();
	gameStart();
	if (!flag)
	{
		putGameOver();
	}
	else
	{
		victory();
	}
	system("pause");
	closegraph();
	return 0;
}

;