Bootstrap

四十五中大冒险 1.0版本 c++小游戏

鄙人第一次做游戏,现在主线剧情未开启,但一些副本已经写好啦,可以稍微玩一玩,因为1.0仍在制作,所以一些作弊已经开开了

作弊:
1.温泉刷经验速度最快
2.第一个技能已经给与

合作制作:道标·愚公
顺便做个推广:我们自己做的社区

代码(可以在任意c++编译器上编译):

注意:如果遇到些沙雕的东西,那就是道标愚公做的哦

/*
关于所有函数的解释
main12:主界面
main: 一开始进入的主界面
board: 一些选项
其它的可以百度一下,都是英文(有些是拼音)
有重要的变量
option:通用选择
游戏说明:
此游戏包含很多玩法
有迷宫,技能,等级制,战斗等等
可以自由去探索
*/

#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <conio.h>
using namespace std;

int main12();
void start();
void board();
void maps();
void bag();//bug 可以先看一下,不知道出了什么问题
void equips();//装备   未完成
void skill_board();//技能板   未完成
void lingdong();
void zhanchang();//未完成
void shenming();
void huo();
void bin();//未完成
void jin();//未完成
void shu();//未完成
void lu();//未完成
void equip_bag();//未完成
int shanghai(double gong);
int jianshang(double fang);
int boss_shanghai(double gong);
void pretreatment();
void ten();
void eleven();
void twelve();
void thirteen();
void fourteen();
void fifteen();
const int N=1e3+10;

int zhuangbei[N];
/*
最高级 神的庇护
第二级:
荆棘护甲  熔岩拳套   流水灵甲    重金宝剑   土流盾
第三级:
木藤鞭  熔岩枪  水灵环  金剑
*/



struct op
{
   
	string name;
	string lei;
	string fangyu;
	string gongji;
} equip_attributes[N];

struct xh
{
   
	int cnn;
	string bag;
} bags[N];

struct xu
{
   
	int cnn;
	string boxx;
} boxs[N];

bool jineng[100]= {
   0,1,0,0,0,0,0};	//
int grade=1;
int blood[101]= {
   0,100};
int experience[101];
string name;
int option,attribute[5],attributes,flag_box[N],flag_bag[N],exits,savage,times,attack[N],defense[N];
int jinyan;
int baoji=5;
int sum_level[101]= {
   };
bool ops[N];
string head,body,trousers,shoes;
int shushen;
string shengfen;
int fang(string shengfen)
{
   
	if(shengfen[0] == '#')
	{
   
		return 1;
	}
	int year = 0;
 	int a1 = (shengfen[6] - '0') * 1000;
 	int a2 = (shengfen[7] - '0') * 100;
 	int a3 = (shengfen[8] - '0') * 10;
 	int s4 = (shengfen[9] - '0') * 1;
 	year = a1 + a2 + a3 + s4;
 	cout << "你出生在:" << year << endl;
 	int len = 2021 - year;
 	cout << "你现在:" << len << endl;
 	if(len < 18)
 	{
   
 		return 0;
	}
	return 1;
}
int main()
{
   
	cout << "为了反映国家号召, 本游开设未成年人反沉迷系统, 请输入身份证号码" << endl;
	cin >> shengfen;
	if(!fang(shengfen))
	{
   
		cout << "未成年人, 禁止进入" << endl; 
		return 0;
	}
	start();
	pretreatment();
	cout<<endl<<"请输入你所要的属性"<<endl;
	cout<<"1.金   2.木   3.水   4.火   5.土"<<endl;
	cin>>attributes;
	attribute[attributes]=1;
	board();
	cin>>option;
	if(option==1)
	{
   
		maps();
		if(exits==1)
		{
   
			return 0;
		}
		main12();
	}
	else if(option==2)
	{
   
		bag();
		main12();
	}
	else if(option==3)
	{
   
		cout<<"已删除" <<endl;
		main12();
	}
	else if(option==4)
	{
   
		equips();
		main12();
	}
	else if(option==5)
	{
   
		skill_board();
		main12();
	}
}

