明日之后1.0(完整版)

大家好

三好鞋僧

又来了

之前答应你们的明日之后终于写完了

此工程数据:

代价:21根头发,电脑蓝屏3次

用时:4小时

代码:1562行

总字数:39621个字

大小:39KB

版本:V1.0

名称:明日之后1:末日新生

编译环境:DevC++

C++标准:C++20

DevC++版本号:6.7.5

特性:带有非强制性的防沉迷系统

最终boss:凋零风暴

上代码:

/*明日之后1:新生*/
/*作者:程序猿*/
/*如需转载请标明出处!*/
/*存档功能尚在完善,末日之战2一定出!*/
/*编译环境:dev-C++*/
 
 
 
#include<algorithm>
#include<cmath>
#include<vector>
#include<stdio.h>
#include<iostream>
#include<string>
#include<cstring>
#include<windows.h>
#include<conio.h>
#include<cstdlib>
#include<ctime>
#include<fstream>
using namespace std;
 
/*****全局的*****/
long long things[10000];
/*
1 HP	2 XP	3 atk	//4 episode	5 water
6 food	7 体力	8 money 9 技能 		10 name
11 defense      12 jiujibao			185 存档编号 
*/
int sudu=80;
int money=things[8];//重新定义一个,免得武器店和药店报错
string name;
int episodes;
string filename[10]={"空存档","空存档","空存档","空存档","空存档","空存档","空存档","空存档","空存档","空存档"};//存档名,如果没有改变则为“空存档”
 
