/*=========================================*SJ出品*=========================================*/ 
#include<bits/stdc++.h>			//万能头文件
#include<cstdlib>				//system("cls");=清屏  std::system("pause");=按任意键继续...		 																		
#include<unistd.h>  			//sleep(x);=等待x秒
#include<conio.h>				//b=getch();=不按回车输入b 
#include<windows.h>
#include <random>
#include <fstream>
#define cj0 p1.cj.c0
#define cj1 p1.cj.c1
#define cj2 p1.cj.c2
#define cj3 p1.cj.c3
#define cj4 p1.cj.c4
#define cj5 p1.cj.c5
#define cj6 p1.cj.c6
#define cj7 p1.cj.c7
#define cj8 p1.cj.c8
using namespace std;
char b;		//游戏内专用输入 
char al;	//标题专用输入 
struct cj{//成就 
	short c0=0;
	short c1=0;
	short c2=0;
	short c3=0;
	short c4=0;
	short c5=0;
	short c6=0;
	short c7=0;
	short c8=0;
};
struct jj{
	bool jj0=false;
	bool jj1=false;
};
struct yhxx{//用户信息 
	string name;
	int score0;
	int score=50;
	short t;
	cj cj;
	jj jj;
}p1;
void fs(){//分数 
		    p1.score0=p1.score-p1.t*3;
			if(cj0>=3){
				p1.score0=p1.score0+5;
			}
			if(cj1>=3){
				p1.score0=p1.score0+5;
			}
			if(cj2>=3){
				p1.score0=p1.score0+5;
			}
			if(cj3>=3){
				p1.score0=p1.score0+5;
			}
			if(cj4>=3){
				p1.score0=p1.score0+5;
			} 
			if(cj6>=5){
				p1.score0=p1.score0+5;
			}
			if(cj7>=5){
				p1.score0=p1.score0+5;
			}
			if(cj8!=0){
				p1.score0=p1.score0+10;
			}
	cout<<"分数："<<p1.score0;
}

// 生成随机数
int generateRandomNumber(int min, int max) {
    static random_device rd;
    static mt19937 gen(rd());
    uniform_int_distribution<int> dis(min, max);
    return dis(gen);
}
int sjs1() {
    return generateRandomNumber(100000, 999999);
}
int sjs2() {
	return generateRandomNumber(1, 2);
} 
// 生成随机数
void cd(){//存档 
			ofstream outFile("用户信息.txt");
			outFile << "用户：" ;
			outFile << p1.name << std::endl;
			outFile << "死亡次数：" ;
			outFile << p1.t << std::endl;
			outFile << "分数：" ;
			outFile <<  p1.score0 << std::endl;
			outFile << "其他：" << std::endl;
			outFile << cj0 << std::endl;
			outFile << cj1 << std::endl;
			outFile << cj2 << std::endl;
			outFile << cj3 << std::endl;
			outFile << cj4 << std::endl; 
			outFile << cj5 << std::endl;
			outFile << cj6 << std::endl;
			outFile << cj7 << std::endl;
			outFile << cj8 << std::endl; 
			outFile << "结局：" << std::endl;
			if(cj8!=0){
				outFile << "已达成" << std::endl;
			}
			else{
				outFile << "未达成" << std::endl;
			} 
			outFile.close();
}

/*
system ("color "):
    0 = 黑色       8 = 灰色
    1 = 蓝色       9 = 淡蓝色
    2 = 绿色       A = 淡绿色
    3 = 浅绿色     B = 淡浅绿色
    4 = 红色       C = 淡红色
    5 = 紫色       D = 淡紫色
    6 = 黄色       E = 淡黄色
    7 = 白色       F = 亮白色
*/
/*=========================================*SJ出品*=========================================*/ 
void jiej(){
	system("cls"); 
	sleep(2);
	cout<<"制作人：朱博文(SJ集团)"<<endl<<"内容：徐译皓"<<endl<<"特别鸣谢：赵楷诚，夏晨轩，为开发提供灵感";
	sleep(4);
	cout<<endl<<"谢谢游玩。"; 
	sleep(2);
	cout<<endl<<"尽情期待逃离学校2！";
	sleep(2);
	std::system("pause");
	fs(); 
}
	short lj=0;
