这一次是最全的17个游戏
作者十分推荐
(没VIP的可以去前三期,但不完全)
1.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;
}
2.宝强越狱
#include"bits/stdc++.h"
#include"Windows.h"
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
int w=3,s=3,a=3,d=3;
bool n=false,ip=true,m=false;
void guize(){
system("cls");
cout<<"\n\n 1.本次更新不仅修复了像变量未重置,第三关未按路线走不死亡的bug\n";
cout<<" 2.更新到了第五关,难度逐步提升,第\n 二关E建破坏墙体过关,死亡需重新\n 来,第三关的提示很明显,剩的自己去摸索吧\n 第四关与S建有关\n 第五关到出口之后按E建出去\n 第六关到指定位置按E建获得密码再按Q键输入密码即可通关\n 第七关因为你被保安打伤了,要在血流尽前自救\n";
cout<<" 3.点个关注不迷路,一波三连就有福~\n";
cout<<" 4.此作品为***原创,无抄袭行为,由谢老板习得神通改编\n";
system("pause");
}
int home(){
while(1){
system("cls");
cout<<"\n\n\n\n\n\n =======\033[32;1m宝强越狱\033[0m=======\n\n\n";
cout<<" ======\033[33;1m1.游戏开始\033[0m======\n";
cout<<" ======\033[34;1m2.关于游戏\033[0m======\n";
cout<<" ======\033[31;1m3.退出游戏\033[0m======\n";
if(KEY_DOWN(49)) break;
if(KEY_DOWN(50)) guize();
if(KEY_DOWN(51)){
m=true;
return 0;
}
Sleep(100);
}
system("cls");
cout<<"\n\n\n\n\n\n 2024年2月28日,有一青年入狱";
Sleep(3000);
system("cls");
cout<<"\n\n\n\n\n\n 现在你是这个青年,名叫宝强,你要逃出危机四伏的监狱";
Sleep(3000);
system("cls");
cout<<"\n\n\n\n\n\n 游戏开始!";
Sleep(3000);
return 0;
}
void first(){
a=3;
d=3;
w=3;
s=3;
cout<<"\n\n\n\n\n\n 第一关:寻找出路";
Sleep(3000);
system("cls");
while(n==false){
cout<<"█████████\n";
for(int i=0;i<w;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█";
for(int i=0;i<a;i++){
cout<<" ";
}
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++){
cout<<" ";
}
cout<<"█\n";
for(int i=0;i<s;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█████████\n";
if(KEY_DOWN(87)){
if(w>0&&s<=6)
{
w--;
s++;
}
}//w
if(KEY_DOWN(83)){
if(s>0&&w<=6)
{
w++;
s--;
}
}//s
if(KEY_DOWN(65)){
if(a>0&&d<=5)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<5)
{
a++;
d--;
}
}//d
if(w==0&&a==0) n=true;
Sleep(100);
system("cls");
}
}
void second(){
int HP=40;
a=3;
d=3;
w=6;
s=0;
n=false;
cout<<"\n\n\n\n\n\n 第二关:雷霆击碎黑暗";
Sleep(3000);
system("cls");
while(n==false){
cout<<"█████████\n";
for(int i=0;i<w;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<"█";
cout<<"█\n";
}
cout<<"█";
for(int i=0;i<a;i++){
cout<<" ";
}
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++){
cout<<" ";
}
cout<<"█\n";
for(int i=0;i<s;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█████████\n";
if(KEY_DOWN(65)){
if(a>0&&d<=5)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<5)
{
a++;
d--;
}
}//d
if(KEY_DOWN(69)) HP--;
if(HP==0) n=true;
Sleep(100);
system("cls");
}
cout<<"█████████\n";
cout<<"█ █\n";
cout<<"█ █\n";
cout<<"█ █\n";
cout<<"█ █\n";
cout<<"█ █\n";
cout<<"█ █\n";
cout<<"█ \033[32;1m●\033[0m █\n";
cout<<"█████████\n";
Sleep(2000);
}
int third(){
a=3;
d=3;
w=6;
s=0;
n=false;
ip=true;
cout<<"\n\n\n\n\n\n 第三关:幻影小道";
Sleep(3000);
system("cls");
while(n==false&&ip==true){
cout<<"█████████\n";
for(int i=0;i<w;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█";
for(int i=0;i<a;i++){
cout<<" ";
}
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++){
cout<<" ";
}
cout<<"█\n";
for(int i=0;i<s;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█████████\n";
cout<<" \n";
cout<<" # \n";
cout<<" # \n";
cout<<" ### \n";
cout<<" # \n";
cout<<" ### \n";
cout<<" # \n";
cout<<" # \n";
cout<<" \n";
if(KEY_DOWN(87)){
if(w>0&&s<=6)
{
w--;
s++;
}
}//w
if(KEY_DOWN(83)){
if(s>0&&w<=6)
{
w++;
s--;
}
}//s
if(KEY_DOWN(65)){
if(a>0&&d<=5)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<5)
{
a++;
d--;
}
}//d
if((a==3&&s==0)||(a==3&&s==1)||(s==2&&(a==3||a==4||a==5))||(s==4&&(a==3||a==4||a==5))||(a==3&&s==5)||(a==3&&s==6)||(s==3&&a==5)) ip=true;
else{
system("cls");
cout<<"\n\n\n\n\n\n \033[31;1m你失败了!\033[0m\n\n\n\n\n\n";
Sleep(3000);
ip=false;
}
if(a==3&&s==6) n=true;
Sleep(50);
system("cls");
}
}
void fourth(){
a=4;
d=4;
n=false;
ip=true;
cout<<"\n\n\n\n\n\n 第四关:12345";
Sleep(3000);
system("cls");
while(n==false&&ip==true){
cout<<"██████████\n";
cout<<"|1|2|3|4|5|\n";
cout<<"|";
for(int i=0;i<a;i++) cout<<" ";
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++) cout<<" ";
cout<<"|\n";
cout<<"██████████\n";
if(KEY_DOWN(65)){
if(a>0&&d<=7)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<7)
{
a++;
d--;
}
}//d
if(a==0&&KEY_DOWN(83)){
n=true;
}
if((a==0&&KEY_DOWN(87))||(a==2&&KEY_DOWN(87))||(a==4&&KEY_DOWN(87))||(a==6&&KEY_DOWN(87))||(a==8&&KEY_DOWN(87))){
system("cls");
cout<<"\n\n\n\n\n\n \033[31;1m你失败了!\033[0m\n\n\n\n\n\n";
Sleep(3000);
ip=false;
}
Sleep(100);
system("cls");
}
}
void fifth(){
a=3;
d=3;
w=6;
s=0;
n=false;
ip=true;
cout<<"\n\n\n\n\n\n 第五关:看不见的陷阱";
Sleep(3000);
system("cls");
while(n==false&&ip==true){
cout<<"█████████\n";
for(int i=0;i<w;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█";
for(int i=0;i<a;i++){
cout<<" ";
}
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++){
cout<<" ";
}
cout<<"█\n";
for(int i=0;i<s;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█████████\n";
cout<<" \n";
cout<<" \033[31;1m*******\033[0m \n";
cout<<" \033[31;1m*\033[0m \n";
cout<<" \033[31;1m*\033[0m \n";
cout<<" \033[31;1m*\033[0m \n";
cout<<" \033[31;1m*\033[0m \n";
cout<<" \n";
cout<<" \n";
cout<<" \n";
if(KEY_DOWN(87)){
if(w>0&&s<=6)
{
w--;
s++;
}
}//w
if(KEY_DOWN(83)){
if(s>0&&w<=6)
{
w++;
s--;
}
}//s
if(KEY_DOWN(65)){
if(a>0&&d<=5)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<5)
{
a++;
d--;
}
}//d
if((w==0&&d==2)&&KEY_DOWN(69)){
n=true;
}
if((a==3&&(s==1||s==2||s==3||s==4||s==5))||(s==6&&(a==0||a==1||a==2||a==3||a==5||a==6))){
system("cls");
cout<<"\n\n\n\n\n\n \033[31;1m你失败了!\033[0m\n\n\n\n\n\n";
Sleep(3000);
ip=false;
}
Sleep(100);
system("cls");
}
}
int sixth(){
a=3;
d=3;
w=6;
s=0;
int l,k=142857;
n=false;
ip=true;
m=false;
cout<<"\n\n\n\n\n\n 第六关:找密码";
Sleep(3000);
system("cls");
while(n==false&&ip==true){
cout<<"█████████\n";
for(int i=0;i<w;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█";
for(int i=0;i<a;i++){
cout<<" ";
}
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++){
cout<<" ";
}
cout<<"█\n";
for(int i=0;i<s;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█████████\n";
if(KEY_DOWN(87)){
if(w>0&&s<=6)
{
w--;
s++;
}
}//w
if(KEY_DOWN(83)){
if(s>0&&w<=6)
{
w++;
s--;
}
}//s
if(KEY_DOWN(65)){
if(a>0&&d<=5)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<5)
{
a++;
d--;
}
}//d
if(w==3&&s==3&&a==3&&d==3&&KEY_DOWN(69)) m=true;
if(m==true){
cout<<"142857\n";
if(KEY_DOWN(81)){
cin>>l;
Sleep(1000);
if(k==l) return 0;
if(k!=l){
cout<<"\033[31;1m密码错误!\033[0m";
Sleep(3000);
l=0;
}
}
}
Sleep(100);
system("cls");
}
return 0;
}
void seventh(){
a=3;
d=3;
w=6;
s=0;
long long k=100;
n=false;
ip=true;
m=false;
cout<<"\n\n\n\n\n\n 第七关:找绷带";
Sleep(3000);
system("cls");
while(k!=0){
cout<<"█████████\n";
for(int i=0;i<w;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█";
for(int i=0;i<a;i++){
cout<<" ";
}
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++){
cout<<" ";
}
cout<<"█\n";
for(int i=0;i<s;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█████████\n";
cout<<"时间"<<k;
if(KEY_DOWN(87)){
if(w>0&&s<=6)
{
w--;
s++;
}
}//w
if(KEY_DOWN(83)){
if(s>0&&w<=6)
{
w++;
s--;
}
}//s
if(KEY_DOWN(65)){
if(a>0&&d<=5)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<5)
{
a++;
d--;
}
}//d
if(w==5&&a==1&&KEY_DOWN(69)){
n==true;
break;
}
Sleep(100);
system("cls");
k--;
}
}
eighth(){
a=3;
d=3;
w=6;
s=0;
n=false;
cout<<"\n\n\n\n\n\n 第八关:找枪";
Sleep(3000);
system("cls");
while(1){
cout<<"█████████\n";
for(int i=0;i<w;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█";
for(int i=0;i<a;i++){
cout<<" ";
}
cout<<"\033[32;1m●\033[0m";
for(int i=1;i<d;i++){
cout<<" ";
}
cout<<"█\n";
for(int i=0;i<s;i++){
cout<<"█";
for(int j=0;j<7;j++) cout<<" ";
cout<<"█\n";
}
cout<<"█████████\n";
if(KEY_DOWN(87)){
if(w>0&&s<=6)
{
w--;
s++;
}
}//w
if(KEY_DOWN(83)){
if(s>0&&w<=6)
{
w++;
s--;
}
}//s
if(KEY_DOWN(65)){
if(a>0&&d<=5)
{
a--;
d++;
}
}//a
if(KEY_DOWN(68)){
if(d>0&&a<5)
{
a++;
d--;
}
}//d
if(w==0&&a==0&&KEY_DOWN(69)){
n==true;
break;
}
Sleep(100);
system("cls");
}
}
int main(){
while(!KEY_DOWN(51)){
while(!KEY_DOWN(51)){
home();
if(m==true){
return 0;
}
system("cls");
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
first();
system("cls");
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
second();
system("cls");
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
third();
if(ip==false){
break;
}
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
fourth();
if(ip==false){
break;
}
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
fifth();
if(ip==false){
break;
}
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
sixth();
if(ip==false){
break;
}
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
seventh();
if(n==false){
break;
}
Sleep(1000);
if(KEY_DOWN(51)){
return 0;
}
eighth();
if(n==false){
break;
}
Sleep(1000);
system("cls");
cout<<"\n\n\n\n\n\n \033[33;1m越狱成功!\033[0m\n\n\n\n\n\n";
Sleep(3000);
}
}
}
3.爆破战争
//爆破战争
//不忘初心,专注枪战。
//大致剧情线:爆破->战役(保卫战->歼灭战->生化空间站救援->阻击战)->枪战 (双人模式架空)
#include<algorithm>
#include<fstream>
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<windows.h>
#include<conio.h>
#include <time.h>
#include <stdlib.h>
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
HWND hMainWnd; //主窗口句柄
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0) //必要的,要背下来
using namespace std;
int ms;
int yb;
int sh=0;
int dhurt=5;
int dz=0;
int bptd=1;
int boom_time;
int map_num;
int hurt;
int js;
int x,y;
int dx,dy;
int bx,by;
int bww=100;
int qfw=100;
char hero;
int dsr;
int game_map[101][101];
int x_what(int x) {//取随机数
srand((unsigned)time(NULL));
return( rand() % x);
}
int map_out(int x) {
if(x==0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
cout<<"*";
} else if(x==1) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN|FOREGROUND_RED);
cout<<"*";
} else if(x==2) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY );
cout<<"*";
} else if(x==3) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE);
cout<<"*";
} else if(x==4) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"*";
} else if(x==5) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE|FOREGROUND_GREEN);
cout<<"*";
} else if(x==6) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE|FOREGROUND_GREEN);
cout<<"*";
}
}
int open() {
hero='+';
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"-------------------"<<endl;
cout<<"| 黑客爱坤 |"<<endl;
cout<<"-------------------"<<endl;
Sleep(2000);
system("cls");
cout<<"-------------------"<<endl;
cout<<"| 1无任何正常梦想 |"<<endl;
cout<<"-------------------"<<endl;
Sleep(2000);
system("cls");
cout<<"------------------"<<endl;
cout<<"| 爆破战争 |"<<endl;
cout<<"-------------------"<<endl;
while(!kbhit()) {
}
system("cls");
}
int out1() {
system("cls");
cout<<"本局角色:土匪"<<endl;
cout<<"警:"<<bww<<"匪:"<<qfw;
if(bptd==0) {
cout<<"距离爆炸的时间:"<<boom_time;
}
cout<<endl;
for(int i=0; i<11; i++) {
for(int j=0; j<11; j++) {
if(i==0||i==10) {
map_out(map_num);
} else if(j==0||j==10) {
map_out(map_num);
} else if(i==x&&j==y) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
cout<<hero;
} else if(i==dx&&j==dy) {
if(sh==0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE);
cout<<"+";
} else {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"#";
}
} else if(i==bx&&j==by) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"O";
} else if(game_map[i][j]==1) {
map_out(map_num);
} else {
cout<<" ";
}
}
cout<<endl;
}
}
int out2() {
system("cls");
cout<<"本局角色:警察"<<endl;
cout<<"警:"<<bww<<"匪:"<<qfw;
if(bptd==0) {
cout<<"距离爆炸的时间:"<<boom_time;
}
cout<<endl;
for(int i=0; i<11; i++) {
for(int j=0; j<11; j++) {
if(i==0||i==10) {
map_out(map_num);
} else if(j==0||j==10) {
map_out(map_num);
} else if(i==dx&&j==dy) {
if(sh==0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
cout<<"+";
} else {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"#";
}
} else if(i==x&&j==y) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE);
cout<<hero;
} else if(i==bx&&j==by) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"O";
} else if(game_map[i][j]==1) {
map_out(map_num);
} else {
cout<<" ";
}
}
cout<<endl;
}
}
int out3() {
system("cls");
cout<<"警:"<<bww<<"匪:"<<qfw;
if(bptd==0) {
cout<<"距离爆炸的时间:"<<boom_time;
}
cout<<endl;
for(int i=0; i<11; i++) {
for(int j=0; j<11; j++) {
if(i==0||i==10) {
map_out(map_num);
} else if(j==0||j==10) {
map_out(map_num);
} else if(i==dx&&j==dy) {
if(sh==0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
cout<<"+";
} else {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"#";
}
} else if(i==x&&j==y) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE);
cout<<hero;
} else if(i==bx&&j==by) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
cout<<"O";
} else if(game_map[i][j]==1) {
map_out(map_num);
} else {
cout<<" ";
}
}
cout<<endl;
}
}
//隔着建筑物可打建筑物上方射建筑物后的人
//例子:
// *-----*
// | ||| |
int play1() {
char c;
if(kbhit()) {
c=getch();
if(c=='w'&&x>1&&game_map[x-1][y]==0) {
x--;
}
if(c=='a'&&y>1&&game_map[x][y-1]==0) {
y--;
}
if(c=='s'&&x<9&&game_map[x+1][y]==0) {
x++;
}
if(c=='d'&&y<9&&game_map[x][y+1]==0) {
y++;
}
if (c==' ') {
if(x==dx||y==dy) {
bww-=hurt;
}
}
if(c=='q'&&x==dx&&y==dy&&(hero=='A'||hero=='*')) {
bww-=200;
}
}
}
int play2() {
char c;
if(kbhit()) {
c=getch();
if(c=='w'&&x>1&&game_map[x-1][y]==0) {
x--;
}
if(c=='a'&&y>1&&game_map[x][y-1]==0) {
y--;
}
if(c=='s'&&x<9&&game_map[x][y+1]==0) {
x++;
}
if(c=='d'&&y<9&&game_map[x][y+1]==0) {
y++;
}
if(c=='e') {
if(x==bx&&y==by) {
qfw=0;
}
}
if (c==' ') {
if(x==dx||y==dy) {
qfw-=hurt;
}
}
if(c=='q'&&x==dx&&y==dy&&(hero=='A'||hero=='*')) {
qfw-=200;
}
}
}
int play3() {
char c;
if(kbhit()) {
c=getch();
if(c=='w'&&x>1&&game_map[x-1][y]==0) {
x--;
}
if(c=='a'&&y>1&&game_map[x][y]-1==0) {
y--;
}
if(c=='s'&&x<9&&game_map[x+1][y]==0) {
x++;
}
if(c=='d'&&y<9&&game_map[x][y-1]==0) {
y++;
}
if(c=='e') {
if(x==bx&&y==by) {
qfw=0;
}
}
if (c==' ') {
if(x==dx||y==dy) {
qfw-=hurt;
}
}
if(c=='i'&&dx>1&&game_map[dx-1][dy]==0) {
dx--;
}
if(c=='j'&&dy>1&&game_map[dx][dy-1]==0) {
dy--;
}
if(c=='k'&&dx<9&&game_map[dx+1][dy]==0) {
dx++;
}
if(c=='l'&&dy<9&&game_map[dx][y+1]==0) {
dy++;
}
if (c=='m') {
if(sh==0&&x==dx||y==dy) {
bww-=hurt;
}
if(sh==1&&x==dx&&y==dy)
bww-=150;
}
}
}
int AI() {
if(bww<=0||qfw<=0) {
return 0;
}
if(boom_time%3!=0) {
return 0;
}
if(x>dx&&dx<9&&game_map[dx+1][dy]==0) {
dx++;
} else if(y>dy&&dy<9&&game_map[dx][dy+1]==0) {
dy++;
}
if(x<dx&&dx>1&&game_map[dx-1][dy]==0) {
dx--;
} else if(y<dy&&dy>1&&game_map[dx][dy-1]==0) {
dy--;
}
if(dy==y||dx==x) {
if(js==2) {
bww-=dhurt;
if(hero=='W') {
bww+=(dhurt/5);
}
}
if(js==1) {
qfw-=dhurt;
if(hero=='W') {
qfw+=(dhurt/5);
}
}
}
}
int AI2() {
if(bww<=0||qfw<=0) {
return 0;
}
if(boom_time%3!=0) {
return 0;
}
if(x>dx&&dx<9&&game_map[dx+1][dy]==0) {
dx++;
} else if(y>dy&&dx!=x&&game_map[dx][dy+1]==0) {
dy++;
}
if(x<dx&&dx>1&&game_map[dx-1][dy]==0) {
dx--;
} else if(y<dy&&dy>1&&game_map[dx][dy-1]==0) {
dy--;
}
if(dy==y&&dx==x) {
if(js==2) {
bww-=100;
if(hero=='W') {
bww+=20;
}
}
}
}
int qf() {
while(true) {
out1();
play1();
if(sh==0) {
AI();
} else {
AI2();
}
boom_time--;
if(bww<=0||boom_time<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
cout<<"土匪胜利";
Sleep(2000);
system("cls");
return 0;
}
if(qfw<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
cout<<"警察胜利";
Sleep(2000);
system("cls");
return 0;
}
Sleep(500);
}
}
int bw() {
while(true) {
out2();
play2();
if(sh==0) {
AI();
} else {
AI2();
}
boom_time--;
if(bww<=0||boom_time<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
cout<<"土匪胜利";
Sleep(2000);
system("cls");
return 0;
}
if(qfw<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
cout<<"警察胜利";
Sleep(2000);
system("cls");
return 0;
}
Sleep(500);
}
}
int srbp() {
while(true) {
out3();
play3();
boom_time--;
if(bww<=0||boom_time<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
cout<<"土匪胜利";
Sleep(2000);
system("cls");
return 0;
}
if(qfw<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
cout<<"警察胜利";
Sleep(2000);
system("cls");
return 0;
}
Sleep(500);
}
}
int story_bwz() {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
system("cls");
cout<<"?警官:一个财阀为了避免我们和军方歼灭生化幽灵,土匪让一个改造人进攻城市,警局已经沦陷,我是唯一幸存者。";
Sleep(2000);
system("cls");
cout<<"?警官:你一定要消灭他!";
Sleep(2000);
system("cls");
cout<<"?警官:小心点,他拿着枪";
Sleep(2000);
system("cls");
cout<<"?警官:啊!";
Sleep(2000);
system("cls");
}
int story_fcns() {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
system("cls");
cout<<"军方指挥官:全体复仇女神部队成员请注意,有新的任务。";
Sleep(2000);
system("cls");
cout<<"军方指挥官:一群警察拿了一个财阀的钱和实验邀请函,进入了生化空间站参加高额奖金生化猎杀,遭遇了生化幽灵。";
Sleep(2000);
system("cls");
cout<<"军方指挥官:进入生化空间站,击毙生化幽灵,营救他们";
Sleep(2000);
system("cls");
}
int story_qfz() {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
system("cls");
cout<<"土匪zero:我们改造士兵恐袭计划失败了,你只能自己进攻了";
Sleep(2000);
system("cls");
cout<<"土匪zero:城市里有一个拿狙击枪的警察,你要消灭他";
Sleep(2000);
system("cls");
cout<<"土匪zero:开始行动!";
Sleep(2000);
system("cls");
}
int story_yb(){
system("cls");
cout<<"土匪zero:我们的生化幽灵被击败了,不能让敌人跑了";
Sleep(2000);
system("cls");
}
int js_h() {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
char c;
while(c!='z') {
system("cls");
cout<<"n换角色,z确定。"<<endl;
cout<<hero<<endl;
if(hero=='+') {
cout<<"斯沃特(手)";
hurt=5;
} else if(hero=='I') {
cout<<"灵狐者(狙)";
hurt=100;
} else if(hero=='8') {
cout<<"刀锋(步)";
hurt=10;
} else if(hero=='T') {
cout<<"奥摩(手)";
hurt=5;
} else if(hero=='=') {
cout<<"飞虎队(狙)";
hurt=100;
} else if(hero=='V') {
cout<<"夜玫瑰(步)";
hurt=10;
} else if(hero=='W') {
cout<<"机械N22(手)<AC护甲免疫20%伤害>";
hurt=5;
} else if(hero=='A') {
cout<<"审判者(狙)<可踢腿>";
hurt=100;
} else if(hero=='*') {
cout<<"零(步)<可踢腿>";
hurt=10;
}
if(kbhit()) {
c=getch();
if(c=='n') {
if(hero=='+') {
hero='I';
} else if(hero=='I') {
hero='8';
} else if(hero=='8') {
hero='T';
} else if(hero=='T') {
hero='=';
} else if(hero=='=') {
hero='V';
} else if(hero=='V') {
hero='W';
} else if(hero=='W') {
hero='A';
} else if(hero=='A') {
hero='*';
} else if(hero=='*') {
hero='+';
}
}
}
Sleep(500);
}
system("cls");
}
int map_what_bp() {
system("cls");
char cz;
cout<<"x:沙漠灰 c:新年广场 v:黑色城镇 b:随机地图。";
while(true) {
wh