/*********存档函数*********/ 
void w1();
void w2();
void w3();
void w4();
void w5();//一堆输出点
void w6();
void w7();
void w8();
void w9(); 
void r1();
void r2();
void r3();
void r4();
void r5();//一堆读入点 
void r6();
void r7();
void r8();
void r9();
void mrf();//save.txt的读取 
void mwf();//save.txt的存档 
void Write_File();//负责调用子存档函数 
void Read_File();//负责调用子读取函数 
 
 
/*功能函数*/
void gs();
void g();
void hidden();
void Sout(string n);
void gotoxy(int x,int y);
int random(int n,int m);
void cls();
void about();
int zhangjieshu;
void init(); 
 
 
/*菊清函数*/
void juqing();
void end1();
 
 
/*游戏页面函数*/
void mianban();//定义干什么(省流)
string episode[10000];//1初出茅庐2背水一战3休养生息4凋零风暴
void welcome();
int main();
string where[10000];//1武器店2药店3家4状态
void home(); 
string guaiwu[123];//1小怪物2大怪物3boss4凋零风暴 
void fight();
void diaolingfengbao();
void fightmmain();
void daguai();
void xiaoguai();
void boss();
/*升级(完善中)*/
const unsigned long long sj[]=//升级所需经验值 
{
//0 1  2   3   4   5    6   7     8    9   10    11   12    13     14   15    16    17      18    19      20    21      22    22                                                                                                                                                                                                                                                                                                                                            
  0,0,100,300,500,800,1500,2122,4500,6821,8933,13382,20091,38392,59183,70003,89312,100033,110344,130953,150099,169821,193831,229183,
//  24      25     26      27       28     29     30       31     32       33     34       35     36        37       38       39       40      41        42                                                                                                                                  
  500000,867132,1102933,1491839,1783021,2092103,2819382,3857192,4561738,5637139,7003928,8563729,10000000,10092819,11928372,12837291,14838279,16738291,18973820,
//   43         44      45      46       47     48      49      50     51       52     53        54     55      56     57       58      59      60      61                                                                                                
  20093819,23849577,25860392,28039281,3003920,3120392,3302910,3939201,4029102,4392018,4592018,4672103,4800928,5028102,5193029,5392010,5503921,5872810,6839201,
//    62     63      64      65      66      67       68         69    70       71       72          73      74         75      76      77      78       79                                                         
  7293829,7495820,7888930,8139002,8873029,9567291,10093829,11293029,13930295,15930281,169302810,18392910,22839020,28739201,38392819,50009329,74892396,99837281,
//    80         81        82        83         84     85      86            87      88        89         90        91       92        93        94        95                                                                                                                         
  103958372,113837293,136573829,157683920,175837292,183726195,200999887,218376859,239837261,254637289,267392019,289383910,309201839,339281039,358372918,381039283,
//     96        97        98       99      100        101         102      103       104      105       106        107     108        109     110          111                                                                                                 
  457362821,478392018,500938271,536839201,556738291,598372918,620999382,647382019,667382010,683920133,708310999,738291839,756372819,778837261,819382910,837291038,
//      112    113        114           115     116          117        118       119      120          121     122      123          124       125       126      127                                                           
  1000000000,1093729183,1128372919,1273829102,1303928193,13283920193,135869302,142637291,144738291,145637289,149392019,151839201,1553291333,156839201,158382919,160993029,
//    128        129        130      131         132          133      134         135       136          137       138        139        140        141         142       143                                                                                    
  1618392918,1638392819,1657382918,1689392819,1700900300,17100000000,1728393820,1759382910,1783929182,1800392022,1819310393,1827392913,1858392918,1889380130,1918038286,1938028284,
//    144        145       146         147       148         149         150       151      152       153       154        155         156        157      158          159                                                                                         
  1958302882,1978928388,2009380291,2039209288,2048983828,20673802838,2083920788,210989382,212980838,214008000,2147483647,225903988,2500993021,2930993822,3259586666,3693829100,
//    160         161       162        163       164         165         166       167        168         169         170          171        172          173        174                                                                                          
  4193857766,4894827188,5693028188,6839281999,7503929188,79302918383,9603929183,1059837772,12968392005,15382993005,16392159388,18396198382,21325938292,24593203928,26832392012,
 //下面为程序自动生成 385
 30052279053,33358029748,39696055400,43665660940,51962136518,59236835630,66937624261,77647644142,91624220087,106284095300,122226709595,139338448938,160239216278,177865530068,199209393676,227098708790,249808579669,294774124009,338990242610,376279169297,440246628077,488673757165,566861558311,657559407640,762768912862,884811938919,1008685610367,1129727883611,1276592508480,1493613234921,1642974558413,1840131505422,2189756491452,2408732140597,2745954640280,3267686021933,3855869505880,4357132541644,4967131097474,5712200762095,6797518906893,7885121931995,8673634125194,9887942902721,11173375480074,12514180537682,14891874839841,16827818569020,19015434982992,21867750230440,24054525253484,27181613536436,30715223296172,35936811256521,40967964832433,45474440964000,51386118289320,61149480764290,71544892494219,85138422068120,99611953819700,110569268739867,122731888301252,139914352663427,166498079669478,183147887636425,206957113029160,229722395462367,261883530827098,298547225142891,349300253417182,415667301566446,461390704738755,539827124544343,642394278207768,706633706028544,833827773113681,967240216811870,1092981444997413,1256928661747025,1420329387774138,1590768914307034,1877107318882300,2121131270336999,2481723586294289,2903616595964318,3223014421520393,3642006296318044,4079047051876209,4731694580176402,5441448767202862,6094422619267206,7130474464542631,8413959868160304,9423635052339540,11025653011237262,12679500962922852,15088606145878194,16899238883383578,19772109493558788,22540204822657020,26146637594282144,30330099609367288,33666410566397688,37033051623037456,42588009366493072,49827970958796896,57302166602616432,65897491593008896,74464165500100048,84144507015113056,95083292927077760,110296619795410208,125738146566767632,139569342689112064,157713357238696640,187678895114048992,213953940430015840,254605189111718848,295342019369593856,336689902081336960,370358892289470656,429616315055785984,506947251765827456,562711449460068480,669626624857481472,770070618586103680,847077680444713984,948727002098079616,1110010592454753152,1243211863549323520,1404829405810735616,1431086375945250560,1446971027840490240,1494018951557873152,1518714164038880000,1592428131188393984,1630900628817673728,1810299697987617792,1824965224029160192,1877743262415855616,1974937311041138432,2007712974518568192,2104325350214072320,2277593219013369088,2389212896748011520,2402552078753502208,2442051050667406336,2526209225503725568,2644886891827077120,2752031650881759744,2925328324759292928,3082952541741774848,3114801490694014464,3272962213933260800,3448520616728823808,3562378621596667904,3614580665056815104,3715541270040010240,3829626753671020544,3881950815100641792,4066119147758477312,4100812022884206080,4264982704384962048,4393977614875269632,4552320047186110976,4729663571374253056,4748539979845751808,4817922013471148032,4978958553478782976,5037722159087005696,5105887941592544256,5153669446809650176,5158992743549910016,5216864161138915328,5313692663972759552,5476127048895844352,5614437613770797056,5790912181349713920,5874510199086896128,6009584831237059584,6108877048861882368,6286137713971544064,6369582544521513984,6402682722514263040,6504774754431067136,6666897655207197696,6846854075068702720,6883076441892843520,6971175851971602432,7024803267562148864,7173881272107077632,7225138449090473984,7346607341013281792,7490330458986493952,7651300351116490752,7800145196587322368,7863362331652847616,8014695660294729728,8134268892447566848,8247604581892128768,8334495277132959744,8394519971509001216,8462948123097688064,8525747737633649664,8598595290495365120,8756588869792719872,8788140778443200512,8902971217834443776,8934328782589128704,9084111032814346240, 
};
 
 
/*凋零风暴学习string*/
const string study[5]=
{
	"凋零风暴的血量与攻击力都很高,没事不要惹它","凋零风暴的防御力很低,一把铁剑就能干过它","凋零风暴的弱点是下半身,建议用刺击与砍击","先把防御力提升到1000再打凋零风暴","凋零风暴被打完半血就无法再用弓箭攻击了"
};
 
 
 
 
 
/********函数定义********/
void mrf()//储存存档名称的存档 
{
	ifstream fin("save.YXCJ");
	for(int i=1;i<=9;i++)
	  fin>>filename[i];
	fin.close();
}
void mwf()
{
	ofstream fout("save.YXCJ");
	for(int i=1;i<=9;i++)
	  fout<<filename[i]<<'\n';
	fout.close();
}
 
