人生之路优化,bug修复

    小森林的几个成就无法完成的bug已经修复。

    如果影响了游戏体验请原谅。

    这个bug的错误原因是先判断了成就,再给物品增加。应该先增加物品数量,再判断成就是否完成,不然一件装备需要做两次才能完成成就。现已修复。

   

 小森林代码如下

void forest()
{
	hdcj(31);
	srand(time(0));
	const string where[]=
	{"打猎","砍树","工作台","探索","查看合成表","离开","附魔","森林背包","查看当前附魔属性","看看森林中各物品说明"};
	int i,j,k,n,m;
	char l;
	while(1)
	  {
	  	things[8]-=5;
	  	tepan();
	  	cls();
	  	printf("树林茂密的森林中,不时传来的尖叫声给人一种不安的气氛\n");
	  	for(i=0;i<10;i++)
	  	  printf("%d.%s\n",i,where[i].c_str());
	  	cout<<"` (ESC下面)神秘人\n";
	  	if (things[188]==1)
	      l=choose(6)+'0';
	    else
	  	  l=_getch();
	  	switch(l)
	  	  {
	  	  	case '0':
	  	  		{
	  	  		cls();
	  	  		if (rand()%4==1)
	  	  		  {
	  	  		  	cout<<"运气不巧,什么都没碰到";
	  	  		  	gs();
	  	  		  	break;
					  }
				cout<<"你遇到了一只野";
				string animal[6]={"","牛","羊","猪","鸡","兔"};
				srand(time(0));
				n=random(1,5);
				cout<<animal[n];
				gs();
				if (dalie())
				  {
				  	happened+=(name+"在小森林打猎,收获猎物一只/");
				  if (n==1)
				    hdcj(39);
				  things[81]++;
				  if (things[81]>=20)
				    hdcj(44);
				  cout<<"打中了!";
				  cout<<"卖了";
				  n=random(800,8000);
				  cout<<n;
				  cout<<"元";
				  things[7]+=n;
				  gotmoney+=n;
				  gs();
				  }
				else
				  {
				  	things[84]=0;
				  	happened+=(name+"打猎时手滑走火导致猎物逃走/");
				  	cout<<"没打中!";
				  	gs();
				  }break;
			}
			case '1':
				{
					use(52);
					gs();
					hdcj(20);
					Sout("你费力地挥舞着斧头,树木吱吱的发出不祥的叫声。");
					happened+=(name+"在森林乱砍乱伐/");
					gs();
					for(i=1;i<=random(4,7);i++)
					  {
					  	m=60000;
					  	n=0;
					  	n+=fost[17]*1593;
					  	n+=fost[18]*3983;
					  	n+=fost[19]*6927;
					  	n+=fost[20]*6281;
					  	n+=fost[21]*12817;
					  	n+=fost[45]*18693;
					  	n+=fost[53]*23100;
					  	n*=random(1,has_fumo[1][1]+1);
					  	m-=n;
					  	jdt(float(m/10000.0));
					  	n=random(2,4);
					  	n*=random(1,has_fumo[2][4]+1);
					  	cout<<"原木*"<<n;
					  	fost[0]+=n;
					  }
					break;
				}
			case '2':
				{
					use(53);
					gs();
					cout<<"______________________________\n";
					cout<<"|         |         |         |\n";
					cout<<"|         |         |         |\n";
					cout<<"|_________|_________|_________|\n";
					cout<<"|         |         |         |\n";
					cout<<"|         |         |         |\n";
					cout<<"|_________|_________|_________|\n";
					cout<<"|         |         |         |\n";
					cout<<"|         |         |         |\n";
					cout<<"|_________|_________|_________|\n";
					cout<<"输入你有的东西的编号,放进对应的格子";
					int f[3][3];
					int grid[3][3][2]=
					{
						{
							2,2,
							2,14,
							2,26,
						},
						{
							5,2,
							5,14,
							5,26,
						},
						{
							8,2,
							8,14,
							8,26,
						},
					};
					  for(i=0;i<3;i++)
					    for(j=0;j<3;j++)
					      {
					      	gotoxy(16,3);
					      	cout<<"第"<<i*3+j+1<<"格放什么?输入编号(什么都不放输入-1)           \n";
					      	int g=0;
					      	for(k=0;k<=56;k++)
					      	  if (fost[k])
					      	    {
					      	      printf("%d.%s * %d\t",k,fsn[k].c_str(),fost[k]);
					      	      if ((++g)%3==0)
					      	        printf("\n");
					      	    }
					      	cin>>f[i][j];
					      	gotoxy(grid[i][j][0],grid[i][j][1]);
					      	if (f[i][j]==-1)
					      	  cout<<"空";
					      	else
					      	  cout<<fsn[f[i][j]];
						  }
					  cls();
					  n=-1;
					  for(i=0;i<=56;i++)
					    {
					    	bool flag=true;
					    	for(j=0;j<3;j++)
					    	  for(k=0;k<3;k++)
					    	    if (f[j][k]!=map[i][j][k])
					    	      flag=false;
					    	if (flag)
					    	  {
					    	  	n=i;
					    	  	break;
							  }
						}
					  if (n==-1)
						{
							cout<<"不存在该合成表!";
							gs();
							break;
						}
					cout<<"做几个 "<<fsn[n]<<" ?";
					int l1;
					cin>>l1;
					int get[201];
					memset(get,0,sizeof(get));
					for(i=0;i<200;i++)
					  get[i]=fost[i]; 
					bool can=true;
					for(i=0;i<3;i++)
					  for(j=0;j<3;j++)
					    if (map[n][i][j]>=0)
					    if (get[map[n][i][j]]<l1)
					      {
					      	can=false;
					      	break;
						  }
						else
						  get[map[n][i][j]]-=l1;
					cout<<can<<endl;
					if (can==0)
					  {
					  	cout<<"材料不足!,缺少"<<i<<','<<j<<'\n';
					  	gs();
						break; 
					  }
					  for(i=0;i<3;i++)
					    for(j=0;j<3;j++)
					      {
					      	if (map[n][i][j]!=-1)
					      	{
					      	  fost[map[n][i][j]]-=l1;
					        }
						  }
					if (i!=500&&j!=600)
					{
					cout<<"获得:"<<fsn[n]<<'*'<<l1;
					if (n==9)
					  hdcj(13);
					if (n==14)
					  hdcj(19);
					if (n==11)
					  hdcj(21);
					if (n==12)
					  things[5]+=l1;
					if (n==13)
					  things[5]+=2*l1;
					if (n==14)
					  things[5]+=3*l1;
					if (n==15)
					  things[5]+=5*l1;
					if (n==22)
					  things[5]+=17*l1;
					happened+=(name+"合成了"+fsn[n]+"/");
					if (i<=5&&j<=5)
					  fost[n]+=l1;
					if (n==1)
					  fost[n]+=3*l1;
					if (n==2)
					  fost[n]+=3*l1;
					if (n==4)
					  fost[n]+=8*l1;
					if (n==5)
					  fost[n]+=8*l1;
					if (n==6)
					  fost[n]+=8*l1;
					if (n>=35&&n<=38)
					  {
					  	bool diamond=true;
					  	for(int ji=35;ji<=38;ji++)
					  	  if (fost[ji]<=0)
					  	    diamond=false;
					  	if (diamond)
					  	  hdcj(23);
					  }
					if (n>=39&&n<=42)
					  {
					  	bool diamond=true;
					  	for(int ji=39;ji<=42;ji++)
					  	  if (fost[ji]<=0)
					  	    diamond=false;
					  	if (diamond)
					  	  hdcj(24);
					  }
					if (n>=46&&n<=49)
					  {
					  	bool diamond=true;
					  	for(int ji=46;ji<=49;ji++)
					  	  if (fost[ji]<=0)
					  	    diamond=false;
					  	if (diamond)
					  	  hdcj(25);
					  }
					/*iron golden diamond hero sky
				head   4    3         6		9	15
				clothes 6    4        8		14	23
				tussle  5    4        7		12	19
				shoes	3    2        5 	8	13
					*/
					if (n==27)
					  things[6]+=4;
					if (n==28)
					  things[6]+=6;
					if (n==29)
					  things[6]+=5;
					if (n==30)
					  things[6]+=3;
					if (n==31)
					  things[6]+=3;
					if (n==32)
					  things[6]+=4;
					if (n==33)
					  things[6]+=4;
					if (n==34)
					  things[6]+=2;
					if (n==35)
					  things[6]+=6;
					if (n==36)
					  things[6]+=8;
					if (n==37)
					  things[6]+=7;
					if (n==38)
					  things[6]+=5;
					if (n==39)
					  things[6]+=9;
					if (n==40)
					  things[6]+=14;
					if (n==41)
					  things[6]+=12;
					if (n==42)
					  things[6]+=8;
					if (n==43)
					  things[5]+=16;
					if (n==46)
					  things[6]+=15;
					if (n==47)
					  things[6]+=23;
					if (n==48)
					  things[6]+=19;
					if (n==49)
					  things[6]+=13;
					if (n==50)
					  things[5]+=35;
					if (n==53)
					  {
					    things[5]+=46;
					    hdcj(27);
					  }
					}
					break;
					}
					case '3':
						{
							/*	string fumoname[4][5]=
{
	{"耐久","锋利","抢夺","雷电之力","落雷术"},
	{"耐久","效率","洪荒之力","木之克星","时运"},
	{"耐久","效率","急迫","精准采集","时运"}
	{"耐久","保护","血量提升","荆棘","雷电附身"},
}; */
							n=random(1,6);
							if (things[187]==2&&rand()%3<=1)
							  n=7;
							cls();
							switch(n)
							  {
							  	case 1:
							  		{
							  			use(54);
							  			Sout("你遇到了一只僵尸!");
							  			m=random(things[9]-10,things[9]+15);
							  			int hp,attack,run;
							  			hp=m*(random(17,29));
							  			attack=m*(random(4,13));
							  			run=m;
							  			while(1)
							  			{
							  			  cls();
							  			  cout<<"Your hp:"<<things[2]<<'\n';
							  			  cout<<"JS's hp:"<<hp<<'\n';
							  			  cout<<"1.attack 2.run away\n";
							  			  char l=_getch();
							  			  cout<<l;
							  			  if (l=='2')
							  			    {
							  			    	if (rand()%4==1)
							  			    	  {
							  			    	  	cout<<"逃跑成功,运气不错!";
							  			    	  	break;
													}
												else
												  cout<<"逃跑失败!\n";
											  }
										  else
										  {
										  if (fost[22]==0&&fost[43]==0&&fost[50]==0&&fost[53]==0)
										  {
							  			  n=gongji(things[5]);
							  			  gotoxy(12,0);
							  			  n-=run;
							  			  Sout("你发动了攻击,僵尸受到了");
							  			  }
							  			else
										  {
										  if (fost[22]>=1)
										    {cout<<"你发动了技能【火炮轰炸】\n";n=1.2*things[5];}
										  if (fost[43]>=1)//43,50,53
										    {cout<<"你发动了技能【横扫】\n";n+=1.1*things[5];}
										  if (fost[50]>=1)
										    {cout<<"你发动了技能【坠入虚空】\n";n+=hp*0.5;}
										  if (fost[53]>=1)
										    {cout<<"你发动了技能【量子充能】\n";n+=0.4*things[2];}
										  }
										if (has_fumo[3][4])
										  if (rand()%(70/(70/has_fumo[3][4])))
										    cout<<"你发动了技能【雷电之力】\n",n+=has_fumo[3][4]*0.01*things[2];
							  			Sout("造成了");
							  			  cout<<n;
							  			  Sout("点伤害\n");
							  			  hp-=n;
							  			  }
							  			  Sout("僵尸发动了攻击,你受到了");
							  			  n=attack*0.87-things[6];
							  			  if (n<1)
							  			    n=1;
							  			  cout<<n;
							  			  Sout("点伤害\n");
							  			  Sout("反伤:");
							  			  m=0;
							  			  if (has_fumo[3][3])
							  			    m=n*(has_fumo[3][3])*0.03;
							  			  cout<<m<<"点\n";
							  			  things[2]-=n;
							  			  hp-=m;
							  			  if (things[2]<=0)
							  			    {
							  			      happened+=(name+"被僵尸杀死了/");
							  			      Die();
							  			    }
							  			if (hp<=0)
							  			  {
							  			  	hdcj(22);
							  			  	break;
											}
							  			}
							  		  Sout("胜利!战利品:");
							  		  things[83]++;
							  		  if (fost[22]>=1)
										things[197]++;
									  if (things[197]>=166)
									    hdcj(6);
							  		  happened+=(name+"杀死了一只僵尸/");
							  		  n=random(2,4);
							  		  m=random(0,2);
							  		  cout<<fsn[m]<<"*"<<n;
							  		  n*=random(1,has_fumo[0][2]+1);
							  		  fost[m]+=n;
							  		  gs();
							  		  break;
									}
								case 2:
									{
										use(55);
										cls();
							  			Sout("你遇到了一只骷髅!");
							  			m=random(things[9]-10,things[9]+15);
							  			int hp,attack,run;
							  			hp=m*(random(7,23));
							  			attack=m*(random(5,8));
							  			run=m;
							  			while(1)
							  			{
							  			  cout<<"Your hp:"<<things[2]<<'\n';
							  			  cout<<"KL's hp:"<<hp<<'\n';
							  			  cout<<"1.attack 2.run away\n";
							  			  char l=_getch();
							  			  cout<<l;
							  			  if (l=='2')
							  			    {
							  			    	if (rand()%4==1)
							  			    	  {
							  			    	  	cout<<"逃跑成功,运气不错!";
							  			    	  	break;
													}
												else
												  cout<<"逃跑失败!\n";
											  }
										  else
										  {
							  			  n=gongji(things[5]);
							  			  gotoxy(12,0);
							  			  n-=run;
							  			  Sout("你发动了攻击,KL受到了");
							  			  cout<<n;
							  			  Sout("点伤害\n");
							  			  hp-=n;
							  			  }
							  			  Sout("骷髅发动了攻击,你受到了");
							  			  n=attack*0.87-things[6];
							  			  if (n<1)
							  			    n=1;
							  			  cout<<n;
							  			  Sout("点伤害\n");
							  			  Sout("反伤:");
							  			  m=0;
							  			  if (has_fumo[3][3])
							  			    m=n*(has_fumo[3][3])*0.03;
							  			  cout<<m<<"点\n";
							  			  things[2]-=n;
							  			  hp-=m;
							  			  if (things[2]<=0)
							  			    {
							  			      happened+=(name+"被骷髅杀死了/");
							  			      Die();
							  			    }
							  			if (hp<=0)
							  			  {
							  			  	hdcj(22);
							  			  	break;
							  			  }
							  			}
							  		  happened+=(name+"杀死了一只骷髅/");
							  		  Sout("胜利!战利品:");
							  		  things[83]++;
							  		  n=random(2,4);
							  		  m=random(0,2);
							  		  n*=random(1,has_fumo[0][2]+1);
							  		  cout<<fsn[m]<<"*"<<n;
							  		  fost[m]+=n;
							  		  gs();
							  		  break;
									}
								case 3:
								 {
								 	use(56);
							  			Sout("你遇到了一只爬行者!");
							  			m=random(things[9]-10,things[9]+15);
							  			int hp,attack,run;
							  			hp=m*(random(17,23));
							  			attack=m*(random(6,8));
							  			run=m;
							  			while(1)
							  			{
							  			  cls();
							  			  cout<<"Your hp:"<<things[2]<<'\n';
							  			  cout<<"PXZ's hp:"<<hp<<'\n';
							  			  cout<<"1.attack 2.run away\n";
							  			  char l=_getch();
							  			  if (l=='2')
							  			    {
							  			    	if (rand()%4==1)
							  			    	  {
							  			    	  	cout<<"逃跑成功,运气不错!";
							  			    	  	break;
													}
												else
												  cout<<"逃跑失败!\n";
											  }
										  if (fost[22]==0&&fost[43]==0&&fost[50]==0&&fost[53]==0)
										  {
							  			  n=gongji(things[5]);
							  			  gotoxy(12,0);
							  			  n-=run;
							  			  Sout("你发动了攻击,爬行者受到了");
							  			  cout<<n;
							  			  Sout("点伤害\n");
							  			  hp-=n;
							  			  }
							  			  Sout("爬行者自爆了,你受到了");
							  			  n=attack*1.4-things[6];
							  			  cout<<n;
							  			  Sout("点伤害") ;
							  			  things[2]-=n;
							  			  hp=0;
							  			  if (things[2]<=0)
							  			    {
							  			      happened+=(name+"被creeper炸飞了/");
							  			      Die();
							  			    }
							  			if (hp<=0)
							  			  break;
							  			}
							  		  Sout("胜利!战利品:");
							  		  n=random(2,5);
							  		  m=23;
							  		  n*=random(1,has_fumo[0][2]+1);
							  		  cout<<fsn[m]<<"*"<<n;
							  		  fost[23]+=n;
							  		  gs();
							  		  break;
									}
								  case 4:
								  	{
								  		use(57);
								  	  Sout("你找到了一个矿洞.");
								  	  Sout("\n是否挖矿?1.是 2.否");
								  	  char l=_getch();
								  	  if (l=='2')
								  	    break;
								  	  n=60000;
								  	  n-=fost[7]*2838;
								  	  n-=fost[8]*5092;
								  	  n-=fost[9]*7928;
								  	  n-=fost[10]*9203;
								  	  n-=fost[11]*13029;
								  	  n-=fost[44]*17832;
								  	  n-=fost[51]*30091;
								  	  n*=1-has_fumo[2][1]*0.04;
								  	  n*=1-has_fumo[2][2]*0.05;
								  	  if (n<10000)
								  	    n=10000;
								  	  for(i=1;i<=6;i++)
								  	  {
								  	  	m=random(3,6);
								  	  	if (has_fumo[2][3])
								  	  	  {
								  	  	  	cout<<"你想要什么?\n";
								  	  	  	cout<<"1.石头\n";
								  	  	  	cout<<"2.铁锭\n";
								  	  	  	cout<<"3.金锭\n";
								  	  	  	cout<<"4.钻石\n";
								  	  	  	int a;
								  	  	  	cin>>a;
								  	  	  	if (a>4)
								  	  	  	  a=random(1,4);
								  	  	  	m=a+2;
										  }
										if (m==6)
										  hdcj(12);
								  	    jdt(n/10000+(m-3));
								  	    k=random(1,3);
								  	    k*=random(1,has_fumo[2][4]+1);
								  	    fost[m]+=k;
								  	    cout<<fsn[m]<<'*'<<k;
								  	    happened+=(name+"在矿洞淘钻/");
								  	    gs();
								  	  }
								  	  break;
									}
									case 5:
										{
											use(58);
											srand(time(0));
											Sout("你遇到了一个废弃矿道");
											cout<<"是否探索?1.是 2.否 3.查看故事";
											char l=_getch();
											if (l=='3')
											  {
											  	cls();
											  	cout<<"    这是一条灵异矿道,以前的矿工常常在里面离奇失踪,\n";
											  	cout<<"数日后便会有几个影子在矿道里游荡。有人说这是矿工的亡\n";
											  	cout<<"魂,也有人说这是恶魔的影子。\n";
											  	cout<<"    唯一一个或者从矿道里走出来的是WYQ,他在下矿之前被\n";
											  	cout<<"MCYH施加了BUFF,所以没事。但是他亲口说自己看到了地上躺\n";
											  	cout<<"着无数没有生命的躯体,眼里冒着绿光。忽然他们全都站了起\n";
											  	cout<<"来向WYQ扑过来,但是他们看到MCYH的BUFF时立刻魂飞魄散了。\n";
											  	cout<<"    从此以后,只有游戏主宰者MCYH和好友WYQ能在矿道和地上\n";
												cout<<"世界中自由的穿梭,只有他能为地面上的人类带来矿道里丰富的宝藏。\n";
											  	cout<<"    所以,这位看故事的玩家,你敢进去吗?\n";
											  	cout<<"是否探索?1.是 2.否";
											  	l=_getch();
											  	if (l=='2'){
											  	  Sout("MCYH:胆小鬼,我编个故事吓吓你而已...");break;}
											  }
											n=rand()%4+1;
											switch(n)
											  {
											  	case 1:
											  	case 2:
											  	case 3:
											  		{
											  			Sout("你发现了一个箱子,是否打开?1.YES 2.NO");
											  			l=_getch();
											  			if (l=='2')
											  			  break;
											  			if (l=='1')
											  			  {
											  			  	srand(time(0));
											  			  	if (rand()%2)
											  			  	  {
											  			  	  	happened+=(name+"在废弃矿道找到了很多宝藏/");
											  			  	  	cout<<"你找到了一堆宝藏!\n";
											  			  	  	cout<<"获得:";
																n=random(3,6);
																m=random(3,5);
																cout<<fsn[n]<<'*'<<m;
																fost[n]+=m;
																cout<<",";
																n=random(3,6);
																m=random(3,5);
																cout<<fsn[n]<<'*'<<m;
																fost[n]+=m;
																break; 
																  }
															{
							  			Sout("你遇到了一只游魂!");
							  			hdcj(14);
							  			m=random(things[9]-10,things[9]+15);
							  			int hp,attack,run;
							  			hp=m*(random(23,28));
							  			attack=m*(random(7,9));
							  			run=m;
							  			while(1)
							  			{
							  			  cls();
							  			  cout<<"Your hp:"<<things[2]<<'\n';
							  			  cout<<"YH's hp:"<<hp<<'\n';
							  			  cout<<"敌军等级:"<<m<<"\n"; 
							  			  cout<<"1.attack 2.run away\n";
							  			  char l=_getch();
							  			  if (l=='2')
							  			    {
							  			    	if (rand()%2)
							  			    	  {
							  			    	  	cout<<"逃跑成功,运气不错!";
							  			    	  	break;
													}
												else
												  cout<<"逃跑失败!\n";
											  }
										  else
										  {
										  if (fost[22])
										    cout<<"你发动了技能【火炮轰炸】\n",n=1.2*things[5];
										  if (fost[43])//43,50,53
										    cout<<"你发动了技能【横扫】\n",n+=1.1*things[5];
										  if (fost[50])
										    cout<<"你发动了技能【坠入虚空】\n",n+=hp*0.5;
										  if (fost[53])
										    cout<<"你发动了技能【量子充能】\n",n+=0.4*things[2];
										if (fost[22]==0&&fost[43]==0&&fost[50]==0&&fost[53]==0){
							  			  n=gongji(things[5]);
							  			  n-=run;
							  			  Sout("你发动了攻击,游魂受到了");
							  			}
							  			  cout<<n;
							  			  Sout("点伤害\n");
							  			  hp-=n;
							  			  }
							  			  if (rand()%4)
							  			  {
							  			  Sout("游魂发动了攻击,你受到了");
							  			  n=attack*0.87-things[6];
							  			  if (n<1)
							  			    n=1;
							  			  cout<<n;
							  			  Sout("点伤害") ;
							  			  things[2]-=n;
							  			  }
							  			  else
							  			  {
							  			  	cout<<"游魂发动技能“灵魂威慑”,对你造成了"<<attack*1.5<<"点伤害\n";
							  			  	things[2]-=attack*1.5;
											}
							  			  if (things[2]<=0)
							  			    {
							  			      happened+=(name+"被游魂杀死了/");
							  			      Die();
							  			    }
							  			if (hp<=0)
							  			  break;
							  			cls();
							  			}
							  		  Sout("胜利!战利品:");
							  		  if (fost[22]>=1)
										things[197]++;
									  if (things[197]>=166)
									    hdcj(6);
							  		  things[83]++;
							  		  n=random(2,6);
							  		  m=random(0,6);
							  		  n*=random(1,has_fumo[0][2]+1);
							  		  cout<<fsn[m]<<"*"<<n;
							  		  fost[m]+=n;
							  		  gs();
							  		  break;
									}	
															}
													  }
									case 4:
										{
											if (rand()%2)
											{
												use(59);
											  cout<<"你遇到了MCYH!\n";
											  cout<<"1.attack 2.run away";
											  char l=_getch();
											  switch(l)
											    {
											    	case '2':break;
											    	default:
											    		{
											    		  Sout("\nMCYH:和作者打架。。。");
											    		  hdcj(15);
											    		  Sout("\nMCYH(拿起纳米剑):来吧!准备好了没有?Y/N");
											    		  char g=_getch();
											    		  if (g!='Y'&&g!='y')
											    		  {
											    		    Sout("MCYH:胆小鬼!");break;
											    		  }
											    		  gs();
											    		  things[0]++;
											    		  return;
											    		  break;
											    		}
												}
											  break;
											}
											else
											{
												use(60);
												cout<<"你遇到了WYQ!\n";
												cout<<"1.attack 2.run away\n";
												char l=_getch();
												switch(l)
												{
													case '2':break;
													default:
														Sout("MCYH:竟敢和作者的好兄弟WYQ打架?!关机吧!!!");
														system("Shutdown -H");
														break;
												}
												break;
											}
										}
											  }
										break;
										}
									case 6:
										{
											use(61);
											cout<<"你遇到了SLS(索罗斯)!";
											int a,b,c,d=random(things[9]-3,things[9]+5);
											int huanying=0;
											a=d*(random(21,30));
							  				b=d*(random(6,11));
							  				c=d;
											gs();
											while(1)
											  {
											  	cls();
											  	Sout("YOUR HP:");
											  	cout<<things[2]<<'\n';
											  	Sout("SLS HP:");
											  	cout<<a<<'\n';
											  	Sout("SLS ATTACK:");
											  	cout<<b<<'\n';
											  	Sout("SLS DEFENCE:");
											  	cout<<c<<'\n';
											  	Sout("SLS XP:");
											  	cout<<d<<'\n';
											  	Sout("SLS幻影层数:");
											  	cout<<huanying<<'\n';
											  	cout<<"1.attack 2.run away\n";
											  	char l=_getch();
											  	if (l=='2')
											  	  {
											  	  	if (rand()%4==1)
											  	  	  {
											  	  	  	Sout("逃跑成功,运气不错");
											  	  	  	break;
													  }
													else
													  Sout("逃跑失败!\n");
												  }
												else
												  {
												  	if (fost[22])
										    		  cout<<"你发动了技能【火炮轰炸】\n",n=1.2*things[5];
										  			if (fost[43])//43,50,53
										    		  cout<<"你发动了技能【横扫】\n",n+=1.1*things[5];
										  			if (fost[50])
										    		  cout<<"你发动了技能【坠入虚空】\n",n+=a*0.5;
										  			if (fost[53])
										    		  cout<<"你发动了技能【量子充能】\n",n+=0.4*things[2];
													if (fost[22]==0&&fost[43]==0&&fost[50]==0&&fost[53]==0){
							  			  			  n=gongji(things[5]);
							  			  			n-=c;
							  			  			Sout("你发动了攻击,SLS受到了");
							  						}
							  						else
							  						  cout<<"造成了";
							  						cout<<n<<"点伤害\n";
							  						a-=n;
												  }
												if (a<=0)
												  {
												  	cout<<"胜利!战利品:XP5000";
												  	int jiangli=random(0,56);
													cout<<" "<<fsn[jiangli];
													cout<<" *1";
													fost[jiangli]++; 
													things[83]++;
													if (fost[22]>=1)
													  things[197]++;
												  	gs();
												  	break;
												  }
												if (rand()%2)
												{
													n=float((random(6,9))/10)*b-things[6];
													Sout("索罗斯发动了攻击,你受到了");
													cout<<n;
													Sout("点伤害,索罗斯叠加了一层幻影\n");
													huanying++;
													things[2]-=n;
													if (things[197]>=166)
									    			  hdcj(6);
												}
												else
												{
													int jin=random(1,3);
													if (jin==1)
													  {
													  	Sout("索罗斯发动了技能【幻枪连击】,对你造成");
													  	n=1.6*b;
													  	cout<<n;
													  	Sout("点伤害\n");
													  	things[2]-=n;
													  }
													if (jin==2)
													  {
													  	Sout("索罗斯发动技能【结合】,将幻影层数清空,并且每失去一个幻影,自身恢复30点血量,增加4点攻击");
													  	a+=huanying*30;
													  	b+=huanying*4;
													  	huanying=0;
													  }
													if (jin==3)
													  {
													  	Sout("索罗斯发动技能【总攻击】,让所有幻影对敌人造成攻击(每个幻影拥有自身60%属性),对你造成了");
													  	n=a*0.6*huanying;
													  	cout<<n;
													  	Sout("点伤害,并失去2个幻影");
													  	huanying-=2;
													  	things[2]-=n;
													  }
												}
												if (things[2]<=0)
												  Die();
											  }
											break;
										  }
										case 7:
											{
												cls();
												int a=things[5]*0.6,b=things[6]*0.5;
												int c=things[9]*3,d=things[9],e=things[9]*11;
												Sout("你遇到了一只树妖(树妖特性:只能攻击,无法逃跑,你的攻击和防御大幅下降,无法用技能)\n");
												while(e>0&&things[2]>0)
												  {
												  	int A,B;
												  	A=gongji(a);
												  	A-=d;
												  	Sout("你发动了攻击,树妖受到了");
												  	cout<<A;
												  	e-=A;
												  	Sout("点伤害\n");
												  	B=c*0.875-b;
												  	Sout("树妖发动了攻击,你受到了");
												  	cout<<B;
												  	Sout("点伤害\n");
												  	things[2]-=B;
												  	if (things[2]<=0)
												  	  {
												  	  	happened+=(name+"被树妖杀死了");
												  	  	Die();
														}
												  	gs();
												  }
												cout<<"胜利!";
												happened+=(name+"杀死了一只树妖/");
							  		 			 Sout("胜利!战利品:");
							  		  			things[83]++;
							  		  			n=random(2,4);
							  		  			m=random(0,2);
							  		 			 n*=random(1,has_fumo[0][2]+1);
							  		 			 cout<<fsn[m]<<"*"<<n;
							  		  			fost[m]+=n;
											}
										}
									break;
							  }
					case '4':
						{
							cls();
							while(1)
							  {
							  	use(62);
							  	cls();
							  	cout<<"想查看什么的合成表?输入编号,输入-1退出\n";
							  	for(i=0;i<=56;i++)
							  	  {
							  	  	cout<<i<<" "<<fsn[i]<<'\n';
									}
								cin>>n;
								if (n==-1)
								  break;
								cls();
								for(i=0;i<3;i++)
								{
								  for(j=0;j<3;j++)
								    {
								    	if (map[n][i][j]==-2)
								    	{
								    	  cout<<"不可合成物";
								    	  gs();
								    	  i=10,j=10;
								    	  break;
								    	}
								    	if (map[n][i][j]==-1)
								    	  {
								    	  	cout<<"空";
										  }
										else
										  cout<<fsn[map[n][i][j]];
										cout<<' ';
									}
									cout<<endl;
								}
								gs();
							  }
							break;
						}
				case '5':return;
				case '6':
				{
					use(63);
					if (things[32]==0)
					  {
					  	cout<<"没有附魔台!\n";
					  	cout<<"获得方式:公园-->登山-->天空之境-->天空集市购买\n";
					  	gs();
					  	break;
					  }
					cls();
					cout<<"你要给哪个装备附魔?";
					cout<<"1.剑\n";
					cout<<"2.斧子\n";
					cout<<"3.镐子\n";
					cout<<"4.头盔\n";
					cout<<"5.胸甲\n";
					cout<<"6.护腿\n";
					cout<<"7.靴子\n"; 
					cin>>n;
					if (n>4)
					  n=4;
					i=n-1;
						srand(time(0));
						cout<<"\n\n";
						cout<<"你有"<<things[9]<<"级经验\n";
						cout<<"你有"<<things[33]<<"块附魔石\n";
						cout<<"你想附哪一种魔?(附魔等级上限:6级)\n";
						int a,b,c;
						a=rand()%5;
						cout<<"0.不附魔\n";
						cout<<"1.1级经验,1块附魔石:"<<fumoname[i][a]<<has_fumo[i][a]+1<<"  经验等级限制:7"<<'\n';
						do
						  b=rand()%5;
						while(a==b);
						cout<<"2.2级经验,2块附魔石:"<<fumoname[i][a]<<has_fumo[i][a]+1<<'+'<<fumoname[i][b]<<has_fumo[i][b]+1<<"  等级限制:15"<<'\n';
						do
						  c=rand()%5;
						while(c==a||c==b);
						cout<<"3.3级经验,3块附魔石:"<<fumoname[i][a]<<has_fumo[i][a]+1<<'+'<<fumoname[i][b]<<'+'<<has_fumo[i][b]+1<<fumoname[i][c]<<has_fumo[i][c]+1<<"等级限制:30"<<'\n';
						cin>>m;
						int s[4]={0,7,15,30};
						if (m==0)
						  break;
						if (things[9]<s[m]||things[33]<m)
						  {
						  	cout<<"材料(经验或附魔石)不足!";
						  	gs();
						  	break;
						  }
						has_fumo[i][a]++;
						if (m>=2)
						  has_fumo[i][b]++;
						if (m>=3)
						  has_fumo[i][c]++;
						things[9]-=m;
						things[1]=sj[things[9]-1];
						things[33]-=m;
					/*	string fumoname[4][5]=
{
	{"耐久","锋利","抢夺","雷电之力","落雷术"},
	{"耐久","效率","洪荒之力","木之克星","时运"},
	{"耐久","效率","急迫","速率提升","时运"}
	{"耐久","保护","血量提升","荆棘","雷电附身"},
}; */
					if (i==0)
					  {
					  	if (a==1||b==1||c==1)
					  	  things[5]+=5;
					  }
					if (i==3)
					  {
					  	if (a==1||b==1||c==1)
					  	  things[6]+=2;
					  	if (a==2||b==2||c==2)
					  	  things[2]+=30;
					  }
					for(i=0;i<4;i++)
					  for(j=0;j<5;j++)
					    if (has_fumo[i][j]>6)
					      has_fumo[i][j]=6;
					break;
					  }
				case '7':
					{
						use(64);
						for(i=0;i<=56;i++)
						  if (fost[i])
						    printf("%s *%d  -%s\n",fsn[i].c_str(),fost[i],nn[leibie[i]].c_str());
						gs();
						break;
					}
				case '8':
					{
						use(65);
						string wupin[4]={"剑","斧头","镐子","盔甲"};
						cls();
						for(i=0;i<4;i++)
						  for(j=0;j<5;j++)
						    {
						    	printf("%s:【%s】%d级\n",wupin[i].c_str(),fumoname[i][j].c_str(),has_fumo[i][j]);
							}
						break;
					}
				case '9':
					{
						use(74);
						/*string fsn[200]=
	0       1       2      3        4      5        6
{"原木 ","木板 ","木棍 ","石头 ","铁锭 ","金锭 ","钻石 ",
   7       8       9           10   11
 "木镐 ","石镐 ","铁镐 ","金镐 ","钻石镐 ",
    12     13		14		15		16
 "木剑 ","石剑 ","铁剑 ","金剑 ","钻石剑 ",
	17		18		19		20		21
 "木斧 ","石斧 ","铁斧 ","金斧 ","钻石斧 ",
 	22		  23	 24		25		26
 "春节礼炮","火药","铁块","金块","钻石块",
 		27		28		29			30
 /*27"铁头盔","铁胸甲","铁护腿","铁靴子",
 	31		32			33		34
 "金头盔","金胸甲","金护腿","金靴子",
 	35			36			37		38
 "钻石头盔","钻石胸甲","钻石护腿","钻石靴子",
 		39			40			41			42		43		44		45
 /*39"英雄头盔","英雄战甲","英雄护腿","英雄战靴","英雄剑","英雄镐","英雄战斧",
 		46			47			48			49		50		51		52
 /*46"虚空头盔","虚空战甲","虚空护腿","虚空战靴","虚空剑","虚空镐","虚空斧",
 		53			54		55		56
 /*53"量子剑", "石头精华", "CPU","工业钻石" 
};*/
					/*iron golden diamond hero sky
				head   4    3         6		9	15
				clothes 6    4        8		14	23
				tussle  5    4        7		12	19
				shoes	3    2        5 	8	13*/ 
					string ab[200]=
					{
						"来自于一棵大树身上的木头","由一块原木分解后得到的东西,可以用于制作基础装备","装备的握把,由木板分解而成",
						"一块普通的石头,蕴含着不普通的能量,可以用于制造石器装备","矿洞里的一种普通矿石,很常见,可用于合成武器与防具",
						"矿洞里的一种普通矿石,很常见,可用于合成武器与防具","一种稀有矿石,可以通过挖矿或购买获得","普通的基础挖矿工具",
						"升级后的挖矿工具","一把挖矿利器,开采效率较高","挖矿能手,附魔时属性会更好哦","奢侈豪华的挖矿神器,速度超快",
						"普通的防身武器","升级后的防身武器","一把打怪利器","打怪能手,附魔时属性会更好哦","奢侈豪华的打怪神器,伤害很高",
						"普通的伐木工具","升级后的伐木工具","一把伐木利器","伐木能手,附魔时属性会更好哦","奢侈豪华的伐木神器,速度超快",
						"炸怪神器,伤害超高","PXZ的掉落物,用于合成春节礼炮","铁锭的块状,可以分解回铁锭,也可以合成英雄装备",
						"金锭的块状,可以分解回金锭,也可以合成英雄装备","钻石的块状,可以分解回钻石,也可以合成英雄装备",
						"铁制的头盔,增加4点防御","铁制的胸甲,增加6点防御","铁制的护腿,增加5点防御","铁制的靴子,增加3点防御",
						"金制的头盔,增加3点防御","金制的胸甲,增加4点防御","金制的护腿,增加4点防御","金制的靴子,增加2点防御",
						"钻石制的头盔,增加6点防御","钻石制的胸甲,增加8点防御","钻石制的护腿,增加7点防御","钻石制的靴子,增加5点防御",
						"金块合成的头盔,增加9点防御","铁块合成的胸甲,增加14点防御","铁块合成的护腿,增加12点防御","钻石块合成的靴子,增加8点防御",
						"英雄使用的宝剑","英雄采矿用的镐子","英雄手中的战斧",
						"金头盔压缩制成的头盔,增加15点防御,好像还有其它作用","铁胸甲压缩制成的胸甲,增加23点防御,好像还有其它作用",
						"铁护腿压缩制成的护腿,增加19点防御,好像还有其它作用","钻石靴子压缩制成的靴子,增加13点防御,好像还有其它作用",
						"虚空来客防身的剑","虚空来客采矿用的镐子","虚空来客手中的战斧",
						"用稀有材料制成的剑,114514年被科学家在MCYH留下的时间印记中发现","石头中能量的精华","14514年ACOPer.th13计算机的CPU,好像还有其他作用",
						"加工后的钻石,闪闪发光",
					};
					int i,j,k;
					char l;
					i=1;
					bool flag=true;
					while(flag)
						{
							cls();
							cout<<"a上一个 d下一个 e退出\n";
							cout<<"["<<fsn[i]<<"]\n";
							cout<<ab[i]<<"\n";
							l=_getch();
							switch(l)
							  {
							  	case 'a':if (i>1)i--;break;
							  	case 'd':if (i<56)i++;break;
							  	case 'e':flag=false;break;
							  }
						}
					break;
					} 
				case '`':
					{
						cls();
						if (things[9]<100)
						 {
						  Sout("神秘人:小伙子不错嘛,居然看得到我。啧啧,你的修行还不够呢,等你升到100级再来找我吧。");
						  gs();
						  break;
					     }
						Sout("神秘人:只要给我传送符,我马上就带你去另一个维度。\n");
						cout<<"1.传送至地狱 2.传送至神界 3.离开\n";
						char l=_getch();
						switch(l)
						  {
						  	case '1':
						  		{
						  			if (things[99])
						  			  {
						  			    things[98]=1;
						  			    things[99]--; 
						  			    Divinity();
						  			  }
						  			else
						  			  cout<<"传送符不足!";
									break;
								}
							case '2':
								{
									if (things[99])
									  {
									    things[98]=2;
									    things[99]--;
									    Hell(); 
									  }
									else
									  cout<<"传送符不足!";
									break;
								}
							case '3':break;
						  }
					}
			}
			if (things[83]>=50)
			  hdcj(48);
			gs();
	  }
}