void start()
{
   
	cout<<"Welcome to AXX";
	cout<<endl;
	cout<<"Please wait a moment"<<endl;
	Sleep(1);
	cout<<"请输入你的名字"<<endl;
	cin>>name;
}

void pretreatment()
{
   
	int num=1;
	for(int i=100; i<=10000; i+=100)
	{
   
		blood[num]=i;
		experience[num]=i;
		attack[num]=5+(i/100)*2;
		defense[num]+=i/100;
		num++;
	}
}

void board()
{
   
	cout<<endl<<endl<<endl;
	cout<<"姓名:"<<name<<endl;
	cout<<"境界"<<endl;	//暂不开放
	cout<<"等级:"<<grade<<endl;
	cout<<"血量:"<<blood[grade]<<endl;
	cout<<"属性:";
	if(attribute[1]==1)
	{
   
		cout<<"金"<<" ";
	}
	if(attribute[2]==1)
	{
   
		cout<<"木"<<" ";
	}
	if(attribute[3]==1)
	{
   
		cout<<"水"<<" ";
	}
	if(attribute[4]==1)
	{
   
		cout<<"火"<<" ";
	}
	if(attribute[5]==1)
	{
   
		cout<<"土"<<" ";
	}
	cout<<endl;
	cout<<"攻击:"<<attack[grade]<<endl;
	cout<<"防御:"<<defense[grade]<<endl;
	Sleep(1);
	cout<<"1.地图   "<<"2.背包   "<<"3.精灵箱(已删除)   "<<"4.合成台   "<<"5.技能板   "<<endl;
}

void maps()
{
   
	cout<<"1.灵洞(难度高)   "<<"2.战场(难度高)   "<<"3.生命之树   "<<"4.流火之地   "<<"5.深海之地   "<<endl;
	cout<<"6.铁金山   "<<"7.恶魔树林   "<<"8.阿努比斯的大陆沙漠   "<<"9.退出";
	cin>>option;
	if(option==1)
	{
   
		lingdong();
		main12();
	}
	else if(option==2)
	{
   
		zhanchang();
		main12();
	}
	else if(option==3)
	{
   
		shenming();
		main12();
	}
	else if(option==4)
	{
   
		huo();
		main12();
	}
	else if(option==5)
	{
   
		bin();
		main12();
	}
	else if(option==6)
	{
   
		jin();
		main12();
	}
	else if(option==7)
	{
   
		shu();
		main12();
	}
	else if(option==8)
	{
   
		lu();
		main12();
	}
	else if(option == 9)
	{
   
		exits=1;
	}
}

void bag()  									//bug
{
   
	int sum=0;
	for(int i=0; i<=20; i++)
	{
   
		for(int j=0; j<5; j++)
		{
   
			if(!flag_bag[i]){
   
				cout<<bags[i].cnn<<":"<<bags[i].bag[j]<<" ";	
			} 
		}
		cout<<endl;
	}
	cout<<endl;
	cout<<"1.丢弃";
	cin>>option;
	if(option==1)
	{
   
		cout<<"请输入丢弃的序号";
		cin>>option;
		for(int i=0; i<100; i++)
		{
   
			if(option==bags[i].cnn)
			{
   
				flag_bag[i]=1;
				for(int j=i+1; j<100; j++)
				{
   
					bags[j].cnn--;
				}
				cout<<"丢弃成功";
				return;
			}
		}
	}
}