void w1()
{
	ofstream fout("file2.b");
 
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w2()
{
	ofstream fout("file2.b");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w3()
{
	ofstream fout("file3.c++");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w4()
{
	ofstream fout("file4.d");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w5()
{
	ofstream fout("file5.e");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w6()
{
	ofstream fout("file6.f");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w7()
{
	ofstream fout("file7.g");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w8()
{
	ofstream fout("file8.h");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void w9()
{
	ofstream fout("file9.i");
	fout<<name<<endl;
	for(int i=0;i<2000;i++)
	  fout<<things[i]<<' ';
	fout<<sudu<<'\n';
	fout<<money<<endl;
	fout<<episodes<<endl;
	fout.close();
}
void Write_File()
{
	if (things[192]==0)
	  return;
	switch(things[185])
	  { 
	  	case 1:w1();break;
	  	case 2:w2();break;
	  	case 3:w3();break;
	  	case 4:w4();break;
	  	case 5:w5();break;
	  	case 6:w6();break;
	  	case 7:w7();break;
	  	case 8:w8();break;
	  	case 9:w9();break;
	  	default:cout<<things[185]<<"[error] 404";Sleep(5000);exit(0);
	  }
}
void r1()
{
	ifstream fin("file1.a");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r2()
{
	ifstream fin("file2.b");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r3()
{
	ifstream fin("file3.c++");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r4()
{
	ifstream fin("file4.d");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r5()
{
	ifstream fin("file5.e");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r6()
{
	ifstream fin("file6.f");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r7()
{
	ifstream fin("file7.g");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r8()
{
	ifstream fin("file8.h");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void r9()
{
	ifstream fin("file9.i");
	fin>>name;
	for(int i=0;i<2000;i++)
	  fin>>things[i];
	fin>>sudu;
	fin>>money;
	fin>>episodes;
	fin.close();
}
void Read_File()
{
	switch(things[185])
	  {
	  	case 1:r1();break;
	  	case 2:r2();break;
	  	case 3:r3();break;
	  	case 4:r4();break;
	  	case 5:r5();break;
	  	case 6:r6();break;
	  	case 7:r7();break;
	  	case 8:r8();break;
	  	case 9:r9();break;
	  	default:cout<<"[error] 找不到存档";Sleep(5000);exit(0);
	  }
}
 
void cls()
{
	system("cls");
}
 
void hidden()
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}
 
 
void gotoxy(int y,int x)
{
	COORD  coord;     
    coord.X=x;         
    coord.Y=y;
    HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(a,coord);
}
 
void gs()
{
	hidden();
	gotoxy(45,80);
	cout<<"按下任意键继续_";
	_getch();
	system("cls");
}
 
void g()
{
	_getch();
}
 
void init()
{
	things[1]=100;
	things[2]=0;
	things[3]=10;
	things[5]=100;
	things[6]=100;
	things[7]=100;
	things[11]=5;
	money=10;
	episodes=0;
}
 
void Sout(string n)//减速输出,挺有用的 
{
	for(int i=0;i<n.size();i++)
	  {
	  	cout<<n[i];
	  	Sleep(sudu);
	  	if (kbhit())
	  	  if (getch()=='\n')
		    {
		  	  cout<<n.substr(i+1,n.size()-i);
		  	  return;
		    }
	  }
}
 
int random(int n,int m)//产生一个随机数n~m 
{
	return rand()%(m-n+1)+n; 
}
 
void about()
{
	;//废 
}
 
/*游戏界面函数定义*/
 
void diaolingfengbao()
{
	;
}
 
void fight()
{
	;
}
 
void wuqidian()
{
	int i=1,n=0,l=1;
	char w,r;
	while(l) {
		cout<<"武器店规则:伤害不能叠加!!!\n例如:假如你目前伤害50 ,购买匕首后,伤害不会+20,而是替换成20"<<endl;
		cout<<"你目前伤害:"<<things[3]<<"目前防御:"<<things[11]<<"你的金币为:"<<"$"<<money<<endl;
		Sleep(250);
		cout<<"欢迎来到 武器店!"<<endl;
		cout<<"1、买匕首($10加40攻击力)"<<endl;
		cout<<"2、买巨剑($50加60攻击力)"<<endl;
		cout<<"3、买光刃($100加120攻击力)"<<endl;
		cout<<"4、买X光刃($150加180攻击力)"<<endl;
		cout<<"5、买木盾($200加100防御力)"<<endl;
		cout<<"6、买铁盾($400加200防御力)"<<endl;
		cout<<"7、买木质铠甲($500加250防御力)"<<endl;
		cout<<"8、买双刃($500加300攻击力)"<<endl;
		cout<<"9、买金剑($200加200攻击力)"<<endl;
		cout<<"0、离开武器店"<<endl;
		l=_getch();
 
		switch(l) {
			case '1' :
				if(money<10) {
					cout<<"你的钱不够"<<endl;
					gs();
					break;
				} else {
					cout<<"购买成功!"<<endl;//钱足够时返回True
					things[3]=40;
					money-=10;
					cout<<"你的伤害现在为"<<things[3]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
			case '2' :
				if(money<50) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else {
					cout<<"购买成功!"<<endl;
					things[3]=60;
					money-=50;
					cout<<"你的伤害现在为"<<things[3]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
 
			case '3' :
				if(money<100) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else
 
				{
					cout<<"购买成功!"<<endl;
					things[3]=120;
					money-=100;
					cout<<"你的伤害现在为"<<things[3]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
 
			case '4' :
				if(money<150) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else {
					cout<<"购买成功!"<<endl;
					things[3]=180;
					money-=150;
					cout<<"你的伤害现在为"<<things[3]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
 
			case '5' :
				if(money<200) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else {
					cout<<"购买成功!"<<endl;
					things[11]=100;
					money-=200;
					cout<<"你的防御现在为"<<things[11]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
 
			case '6':
				if(money<400) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else {
					things[11]=200;
					money-=500;
					cout<<"你的防御现在为"<<things[11]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
			case '7':
				if(money<500) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else {
					things[11]=250;
					money-=500;
					cout<<"你的防御现在为"<<things[11]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
			case '8':
				if(money<500) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else {
					things[3]=300;
					money-=500;
					cout<<"你的攻击现在为"<<things[3]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
			case '9':
				if(money<200) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					gs();
					break;
				} else {
					things[3]=200;
					money-=200;
					cout<<"你的攻击现在为"<<things[3]<<endl;
					cout<<"-------------------------------------------------------------------------------\n" ;
					gs();
					break;
				}
			case '0':
				break;
 
			default:
				cout<<"看清楚."<<endl;
				gs();
				break;
		}
		cls();
		break;
	}
}
 
void yaopindian() {
	int i=1,n=0,l=1;
	char w,r;
	while(l) {
		cout<<"-------------------------------------------------------------------------------\n" ;
		cout<<"欢迎来到 药品店!"<<endl;
		cout<<"你的金币为:"<<"$"<<money<<endl;
		cout<<"1、坏药水(小)($50加50血)"<<endl;
		cout<<"2、一般的药水($100加100血)"<<endl;
		cout<<"3、正常的药水($150加200血)"<<endl;
		cout<<"4、好药水     ($200加300血)"<<endl;
		cout<<"5、优质药水   ($500加300血,50点防御)"<<endl;
		cout<<"6、神圣药水	($700加400血,50点防御,100点攻击(+100))"<<endl;
		cout<<"7、急救包     ($50加50血 战斗时使用)"<<endl;
		cout<<"0、离开药品店"<<endl;
		l=getch();
 
		switch(l) {
			case '1' :
				if(money<50) {
					cout<<"你的钱不够"<<endl;
					break;
				} else {
					cout<<"购买成功!"<<endl;
					things[1]+=50;
					money-=50;
					cout<<"-------------------------------------------------------------------------------\n" ;
					break;
				}
			case '2' :
				if(money<100) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					break;
				} else {
					cout<<"购买成功!"<<endl;
					things[1]+=100;
					money-=100;
					cout<<"-------------------------------------------------------------------------------\n" ;
					break;
				}
 
			case '3' :
				if(money<150) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					break;
				} else
 
				{
					cout<<"购买成功!"<<endl;
					things[1]+=200;
					money-=150;
					cout<<"-------------------------------------------------------------------------------\n" ;
					break;
				}
 
			case '4' :
				if(money<200) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					break;
				} else {
					cout<<"购买成功!"<<endl;
					things[1]+=300;
					money-=200;
					cout<<"-------------------------------------------------------------------------------\n" ;
					break;
				}
 
			case '5' :
				if(money<500) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					break;
				} else {
					cout<<"购买成功!"<<endl;
					things[1]+=300;
					things[11]+=50;
					money-=500;
					cout<<"-------------------------------------------------------------------------------\n" ;
 
 
					break;
				}
 
			case '6':
				if(money<700) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					break;
				} else {
					things[1]+=400;
					things[11]+=50;
					things[3]+=100;
					money-=700;
					cout<<"-------------------------------------------------------------------------------\n" ;
 
 
					break;
				}
			case '7':
				if(money<50) {
					cout<<"你的钱不够"<<endl;//钱不够时返回Flase
					break;
				}
				money-=50;
				things[12]++;
				cout<<"购买成功!"<<endl;
				cout<<"-------------------------------------------------------------------------------\n" ;
 
				break;
			case '0':
				break;
 
			default:
				cout<<"看清楚"<<endl;
				cout<<"-------------------------------------------------------------------------------\n" ;
				break;
		}
		cls();
		break;
 
	}
 
 
 
 
 
}
 
void Die()
{
	cls();
	cout<<"你\t死\t了\t!";
	gs();
	cout<<"血量恢复至50,按1继续,按e关机,按其他退出";
	char d;
	d=_getch();
	switch(d)
	{
		case '1':
			things[1]=50;
			break;
		case 'e':
			system("Shutdown -H");
			break;
		default:
			exit(0);
			break;
	}
}
 
void juqing()
{
	/*开始菊琴*/
	if (episodes==0)
	{
		cls();
		Sout("这是一个四面都是森林的小镇\n你是这里的居民\n这里的人都生活的很幸福\n但是,从连着下暴雨一个月之后\n人们就开始重复着一句话:明天和意外不知道哪个先来\n");
		gs();
		Sout("正如人们说的,这一天,创世神程序猿不知发了什么神经\n往你们小镇投放了凋零风暴\n从此,这里野兽横行,凋零风暴也无时无刻地骚扰小镇\n");
		gs();
		Sout("有一天,人们实在是受不了了\n大家就开始想着逃离小镇\n于是,人们开启了流浪之旅");
		gs();
		Sout("你奉命保护人烟稀少的小镇,以免逃亡中途怪物袭击小镇");
		Sleep(1*1000);
		cls();
		sudu=200;
		Sout("镇长:请问勇士尊姓大名?\n");
		cin>>name;
		Sout("镇长:");Sout(name);Sout(",希望你能守护好我们的小镇!");
		gs(); 
		episodes+=1;
	}
	/*章节*/
	if (episodes==1)
	{
		sudu=300;
		gotoxy(30,70);
		Sout("第\t一\t章");
		gotoxy(32,70);
		Sout("初\t出\t茅\t庐");
		gotoxy(31,70);
		Sout("Episode 1\n");
		gotoxy(33,70);
		Sout("Fledling\n");
		things[26]=1;
		gs();
		mianban(); 
	}
	if (episodes==2)
	{
		sudu=300;
		gotoxy(30,70);
		Sout("第\t二\t章");
		gotoxy(32,70);
		Sout("背\t水\t一\t战");
		gotoxy(31,70);
		Sout("Episode 2\n");
		gotoxy(33,70);
		Sout("Burn one's bridges\n");
		gs();
		things[1]+=50;
		things[3]+=20;
		things[11]+=10;
		mianban();
	}
	if (episodes==3)
	{
		sudu=300;
		gotoxy(30,70);
		Sout("第\t三\t章");
		gotoxy(32,70);
		Sout("休\t养\t生\t息");
		gotoxy(31,70);
		Sout("Episode 3\n");
		gotoxy(33,70);
		Sout("Recuperate\n");
		gs();
		mianban();
	}
	if (episodes==4)
	{
		sudu=300;
		gotoxy(30,70);
		Sout("第\t四\t章");
		gotoxy(32,70);
		Sout("决\t战");
		gotoxy(31,70);
		Sout("Episode 4\n");
		gotoxy(33,70);
		Sout("Decisive battle\n");
		gs();
		mianban();
	}
}
 
/*怪物部分*/
void xiaoguai()
{
	if(things[1]<=0)
	{
		return xiaoguai();
	}
	int i=1,n=0,l=1,taopao,cg,lengque=0;
	char r,w; 
	srand(static_cast<unsigned  int >(time(0))) ; 
	int randomNumber=rand(); 
	int xdj=(randomNumber% 5)+1;
	cg=(randomNumber% 5)+1;
	int xhp=xdj*100;
	int xsh=xdj*20;
	int xjb=xdj*10;
	int xfy=xdj*5; 
	cout<<"你面对的是"<<xdj<<"级小怪,是否迎战(y/n)"<<endl;
	cin>>r;
	if(r=='y')
	{
		int f=0; 
		while(things[1]>0&&xhp>0&&l!=123&&i<=15)
		{
			cout<<"第"<<i<<"回合"<<endl;
			cout<<"你的生命:"<<things[1]<<endl;
			cout<<"小怪生命:"<<xhp<<endl;
			cout<<"输入1攻击(造成攻击(你的伤害-怪的伤害),防御减半)"<<endl;
			cout<<"输入2防御(不造成攻击,防御*2)"<<endl; 
			cout<<"输入3使用技能(无敌,造成敌方等级*20伤害,boss:500点伤害)"<<endl;  
			cout<<"输入4逃跑(20%几率,逃跑失败也要减少血(无视防御),实在打不过撑过15回合自动结束)"<<endl; 
			cout<<"输入5使用战斗急救包!!!"<<endl; 
			cin>>l;
			 
			if(lengque>0&&f==1)
			{
				lengque--; 
			} 
			switch(l)
			{
				case 1:
					if((things[11]/2)<xsh)
					{
						things[1]-=xsh-things[11]/2; 
					} 
					if(things[3]>xfy ) 
					{
						xhp-=things[3]-xfy; 
					} 
					i++; 
					f=1; 
				break; 
				case 2: 
					if(things[11]*2<xsh)
					{
						things[1]-=xsh-things[11]*2; 
					} 
					i++; 
					f=1; 
				break;
				case 3:
					if(lengque==0)
					{
						xhp-=xdj*20;
						lengque=5;
						i++; 
						break; 
					} 
					cout<<"冷却中剩余"<<lengque<<"回合"<<endl; 
					f=0;
					 
				break;
				case 4:
					if(taopao=1)
					{
						cout<<"逃跑成功!!!"<<endl; 
						l=123;
					} 
					f=1; 
				
				break; 
				case 5:
					if(things[12]>0)
					{
						cout<<"使用成功!!!"<<endl; 
						things[12]--;
						things[1]+=50;
						i++; 
					} 
					f=1; 
				
				break; 
			} 
			
		}
		if(things[1]<=0)
		{
			cout<<"你死了"<<endl;
			Sleep(1000);
			Die(); 
			return xiaoguai(); 
		}
		if(xhp<=0)
		{
			cout<<"你打败了"<<xdj<<"级小怪"<<endl;
			cout<<"奖励金币"<<xjb<<"$"<<endl;
			money+=xjb; 
			cout<<"奖励经验"<<xdj*10<<endl;
			money+=xdj*10; 
		}
	
	}
	else
	{
		cout<<"你已逃跑"<<endl; 
	} 
	
}
void daguai()
{
	if(things[1]<=0)
	{
		return daguai();
	}
	int i=1,n=0,l=1,taopao,cg;
	int lengque=0; 
	char r,w; 
	srand(static_cast<unsigned  int >(time(0))) ; 
	int randomNumber=rand(); 
	int ddj=(randomNumber% 5)+6;
	int dhp=ddj*100;
	int dsh=ddj*20;
	int djb=ddj*10;
	int dfy=ddj*5; 
	cout<<"你面对的是"<<ddj<<"级大怪,是否迎战(y/n)"<<endl;
	cin>>r;
	if(r=='y')
	{
		int f=0;
		while(things[1]>0&&dhp>0&&l!=123&&i<=20)
		{
			
			cout<<"第"<<i<<"回合"<<endl;
			cout<<"你的生命:"<<things[1]<<endl;
			cout<<"大怪生命:"<<dhp<<endl;
			cout<<"输入1攻击(造成攻击(你的伤害-怪的伤害),防御减半)"<<endl;
			cout<<"输入2防御(不造成攻击,防御*2)"<<endl; 
			cout<<"输入3使用技能(无敌,造成敌方等级*20伤害,boss:500点伤害)"<<endl;
			cout<<"输入4逃跑(20%几率,逃跑失败也要减少血(无视防御),实在打不过撑过20回合自动结束)"<<endl; 
			cout<<"输入5使用战斗急救包!!!"<<endl; 
			taopao=(randomNumber% 5)+1;
			cin>>l;
			if(lengque>0&&f==1)
			{
				lengque--; 
			} 
			switch(l)
			{
				case 1:
					if((things[11]/2)<dsh)
					{
						things[1]-=dsh-things[11]/2; 
					} 
					if(things[3]>dfy ) 
					{
						dhp-=things[3]-dfy; 
					} 
					i++; 
					f=1;
				break; 
				case 2: 
					if(things[11]*2<dsh)
					{
						things[1]-=dsh-things[11]*2; 
					} 
					i++; 
					f=1;
				break;
				case 3:
					if(lengque==0)
					{
						dhp-=ddj*20;
						lengque=5;
						i++; 
						break; 
					} 
					cout<<"冷却中剩余"<<lengque<<"回合"<<endl; 
					f=0;
				break;
				case 4:
					if(taopao=3)
					{
						cout<<"逃跑成功!!!"<<endl; 
						l=123;
					} 
					f=1;
					
				break;
				case 5:
					f=1;
					if(things[12]>0)
					{
						cout<<"使用成功!!!"<<endl; 
						things[12]--;
						things[1]+=50;
						i++; 
					} 
				
				break; 
			} 
			
		}
		if(things[1]<=0)
		{
			cout<<"你死了"<<endl;
			Sleep(1000);
			return daguai(); 
			 
		}
		if(dhp<=0)
		{
			cout<<"你打败了"<<ddj<<"级大怪"<<endl;
			cout<<"奖励金币"<<djb<<"$"<<endl;
			cout<<"奖励经验"<<ddj*10<<endl;
			money+=djb; 
			things[2]+=ddj*10; 
		}
	}
	else
	{
		cout<<"你已逃跑"<<endl; 
	} 	
 
 
} 
void boss()
{
 
	int i=1,n=0,l=1,taopao,cg;
	int lengque=0;
	srand(static_cast<unsigned  int >(time(0))) ; 
	int randomNumber=rand(); 
	int bossHP=5000;
	int bossSH=700;
	int bossfy=500;
	cout<<"你面对的是"<<"BOSS"<<endl;
	int f=0;
	while(things[1]>0&&bossHP>0&&l!=123)
	{
		cout<<"第"<<i<<"回合"<<endl;
		cout<<"你的生命:"<<things[1]<<endl;
		cout<<"BOSS生命:"<<bossHP<<endl;
		cout<<"输入1攻击(造成攻击(你的伤害-怪的伤害),防御减半)"<<endl;
		cout<<"输入2防御(不造成攻击,防御*2)"<<endl; 
		cout<<"输入3使用技能(无敌,造成敌方等级*20伤害,boss:500点伤害)"<<endl;
		cout<<"输入4逃跑(10%几率,逃跑失败也要减少血(无视防御),实在打不过撑过30回合自动结束)"<<endl; 
		cout<<"输入5使用战斗急救包!!!"<<endl; 
		taopao=(randomNumber%10)+1;
		cin>>l;
		if(lengque>0&&f==1)
		{
			lengque--; 
		} 
		switch(l)
		{
			case 1:
				f=1; 
				if((things[11]/2)<bossSH)
				{
					things[1]-=bossSH-things[11]/2; 
				} 
				if(things[3]>bossfy ) 
				{
					bossHP-=things[3]-bossfy; 
				} 
				i++; 
			break; 
			case 2: 
				f=1;
				if(things[11]*2<bossSH)
				{
					things[1]-=bossSH-things[11]*2; 
				} 
				i++; 
			break;
			case 3:
				f=1;
				if(lengque==0)
				{
					bossHP-=500;
					lengque=5;
					i++; 
					break; 
				} 
				cout<<"冷却中剩余"<<lengque<<"回合"<<endl; 
				f=0;
			break;
			case 4:
				f=1;
				if(taopao=1)
				{
					cout<<"逃跑成功!!!"<<endl; 
					l=123;
				} 
				
			break; 
			case 5:
				f=1;
				if(things[12]>0)
				{
					cout<<"使用成功!!!"<<endl; 
					things[12]--;
					things[1]+=50;
					i++; 
				} 
			
			break;
		} 
		
	}
	if(things[1]<=0)
	{
		cout<<"你死了"<<endl;
		Sleep(1000);
		return boss(); 
		 
	}
	if(bossHP<=0)
	{
		cout<<"你打败了BOSS"<<endl;
		bossHP=0; 
	}
		
	
} 
 
/*第二主函数*/
void mianban()
{
	while(1)
	{
		if (things[2]>=300)
		{
			episodes=2;
			juqing();
		}
		if (things[2]>=1500)
		{
			episodes=3;
			juqing();
		}
		if (things[2]>=5000)
		{
			episodes=4;
			juqing();
		}
		
		
		
		sudu=80;
		gotoxy(0,0);
		printf("-----------------------------------------------------\n");
		printf("                      选择行动                       \n");
		printf("1、与NPC战斗	2、行径		3、干活		\n");
		printf("4、末日新生(第四章开放)	5、查看状态\n");
		printf("-----------------------------------------------------\n");
		gotoxy(6,0);
		Sout("请选择>");
		char l;
		l=_getch();
		if (l=='1')
		{
			cls();
			printf("-----------------------------------------------------\n");
			printf("                 你要打什么怪?                       \n");
			printf("1、小怪物	2、大怪物	3、Boss\n"); 
			printf("-----------------------------------------------------\n");
			Sout("请选择>");
			char l1;
			l1=_getch();
			if (l1=='1')
			{
				xiaoguai();
				gs();
				cls();
			}
			if (l1=='2')
			{
				daguai();
				gs();
				cls();
			}
			if (l1=='3')
			{
				boss();
				gs();
				cls();
			}
		}
		if (l=='2')
		{
			cls();
			Sout("你要去哪里?\n");
			printf("1.武器店\n2.药店\n");
			char s;
			s=getch();
			if (s=='1')
			{
				wuqidian();
			}
			if (s=='2')
			{
				yaopindian();
			}
			if (s=='3')
			{
				//home();
			}
			/*if (where[1]==1)
			{
				;
			}
			if (where[2]==1)
			{
				;
			}
			if (where[3]==1)
			{
				;
			}*/
		}
		if (l=='3')
		{
			cls();
			Sout("你要做什么工作?");
			cout<<"\n1.打扫小镇卫生\n2.帮大爷值班(?\n3.学习关于凋零风暴的知识\n4.钓鱼"<<endl;//越来越离谱
			char w;w=_getch();
			switch(w)
			{
				case '1':
					Sout("工作中。。。");
					Sleep(1*10000);
					money+=25;
					cout<<"镇长觉得你干的很好,并奖励了你25块钱";
					things[2]+=10;
					gs();
					break;
				case '2':
					Sout("工作中。。。");
					Sleep(1*10000);
					money+=30;
					cout<<"大爷觉得你干的很好,并奖励了你30块钱";
					things[2]+=15;
					gs();
					break;
				case '3':
					Sout("学习中。。。");
					Sleep(1*1000);
					cls();
					Sout(study[random(1,6)]);
					things[2]+=5;
					gs(); 
					break;
				case '4':{
				cls();
				const string fish[]=
				{"罗非鱼(?)","草鱼","鲤鱼","太阳鱼","石斑鱼","鲫鱼","鲨鱼(emmmmm...)"};
				const int fm[]=
				{15,100,300,800,2500,7500,100000};
				bool fishing[7]=
				{0,0,0,0,0,0,0};
				things[7]-=5;
				if (rand()%2==1)
				  fishing[0]=1;
				if (rand()%5==3)
				  fishing[1]=1;
				if (rand()%8==5)
				  fishing[2]=1;
				if (rand()%15==3)
				  fishing[3]=1;
				if (rand()%20==4)
				  fishing[4]=1;
				if (rand()%25==9)
				  fishing[5]=1;
				if (rand()%50==6)
				  fishing[6]=1;
				bool diao=false;
				string shouhuo="";
				int get=0;
				int i;
				for(i=0;i<7;i++)
				  if (fishing[i])
				    shouhuo+=fish[i]+',',money+=fm[i],get+=fm[i],diao=true;
				if (diao)
				{
					cout<<"你钓到了"<<shouhuo<<"\b。卖了"<<get<<"元钱\n";
				  	things[2]+=(get/10);
				}
				  
				else
				  cout<<"毛都没钓到!";
				gs(); 
				break;}
			 } 
			 continue;
		 } 
		if (l=='4')
		{
			if (episodes<=3)
			{
				cls();
				gotoxy(0,0);
				Sout("还没到第四章呢,到第四章再来吧~");
				gs();
				continue;
			}
			if (episodes==4)
			{
				diaolingfengbao();
				end1();
			}
		}
		if (l=='5')
		{
			cls();
			cout<<"name:"<<name<<endl;
			cout<<"HP:"<<things[1]<<endl;
			cout<<"XP:"<<things[2]<<endl;
			cout<<"Attack:"<<things[3]<<endl;
			cout<<"money:"<<money<<endl;
			cout<<"Defense:"<<things[11]<<endl;
			cout<<"急救包数量:"<<things[12]<<endl;
			cout<<"体力:"<<things[7]<<endl; 
			gs();
			continue;
		}
		if (l=='6')
		{
			cout<<"管理员模式开启中";
			Sleep(1*1000);
			cls();
			gs();
			things[10000]=1;//Admin mode is Open.
		}
	}
		
	
}
 
void welcome()
{
	hidden();
	gotoxy(20,40);
	cout<<"明  日  之  后";
	gotoxy(21,40);
	cout<<"ming ri zhi hou";
	Sleep(2000);
	cls();
	gotoxy(20,40);
	cout<<"MRXS||CSB||程序猿 ";
	Sleep(200);
	gotoxy(21,40);
	Sout("   by 程序猿");
	Sleep(1000);
	int i,j,k;
	/*for(k=1;i<=10;k++)
	{
	for(i=1;i<=47;i++)
	  for(j=1;j<=110;j++)
	    {
	    	gotoxy(i,j);
	    	cout<<char(random(2,120));//装模做样一下     //这里会出bug! 
		}
	Sleep(90);
	}*/
	cls();
	gotoxy(20,45);
	cout<<"程序猿出品,必是精品!\n";
	Sleep(2000);
	cls();
	hidden();
	i=0,j=0;
	while(i<=800&&j<=1500)
	  {
	  	i+=random(4,8)*10;
	  	j+=random(8,16)*10;
	  	gotoxy(0,0);
	  	//jdt(1);
	  	cout<<"解析文件"<<i<<" of "<<j;//装模做样一下 v    
	  	Sleep(random(50,180));
	  }
	gotoxy(0,60);
	cout<<"\t\t\t\t\t\tv1.0"; 
	gotoxy(0,0);
	printf("    WELCOME            \n");
	printf("------------------------------------\n");
	printf("|                                  |\n");
	printf("|                                  |\n");
	printf("|                                  |\n");
	printf("|                                  |\n");
	printf("|                                  |\n");
	printf("|                                  |\n");
	printf("|                                  |\n");
	printf("|                                  |\n");
	printf("|__________________________________|\n");
	gotoxy(2,2);
	hidden();
	Sout("欢迎来到《明日之后1:新生》");
	gotoxy(3,2);
	Sout("作者:程序猿\n");
	gotoxy(4,2);
	Sout("祝你游戏愉快\n");
	gotoxy(5,2);
	Sout("(*^_^*)\n");
	gs();
}
 
void end1()
{
	cls();
	Sout("你打败了凋零风暴,人们获得了新生......");
	Sleep(1*1000);
	Sout("请期待程序猿的明日之后2:东山再起");
	Sleep(1*1000);
	gs();
	Sout("按任意键退出_");
	_getch();
	exit(0); 
}
 
int main()
{
	SetWindowTextA( GetConsoleWindow(), "明日之后1:新生" );
	ShellExecute(NULL,"open","cmd.exe /c attrib file1.txt +h",NULL,NULL,SW_SHOWNORMAL);
	cout<<"正在加载...请稍等...";
	int  cx   =   GetSystemMetrics(   SM_CXSCREEN   );   
	int  cy   =   GetSystemMetrics(   SM_CYSCREEN   );  //这些好像没啥用... 
	cout<<"屏幕大小:"<<cx<<"x"<<cy<<"\n"; 
	cout<<"正在调整为全屏模式~Loading...\n";
	system("mode con cols=300 lines=114"); 
	MessageBox(NULL,TEXT("点击右上角□即可调为全屏~"),TEXT("请调整为全屏模式"),MB_OK);
	MessageBox(NULL,TEXT("根据国家要求,未成年人只能在8点~22点获取游戏服务!"),TEXT("提示"),MB_OK);
	gs();
	srand(time(0));
	welcome();
	gs();
	hidden();
	/*cout<<"游戏基本规则:当选项左边出现数字(比如1. 2. 3.之类的)就需要按下序号进行移动,输入时请注意(数值禁止输入字符,否则直接卡退或存档混乱!)\n";
	cout<<"请选择:\n";
	cout<<"1.新建用户(覆盖或新建存档)\n";
	cout<<"2.继续游戏(读取存档)\n";
	char m=_getch();
	if (m=='1')//新建存档 
	  {
	  	//csj();
	  	string number[10]={"0","1","2","3","4","5","6","7","8","9"};
	  	cout<<"覆盖哪个存档?\n";
	  	for(int i=1;i<=9;i++)
	  	  cout<<"存档"<<i<<":"<<filename[i]<<'\n';
	  	cin>>things[185];
	  	filename[things[185]]="新存档"+number[things[185]]; 
	  	cout<<"是否改存档名?(当前存档名:"<<filename[things[185]]<<")\n(Y/N)";
		char s;
		cin>>s;
		if (s=='Y')
		  {
		  	cout<<"改成什么?";
		  	cin>>filename[things[185]];
		  } 
		things[192]=1;//已读取,开始运行 
		juqing();//开始剧情 
	  }
	else
	  {
	  	cout<<"读取哪个存档?\n";
	  	for(int i=1;i<=9;i++)
	  	  if (filename[i]!="空存档")
	  	    cout<<"存档"<<i<<":"<<filename[i]<<'\n';
	  	cin>>things[185];
	  	int i=things[185];
	  	Read_File();
	  	things[185]=i;//防止存档被恶意毁坏 
	  	things[192]=1;
	  	juqing();//这是第二主函数,相当于剧情主干 
	  }*/
	  cout<<"是否跳过剧情引导及帮助?y/n";
	  char l;
	  cin>>l;
	  switch(l)
	  {
	  	case 'y':break;
	  	case 'n':juqing();break;
	  }
	  Sout("你叫什么名字?");
	  cin>>name;
	  cls();
	  init();
	  mianban();
}

 以上就是本期内容

谢谢观看

记得点赞收藏夹关注

接下来顺便汇报一下5月17日的数据:

原创:8个

被访问:266次

排名:第157349名

粉丝:2

C#开发典型模块大全 明日科技 源代码 解压后139M 《C#开发典型模块大全(修订版)》以关键技术为核心,通过22个典型模块系统、全面地介绍了如何使用C#进行各领域的程序开发。全书共分为24章,第1章介绍了C#集成开发环境的使用,使初学者能够熟练掌握使用C#集成开发环境进行编程,之后通过对QQ企业通、SQL数据表提取器模块、万能搜索模块、万能打印模块、决策分析模块、自定义图表控件、电子邮件收发模块、短信群发模块、桌面精灵模块、文件批量处理器、图片管理工具模块、FTP文件管理模块、魔法兔子模块、学生考试模块、网页浏览器模块、电话客服管理模块、多媒体播放器、屏幕录像模块、EXE文件加密器、视频监控模块、网络五子棋游戏和在线升级模块等22个模块进行了详细的介绍,使读者能够掌握图形图像、多媒体、文件处理、数据库、报表打印、软件安全、系统优化、网络通信及硬件开发等各领域的相关技术,为从事项目开发的人员提供相关解决方案,最后一章通过对Windows应用程序的打包与部署进行讲解,使读者能够快速掌握Windows应用程序的打包与部署方案。 《C#开发典型模块大全(修订版)》附有配套光盘。光盘提供了书中所有案例的全部源代码,所有源代码都经过精心调试,在Windows XP、Windows 2003和Windows 7系统下全部通过,保证能够正常运行。此外,光盘中还提供了C#编程词典试用版软件等。 《C#开发典型模块大全(修订版)》案例涉及行业广泛,实用性非常强,通过对《C#开发典型模块大全(修订版)》的学习,读者可以了解各个行业的特点,并能够针对某一行业进行软件开发,也可以通过光盘中提供的模块源代码进行二次开发,以减少开发项目所需要的时间。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值