C++#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include <fstream>
#define MAX_ZOMBIES 10
using namespace std;
long long dt[1001][3001];
long long dtf[1001][3001];
long long dty[1001][3001];//yun
long long dtyf[1001][3001];//yun
long long dts[1001][3001];//shui
const string SAVE_DIR = "./Saves/";
int x,y,scfk=1,MS=1,gbx,gby,smsj=0,dtcshcs=0,fly=0,xl=18,jez=18,cl=0,zgd,zhsl=0,sfjp=0,wushui=0,ys=0,ggbx=9,ggby=5,xndq=0,sxpl=150;
int gbfk=0,gbwpsl=0,xx1,yy1,gbxx,gbyy,anstime=0,bbysxh=1;
bool jun=0,dfgt;
int dllg[13][19] = {{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,1,0,0,0,0,1,1,1,1,0,0},{0,1,2,0,0,2,2,1,0,0,0,0,1,0,0,1,0,0},{0,1,2,0,0,2,0,1,0,0,0,0,1,2,2,1,0,0},{0,1,0,2,2,0,0,1,0,0,0,0,1,0,0,1,0,0},{0,1,0,0,2,0,0,1,0,0,0,0,1,1,1,1,0,0},{0,1,0,2,0,2,0,1,0,0,0,0,0,1,0,0,0,0},{0,1,2,0,0,2,0,1,0,0,0,0,1,1,1,1,1,0},{0,1,2,0,0,0,2,1,0,0,0,1,0,2,2,0,1,0},{0,1,0,0,0,0,1,1,0,0,0,0,2,0,2,0,1,0},{0,1,0,0,0,0,0,1,0,0,0,0,2,0,2,1,1,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}};
int bb[10][18]= {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,6,7,7,7,6,0,0,0,0,0,0,0,0,0},{0,0,0,0,6,7,8,7,6,0,0,0,0,0,0,0,0,0},{0,0,0,0,6,7,7,7,6,0,0,0,0,0,0,0,0,0},{0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0,0},{0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0,0},{0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0,0},{0,0,0,0,1,1,1,1,1,1,1,1,1,1,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}};
int bbxz[10][18]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,3,3,3,3,3,3,3,3,3,3,0,0,0,0},{0,0,0,0,3,3,3,3,3,3,3,3,3,3,0,0,0,0},{0,0,0,0,3,3,3,3,3,3,3,3,3,3,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,2,2,2,2,2,2,2,2,2,2,0,0,0,0},{0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0,0},{0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0,0},{0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
int bbwpl[10]={1,2,3,4,5,6,7,8,10,0};
int bbwplsl[10]={64,64,64,64,64,64,64,64,64,0};
int bbkgsl[7][14]={{},{},{},{},{0,0,0,0,1,10,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}};
int bbkg[7][14]={{},{},{},{},{0,0,0,0,11,12,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}};
int fkwjsj[1001]={-1,5,15,1000000,10,2,5,1,1,1,15,25,10,};
long long tree[8][7][6]={{{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,5,5,0,0},{0,5,5,5,0,0},{0,5,4,5,0,0},{0,0,4,0,0,0},{0,0,4,0,0,0}},{{0,0,0,0,0,0},{0,5,5,5,0,0},{0,5,5,5,0,0},{5,5,5,5,5,0},{5,5,4,5,5,0},{0,0,4,0,0,0},{0,0,4,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,5,5,0,0},{0,5,4,4,5,0}},{{0,0,0,0,0,0},{0,0,5,5,5,0},{0,5,5,5,5,0},{5,5,5,4,4,5},{0,5,4,0,5,0},{0,4,0,0,0,0},{0,4,0,0,0,0}},{{0,0,0,5,0,0},{0,0,0,5,0,0},{0,0,5,4,5,0},{5,5,4,4,5,5},{4,0,4,4,4,4},{0,4,4,4,4,4},{0,0,4,4,0,0}},{{0,0,0,0,0,0},{0,0,5,5,0,0},{0,0,5,5,0,0},{0,0,5,5,0,0},{0,0,5,5,0,0},{4,4,0,0,4,4},{4,4,0,0,4,4}},{{0,0,0,0,0,0},{0,5,5,5,0,0},{5,5,5,5,5,0},{0,4,4,5,4,5},{0,4,0,4,0,0},{0,0,4,0,0,0},{0,0,4,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}}};
long long sctree[3001];//shu de zhong lei
struct XZ{
int kg[4][14];
int sl[4][14];
}xz[1001][3001];
enum TerrainType {
PLAIN = 0,
MOUNTAIN = 1,
LAKE = 2,
OCEAN = 3,
FOREST = 4
};
TerrainType map_terrain[1000][3000];
void ClearLocalArea(int start_y, int end_y, int start_x, int end_x) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
for(int y=start_y; y<=end_y; y++){
pos.Y = y;
for(int x=start_x; x<=end_x; x++){
pos.X = x;
SetConsoleCursorPosition(hConsole, pos);
cout << " ";
}
}
}
void createDirectory(const string& dirPath) {
string tempPath = dirPath;
replace(tempPath.begin(), tempPath.end(), '/', '\\');
for (size_t i = 0; i < tempPath.size(); i++) {
if (tempPath[i] == '\\') {
string subDir = tempPath.substr(0, i);
CreateDirectoryA(subDir.c_str(), NULL);
}
}
CreateDirectoryA(tempPath.c_str(), NULL);
}
void O_CustomPath(string name, string customDir) {
string fullDir = customDir + "/Saves/";
createDirectory(fullDir);
string fullPath = fullDir + name + ".txt";
ofstream out(fullPath.c_str());
if (!out.is_open()) {
cout << "错误:无法创建自定义路径存档 " << fullPath << endl;
return;
}
out.close();
cout << "自定义路径存档成功:" << fullPath << endl;
}
void I(string name) {
string fullPath = SAVE_DIR + name + ".txt";
ifstream in(fullPath.c_str());
if (!in.is_open()){
cout << "错误:无法打开存档文件 " << fullPath << endl;
return;
}
in >> x >> y >> scfk >> MS >> gbx >> gby >> smsj >> dtcshcs >> fly >> xl >> cl >> jez >> wushui >> sfjp >> ys >> ggbx >> ggby >> gbfk >> xndq;
for (int j = 0; j < 1000; j++){
for (int i = 0; i < 3000; i++){
if (!(in >> dt[j][i])){
cout << "错误:读取数组时文件提前结束" << endl;
in.close();
return;
}
}
}
for (int j = 0; j < 1000; j++){
for (int i = 0; i < 3000; i++){
if (!(in >> dtf[j][i])){
cout << "错误:读取数组时文件提前结束" << endl;
in.close();
return;
}
}
}
for (int j = 0; j < 1000; j++){
for (int i = 0; i < 3000; i++){
if (!(in >> dty[j][i])){
cout << "错误:读取数组时文件提前结束" << endl;
in.close();
return;
}
}
}
in.close();
cout << "读档成功!文件位置:" << fullPath << endl;
}
void O(string name) {
createDirectory(SAVE_DIR);
string fullPath = SAVE_DIR + name + ".txt";
ofstream out(fullPath.c_str());
if (!out.is_open()) {
cout << "错误:无法创建存档文件 " << fullPath << endl;
return;
}
out << x << " " << y << " " << scfk << " " << MS << " " << gbx << " " << gby << " " << smsj << " " << dtcshcs << " " << fly << " " << xl << " " << cl << " " << jez << " " << wushui << " " << sfjp << " " << ys << " " << ggbx << " " << ggby << " " << gbfk << " " << xndq << " ";
for (int j = 0; j < 1000; j++) {
for (int i = 0; i < 3000; i++) {
out << dt[j][i] << " " << dtf[j][i] << " " << dty[j][i] << " ";
}
}
out.close();
cout << "存档成功!文件位置:" << fullPath << endl;
}
void xccdl(){
HANDLE hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
DWORD consoleMode;
GetConsoleMode(hConsoleInput, &consoleMode);
consoleMode &= ~ENABLE_EXTENDED_FLAGS;
consoleMode |= ENABLE_MOUSE_INPUT;
SetConsoleMode(hConsoleInput, consoleMode);
}
bool sbleftdown(){
return(GetAsyncKeyState(VK_LBUTTON) & 0x8000) != 0;
}
bool sbrightdown(){
return(GetAsyncKeyState(VK_RBUTTON) & 0x8000) != 0;
}
struct hl{
long long h,l;
};
hl sbwz(bool x=1,bool n=1){
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
HWND h=GetForegroundWindow();CONSOLE_FONT_INFO consoleCurrentFont;
hl hl;
POINT p;
if(x){
GetCursorPos(&p);
ScreenToClient(h,&p);
}
else{
GetCursorPos(&p);
}
if(n){
GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
p.x/=consoleCurrentFont.dwFontSize.X;
p.y/=consoleCurrentFont.dwFontSize.Y;
}
hl.h=p.y+1;
hl.l=p.x+1;
return hl;
}
int ti(float a){
return ((int)(a*10+5))/10;
}
void hideCursor(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursorInfo;
GetConsoleCursorInfo(hConsole, &cursorInfo);
cursorInfo.bVisible = FALSE;
SetConsoleCursorInfo(hConsole, &cursorInfo);
}
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 yanse(int n){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n);
return;
}
void CLS(int x){
hideCursor();Setpos(0,0);
for(int i=0;i<21;i++){
yanse(x);
cout<<" ";
}
Setpos(0,0);
}
int jzhm2(){
CLS(240);
hideCursor();
string ccm="Game.dts";
system("mode con cols=62 lines=21");
for(int i=17;i>=6;i--){
Setpos(i,15);
cout<<"■";
Sleep(50);
Setpos(i+1,15);
cout<<" ";
}
for(int i=5;i<=8;i++){
Setpos(i,15);
cout<<"■";
Sleep(70);
Setpos(i-1,15)
,cout<<" ";
}
Beep(1000,21);
for(int i=8;i>=7;i--){
Setpos(i,15);
cout<<"■";
Sleep(90);
Setpos(i+1,15);
cout<<" ";
}
Sleep(50),Setpos(8,15),cout<<"■",Sleep(150),Setpos(7,15),cout<<" ",Beep(900,21),Sleep(150);
for(int i=0;i<8;i++){Sleep(90),Setpos(9,13.5+(i*0.5)),cout<<ccm[i];}Setpos(0,0);
Sleep(600),CLS(11),yanse(11),Setpos(8,15),cout<<"■",Setpos(9,13.5),cout<<ccm,Setpos(9,13.5),Sleep(1000);
for(int i=0;i<8;i++){Setpos(9,13.5+(i*0.5)),yanse(15),cout<<ccm[i];if(13.5+(i*0.5)==12){Setpos(8,13.5+(i*0.5)),yanse(15),cout<<"■";}Sleep(90),Setpos(9,13.5+(i*0.5)),yanse(11),cout<<ccm[i];if(13.5+(i*0.5)==15){Setpos(8,13.5+(i*0.5)),yanse(11),cout<<"■";}Sleep(90);}
Sleep(2000);
return 0;
}
void say(string kp){
for(int i=0;i<kp.size();i++){
cout<<kp[i];
Sleep(25);
}
}
void jzhm(){
system("cls");
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
for(int i=1;i<13;i++){
for(int j=0;j<19;j++){
cout<<" ";
}
cout<<"\n";
}
for(int k=0;k<19;k++){
for(int i=1;i<13;i++){
for(int j=0;j<19;j++){
if(dllg[i][j]==2 and j<=k){
Setpos(i,j);
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_INTENSITY / 3);
cout<<" ";
}
if(dllg[i][j]==1 and j<=k){
Setpos(i,j);
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_INTENSITY);
cout<<" ";
}
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
if(i == 12 and k==18){
Setpos(i,k);
cout<<" 游戏\n ";
}
}
Sleep(20);
}
system("pause");
system("cls");
}
void color(int color1){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
if(color1 == 0){//kong qi
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<" ";
}
if(color1 == 1){//cao fang kuai
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN | BACKGROUND_RED | BACKGROUND_GREEN | FOREGROUND_INTENSITY);
cout<<"~~";
}
if(color1 == 2){//shi tou
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
cout<<" ";
}
if(color1 == 3){//ji yan
// SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
cout<<"基";
}
if(color1 == 4){//xiang mu mu tou
SetConsoleTextAttribute(hConsole,FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | (BACKGROUND_RED | BACKGROUND_GREEN) | BACKGROUND_INTENSITY / 2);
cout<<"||";
}
if(color1 == 5){//shu ye
SetConsoleTextAttribute(hConsole,BACKGROUND_GREEN);
cout<<" ";
}
if(color1 == 6){//ni tu
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN | BACKGROUND_RED | BACKGROUND_GREEN | FOREGROUND_INTENSITY);
cout<<" ";
}
if(color1 == 7){//du qi
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
cout<<" ";
}
if(color1 == 8){//shui
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY);
cout<<" ";
}
if(color1 == 9){//shui 2
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY);
cout<<" ";
}
if(color1 == 10){//mei tan
SetConsoleTextAttribute(hConsole,(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) | 0);
cout<<"::";
}
if(color1 == 11){//tie kuang
SetConsoleTextAttribute(hConsole,(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) | (FOREGROUND_GREEN| (FOREGROUND_RED | FOREGROUND_INTENSITY*3)));
cout<<"::";
}
if(color1 == 12){//xiang zi
SetConsoleTextAttribute(hConsole,(BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3) | (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY));
cout<<"▅";
}
if(color1 == 100){//ya li ban
SetConsoleTextAttribute(hConsole,(FOREGROUND_RED | FOREGROUND_GREEN) | FOREGROUND_INTENSITY / 2 | BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"__";
}
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
return ;
}
bool ksjm(){
int x=15,y=10,tpfkys=0,tpcs=0,n=2,xx=-1,yy=-1;
srand(time(0));
CLS(240);
Sleep(50);
system("mode con cols=62 lines=21");
while(1){
SetConsoleTitle("dts");
long long sby=sbwz().h-1,sbx=(sbwz().l+1)/2-1;
bool sbt=(0<=sbx and sbx<=29 and 0<=sby and sby<=19);
HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
hideCursor();
for(int j=0;j<20;j++){
for(int i=0;i<32;i++){
Setpos(j,i);
if(j==yy and i==xx)color((tpfkys+1)%12+1);
else if(j==y and i==x-2)color(tpfkys);
else if(j==y and i==x-1)cout<<"开";
else if(j==y and i==x)cout<<"始";
else if(j==y and i==x+1)cout<<"游";
else if(j==y and i==x+2)cout<<"戏";
else color(0);
}
}
cout<<n<<" ";
if(GetAsyncKeyState('W'))yy=(yy-1)%19;
if(GetAsyncKeyState('S'))yy=(yy+1)%19;
if(GetAsyncKeyState('A'))xx=(xx-1)%29;
if(GetAsyncKeyState('D'))xx=(xx+1)%29;
if(!(abs(x-xx)<=3 and abs(y-yy)<=1)){
if(/**/abs(sbx-x)<=abs(sby-y) and /**/abs(sbx-x)<=15 and /**/abs(sbx-x+1)>=abs(sbx-x-1))x=(x-n/5)%29;
if(/**/abs(sbx-x)<=abs(sby-y) and /**/abs(sbx-x)<=15 and /**/abs(sbx-x-1)>=abs(sbx-x+1))x=(x+n/5)%29;
if(/**/abs(sbx-x)>=abs(sby-y) and /**/abs(sby-y)<=10 and /**/abs(sby-y+1)>=abs(sby-y-1))y=(y-n/5)%19;
if(/**/abs(sbx-x)>=abs(sby-y) and /**/abs(sby-y)<=10 and /**/abs(sby-y-1)>=abs(sby-y+1))y=(y+n/5)%19;
}
if(x<0 or x>29 or y<0 or y>19){
x=rand()%28+1;
y=rand()%18+1;
}
sby=sbwz().h-1,sbx=(sbwz().l+1)/2-1;
if(tpcs%5==0)tpfkys=(tpfkys+1)%12+1;
if((x==sbx or x==sbx-1 or x==sbx-2 or x==sbx+1 or x==sbx+2) and y==sby){
n++;
x=rand()%28+1;
y=rand()%18+1;
}
if(n==30)return true;
Sleep(6-n/5);tpcs++;
}
}
void hzfk(int x,int y,int ys){
if(ys==0){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(0);
}
}
}
else if(ys==1){
for(int i=x;i<x+3;i++){
Setpos(y,i);
color(1);
}
for(int j=y+1;j+1<y+4;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(6);
}
}
}
else if(ys==2){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(2);
}
}
}
else if(ys==3){
for(int j=y;j<y+3;j++){for(int i=x;i<x+3;i++){Setpos(j,i);cout<<" ";}}
for(int i=x;i<x+3;i++){Setpos(y,i);color(3);}
for(int i=x;i<x+3;i++){Setpos(y+2,i);color(3);}
for(int i=y;i<y+3;i++){Setpos(i,x);color(3);}
for(int i=y;i<y+3;i++){Setpos(i,x+2);color(3);}
}
else if(ys==4){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(4);
}
}
}
else if(ys==5){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(5);
}
}
}
else if(ys==6){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(6);
}
}
}
else if(ys==7){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(7);
}
}
}
else if(ys==8){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(8);
}
}
}
else if(ys==9){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(9);
}
}
}
else if(ys==10){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(10);
}
}
}
else if(ys==11){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
color(11);
}
}
}
else if(ys==12){
for(int j=y;j<y+3;j++){
for(int i=x;i<x+3;i++){
Setpos(j,i);
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole,(BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3) | (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY));
cout<<"█";
}
}
Setpos(y+1,x+1);
color(12);
}
else if(ys==13){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY/3);
Setpos(y,x); cout<<"/[你]\\\n";
Setpos(y+1,x);cout<<"| || |\n";
Setpos(y+2,x);
color(1);
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY/3);
cout<<"/\\";color(0);
}
}
void ksjm1(){
int x=6,y=8,tycs=0,fkwjcs=0;
CLS(240);
SetConsoleTitle("dts");
system("mode con cols=66 lines=21");
for(int j=0;j<21;j+=3)for(int i=0;i<33;i+=3)hzfk(i,j,0);
for(int i=0;i<33;i+=3)hzfk(i,12,1);
for(int j=15;j<21;j+=3)for(int i=0;i<33;i+=3)hzfk(i,j,2);
hzfk(0,14,10);hzfk(18,17,10);hzfk(12,14,11);hzfk(9,17,11);hzfk(21,14,11);
hzfk(x,y,13);hzfk(18,8,12);
srand(time(0));
while(1){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
long long sby=sbwz().h-1,sbx=(sbwz().l+1)/2-1;
bool ldown = sbleftdown();
bool sbt = (sby==3 and sbx>=14 and sbx<=18);
if(GetAsyncKeyState('A') and x>=3){
hzfk(x,y,0);
hzfk(18,8,12);
x-=3;
hzfk(x,y,13);
Sleep(100);
}
if(GetAsyncKeyState('D') and x<=27){
hzfk(x,y,0);
hzfk(18,8,12);
x+=3;
hzfk(x,y,13);
Sleep(100);
}
if(GetAsyncKeyState('W') and y==8 and tycs==0){
hzfk(18,8,12);
tycs=2;
Sleep(100);
}
if(tycs>0){
hzfk(x,y,0);
hzfk(18,8,12);
y-=3;
tycs--;
hzfk(x,y,13);
Sleep(100);
}
else if(y!=8){
hzfk(x,y,0);
hzfk(18,8,12);
y+=3;
hzfk(x,y,13);
Sleep(100);
}
if(GetAsyncKeyState('S')){
fkwjcs++;
Sleep(100);
}
else fkwjcs=0;
if(fkwjcs==10){
if(y==8){
if(x<=27){
hzfk(x+3,y,x%2+1);
hzfk(x+3,y+3,6);
}
else{
hzfk(x-3,y,x%2+1);
hzfk(x-3,y+3,6);
}
}
else{
if(x<=27){
hzfk(x+3,y,(x+y+rand()%50)%11+1);
}
else{
hzfk(x-3,y,(x+y+rand()%50)%11+1);
}
}
}
if(sbt){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3 | FOREGROUND_RED);
Setpos(3,13);cout<<"<<开始游戏>>";
if(ldown){
return ;
}
}
else{
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
Setpos(3,13);cout<<" 开始游戏 ";
}
}
}
void dkbb(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
system("cls");Sleep(10);
while(1) {
// system("cls");
ClearLocalArea(0,0,0,0);
long long sby=sbwz().h-1,sbx=(sbwz().l+1)/2-1;
bool sbt=(4<=sbx and sby>3 and 13>=sbx and sby<=7);
bool sbld=sbleftdown();
for(int j=0; j<10; j++){
for(int i=0; i<18; i++){
Setpos(j,i);
if(j==ggby and i==ggbx-1) {
if(bb[ggby][ggbx-1]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bb[ggby][ggbx-1]==2){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<" |";
}
else if(j==ggby and i==ggbx+1) {
if(bb[ggby][ggbx+1]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bb[ggby][ggbx+1]==2){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"| ";
}
else if(j==ggby-1 and i==ggbx) {
if(bb[ggby-1][ggbx]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bb[ggby-1][ggbx]==2){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"__";
}
else if(j==ggby+1 and i==ggbx) {
if(bb[ggby+1][ggbx]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bb[ggby+1][ggbx]==2){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"--";
}
else if(j==ggby and i==ggbx and gbfk!=0)color(gbfk);
else if(bb[j][i]==1) {
if(bbwpl[i-4]!=0) {
color(bbwpl[i-4]);
} else {
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
cout<<"□";
}
}
else if(bb[j][i]==2) {
if(bbkg[j][i]!=0) {
color(bbkg[j][i]);
} else {
if(bbysxh==1){
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
cout<<" ";
}
else if(bbysxh==2){
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
cout<<"□";
}
else if(bbysxh==0){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"□";
}
}
}
else if(bb[j][i]==6) {
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | BACKGROUND_INTENSITY*409);
cout<<" ";
}
else if(bb[j][i]==7) {
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE/547);
cout<<" ";
}
else if(bb[j][i]==8) {
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE/547);
cout<<"你";
}
else if(bb[j][i]==0) {
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<" ";
}
if(j==0 and i==17){
Setpos(j,i);
cout<<bbysxh<<bbysxh;
}
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
cout<<"\n";
}
Setpos(10,0);
cout<<" 选中方块:";
if(bb[ggby][ggbx]==1 and bbwpl[ggbx-4]!=0){
color(bbwpl[ggbx-4]);
cout<<" 数量:"<<bbwplsl[ggbx-4];
}
else if(bb[ggby][ggbx]==2 and bbkg[ggby][ggbx]!=0){
color(bbkg[ggby][ggbx]);
cout<<" 数量:"<<bbkgsl[ggby][ggbx];
}
else cout<<"无";
cout<<" \n";
if(GetAsyncKeyState('E')){
system("cls");
return;
}
if(sbld and sbx==17 and sby==0)bbysxh=(bbysxh+1)%3;
if(sbt or (sbx==17 and sby==0)){ggbx=sbx,ggby=sby;}
if(GetAsyncKeyState('J') and ggbx>4)ggbx--;
if(GetAsyncKeyState('L') and ggbx<13)ggbx++;
if(GetAsyncKeyState('I') and ggby>4)ggby--;
if(GetAsyncKeyState('K') and ggby<7)ggby++;
if(GetAsyncKeyState('U')or(sbld and sbt)){
if(bb[ggby][ggbx]==2){
int gfjdahsgfahfgkjadhg=gbfk,dfghbhjg=gbwpsl;
gbwpsl=bbkgsl[ggby][ggbx];
bbkgsl[ggby][ggbx]=dfghbhjg;
gbfk = bbkg[ggby][ggbx];
bbkg[ggby][ggbx]=gfjdahsgfahfgkjadhg;
}
if(bb[ggby][ggbx]==1){
int gfjdahsgfahfgkjadhg=gbfk,dfghbhjg=gbwpsl;
if(gbfk==bbwpl[ggbx-4] and bbwplsl[ggbx-4]+gbwpsl<=64){
bbwplsl[ggbx-4]+=gbwpsl;
gbwpsl=0;gbfk=0;
}
else if(gbfk==bbwpl[ggbx-4] and bbwplsl[ggbx-4]+gbwpsl>=64){
gbwpsl=gbwpsl+bbwplsl[ggbx-4]-64;
gbfk=bbwpl[ggbx-4];
bbwplsl[ggbx-4]=64;
}
else{
gbwpsl=bbwplsl[ggbx-4];
bbwplsl[ggbx-4]=dfghbhjg;
gbfk = bbwpl[ggbx-4];
bbwpl[ggbx-4]=gfjdahsgfahfgkjadhg;
}
}
}
Sleep(20);
}
}
void dkxz(int xzx,int xzy){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
system("cls");Sleep(10);
while(1){
ClearLocalArea(0,0,0,0);
long long sby=sbwz().h-1,sbx=(sbwz().l+1)/2-1;
bool sbt=((4<=sbx and sby>4 and 13>=sbx and sby<=8)or(4<=sbx and sby>0 and 13>=sbx and sby<=3));
bool sbld=sbleftdown();
for(int j=0; j<10; j++){
for(int i=0; i<18; i++){
Setpos(j,i);
if(j==ggby and i==ggbx-1) {
if(bbxz[ggby][ggbx-1]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bbxz[ggby][ggbx-1]==2 or bbxz[ggby][ggbx-1]==3){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<" |";
}
else if(j==ggby and i==ggbx+1) {
if(bbxz[ggby][ggbx+1]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bbxz[ggby][ggbx+1]==2 or bbxz[ggby][ggbx+1]==3){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"| ";
}
else if(j==ggby-1 and i==ggbx) {
if(bbxz[ggby-1][ggbx]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bbxz[ggby-1][ggbx]==2 or bbxz[ggby-1][ggbx]==3){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"__";
}
else if(j==ggby+1 and i==ggbx) {
if(bbxz[ggby+1][ggbx]==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
else if(bbxz[ggby+1][ggbx]==2 or bbxz[ggby+1][ggbx]==3){
if(bbysxh==1)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
else if(bbysxh==2)SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
else if(bbysxh==0)SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
}
else SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"--";
}
else if(j==ggby and i==ggbx and gbfk!=0)color(gbfk);
else if(bbxz[j][i]==1){
if(bbwpl[i-4]!=0)color(bbwpl[i-4]);
else{
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
cout<<"□";
}
}
else if(bbxz[j][i]==2){
if(bbkg[j-1][i]!=0) {
color(bbkg[j-1][i]);
}
else{
if(bbysxh==1){
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
cout<<" ";
}
else if(bbysxh==2){
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
cout<<"□";
}
else if(bbysxh==0){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"□";
}
}
}
else if(bbxz[j][i]==3){
if(xz[xzy][xzx].kg[j-1][i]!=0)color(xz[xzy][xzx].kg[j-1][i]);
else {
if(bbysxh==1){
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*405);
cout<<" ";
}
else if(bbysxh==2){
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY*5);
cout<<"□";
}
else if(bbysxh==0){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3);
cout<<"□";
}
}
}
else if(bbxz[j][i]==0){
color(0);
}
if(j==0 and i==17){
Setpos(j,i);
cout<<bbysxh<<bbysxh;
}
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
cout<<"\n";
}
Setpos(10,0);
cout<<" 选中方块:";
if(bbxz[ggby][ggbx]==1 and bbwplsl[ggbx-4]!=0){
color(bbwpl[ggbx-4]);
cout<<" 数量:"<<bbwplsl[ggbx-4];
}
else if(bbxz[ggby-1][ggbx]==2 and bbkgsl[ggby-1][ggbx]!=0){
color(bbkg[ggby-1][ggbx]);
cout<<" 数量:"<<bbkgsl[ggby-1][ggbx];
}
else cout<<"无";
cout<<" \n";
if(GetAsyncKeyState('E')){
system("cls");
return;
}
if(sbld and sbx==17 and sby==0)bbysxh=(bbysxh+1)%3;
if(sbt or (sbx==17 and sby==0)){ggbx=sbx,ggby=sby;}
if(sbld and sbt){
if(bbxz[ggby][ggbx]==2){
int gfjdahsgfahfgkjadhg=gbfk,dfghbhjg=gbwpsl;
gbwpsl=bbkgsl[ggby-1][ggbx];
bbkgsl[ggby-1][ggbx]=dfghbhjg;
gbfk = bbkg[ggby-1][ggbx];
bbkg[ggby-1][ggbx]=gfjdahsgfahfgkjadhg;
}
if(bbxz[ggby][ggbx]==3){
int gfjdahsgfahfgkjadhg=gbfk,dfghbhjg=gbwpsl;
gbwpsl=xz[xzy][xzx].sl[ggby-1][ggbx];
xz[xzy][xzx].sl[ggby-1][ggbx]=dfghbhjg;
gbfk = xz[xzy][xzx].kg[ggby-1][ggbx];
xz[xzy][xzx].kg[ggby-1][ggbx]=gfjdahsgfahfgkjadhg;
}
if(bbxz[ggby][ggbx]==1){
int gfjdahsgfahfgkjadhg=gbfk,dfghbhjg=gbwpsl;
if(gbfk==bbwpl[ggbx-4] and bbwplsl[ggbx-4]+gbwpsl<=64){
bbwplsl[ggbx-4]+=gbwpsl;
gbwpsl=0;gbfk=0;
}
else if(gbfk==bbwpl[ggbx-4] and bbwplsl[ggbx-4]+gbwpsl>=64){
gbwpsl=gbwpsl+bbwplsl[ggbx-4]-64;
gbfk=bbwpl[ggbx-4];
bbwplsl[ggbx-4]=64;
}
else{
gbwpsl=bbwplsl[ggbx-4];
bbwplsl[ggbx-4]=dfghbhjg;
gbfk = bbwpl[ggbx-4];
bbwpl[ggbx-4]=gfjdahsgfahfgkjadhg;
}
}
}
Sleep(20);
}
}
void dtcsh(int cshcs,int cshms){
srand(time(0));
int nn;
if(cshcs == 1){
dt[y+1][x]=1;
dt[y+2][x]=6;
for(int i=0;i<448;i++)dt[y+3+i][x]=2;
dt[y+450+3][x]=3;
int terrain_radius = 200;
for(int j=y-terrain_radius;j<y+terrain_radius;j++){
for(int i=x-terrain_radius;i<x+terrain_radius;i++){
if(j<0 || j>=1000 || i<0 || i>=3000) continue;
int dist = abs(j-y) + abs(i-x);
if(dist < 50) map_terrain[j][i] = PLAIN;
else if(dist < 100) map_terrain[j][i] = FOREST;
else if(dist < 150 && rand()%5==0) map_terrain[j][i] = LAKE;
else if(dist < 200) map_terrain[j][i] = MOUNTAIN;
else map_terrain[j][i] = OCEAN;
}
}
// 先清空树种数组,防止残留脏数据
memset(sctree, 0, sizeof(sctree));
// 直接按横坐标分配树种,无越界
for(int i=0;i<3001;i++){
// 仅部分坐标生成树木,其余为0不渲染
if(rand() % 30 == 0){
sctree[i] = rand()%8 + 1; // 1~8对应8种树
}else{
sctree[i] = 0;
}
}
}
nn = rand()%350+50;
if(cshms==1){
for(int j=1;j<1000;j++){
for(int i=1;i<3000;i++){
if(dtf[j][i] == 2 and dt[j][i] != 8){
continue;
}
if(sctree[i]!=0 && yy1-6==j){
int kju=sctree[i]-1;
// 修正循环边界,不再越界,保留单行起始限制,不会遍地长树
for(int s=0;s<7;s++){
for(int k=0;k<6;k++){
int mapY = j + s;
int mapX = i + k;
// 边界拦截 + 不覆盖道路1/6,只画空地
if(mapY >= 0 && mapY < 1000 && mapX >=0 && mapX <3000){
if(dt[mapY][mapX] == 0){
dt[mapY][mapX] = tree[kju][s][k];
}
}
}
}
}
if(dt[j][i] == 1){
if(dtf[j][i-1] == 0){
dt[j][i-1]=1;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0){
dt[j][i+1]=1;
dtf[j][i+1]=1;
}
if(dt[j-1][i] != 0 and dt[j-1][i] != 8 and dt[j-1][i] != 9){
dt[j][i]=6;
dtf[j][i]=2;
}
}
if(dt[j][i] == 6){
if(dtf[j][i-1] == 0){
dt[j][i-1]=6;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0){
dt[j][i+1]=6;
dtf[j][i+1]=1;
}
}
if(dt[j][i] == 2){
int fsr=rand()%15;
int fse=rand()%15;
if(dtf[j][i-1] == 0 and fsr!=8 and fsr != 12 and fsr != 8 and fsr!=11){
dt[j][i-1]=2;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0 and fse!=5 and fse != 4 and fse != 6 and fse!=9){
dt[j][i+1]=2;
dtf[j][i+1]=1;
}//
if(dtf[j-1][i] == 0 and fsr!=8 and fsr != 12 and fsr != 8 and fsr!=11){
dt[j-1][i]=2;
dtf[j-1][i]=1;
}
if(dtf[j+1][i] == 0 and fse!=5 and fse != 4 and fse != 6 and fse!=9){
dt[j+1][i]=2;
dtf[j+1][i]=1;
}//
if(dtf[j][i-1] == 0 and fsr==8){
dt[j][i-1]=10;
dtf[j][i-1]=2;
}
if(dtf[j][i+1] == 0 and fse==5){
dt[j][i+1]=10;
dtf[j][i+1]=2;
}
if(dtf[j][i-1] == 0 and fsr == 12){
dt[j][i-1]=0;
dtf[j][i-1]=2;
}
if(dtf[j][i+1] == 0 and fse == 4){
dt[j][i+1]=0;
dtf[j][i+1]=2;
}
if(dtf[j][i-1] == 0 and fsr == 8){
dt[j][i-1]=0;
dtf[j][i-1]=2;
}
if(dtf[j][i+1] == 0 and fse == 6){
dt[j][i+1]=0;
dtf[j][i+1]=2;
}
if(dtf[j][i+1] == 0 and fse == 9){
dt[j][i+1]=11;
dtf[j][i+1]=2;
}
if(dtf[j][i-1] == 0 and fsr == 11){
dt[j][i-1]=11;
dtf[j][i-1]=2;
}
}
if(dt[j][i] == 3){
if(dtf[j][i-1] == 0){
dt[j][i-1]=3;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0){
dt[j][i+1]=3;
dtf[j][i+1]=1;
}
}
if(dty[j][i] == 7){
if(xndq == 1 && x >= 0 && x < 30000 && y >= 0 && y < 10000){
int dx = x - i;
int dy = y - j;
bool moved = false;
if(abs(dx) >= abs(dy)){
if(dx > 0 && dty[j][i+1] == 0 && dt[j][i+1] != 3 && dt[j+1][i] != 5){
dty[j][i+1] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
moved = true;
} else if(dx < 0 && dty[j][i-1] == 0 && dt[j][i-1] != 3 && dt[j+1][i] != 5){
dty[j][i-1] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
moved = true;
}
}
if(!moved){
if(dy > 0 && dty[j+1][i] == 0 && dt[j+1][i] != 3 && dt[j+1][i] != 5){
dty[j+1][i] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
moved = true;
} else if(dy < 0 && dty[j-1][i] == 0 && dt[j-1][i] != 3 && dt[j+1][i] != 5){
dty[j-1][i] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
moved = true;
}
}
if(!moved){
nn = rand()%6;
if(nn == 1 && dty[j][i-1] == 0 && dt[j][i-1] != 3 && dt[j+1][i] != 5) {
dty[j][i-1] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
} else if(nn == 2 && dty[j][i+1] == 0 && dt[j][i+1] != 3 && dt[j+1][i] != 5) {
dty[j][i+1] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
} else if(nn == 3 && dty[j-1][i] == 0 && dt[j-1][i] != 3 && dt[j+1][i] != 5) {
dty[j-1][i] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
} else if(nn == 4 && dty[j+1][i] == 0 && dt[j+1][i] != 3 && dt[j+1][i] != 5) {
dty[j+1][i] = 7;
if(rand()%2 == 0) dty[j][i] = 0;
}
}
}
else {
if(dty[j][i-1] == 0 && dt[j][i-1] != 3 && dt[j+1][i] != 5){
nn = rand()%5;
if(nn == 1){
dty[j][i-1] = 7;
nn = rand()%2;
if(nn == 0) dty[j][i] = 0;
}
}
if(dty[j][i+1] == 0 && dt[j][i+1] != 3 && dt[j+1][i] != 5){
nn = rand()%5;
if(nn == 2){
dty[j][i+1] = 7;
nn = rand()%2;
if(nn == 0) dty[j][i] = 0;
}
}
if(dty[j-1][i] == 0 && dt[j-1][i] != 3 && dt[j+1][i] != 5){
nn = rand()%6;
if(nn == 3){
dty[j-1][i] = 7;
nn = rand()%2;
if(nn == 1) dty[j][i] = 0;
}
}
if(dty[j+1][i] == 0 && dt[j+1][i] != 3 && dt[j+1][i] != 5){
nn = rand()%6;
if(nn == 4){
dty[j+1][i] = 7;
nn = rand()%2;
if(nn == 1) dty[j][i] = 0;
}
}
}
nn = rand()%3;
if(nn == 1) dty[j][i] = 0;
if(dt[j][i] == 3 || dt[j+1][i] == 5) dty[j][i] = 0;
if(dty[y][x] == 7 && xndq == 1) dty[j][i] = 0;
}
}
}
}
else{
for(int j=y-5;j<y+5;j++){
for(int i=x-9;i<x+9;i++){
if(dtf[j][i] == 2 and dt[j][i] != 8){
continue;
}
// if(sctree[i]!=0 and yy1-7==j){
// int kju=sctree[i];
// for(int s=0;s<7;s++)for(int k=0;k<6;k++)dt[j-s][i+k]=tree[kju][s][k],dtf[j-s][i+k]=2;
// }
if(dt[j][i] == 1){
if(dtf[j][i-1] == 0){
dt[j][i-1]=1;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0){
dt[j][i+1]=1;
dtf[j][i+1]=1;
}
if(dt[j-1][i] != 0 and dt[j-1][i] != 8 and dt[j-1][i] != 9){
dt[j][i]=6;
dtf[j][i]=2;
}
}
if(dt[j][i] == 6){
if(dtf[j][i-1] == 0){
dt[j][i-1]=6;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0){
dt[j][i+1]=6;
dtf[j][i+1]=1;
}
}
if(dt[j][i] == 2){
int fsr=rand()%15;
int fse=rand()%15;
if(dtf[j][i-1] == 0 and fsr!=8 and fsr != 12 and fsr != 8 and fsr!=11){
dt[j][i-1]=2;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0 and fse!=5 and fse != 4 and fse != 6 and fse!=9){
dt[j][i+1]=2;
dtf[j][i+1]=1;
}//
if(dtf[j-1][i] == 0 and fsr!=8 and fsr != 12 and fsr != 8 and fsr!=11){
dt[j-1][i]=2;
dtf[j-1][i]=1;
}
if(dtf[j+1][i] == 0 and fse!=5 and fse != 4 and fse != 6 and fse!=9){
dt[j+1][i]=2;
dtf[j+1][i]=1;
}//
if(dtf[j][i-1] == 0 and fsr==8){
dt[j][i-1]=10;
dtf[j][i-1]=2;
}
if(dtf[j][i+1] == 0 and fse==5){
dt[j][i+1]=10;
dtf[j][i+1]=2;
}
if(dtf[j][i-1] == 0 and fsr == 12){
dt[j][i-1]=0;
dtf[j][i-1]=2;
}
if(dtf[j][i+1] == 0 and fse == 4){
dt[j][i+1]=0;
dtf[j][i+1]=2;
}
if(dtf[j][i-1] == 0 and fsr == 8){
dt[j][i-1]=0;
dtf[j][i-1]=2;
}
if(dtf[j][i+1] == 0 and fse == 6){
dt[j][i+1]=0;
dtf[j][i+1]=2;
}
if(dtf[j][i+1] == 0 and fse == 9){
dt[j][i+1]=0;
dtf[j][i+1]=11;
}
if(dtf[j][i-1] == 0 and fsr == 11){
dt[j][i-1]=0;
dtf[j][i-1]=11;
}
}
if(dt[j][i] == 3){
if(dtf[j][i-1] == 0){
dt[j][i-1]=3;
dtf[j][i-1]=1;
}
if(dtf[j][i+1] == 0){
dt[j][i+1]=3;
dtf[j][i+1]=1;
}
}
if(dty[j][i] == 7){
if(dty[j][i-1]==0 and dt[j][i-1]!=3 and dt[j+1][i]!=5 and xndq==0){
nn = rand()%5;
if(nn == 1){
dty[j][i-1]=7;
nn = rand() % 2;
if(nn==0)dty[j][i]=0;
}
}
if(dty[j][i+1]==0 and dt[j][i+1]!=3 and dt[j+1][i]!=5 and xndq==0){
nn = rand()%5;
if(nn == 2){
dty[j][i+1]=7;
nn = rand() % 2;
if(nn==0)dty[j][i]=0;
}
}
if(dty[j-1][i]==0 and dt[j-1][i]!=3 and dt[j+1][i]!=5 and xndq==0){
nn = rand()%6;
if(nn == 3){
dty[j-1][i]=7;
nn = rand() % 2;
if(nn==1)dty[j][i]=0;
}
}
if(dty[j+1][i]==0 and dt[j+1][i]!=3 and dt[j+1][i]!=5 and xndq==0){
nn = rand()%6;
if(nn == 4){
dty[j+1][i]=7;
nn = rand() % 2;
if(nn==1)dty[j][i]=0;
}
}
nn = rand() % 3;
if(nn==1)dty[j][i]=0;
if(dt[j][i]==3 or dt[j+1][i]!=5 and xndq==0)dty[j][i]=0;
else if(dty[y][x]==7)dty[j][i]=0;
}
}
}
}
int i1 = 0, j1 = 0, bk = 0,rr;
for(int j = y + 4; j > y - 4; j--){
for(int i = x + 8; i > x - 8; i--){
if(j < 0 || j >= 1000 || i < 0 || i >= 3000)continue;
if(dts[j][i]==0 and dt[j][i]==9)dt[j][i]=0;
else if(dt[j][i]==9)dts[j][i]--;
if(dt[j][i] == 8 or dt[j][i] == 9) {
if(j + 1 < 1000 && dt[j + 1][i] == 0 and dt[j][i] == 9) {
dt[j + 1][i] = 9;
dts[j + 1][i]=3;
dt[j][i] = 0;//
i1 = i;
j1 = j + 1;
bk = 1;
break;
}
if(j + 1 < 1000 && dt[j + 1][i] == 0 and dt[j][i] == 8) {
dt[j + 1][i] = 9;
dts[j + 1][i]=3;
// dt[j][i] = 0;//
i1 = i;
j1 = j + 1;
bk = 1;
break;
}
else{
rr = rand()%5;
if(i + 1 < 3000 && dt[j][i + 1] == 0 and dt[j+1][i]!=8 and rr<=1) {
dt[j][i + 1] = 9;
dts[j][i + 1]=2;
// if(dt[j][i] != 8)dt[j][i] = 0;//
i1 = i + 1;
j1 = j;
bk = 1;
break;
}
if(i - 1 >= 0 && dt[j][i - 1] == 0 and dt[j+1][i]!=8 and rr>=3) {
dt[j][i - 1] = 9;
dts[j][i - 1]=2;
// if(dt[j][i] != 8)dt[j][i] = 0;//
i1 = i - 1;
j1 = j;
bk = 1;
break;
}
}
}
}
if (bk == 1) {
bk = 0;
break;
}
}
return;
}
void fkgb(){
if(GetAsyncKeyState('0'))scfk=9;
if(GetAsyncKeyState('1'))scfk=0;
if(GetAsyncKeyState('2'))scfk=1;
if(GetAsyncKeyState('3'))scfk=2;
if(GetAsyncKeyState('4'))scfk=3;
if(GetAsyncKeyState('5'))scfk=4;
if(GetAsyncKeyState('6'))scfk=5;
if(GetAsyncKeyState('7'))scfk=6;
if(GetAsyncKeyState('8'))scfk=7;
if(GetAsyncKeyState('9'))scfk=8;
//if(GetAsyncKeyState('8'))scfk=8;
return ;
}
void xlxs(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
for(int i=0;i<xl;i++){
SetConsoleTextAttribute(hConsole,FOREGROUND_RED);
if(i%2 == 0)cout<<"(";
else cout<<")";
}
for(int i=18-xl;i>0;i--){
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(i%2 == 0)cout<<"(";
else cout<<")";
}
cout<<" ";
for(int i=0;i<jez;i++){
SetConsoleTextAttribute(hConsole,FOREGROUND_RED | FOREGROUND_GREEN);
if(i%2 == 0)cout<<"(";
else cout<<")";
}
for(int i=18-jez;i>0;i--){
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(i%2 == 0)cout<<"(";
else cout<<")";
}
if(xl<=0){
system("cls");
cout<<"\n\n 已死亡 \n A.重生 D.退出 ";
while(1){
if(GetAsyncKeyState('D'))exit(0);
if(GetAsyncKeyState('A')){
smsj=0;fly=0;xl=18;
for(int i=0;i<10000;i++)for(int j=0;j<30000;j++){
if(dt[i][j]==8 or dt[j][i] == 9)dt[j][i]==0;
dty[i][j] = 0;
}
jez=18;
cl = 1;
break;
}
}
}
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
void ks(){
while(1){
dtcshcs+=1;
dtcsh(dtcshcs,1);
fkgb();
long long sby=sbwz().h-2,sbx=(sbwz().l+1)/2-1;
bool sbzhml=(0<=sbx and sbx<=17 and 0<=sby and sby<=9);
bool ldown=sbleftdown();
bool rdown=sbrightdown();
if(dtcshcs%30 == 0 and jez > 0 and sfjp==1)jez--;
if(dtcshcs%100 == 0 and jez > 0)jez--;
if(jez<=0 and dtcshcs%15==0)xl--;
if(GetAsyncKeyState(VK_F3) and smsj == 0)smsj=1;
if(GetAsyncKeyState(VK_F3) and smsj == 1)smsj=0;
if(GetAsyncKeyState('E')){
if(dt[gby][gbx]==12)dkxz(gbx,gby);
else dkbb();
}
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<"x坐标:"<<x<<" y坐标:"<<y;
// if(MS==3)cout<<" 鼠标x坐标:"<<sbx<<" y坐标:"<<sby;
cout<<" "<<anstime<<" \n";
for(int j=y-5;j<y+5;j++){
for(int i=x-9;i<x+9;i++){
if(dty[j][i] == 7 and j == y and i == x and xndq==0)xl--;
else if(dty[j][i] == 7 and j == y and i == x and xndq==1 and dtcshcs%5==0)xl--;
if(j == y and i == x){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
Setpos(j,i);
cout<<"你";
}
else if(j == gby+1 and i == gbx and (MS == 2 or MS == 3)){
Setpos(j,i);
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(dt[gby+1][gbx]==1 or dt[gby+1][gbx]==6){
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN | BACKGROUND_RED | BACKGROUND_GREEN | FOREGROUND_INTENSITY);
}
else if(dt[gby+1][gbx]==2 or dt[gby+1][gbx]==10){
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
}
else if(dt[gby+1][gbx]==3){
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
else if(dt[gby+1][gbx]==8 or dt[gby+1][gbx]==9){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY);
}
cout<<"--";
}
else if(j == gby-1 and i == gbx and (MS == 2 or MS == 3)){
Setpos(j,i);
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(dt[gby-1][gbx]==1 or dt[gby-1][gbx]==6){
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN | BACKGROUND_RED | BACKGROUND_GREEN | FOREGROUND_INTENSITY);
}
else if(dt[gby-1][gbx]==2 or dt[gby-1][gbx]==10){
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
}
else if(dt[gby-1][gbx]==3){
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
else if(dt[gby-1][gbx]==8 or dt[gby-1][gbx]==9){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY);
}
cout<<"__";
}
else if(j == gby and i == gbx+1 and (MS == 2 or MS == 3)){
Setpos(j,i);
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(dt[gby][gbx+1]==1 or dt[gby][gbx+1]==6){
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN | BACKGROUND_RED | BACKGROUND_GREEN | FOREGROUND_INTENSITY);
if(dt[gby][gbx+1]==1)cout<<"]~";
else cout<<"] ";
}
else if(dt[gby][gbx+1]==2 or dt[gby][gbx+1]==10){
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
if(dt[gby][gbx+1]==10){
cout<<"]";
SetConsoleTextAttribute(hConsole,(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) | 0);
cout<<":";
}
else cout<<"] ";
}
else if(dt[gby][gbx+1]==3){
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
cout<<"] ";
}
else if(dt[gby][gbx+1]==8 or dt[gby][gbx+1]==9){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY);
cout<<"] ";
}
else cout<<"] ";
}
else if(j == gby and i == gbx-1 and (MS == 2 or MS == 3)){
Setpos(j,i);
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY / 3 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(dt[gby][gbx-1]==1 or dt[gby][gbx-1]==6){
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN | BACKGROUND_RED | BACKGROUND_GREEN | FOREGROUND_INTENSITY);
if(dt[gby][gbx-1]==1)cout<<"~[";
else cout<<" [";
}
else if(dt[gby][gbx-1]==2 or dt[gby][gbx-1]==10){
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
if(dt[gby][gbx-1]==10){
SetConsoleTextAttribute(hConsole,(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) | 0);
cout<<":";
SetConsoleTextAttribute(hConsole,BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY/10);
cout<<"[";
}
else cout<<" [";
}
else if(dt[gby][gbx-1]==3){
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
cout<<" [";
}
else if(dt[gby][gbx-1]==8 or dt[gby][gbx-1]==9){
SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_INTENSITY);
cout<<" [";
}
else cout<<" [";
}
else{
Setpos(j,i);
if(smsj == 1)cout<<dt[j][i];
else if(dty[j][i]== 7)color(dty[j][i]);
else color(dt[j][i]);
}
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
cout<<"\n";
}
Setpos(11,0);xlxs();
cout<<"\n ";
Setpos(12,0);cout<<"手持方块:";
if(bbwpl[scfk]!=0)color(bbwpl[scfk]);
else cout<<"无";
if(bbwpl[scfk]!=0)cout<<" 数量:"<<bbwplsl[scfk];
cout<<" \n";
if(dtcshcs%4==0 and jez>=16 and xl<18)xl++;
if(y>=yy1+555)xl--;
if(dt[y][x] == 8)zgd=y;
if(dt[y+1][x] != 0 and dt[y+1][x] != 9 and dt[y+1][x] != 8 and dt[y][x] != 100){
if(zgd<y and fly == 0){
for(int i=y-zgd;i>=5;i--)xl--;
}
zgd = y;
}
if(GetAsyncKeyState('W') and (dt[y+1][x]==1 or dt[y+1][x]==2 or dt[y+1][x]==3 or dt[y+1][x]==4 or dt[y+1][x]==5 or dt[y+1][x]==6 or dt[y][x] == 8)){
if(MS==2 or !sbzhml)MS = 1;
if((dt[y-1][x]==0 or dt[y-1][x]==4 or dt[y-1][x]==5 or dt[y-1][x]==8 or dt[y-1][x]==9 or dt[y-1][x]==100) and x-1>5){
y--;
zgd = y;
}
if((dt[y-1][x]==0 or dt[y-1][x]==4 or dt[y-1][x]==5 or dt[y-1][x]==8 or dt[y-1][x]==9 or dt[y-1][x]==100) and x-1>5){
y--;
zgd = y;
}
if((dt[y-1][x]==0 or dt[y-1][x]==4 or dt[y-1][x]==5 or dt[y-1][x]==8 or dt[y-1][x]==9 or dt[y-1][x]==100) and x-1>5){
y--;
zgd = y;
}
}
if(GetAsyncKeyState('W') and fly == 1){
if(MS==2 or !sbzhml)MS = 1;
if((dt[y-1][x]==0 or dt[y-1][x]==4 or dt[y-1][x]==5 or dt[y-1][x]==8 or dt[y-1][x]==9 or dt[y-1][x]==100) and x-1>5){
y-=2;
}
}
if(GetAsyncKeyState('S') and fly == 1 and y-1<995){
if(MS==2 or !sbzhml)MS = 1;
if(dt[y+1][x] == 0 or dt[y+1][x] == 8 or dt[y+1][x] == 4 or dt[y+1][x] == 5){
y++;
}
}
if(GetAsyncKeyState('S') and fly == 0 and y-1<995){
if(MS==2 or !sbzhml)MS = 1;
if(dt[y+1][x] == 8 or dt[y+1][x] == 4 or dt[y+1][x] == 5){
y++;
}
}
if(GetAsyncKeyState('A')){
if(MS==2 or !sbzhml)MS = 1;
if(dt[y][x-1]!=1 and (dt[y][x-1]==0 or dt[y][x-1]==8 or dt[y][x-1]==9 or dt[y][x-1]==100 or dt[y][x-1]==4 or dt[y][x-1]==5) and x-1>9){
x--;
}
if(sfjp == 1)x--;
}
if(GetAsyncKeyState('D')){
if(MS==2 or !sbzhml)MS = 1;
if(dt[y][x+1]!=1 and (dt[y][x+1]==0 or dt[y][x+1]==8 or dt[y][x+1]==9 or dt[y][x+1]==100 or dt[y][x+1]==4 or dt[y][x+1]==5) and x+1<2991){
x++;
}
if(sfjp == 1)x++;
}
if(((dt[y+1][x]==0 or dt[y+1][x]==100 or dt[y+1][x]==8 or dt[y+1][x]==9 or ((dt[y+1][x]==4 or dt[y+1][x]==5) and (dt[y][x]==4 or dt[y][x]==5))) and y-1<995)or(fly==1 and GetAsyncKeyState('S'))){
y++;
}
if(GetAsyncKeyState(VK_UP)){
if(MS != 2){
MS = 2;
gbx=x;
gby=y-1;
}
else if(gby>y-5){
gby--;
}
}
if(GetAsyncKeyState(VK_LEFT)){
if(MS != 2){
MS = 2;
gbx=x-1;
gby=y;
}
else if(gbx>x-9){
gbx--;
}
}
if(GetAsyncKeyState(VK_DOWN)){
if(MS != 2){
MS = 2;
gbx=x;
gby=y+1;
}
else if(gby<y+5){
gby++;
}
}
if(GetAsyncKeyState(VK_RIGHT)){
if(MS != 2){
MS = 2;
gbx=x+1;
gby=y;
}
else if(gbx<x+9){
gbx++;
}
}
if(0<=sbx and sbx<=17 and 0<=sby and sby<=9){
MS=3;
if(sbx<=9)gbx=x-abs(9-sbx);
if(sbx>=9)gbx=x+abs(sbx-9);
if(sby<=5)gby=y-abs(5-sby);
if(sby>=5)gby=y+abs(sby-5);
}
if(ldown and MS == 3){
bool pfd=0;
gbxx=gbx,gbyy=gby;
int block_type = dt[gby][gbx];
if(block_type < 0 || block_type >= sizeof(fkwjsj)/sizeof(fkwjsj[0])){
anstime = 0;
jun = 0;
continue;
}
if(anstime>=fkwjsj[block_type]){
jun=1;
anstime=0;
}
else{
anstime++;
dfgt=1;
}
if(jun==1){
for(int i=0;i<10;i++){
if(bbwpl[i]==dt[gby][gbx] and bbwplsl[i]<64){
bbwplsl[i]+=1;
pfd=1;
break;
}
}
if(!pfd){
for(int i=4;i<7;i++){
for(int j=4;j<14;j++){
if(bbkg[i][j]== dt[gby][gbx] and bbkgsl[i][j]<64){
bbkgsl[i][j]+=1;
pfd=1;
break;
}
}
if(pfd==1)break;
}
}
if(!pfd){
for(int i=0;i<10;i++){
if(bbwpl[i]==0){
bbwpl[i]=dt[gby][gbx];
bbwplsl[i] = 1;
pfd=1;
break;
}
}
}
if(!pfd){
for(int i=4;i<7;i++){
for(int j=4;j<14;j++){
if(bbkg[i][j]==0){
bbkg[i][j]=dt[gby][gbx];
bbkgsl[i][j] = 1;
pfd=1;
break;
}
}
if(pfd==1)break;
}
}
dt[gby][gbx]=0;
dtf[gby][gbx]=2;
jun = 0;
}
}
else if(GetAsyncKeyState(' ')){
if(MS == 3 or MS == 2){
if(bbwpl[scfk] == 7){
if(dty[gby][gbx]!=bbwpl[scfk])bbwplsl[scfk]--;
if(bbwplsl[scfk]==0)bbwpl[scfk]=0;
dty[gby][gbx]=bbwpl[scfk];
}
else if(bbwpl[scfk]!=0){
if(dt[gby][gbx]!=bbwpl[scfk])bbwplsl[scfk]--;
if(bbwplsl[scfk]==0)bbwpl[scfk]=0;
dt[gby][gbx]=bbwpl[scfk];
dtf[gby][gbx]=2;
}
}
if(bbwpl[scfk] == 0){
int pfd=0;
gbxx=gbx,gbyy=gby;
if(anstime>=fkwjsj[dt[gby][gbx]]){
jun=1;
anstime=0;
}
else anstime++;
if(jun==1){
for(int i=0;i<10;i++){
if(bbwpl[i]==dt[gby][gbx] and bbwplsl[i]<64){
bbwplsl[i]+=1;
pfd=1;
break;
}
}
if(!pfd){
for(int i=4;i<7;i++){
for(int j=4;j<14;j++){
if(bbkg[i][j]== dt[gby][gbx] and bbkgsl[i][j]<64){
bbkgsl[i][j]+=1;
pfd=1;
break;
}
}
if(pfd==1)break;
}
}
if(!pfd){
for(int i=0;i<10;i++){
if(bbwpl[i]==0){
bbwpl[i]=dt[gby][gbx];
bbwpl[i]++;
pfd=1;
break;
}
}
}
if(!pfd){
for(int i=4;i<7;i++){
for(int j=4;j<14;j++){
if(bbkg[i][j]==0){
bbkg[i][j]=dt[gby][gbx];
bbkg[i][j]++;
break;
}
}
if(pfd==1)break;
}
}
dt[gby][gbx]=0;
dtf[gby][gbx]=2;
}
}
else{
if(bbwpl[scfk]==7){
dty[y][x]=bbwpl[scfk];
if(bbwplsl[scfk]<=1)bbwpl[scfk]=0,bbwplsl[scfk]=0;
else bbwplsl[scfk]--;
}
else{
dt[y][x]=bbwpl[scfk];
if(bbwplsl[scfk]<=1)bbwpl[scfk]=0,bbwplsl[scfk]=0;
else bbwplsl[scfk]--;
dtf[y][x]=2;
}
}
}
if(((gbyy!=gby and gbxx!=gbx)or !ldown) and dfgt){
jun=0;
dfgt=0;
anstime=0;
}
if(rdown and MS == 3){
if(bbwpl[scfk] == 7){
if(dty[gby][gbx]!=bbwpl[scfk])bbwplsl[scfk]--;
if(bbwplsl[scfk]==0)bbwpl[scfk]=0;
dt[gby][gbx]=bbwpl[scfk];
dty[gby][gbx]=bbwpl[scfk];
break;
}
else if(bbwpl[scfk]!=0){
if(dt[gby][gbx]!=bbwpl[scfk])bbwplsl[scfk]--;
dt[gby][gbx]=bbwpl[scfk];
dtf[gby][gbx]=2;
if(bbwplsl[scfk]==0)bbwpl[scfk]=0;
break;
}
}
if(GetAsyncKeyState('P')){
system("cls");
int zlms=0,fzfk=0;
while(1){
if(zlms==0){
system("cls");
cout<<" 游戏设置\n";
cout<<"1.基础指令 \n";
cout<<"2.视觉修改 \n";
cout<<"3.地图生成模块 \n";
if(GetAsyncKeyState(VK_NUMPAD1) or GetAsyncKeyState('1'))zlms=1;
if(GetAsyncKeyState(VK_NUMPAD2) or GetAsyncKeyState('2'))zlms=2;
if(GetAsyncKeyState(VK_NUMPAD3) or GetAsyncKeyState('3'))zlms=3;
if(GetAsyncKeyState('P'))break;
Sleep(100);
}
if(zlms==1){
system("cls");
cout<<" 基础指令 \n";
cout<<"1.飞行:";
if(fly == 1)cout<<"开\n";
else cout<<"关\n";
cout<<"2.疾跑:";
if(sfjp == 1)cout<<"开\n";
else cout<<"关\n";
cout<<"3.water消失术 :";
if(wushui == 1)cout<<"开\n";
else cout<<"关\n";
cout<<"4./kill\n";
cout<<"5.传送\n";
cout<<"x.吸纳毒气:";
if(xndq==0)cout<<"关\n";
else cout<<"开\n";
cout<<"按0返回\n";
if(GetAsyncKeyState(VK_NUMPAD1) or GetAsyncKeyState('1'))fly = (fly+1)%2;
if(GetAsyncKeyState(VK_NUMPAD2) or GetAsyncKeyState('2'))sfjp = (sfjp+1)%2;
if(GetAsyncKeyState(VK_NUMPAD4) or GetAsyncKeyState('4')){
xl = 0;
break;
}
if(GetAsyncKeyState(VK_NUMPAD5) or GetAsyncKeyState('5')){
int x1,y1;
Sleep(100);
system("cls");
cout<<" 坐标示意图(x,y):\n";
cout<<" (0,-1)\n ||\n (-1,0)==(0,0)==(1,0)\n ||\n (1,0)\n";
int x2,y2;
int dtsfjz=0;
cout<<"x坐标(9~2991):";cin>>x1;
if(9<=x1 and x1<=2991){
x2=x;
dtsfjz=1;
x = x1;
}
cout<<"y坐标(5~995):";cin>>y1;
if(5<=y1 and y1<=995){
y2=y;
dtsfjz=1;
y = y1;
zgd = y1;
}
if(dtsfjz){
if(9<=x1 and x1<=2991)x=x1;
if(5<=y1 and y1<=995)y=yy1;
dtcsh(1,1);
for(int i=0;i<=20;i++)dtcsh(dtcshcs,1);
for(int i=0;i<=rand()%9+3;i++){
system("cls");
cout<<"\n\n 地形加载中";
for(int j=0;j<=i%3;j++)cout<<".";
cout<<"\n";
Sleep(100);
}
system("cls");
cout<<" 地形加载成功!";
if(5<=y1 and y1<=995)y=y1;
}
break;
}
if(GetAsyncKeyState('X'))xndq=(xndq+1)%2;
if(GetAsyncKeyState(VK_NUMPAD3) or GetAsyncKeyState('3'))wushui=(wushui+1)%2;
if(GetAsyncKeyState('P'))break;
if(GetAsyncKeyState(VK_NUMPAD0) or GetAsyncKeyState('0'))zlms=0;
Sleep(100);
}
if(zlms==2){
system("cls");
cout<<"1.僵尸颜色<";
if(ys==0)cout<<"绿色>\n";
if(ys==1)cout<<"红色>\n";
if(ys==2)cout<<"黑色>\n";
cout<<"2.背包颜色设定:"<<bbysxh<<"\n";
cout<<"按0返回\n";
if(GetAsyncKeyState(VK_NUMPAD1) or GetAsyncKeyState('1'))ys=(ys+1)%3;
if(GetAsyncKeyState(VK_NUMPAD2) or GetAsyncKeyState('2'))bbysxh=(bbysxh+1)%3;
if(GetAsyncKeyState('P'))break;
if(GetAsyncKeyState(VK_NUMPAD0) or GetAsyncKeyState('0'))zlms=0;
Sleep(100);
}
if(zlms==3){
system("cls");
cout<<"1.生成地图 \n";
cout<<"按0返回\n";
if(GetAsyncKeyState(VK_NUMPAD1) or GetAsyncKeyState('1'))zlms=100;
if(GetAsyncKeyState('P'))break;
if(GetAsyncKeyState(VK_NUMPAD0) or GetAsyncKeyState('0'))zlms=0;
Sleep(100);
}
if(zlms==100){
system("cls");
cout<<"在当前y 坐标生成<";
if(fzfk==0)cout<<"草方块>\n";
if(fzfk==1)cout<<"泥土>\n";
if(fzfk==2)cout<<"石头>\n";
if(fzfk==3)cout<<"水>\n";
if(fzfk==4)cout<<"基岩>\n";
cout<<"按2确认\n";
cout<<"按0返回\n";
if(GetAsyncKeyState(VK_NUMPAD1) or GetAsyncKeyState('1'))fzfk=(fzfk+1)%5;
if(GetAsyncKeyState(VK_NUMPAD2) or GetAsyncKeyState('2')){
if(fzfk==0)dt[y][x]=1;
if(fzfk==1)dt[y][x]=6;
if(fzfk==2)dt[y][x]=2;
if(fzfk==3)dt[y][x]=8;
if(fzfk==4)dt[y][x]=3;
for(int i=0;i<=rand()%4+10;i++){
system("cls");
dtcsh(2,1);
cout<<"\n 加载地形中";
for(int j=0;j<i%3;i++)cout<<".";
}
break;
}
if(GetAsyncKeyState('P'))break;
if(GetAsyncKeyState(VK_NUMPAD0) or GetAsyncKeyState('0'))zlms=3;
Sleep(100);
}
}
}
if(GetAsyncKeyState(VK_ESCAPE)){
int sf;
system("cls");
cout<<"0.返回 \n1.设置 \n2.退出游戏\n";
cin>>sf;
if(sf==1){
system("cls");
cout<<"1.游戏刷新频率 \n";
cin>>sf;
if(sf==1){
system("cls");
cout<<"请输入刷新频率(默认频率50):";
cin>>sxpl;
system("cls");
}
}
else if(sf==2){
cout<<"是否存档?\n 1.Yes(默认路径) 2.Yes(自定义路径) 3.No \n";
cin>>sf;
if(sf == 1){
system("cls");
cout<<"请输入存档名称:";
string fserf;
cin>>fserf;
O(fserf);
}
else if(sf == 2){
system("cls");
cout<<"请输入自定义根目录(如 D:\\Game\\):";
string customDir;
cin>>customDir;
cout<<"请输入存档名称:";
string fserf;
cin>>fserf;
O_CustomPath(fserf, customDir);
}
if(sf != 3)exit(0);
}
}
if(GetAsyncKeyState('M')){
if(jez<18)jez++;
if(xl<18)xl++;
}
if(GetAsyncKeyState('N') and bbwpl[scfk]!=0){
bbwplsl[scfk]=64;
}
if(GetAsyncKeyState('B')){
bbwplsl[scfk]=0;
bbwpl[scfk]=0;
}
// if(dtcshcs % 100 == 0){
// for(int z=0;z<MAX_ZOMBIES;z++){
// if(!js[z].alive){
// js[z].x = x + rand()%20 - 10;
// js[z].y = y + rand()%20 - 10;
// js[z].xl = 18;
// js[z].zt = 1;
// js[z].cx = 1;
// js[z].alive = true;
// break;
// }
// }
// }
// //ren gong zhing zhang -- jiang shi
// for(int z=0;z<MAX_ZOMBIES;z++){
// if(!js[z].alive) continue;
// if(js[z].xl <= 0){
// js[z].alive = false;
// continue;
// }
// int zx = js[z].x;
// int zy = js[z].y;
// int dx = x - zx;
// int dy = y - zy;
//
// if(abs(dx) <=5 && abs(dy) <=2){
// if(dx > 0 && (dt[zy][zx+1]==0 || dt[zy][zx+1]==8) && zx+1<2991){
// js[z].cx=2;
// js[z].zt=1;
// js[z].x++;
// }
// else if(dx < 0 && (dt[zy][zx-1]==0 || dt[zy][zx-1]==8) && zx-1>9){
// js[z].cx=1;
// js[z].zt=1;
// js[z].x--;
// }
// if(dy > 0 && (dt[zy+1][zx]==0 || dt[zy+1][zx]==8) && zy+1<995){
// js[z].y++;
// }
// else if(dy < 0 && (dt[zy-1][zx]==0 || dt[zy-1][zx]==8) && zy-1>5){
// js[z].y--;
// }
// }
// else{
// int move_dir = rand()%4;
// if(move_dir == 0 && zx+1<2991 && (dt[zy][zx+1]==0 || dt[zy][zx+1]==8)){
// js[z].x++;
// }
// else if(move_dir ==1 && zx-1>9 && (dt[zy][zx-1]==0 || dt[zy][zx-1]==8)){
// js[z].x--;
// }
// else if(move_dir ==2 && zy+1<995 && (dt[zy+1][zx]==0 || dt[zy+1][zx]==8)){
// js[z].y++;
// }
// else if(move_dir ==3 && zy-1>5 && (dt[zy-1][zx]==0 || dt[zy-1][zx]==8)){
// js[z].y--;
// }
// }
// }
if(cl == 1){
cl=0;
return;
}
if(wushui==1){
for(int j = y + 4; j > y - 4; j--)for(int i = x + 8; i > x - 8; i--)if(dt[j][i]==8 or dt[j][i]==9)dt[j][i]=0;
}
// system("cls");
ClearLocalArea(0,0,0,0);
Sleep(sxpl);
}
return;
}
int main(){
hideCursor();
xccdl();
SetConsoleTitle("dts");
system("mode con cols=62 lines=21");
HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hInput, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hInput, mode);
// jzhm2();
// jzhm();
// ksjm1();
// ksjm();
// MessageBox(0," 欢迎来到 dts!\n 制作者:haha","冈易游戏",0);
// MessageBox(0,"WSAD 移动 | 空格 放置方块\nE 打开背包 | UJHK 控制背包光标\nU移动方块 | 方向键 移动光标\n0~9 改变手持方块","游戏操作方式",0);
system("cls");
say("已尝试切换到英文模式");cout<<"\n";Sleep(200);
system("cls");
string sd;
sd=_getch();
if(sd=="1"){
cout<<"是否读取存档\n 1.Yes 2.No";
sd=_getch();
if(sd=="1"){
system("cls");
cout<<"请输入存档名称:";
cin>>sd;
I(sd);
system("cls");
}
sd="2";
}
if(sd=="2"){
system("cls");
cout<<"请输入刷新频率(默认频率50):";
cin>>sxpl;
system("cls");
}
cl = 0;
while(1){
hideCursor();
for(int i=0;i<=12;i++)color(i);
jez=18;
cout<<"\n";
srand(time(0));
if(dtcshcs <1){
x=rand()%21+1490;
y=rand()%21+490;
xx1 = x;
yy1 = y;
for(int i=0;i<3;i++)for(int j=0;j<10;j++)bbkg[i][j]=0;
}
else{
x = xx1;
y = yy1;
for(int i=0;i<3;i++)for(int j=0;j<10;j++)bbkg[i][j]=0;
}
zgd=y;
for(int i=0;i<=10;i++)dtcsh(2,0);
ks();
}
return 0;
}