void box()
{
   
	int sum=0;
	for(int i=0; i<20; i++)
	{
   
		for(int j=0; j<5; j++)
		{
   
			if(!flag_box[i])
				cout<<boxs[i].cnn<<":"<<boxs[i].boxx[j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
	cout<<"1.丢弃";
	cin>>option;
	if(option==1)
	{
   
		Sleep(1);
		cout<<"请输入丢弃的序号";
		cin>>option;
		for(int i=0; i<100; i++)
		{
   
			if(option==bags[i].cnn)
			{
   
				flag_box[i]=1;
				for(int j=i+1; j<100; j++)
				{
   
					bags[j].cnn--;
				}
				cout<<"丢弃成功";
				return;
			}
		}
	}
}

int main12()
{
   
	if(grade==0)
	{
   
		grade++;
	}
	while(jinyan>=experience[grade]&&grade<100)
	{
   
		grade++;
		jinyan-=experience[grade-1];
	}
	if(exits==1)
	{
   
		return 0;
	}
	board();
	cin>>option;
	if(option==1)
	{
   
		maps();
		system("cls");
		if(exits==1)
		{
   
			return 0;
		}
		main12();
	}
	else if(option==2)
	{
   
		bag();
		system("cls");
		main12();
	}
	else if(option==3)
	{
   
		box();
		system("cls");
		main12();
	}
	else if(option==4)
	{
   
		equips();
		system("cls");
		main12();
	}
	else if(option==5)
	{
   
		skill_board();
		system("cls");
		main12();
	}else{
   
		main12();
	}
}

void lingdong()
{
   
	cout<<"欢迎来到灵洞"<<endl;
	Sleep(1);
	cout<<"1.刷级(等级高)   2.泡温泉";
	cin>>option;
	if(option==1)
	{
   
		cout<<"你遇见了——"<<endl;
		Sleep(1);
		savage=rand()%2;
		if(savage==0)
		{
   
			double x=rand()%(100-80+1)+80;
			cout<<"碧水金睛兽"<<" "<<"等级:"<<x<<endl;
			int tema=blood[grade];
			int temb=blood[(int)x];
			double temg=attack[grade]*1.5;
			double temf=defense[grade]*1.5;
			cout<<name<<"开始释放技能";
			for(int i=1; i<=5; i++)
			{
   
				if(jineng[i]&&i==1)
				{
   
					cout<<"火神术--"<<endl;
					cout<<"焚毁!"<<endl;
					temb-=5*10+attack[grade];
					cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
					if(temb<=0)
					{
   
						cout<<"你赢了";
						int n=rand()%20+1;
						if(n==1)
						{
   
							cout<<",你获得了碧水金睛兽一只";
						}
						else
						{
   
							cout<<",你获得了碧水珠";
						}
						jinyan+=(double)experience[(int)x]/10;
						return;
					}
				}
				if(jineng[i]&&i==2){
   
					cout<<"木神术--"<<endl;
					cout<<"千手顶上化佛!"<<endl;
					temb-=5*10+attack[grade];
					cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
					if(temb<=0)
					{
   
						cout<<"你赢了";
						int n=rand()%20+1;
						if(n==1)
						{
   
							cout<<",你获得了碧水金睛兽一只";
						}
						else
						{
   
							cout<<",你获得了碧水珠";
						}
						jinyan+=(double)experience[(int)x]/10;
						return;
					} 
				}
				if(jineng[i]&&i==3){
   
					cout<<"水神术--"<<endl;
					cout<<"水乱波!"<<endl;
					temb-=5*10+attack[grade];
					cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
					if(temb<=0)
					{
   
						cout<<"你赢了";
						int n=rand()%20+1;
						if(n==1)
						{
   
							cout<<",你获得了碧水金睛兽一只";
						}
						else
						{
   
							cout<<",你获得了碧水珠";
						}
						jinyan+=(double)experience[(int)x]/10;
						return;
					} 
				}
				if(jineng[i]&&i==4){
   
					cout<<"土神术--"<<endl;
					cout<<"土淹!"<<endl;
					temb-=5*10+attack[grade];
					cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
					if(temb<=0)
					{
   
						cout<<"你赢了";
						int n=rand()%20+1;
						if(n==1)
						{
   
							cout<<",你获得了碧水金睛兽一只";
						}
						else
						{
   
							cout<<",你获得了碧水珠";
						}
						jinyan+=(double)experience[(int)x]/10;
						return;
					} 
				}
				if(jineng[i]&&i==5){
   
					cout<<"金神术--"<<endl;
					cout<<"金光剑!"<<endl;
					temb-=5*10+attack[grade];
					cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
					if(temb<=0)
					{
   
						cout<<"你赢了";
						int n=rand()%20+1;
						if(n==1)
						{
   
							cout<<",你获得了碧水金睛兽一只";
						}
						else
						{
   
							cout<<",你获得了碧水珠";
						}
						jinyan+=(double)experience[(int)x]/10;
						return;
					} 
				}
			}
			int sum=0;
			while(true)
			{
   
				int y1=boss_shanghai(x);
				tema-=y1+jianshang(defense[grade]);
				cout<<"碧水金睛兽打出了"<<y1<<"点伤害"<<endl;
				Sleep(1);
				cout<<name<<"还剩"<<tema<<"滴血"<<endl;
				Sleep(1);
				if(tema<=0)
				{
   
					cout<<"你落败了,等级-1"<<endl;
					grade--;
					return;
				}
				for(int i=1; i<=5; i++)
				{
   
					if(jineng[i]&&i==1)
					{
   
						cout<<"火神术--"<<endl;
						cout<<"焚毁!"<<endl;
						temb-=5*10+attack[grade];
						cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
						if(temb<=0)
						{
   
							cout<<"你赢了";
							int n=rand()%20+1;
							if(n==1)
							{
   
								cout<<",你获得了碧水金睛兽一只";
							}
							else
							{
   
								cout<<",你获得了碧水珠";
							}
							jinyan+=(double)experience[(int)x]/10;
							return;
						}
					}
					if(jineng[i]&&i==2){
   
						cout<<"木神术--"<<endl;
						cout<<"千手顶上化佛!"<<endl;
						temb-=5*10+attack[grade];
						cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
						if(temb<=0)
						{
   
							cout<<"你赢了";
							int n=rand()%20+1;
							if(n==1)
							{
   
								cout<<",你获得了碧水金睛兽一只";
							}
							else
							{
   
								cout<<",你获得了碧水珠";
							}
							jinyan+=(double)experience[(int)x]/10;
							return;
						} 
					}
					if(jineng[i]&&i==3){
   
						cout<<"水神术--"<<endl;
						cout<<"水乱波!"<<endl;
						temb-=5*10+attack[grade];
						cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
						if(temb<=0)
						{
   
							cout<<"你赢了";
							int n=rand()%20+1;
							if(n==1)
							{
   
								cout<<",你获得了碧水金睛兽一只";
							}
							else
							{
   
								cout<<",你获得了碧水珠";
							}
							jinyan+=(double)experience[(int)x]/10;
							return;
						} 
					}
					if(jineng[i]&&i==4){
   
						cout<<"土神术--"<<endl;
						cout<<"土淹!"<<endl;
						temb-=5*10+attack[grade];
						cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
						if(temb<=0)
						{
   
							cout<<"你赢了";
							int n=rand()%20+1;
							if(n==1)
							{
   
								cout<<",你获得了碧水金睛兽一只";
							}
							else
							{
   
								cout<<",你获得了碧水珠";
							}
							jinyan+=(double)experience[(int)x]/10;
							return;
						} 
					}
					if(jineng[i]&&i==5){
   
						cout<<"金神术--"<<endl;
						cout<<"金光剑!"<<endl;
						temb-=5*10+attack[grade];
						cout<<name<<"打出了"<<5*10+attack[grade]<<"点伤害"<<endl;
						if(temb<=0)
						{
   
							cout<<"你赢了";
							int n=rand()%20+1;
							if(n==1)
							{
   
								cout<<",你获得了碧水金睛兽一只";
							}
							else
							{
   
								cout<<",你获得了碧水珠";
							}
							jinyan+=(double)experience[(int)x]/10;
							return;
						} 
					}
				} 
				int y2=shanghai(attack[grade]);
				temb-=y2;
				temb+=jianshang(temf);
				cout<<name<<"打出了"<<y2<<"点伤害"<<endl;
				Sleep(1);
				cout<<
;