新增赌场玩法“老虎机”(抽中概率有点小啊)

赌场代码如下,还修复了一点点bug

void Duchang()
{
	cls();
	srand(time(0));
	cout<<"WYQ:小子,又来赌场了啊,哈哈哈";
	const string where[]=
	{"赌大小","猜数","彩票","取数游戏","离开","老虎机"};
	int i,j,k,n,m;
	while(1)
	  {
	  	cls();
	  	for(i=0;i<6;i++)
	  	  {
	  	  	printf("%d.%s\n",i,where[i].c_str());
			}
		char l=_getch();
		tepan();
		things[8]-=10;
		switch(l)
		  {
		  	case '0':
		  		{
		  			use(47);
		  			hdcj(16);
		  			system("cls");
		  			cout<<"1-大 2-小\n";
		  			cin>>m;
		  			cout<<"赌多少钱?";
		  			cin>>i;
		  			k=0;
		  			if (things[7]<i)
		  			  {
		  			  	cout<<"钱不够!";
		  			  	break;
						}
		  			things[7]-=i;
		  			for(j=1;j<=6;j++)
		  			  {
		  			  	n=rand()%6+1;
		  			  	printf("%d\n",n);
		  			  	k+=n;
						}
					if (k>21)
					  j=1;
					else
					  j=0;
					if (m==j)
					  {
					  	cout<<"赚到了!";
					  	things[7]+=i*2;
					  	gotmoney+=i*2;
					  	happened+=(name+"在赌场大赚一笔/");
					  }
					else
					  {
					    cout<<"血本无归!";
					    happened+=(name+"在赌场血亏/");
					  }
					break;
				  }
				case '1':
					{
					use(48);
					cout<<"赌多少钱?";
		  			cin>>i;
		  			k=0;
		  			if (things[7]<i)
		  			  {
		  			  	cout<<"钱不够!";
		  			  	break;
						}
		  			things[7]-=i;
						n=random(1,50);
						for(j=1;j<=6;j++)
						  {
						  	system("cls");
						  	cout<<"猜一个数,1~50之间,你还有"<<7-j<<"次机会\n";
						  	cin>>m;
						  	if (m>n)
						  	  cout<<"Too big!";
						  	if (m<n)
						  	  cout<<"Too small!";
						  	if (m==n)
						  	  {
						  	  	things[69]++;
						  	  	cout<<"猜中了!你赚到了"<<i*2<<"元!";
						  	  	happened+=(name+"在猜数游戏中赚了很多钱/");
						  	  	things[7]+=i*2;
						  	  	gotmoney+=i*2;
						  	  	break;
							  }
							gs();
						  }
						if (j==7)
						  {
						    cout<<"血本无归!";
						    happened+=(name+"竟然连猜数游戏都猜不中/");
						    things[69]=0;
						  }
						if (things[69]>=5)
						  hdcj(37);
						break;
					}
					case '2':
						{
							use(49);
							int a[6]={0,1,100,10000,500000,1000},b[6]={0,100,10000,500000,10000000,1000000};
							int c[6]={0,20,10,5,4,1};
							cout<<"你要买什么彩票?\n";
							cout<<"1.1-->100 20%概率中\n";
							cout<<"2.100-->10000 10%\n";
							cout<<"3.10000-->500000 5%\n";
							cout<<"4.500000-->10000000 4%\n";
							cout<<"5.1000 --> 1000000 1%\n";
							cin>>m;
							if (things[7]<a[m]){
							  cout<<"钱不够!";break;}
							if (rand()%100+1<=c[m])
							  {
							  	cout<<"中奖了!简直是好运附体!";
							  	happened+=(name+"买彩票中奖了!/");
							  	things[7]+=b[m];
							  	gotmoney+=b[m];
							  }
							else
							  {
							    cout<<"毛都没抽到!";
							    happened+=(name+"早上没洗脸,买彩票遭血亏/");
							  }
							break;
						}
					case '3':
						{
							cls();
							cout<<"赌多少钱?\n";
							cin>>m;
							if (things[7]>=m)
							  things[7]-=m;
							else
							  {
							  	cout<<"钱不够";
							  	break;
							  }
							int a[21];
							cls();
							for(i=1;i<=20;i++)
							  a[i]=random(1,10000);
							for(i=1;i<=20;i++)
							  {
							  	gotoxy(0,0);
							  	cout<<a[i]<<' ';
							  	gotoxy(1,0);
							  	cout<<"1.选择 2.下一个";
							  	char l=_getch();
							  	switch(l)
							  	  {
							  	  	case '1':k=a[i];i=5555;
							  	  	case '2':break;
								  }
							  }
							j=0;
							for(i=1;i<=20;i++)
							  j+=(a[i]>k);
							cls();
							cout<<"得分:"<<20-j;
							switch(j)
							  {
							  	case 0:k=400;break;
							  	case 1:k=330;break;
							  	case 2:k=260;break;
							  	case 3:k=185;break;
							  	case 4:k=115;break;
							  	case 5:k=84;break;
							  	default:k=0;break;
							  }
							m*=(k/100.0);
							cout<<"\n赚了"<<m<<"元\n";
							cout<<"序列为:";
							for(i=1;i<=20;i++)
							  cout<<a[i]<<' ';
							things[7]+=m;
							gotmoney+=m;
							gs();
							break;
						}
					case '4':return;
					case '5':
						{
							char o[3]={'O','X','K'};//3,3 3,6 3,9
							int line[4]={0,3,6,9};
							cls();
							int i,j,k,last;
							cout<<"赌多少钱?";
							cin>>j;
							if (j>things[7])
							  {
							  	Sout("老虎机:钱,不够,出去!");
							  	break;
							  }
							else
							  things[7]-=j;
							coutwhat(1,1,1,12,"#");
							coutwhat(1,1,6,1,"#");
							coutwhat(1,12,6,12,"#");
							coutwhat(6,1,6,12,"#");
							coutwhat(2,5,5,5,"#");
							coutwhat(2,8,5,8,"#");
							bool win=true;
							for(i=1;i<=3;i++)
							  {
							  	for(int nbi=1;nbi<=random(40,50);nbi++)
							  	  {
							  		gotoxy(3,line[i]);
							  		k=rand()%3;
							  		cout<<o[k];
							  		if (i==1)
							  		  last=k;
							  		Sleep(50); 
							  	  }
							  	if (last!=k)
							  	  win=false;
							  }
							if (win)
							  {
							  	gotoxy(12,0);
							  	Sout("手气不错,你赢了!");
							  	j*=5;
							  	things[7]+=j,gotmoney+=j;
							  }
							else
							  {
							  	gotoxy(5,0);
							  	Sout("血本无归。");
							  }
							gs();
							break;
						}
		  }
		  gs();
	   } 
}

(注:其实我就是原作者来的哟~)

评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值