void HideCursor(){//隐藏鼠标 
    CONSOLE_CURSOR_INFO cursor_info = {1, 0}; 
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
	}
int main(){
	p1.t=0;
    HideCursor();
	cout<<"输入你的名字"<<endl;
	getline(cin,p1.name);
	cd();
	L2:
	system("cls");
	system ("color 4");
	cout<<endl<<endl;
	cout<<"         ==========="<<endl;
	cout<<"        |逃离学校1  |"<<endl;
	cout<<"         ==========="<<endl;
	system ("color F");
	cout<<"	v1.2.5.6"<<endl<<"2025/12/24~2026/2/9"<<endl<<endl;
	cout<<"	输入a开始"<<endl;
	cout<<"	输入b查看成就"<<endl;
	cout<<"	输入c查看规则"<<endl;
	cout<<"	输入d退出"<<endl;
	cout<<"	输入e查看用户信息"<<endl;
	cout<<"________________________"<<endl<<"	";
	al=getch();
	system("cls");
	if(al=='a'){
		system ("color F");
			cout<<"SJ出品"<<endl;
			sleep(1);
			cout<<"主编许译皓"<<endl;
			sleep(1);
			cout<<"改编朱博文"<<endl;
			sleep(3);
			std::system("pause");
		a1:
		system("cls"); 
		
		cout<<"你醒了，你在厕所，";
		L1:
		cout<<"你要1、滋同学2、进浴室"<<endl;
		b=getch();
		switch (b){
			case '1':
				cout<<"<"<<p1.name<<"> 击杀了 <同学>"<<endl;
				cj0++;
				if(cj0==3){
					sleep(1);
					cout<<"成就！尿尿大王1！"<<endl;
					sleep(3);
					std::system("pause");
					system("cls");
					goto L1; 
					break;
				}
				else{
				sleep(2);
				system("cls");
				goto L1; 
				break;
				}
			case '2':
				system("cls");
				cout<<"你看见了一个人全身都是血，你要1、尖叫2、告老师"<<endl; 
				b=getch();
				switch(b){
					case '1':
						system("cls");
						cout<<"你死了"<<endl;
						system ("color 4F");
						sleep(3);
						system ("color 0F");
							system("cls");
							cout<<"广告:"<<endl;
							sleep(1);
							cout<<"A:1+1=几？"<<endl;
							sleep(2);
							cout<<"B:等于4"<<endl;
							sleep(2);
							cout<<"A:为什么？"<<endl; 
							sleep(2);
							cout<<"B:因为肉包子很好吃"<<endl; 
							cj3++;
							p1.cj.c6++;
							p1.t++;
							sleep(2);
						std::system("pause");
						system("cls");
							cout<<"你要：1、重生2、返回标题页面";
								b=getch();
								if(b=='1'){
									goto a1;
								}
								else if(b=='2'){
									goto L2;
								}
								else{
									cout<<"要你叫！";
									p1.cj.c7++;
									sleep(2);
									goto L2;
									if(p1.cj.c7==5){
										sleep(1);
										cout<<"成就！要你叫！"<<endl;
										sleep(3);
										std::system("pause");
										system("cls");
										goto L2; 
									}
								}
						break;
					case '2':
						system("cls");
						L6:
						cout<<"老师让大家自杀，你要1、割腕2、跳楼3、打晕自己"<<endl;
							b=getch();
							switch(b){
								case '1':
								case '2':
								case '3':
									cout<<"你晕了"<<endl;
									sleep(2); 
									system("cls");
									cout<<"你醒了，";
									L3: 
									cout<<"你要1、撒了旁边的老师2、出教室3、滋老师"<<endl;                              
									b=getch();
									switch(b){
										case '1':{
											cout<<"<"<<p1.name<<"> 击杀了 <老师>"<<endl;
											p1.cj.c2++;
												if(p1.cj.c2==3){
												sleep(1);
												cout<<"成就！艾莎王子！"<<endl;
												sleep(3);
												std::system("pause");
												system("cls");
												goto L3;
												break;
												}
												else{
													sleep(2);
													system("cls");
													goto L3;
												} 
										}
										case '2':{
										
											system("cls");
											L4:
											cout<<"你要1、下楼2、去教室3、回教室"<<endl;/////////// 
												b=getch();
													system("cls");
												switch(b){
													case '1':{
														L7:
														cout<<"你看见了2个老师，窗外有一个上吊的人，你要1、下楼2、告诉老师有人上吊3、上楼"<<endl;/////////////////////////////////////////////////
														b=getch();
														switch(b){
															case '1':{
																system("cls");
																cout<<"你要到1、校门2、回去";
																b=getch();
																	switch(b){
																		case '1':{
																			system("cls");
																			cout<<"你感到后面有人，你要1、回头2、继续跑";
																			b=getch();
																			switch(b){////////////////////////////////////////////////////////////////////////////
																				case '1':{
																					aaa:
																					system("cls");
																					cout<<"你感到浑身一麻..."<<endl;
																					sleep(2);
																					std::system("pause");
																					system("cls");
																					lj++;
																					goto a1;
																					break;
																				}
																				case '2':{
																					if(lj>=3){
																						int p=sjs2();
																						if(p==1){
																							system("cls");
																							cout<<"你在厕所醒来，进入了新的循环..."<<endl<<"结局：循环";
																							sleep(2);
																							cj8++;
																							p1.jj.jj0=true;
																							jiej();
																							cd();
																							goto L2;
																							break;
																						}
																						else{
																							system("cls");
																							cout<<"你从梦中醒来，发现在上课，你想：“原来只是个梦...”"<<endl;
																							sleep(3);
																							cout<<"已通关"<<endl; 
																							sleep(2);
																							cout<<"结局：原来只是个梦...";
																							p1.jj.jj1=true;
																							cj8++;
																							sleep(3);
																							jiej();
																							cd();
																							goto L2;
																							break;
																						}

																					}
																					else{
																						goto aaa;
																					}
	
																				}
																		   }
																			break;
																		}
																		case '2':{
																			system("cls");
																			goto L7;
																			system("cls"); 
																			break;
																		}
																		case '3':{
																			system("cls");
																			break;
																		}
																	} 
																break;
															}
															case '2':{
																goto L6;
																break;
															}
															case '3':{
																goto L4;
																break;
															}
														} 
														break;
													}
													case '2':{
														cout<<"有一个奇怪的玩偶你要1、碰他2、撕他3、出教室"<<endl;
														b=getch();
														system("cls");
														switch(b){
															case '1':{
																cout<<"你晕了"<<endl;
																sleep(2);
																system("cls");
																cout<<"你醒了，感觉四周似曾相识，";
																goto L4;
																break;
															} 
															case '2':{
																	system("cls");
																	cout<<"你死了"<<endl;
																	system ("color 4F");
																	sleep(3);
																	system ("color 0F");
																		system("cls");
																		cout<<"广告:"<<endl;
																		sleep(1);
																		cout<<"A:2+2=几？"<<endl;
																		sleep(2);
																		cout<<"B:等于6"<<endl;
																		sleep(2);
																		cout<<"A:为什么？"<<endl; 
																		sleep(2);
																		cout<<"B:因为菜包子很难吃"<<endl; 
																		p1.cj.c4++;
																		p1.cj.c6++;
																		p1.t++;
																		sleep(2);
																	std::system("pause");
																	
																	system("cls");
																		cout<<"你要：1、重生2、返回标题页面";
																		b=getch();
																		if(b=='1'){
																			goto a1;
																		}
																		else if(b=='2'){
																			goto L2;
																		}
																		else{
																			cout<<"要你叫！";
																			p1.cj.c7++;
																			sleep(2);
																			goto L2;
																			if(p1.cj.c7==5){
																				sleep(1);
																				cout<<"成就！要你叫！"<<endl;
																				sleep(3);
																				std::system("pause");
																				system("cls");
																				goto L2; 
																			}
																		}
																break;
															}
															case '3':{
																goto L4;
																break;
															}
														}
														break;
													}
													case '3':{
														system("cls");
														cout<<"你出了教室，";
														goto L4;
														break;
													}
			
												} 
												
											break;
										} 
										case '3':{
											cout<<"<"<<p1.name<<"> 击杀了 <老师>"<<endl;
											p1.cj.c1++;
												if(p1.cj.c1==3){
													sleep(1);
													cout<<"成就！尿尿大王2！"<<endl;
													sleep(3);
													std::system("pause");
													system("cls");
													goto L3;
													break;
												}
												else{
												sleep(2);
												system("cls");
												goto L3;
												} 
											break;
										}
										
									}
							} 
				}
			default:{
				system("cls");
				a2:
				cout<<"要你叫！"<<endl;
				p1.cj.c7++;
				sleep(3);
				if(p1.cj.c7==5){
					sleep(1);
					cout<<"成就！要你叫！"<<endl;
					sleep(3);
					std::system("pause");
					system("cls");
					goto L2; 
				}
				goto L2;
			}

		}
	}
		else if(al=='b'){
			if(cj0>=3){
				cout<<"尿尿大王1"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(cj1>=3){
				cout<<"尿尿大王2"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(cj2>=3){
				cout<<"艾莎王子"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(cj3>=3){
				cout<<"肉包子！"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			}
			if(cj4>=3){
				cout<<"菜包子！"<<endl;
			} 
			else{
				cout<<"未解锁"<<endl;
			}
			if(cj5>=5){
				cout<<"肉包子，菜包子！";
			}
			else{
				cout<<"未解锁"<<endl;
			}
			if(cj7>=5){
				cout<<"要你叫！"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(cj8!=0){
				cout<<"通关"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			cout<<"结局："<<endl;
			if(p1.jj.jj1==true){
				cout<<"原来只是个梦..."<<endl;
			}
			else{
				cout<<"未解锁"<<endl; 
			}
			if(p1.jj.jj0==true){
				cout<<"循环"<<endl;
			} 
			else{
				cout<<"未解锁"<<endl;
			}
			if(cj8!=0){
				fs();
			}
			else{
				cout<<"分数：无"; 
			}
			cout<<"死亡次数："<<p1.t;
			cout<<endl<<endl<<endl<<endl;
			cout<<"输入任意返回"<<endl<<"________________________"<<endl;
			char d;
			d=getch();
			goto L2;
		}
	else if(al=='c'){
		cout<<""<<"1、退出后会保存"<<endl<<"2、不要乱输！！！"; 
		cout<<endl<<endl<<endl<<"输入任意返回"<<endl<<"________________________"<<endl;
		b=getch();
			system("cls");
			goto L2;
	}
	else if(al=='d') {
		cout<<"确定？确定输入1，否则输入其他"<<endl;
		b=getch();
		if(b!='1'){
			goto L2;
		} 
		else{
			cd();
			std::ifstream inFile("用户信息.txt");
    		std::string line;
    		while (std::getline(inFile, line)) {
        		std::cout << line << std::endl;
    		}
    		inFile.close();
    		sleep(2); 
			return 0;
		}
	}
	else if(al=='e'){
			std::ifstream inFile("用户信息.txt");
    		std::string line;
    		while (std::getline(inFile, line)) {
        		std::cout << line << std::endl;
    		}
    		inFile.close();
    		cout<<"输入任意返回"<<endl<<"________________________";
    		b=getch();
			goto L2;
    		
	} 
	else{
		cout<<"有病吧！";
		sleep(5);
		goto L2;
	}
}	
/*=========================================*SJ出品*=========================================*/
