目录
既然是胎神游戏集,那当然要先感谢我们的胎神大大了
胎神洛谷名:TSzza
好了,言归正传,知道你们不喜欢啰嗦,直接上代码
一、变色小跳龙
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
void SetPos(int x,int y)
{
COORD pos;pos.X=y*2,pos.Y=x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void Color(int a)
{
if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
}
int Se,Tx,X=7,K,T,SS,xt,H=3,Wu,Mk;
int m[10001];
void Sheng()
{
int R=rand()%10,RR=rand()%100;
if(R==0) SS=rand()%3-1;K++;
if(RR==0)
{
int rr=rand()%4+2;
for(int i=1;i<=rr;i++) m[K+i+20]=2;
}
else if(m[K+20]==0) m[K+20]=SS;
}
void Map(int a)
{
Color(0);
if(a==1)
{
for(int i=0;i<=7;i++) SetPos(i,1),cout<<' ';
SetPos(X,1);Color(Se+1);if(Wu!=0&&T%3==0) Color(4);
if(X==7&&m[K+1]==2&&Wu<=0) SetPos(8,1);cout<<"●";
}
if(a==2)
{
SetPos(8,0);
for(int i=K;i<=K+20;i++) {if(m[i]!=2) Color(m[i]+1),cout<<"■";else cout<<" ";if(T==1) Sleep(30);}
}
if(a==3)
{
Color(3);if(Wu!=0&&T%3==0) Color(4);
SetPos(3,15);for(int i=0;i<H;i++) cout<<"■";Color(0);
SetPos(1,15),cout<<T/5;if(T/5>=Mk) Mk=T/5;SetPos(2,17),cout<<Mk;
}
Color(0);
}
void Start()
{
Color(0);
SetPos(2,5);cout<<"变 色 小 跳 龙";
SetPos(3,14);cout<<"(1.5)";
SetPos(5,9);cout<<"作者:胎神大大!";
SetPos(7,6);cout<<"按 y 开始游戏!";
A:char y=_getch();if(y!='y') goto A;
else
{
system("cls");
SetPos(1,2);cout<<"变色小跳龙游戏规则:";
SetPos(3,1);cout<<"↑跳跃 不能踩在与自己",Color(1),cout<<"颜色不同",Color(0),cout<<"的块上";
SetPos(4,1);cout<<" 开局与减血后会",Color(4),cout<<"无敌",Color(0),cout<<"一段时间";
SetPos(5,1);cout<<"↓变色 无敌时会",Color(3),cout<<"自动变色",Color(0),cout<<"!";
SetPos(7,2);cout<<"移动速度会越来越快,努力取得高分吧!";
SetPos(8,2);Color(2),cout<<"按任意键开始游戏!";y=_getch();
}
}
int main()
{
system("mode con cols=42 lines=10");
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
srand((unsigned)time(NULL));
Start(); system("cls");
Re: Se=T=SS=xt=0;Tx=4;X=7;H=3;K=-5;
memset(m,0,sizeof(m));
for(int i=0;i<=15;i++) m[i]=-1;
for(int i=1;i<=5;i++) Sheng();
KK: Wu=100;system("cls");
SetPos(1,12),Color(0),cout<<"Score: ";
SetPos(2,12),Color(0),cout<<"MaxScore: ";
SetPos(3,12),Color(0),cout<<"Life: ";
while(!(m[K+1]!=Se&&m[K+1]!=-1&&X==7&&Wu==0))
{
T++; if(X==7) xt=0;
if(Wu>0) {Wu--;if(m[K+1]==0||m[K+1]==1) Se=m[K+1];}
if(K==90||K==480||K==970||K==1460||K==2100) SetPos(5,10),Color(3),cout<<"Warning!! LEVEL UP!";
if(K==110||K==520||K==1030||K==1540||K==2250) SetPos(5,10),cout<<" ";
if(kbhit())
{
char g=_getch();
if(g==72&&xt<2) {if(X==7) X--;Tx=4,xt++;}
if(g==80&&Wu<=0) Se=(Se+1)%2,Map(2);
}
if(T%4==0) {if(Tx>0) {Tx--;if(X>=2) X--;}else if(X<7) X++;Map(1);}
if(K<=100&&T%7==0) Sheng(),Map(2);
if(K<500&&K>=100&&T%5==0) Sheng(),Map(2);
if(K<1000&&K>=500&&T%4==0) Sheng(),Map(2);
if(K<1500&&K>=1000&&T%3==0) Sheng(),Map(2);
if(K<2200&&K>=1500&&T%2==0) Sheng(),Map(2);
if(K>=2200) Sheng(),Map(2);
Map(3);Sleep(10);
}system("color 4F");
if(H>0) {H--,Sleep(10),Se=(Se+1)%2,system("color 0F");goto KK;}
SetPos(5,10),Sleep(1000),Color(0),system("pause");SetPos(5,10),cout<<" ";
system("color 0F"); goto Re;
return 0;
}
二、超级按钮
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
int mouse,S,An,k,t,Rr,T;
POINT Windowpos()
{
POINT pt;
GetCursorPos(&pt);
HWND h=GetForegroundWindow();
ScreenToClient(h,&pt);
pt.x/=8;pt.y/=16;
return pt;
}
void SlowDisplay(int x,char *p)
{
while(1)
{
if(*p!=0) printf("%c",*p++);
else break;Sleep(x);
}
}
void Color(int a)
{
if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
}
void Luan()
{
if(Rr==0) printf("┃过天按钮┃");
if(Rr==1) printf("┃过关按扭┃");
if(Rr==2) printf("┃过关按纽┃");
if(Rr==3) printf("┃过关按忸┃");
if(Rr==4) printf("┃过关桉钮┃");
if(Rr==5) printf("┃过关侒钮┃");
if(Rr==6) printf("┃过关按杻┃");
if(Rr==7) printf("┃过关按炄┃");
if(Rr==8) printf("┃过关铵钮┃");
if(Rr==9) printf("┃过关胺钮┃");
}
void Die()
{
system("color 4F");
Sleep(2000);system("color 0F");
system("cls"); Color(0);
SlowDisplay(50,"\nWarning!\nSYSTEM ERROR!!\nThe system is about to collapse!!!");
Sleep(1000);system("shutdown /s");
}
void SetPos(int x,int y)
{
COORD pos; pos.X=y,pos.Y=x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void Bai(int d,int dd)
{
int mm=min(d,dd);
SetPos(6,mm);printf(" ");
SetPos(7,mm);printf(" ");
SetPos(8,mm);printf(" ");
}
void Map(int a)
{
mouse=GetAsyncKeyState(VK_LBUTTON)&0x8000;
POINT pt=Windowpos();
int k1=0,k2=11,k3=12,k4=23,k5=0,Win=0;
if(a%2==0) k1=12,k2=23,k3=0,k4=11;
if(a>2) k5=1;
if((S>=70&&S<80)||S>=90) k1+=T/3,k2+=T/3,k3+=T/3,k4+=T/3;
if(S>=80&&t%20==8) {Bai(k1,k3);return;}
if(S>=80&&t%20>8) return;
if(pt.x>=k1&&pt.x<=k2&&pt.y>=6&&pt.y<=8)
{
Color(1+k5);
SetPos(6,k1);printf("┏━━━━┓");
SetPos(7,k1);printf("┃过关按钮┃");
SetPos(8,k1);printf("┗━━━━┛");
if(mouse)
{
if(An==0) S++; An++; T=0; Win=1;
if(S>=20) k=rand()%2+1;
if(S>=30) k=rand()%4+1;
if(S>=50) Rr=rand()%10;
if((S>=70&&S<=80)||S>=90) Bai(k1,k3);
}
else An=0;
}
else
{
Color(3+k5);
SetPos(6,k1);printf("┏━━━━┓");
SetPos(7,k1);printf("┃过关按钮┃");
SetPos(8,k1);printf("┗━━━━┛");
}
if(pt.x>=k3&&pt.x<=k4&&pt.y>=6&&pt.y<=8&&Win==0)
{
Color(2-k5);
if(S>=40&&T>=10) mouse=1;
SetPos(6,k3);printf("┏━━━━┓");
SetPos(7,k3);if(S<50) printf("┃关机按钮┃");else Luan();
SetPos(8,k3);printf("┗━━━━┛");
if(mouse) {if(An==0) Die();An=0;}
}
else if(Win==0)
{
Color(4-k5);
SetPos(6,k3);printf("┏━━━━┓");
SetPos(7,k3);if(S<50) printf("┃关机按钮┃");else Luan();
SetPos(8,k3);printf("┗━━━━┛");
}
}
int main()
{
srand(unsigned(time(NULL)));
ios::sync_with_stdio(false);
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
Color(0);k=1;
SlowDisplay(200,"欢迎来到超级按钮!你的目标是按下按钮100次!\n\n");
SetPos(2,0),printf("已开启普通模式。");
while(S<100)
{
t++;T++;Color(0);
SetPos(4,0);Color(0);printf("还需按%d次。\n\n",100-S);
if(S==20&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启按钮混乱模式。");
if(S==30&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启按钮混乱2.0模式。");
if(S==40&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启接触引爆模式。");
if(S==50&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启按钮混乱3.0模式。");
if(S==60&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启定时引爆模式。");
if(S==70&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启移动按钮模式。");
if(S==80&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启隐形按钮模式。");
if(S==90&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启隐形移动按钮模式。");
if(S>=60)SetPos(2,20),printf("%d ",100-T);
if(S>=60&&T>=100) {Die();break;}
POINT pt; GetCursorPos(&pt);
int k1=0,k2=11,k3=12,k4=23;
if(k==2) k1=12,k2=23,k3=0,k4=11;
Sleep(50); Map(k);
}
if(S>=100)
{
system("cls");Color(0);
SlowDisplay(200,"\n让你通关吧!");
}
}
三、超级迷宫
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
void Color(int a)
{
if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_RED);
}
void Setpos(int x,int y){COORD pos;pos.X=y*2,pos.Y=x;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}
int R[5];
void SlowDisplay(int x,char *p){while(1){if(*p!=0) printf("%c",*p++);else break;Sleep(x);}}
struct xg{int xgx,xgy;bool fx,sw=0; }xg[21];
int ys=0,hd=0,sj=0,sl=0,mg=0,hp=0,hss=0,hsx=0,jt=0,s=0;
char ch[35][35];
char ch1[35][35]={"", " ##### ##### ########"," #&## ### ### "," #### # ## #### #### "," ### ## # ####! ## "," ###& ### +## ###### ####"," ######&############! ##"," # *# ! ######### ###-##"," # ### ##### # "," # ###*# ############### ### "," # ###&### ####"," # # # ##-############## "," ###### #####! "," #+ # ###### ############ ", " ##&########## ### ### ### ## "," # ! ! #"," ############################"," # ! # ! # #"," # ! # ! #### "," #&########################### "," ) ",};
char ch2[35][35]={""," ##############################"," #* #"," ########&###################-#"," # # #"," # # ################&#####-# #"," # # # ! +# # #"," # # # ##&############### # # #"," # # # # # # # #"," # # # # ###########&## # # # #"," # # # # #)- ! # # # & #"," # # # # ### ! # # # # #", " # # # ##########&####### # # #"," # # # ! # #"," # # ##################&##### #"," # # ! *# #"," # #####&####### ############ #"," # ! # # ! #"," # ############# ########### #"," # ! #"," ##############################", };
char ch3[31][33]={""," ##############################"," #. + .#"," # ! #"," # + ! #"," # #"," # ! + #"," # ! + ! #"," # + #"," # + ! #", " # + ! #"," # ! + #"," #+ _____ #"," # |_ _ _| + #"," # + |_|||_| #"," # + |MMMMM| !#"," # |WWWWW| #"," #! |_____| #"," # ! #"," #. + .#"," ##############################", };
char ch4[35][35]={""," ###*### ########"," ###! # ##### # *#"," ###&#+####### # # # # ######"," # !# # #-# # # # #"," ###&####### # # # # ## #"," ####### ##### # ## #"," ####&### ! ! !# ## #"," # ################ ## #"," ### !! ## "," #### ##&##################### "," # ! !# "," #-############&######### #&## "," #-#ooooooooooo o # #*## "," o ooo o o o o ooo # #### "," o o o o oo o o # "," ooo o ooooooo oo ooo o #######"," ooo o o o oo o #"," ooo o o o*oooooooooooooooo-#"," ooooooo o oo o o o o #"," ) o o o o o #",};
char ch5[35][35]={""," oooo oooooooooooooooooooo"," ooo o oo+oo o o"," ooooooo*oooo ! o ! o o o"," o o o o o o o"," oooooooooo ooooooooooooooooo o"," o ! ! o"," oooooooo ooooooooooooooooooooo"," oooooooo ooooooooooooooooooooo", " o ! o"," o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o"," o ! ! ! ! ! o"," o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o"," o^*^! !^! !^! ^^! +^! !^! *^o"," o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o"," o ! ! ! ! ! o"," #^^^^^^^^^^^^^^^^^^^^^^^^^^^^#"," # ! #"," ####oooooooooo--oooooooooooo##"," ########oooooo--ooooooo#######"," ###########ooo))oooo##########", };
char ch6[35][35]={""," oooooooooooooo .oooooooooooooo"," o+oooooooooooo oooooooooooo+o"," ooooooooooooo# #ooooooooooooo"," oooooooooooo#^^^^#oooooooooooo"," oooo*oooooo#^ ^#oooooo*oooo"," oooooooooo# ^ ^ #oooooooooo"," ooooooooo# ^ ^ #ooooooooo"," oooooooo#^^^^^^^^^^^^#oooooooo"," ooooooo#^ ^#--#^ ^#ooooooo"," . ^ ^-NO-^ ^ "," ^ ^-IP-^ ^ ."," ooooooo#^ ^#--#^ ^#ooooooo"," oooooooo#^^^^^^^^^^^^#oooooooo"," ooooooooo# ^ ^ #ooooooooo"," oooooooooo# ^ ^ #oooooooooo"," oooo*oooooo#^ ^#oooooo*oooo"," oooooooooooo#^^^^#oooooooooooo"," ooooooooooooo# #ooooooooooooo"," o+oooooooooooo oooooooooooo+o"," oooooooooooooo. oooooooooooooo",};
void map1(int x,int y,int k){
for(int i=1;i<=20;++i)
for(int j=1;j<=30;++j){
bool f=1;
for (int l=1;l<=k;++l)
if (xg[l].xgx==i&&xg[l].xgy==j&&xg[l].sw==0) {Setpos(i,j);Color(4),cout<<"▼";f=0;break;}
if (f==1)
{Setpos(i,j);
if (i==x&&j==y) Color(1),cout<<"●";
else if (ch[i][j]=='#'||ch[i][j]=='&') Color(7),cout<<"■";
else if (ch[i][j]==')') Color(5),cout<<"☆";
else if (ch[i][j]=='*') Color(5),cout<<"♂";
else if (ch[i][j]=='-') Color(3),cout<<"▋";
else if (ch[i][j]=='+') Color(2),cout<<"◆";
else if (ch[i][j]=='.') Color(1),cout<<"◆";
else if (ch[i][j]=='o') Color(8),cout<<"~ ";
else if (ch[i][j]=='_') Color(3),cout<<"▁";
else if (ch[i][j]=='^') Color(3),cout<<"▲";
else if (ch[i][j]=='|') Color(3),cout<<"|";
else if (ch[i][j]=='M') Color(3),cout<<'M'<<'M';
else if (ch[i][j]=='W') Color(3),cout<<'W'<<'W';
else if (ch[i][j]=='N') Color(2),cout<<"NO";
else if (ch[i][j]=='I') Color(2),cout<<"..";
else if (ch[i][j]=='O') Color(2),cout<<"I!";
else if (ch[i][j]=='P') Color(2),cout<<".P";
else Color(0),cout<<" ";
}
}
Setpos(21,3);Color(5),cout<<"["<<ys<<" ♂] ",Color(2),cout<<"["<<hd<<" ◆]";
}
int yx(int a)
{
int k=0,T=0,x,y,boss=0,win=0;ys=0,hd=0,sj=0;
system("cls");
if(a==1) {for(int i=0;i<35;i++)for(int j=0;j<35;j++) ch[i][j]=ch1[i][j];x=1,y=1;}
if(a==2) {for(int i=0;i<35;i++)for(int j=0;j<35;j++) ch[i][j]=ch2[i][j];x=2,y=29;}
if(a==3) {for(int i=0;i<35;i++)for(int j=0;j<35;j++) ch[i][j]=ch3[i][j];x=10,y=15;boss=1;}
if(a==4) {for(int i=0;i<35;i++)for(int j=0;j<35;j++) ch[i][j]=ch4[i][j];x=1,y=1;}
if(a==5) {for(int i=0;i<35;i++)for(int j=0;j<35;j++) ch[i][j]=ch5[i][j];x=1,y=1;}
if(a==6) {for(int i=0;i<35;i++)for(int j=0;j<35;j++) ch[i][j]=ch6[i][j];x=1,y=15;boss=2;}
if(boss==1){for (int i=1;i<=200;++i) {int xx=rand()%21,yy=rand()%31;if ((xx!=x||yy!=y)&&ch[xx][yy]!='_'&&ch[xx][yy]!='W'&&ch[xx][yy]!='|'&&ch[xx][yy]!='M'&&ch[xx][yy]!='.') ch[xx][yy]='o';}map1(x,y,k);}
for(int i=1;i<35;++i)for(int j=1;j<35;++j) if (ch[i][j]=='!')k++,xg[k].xgx=i,xg[k].xgy=j,ch[i][j]=' ';
map1(x,y,k);
while (1)
{
T++;
Setpos(x,y),cout<<" ";
if(GetAsyncKeyState(VK_UP)&0x8000&&x!=1&&ch[x-1][y]!='#') x--;
else if(GetAsyncKeyState(VK_DOWN)&0x8000&&x!=20&&ch[x+1][y]!='#') x++;
else if(GetAsyncKeyState(VK_LEFT)&0x8000&&y!=1&&ch[x][y-1]!='#') y--;
else if(GetAsyncKeyState(VK_RIGHT)&0x8000&&y!=30&&ch[x][y+1]!='#') y++;
Setpos(x,y),Color(1),cout<<"●";
if(boss!=0&&T%20==5){
for (int i=1;i<=20;++i)for (int j=1;j<=30;++j)if (ch[i][j]=='o') ch[i][j]=' ';
for (int i=1;i<=200*boss;++i) {int xx=rand()%21,yy=rand()%31;if ((xx!=x||yy!=y)&&ch[xx][yy]==' ') ch[xx][yy]='o';}
map1(x,y,k);}
if(T%20==0) map1(x,y,k);if(T%20==10){for(int i=1;i<35;++i)for(int j=1;j<35;++j) if(ch[i][j]=='^')Setpos(i,j),cout<<" ";}
if(T%4==0&&k!=0)
for (int i=1;i<=k;i++){
if (xg[i].fx==0&&(ch[xg[i].xgx][xg[i].xgy+1]==' '||(ch[xg[i].xgx][xg[i].xgy-1]=='^'&&T%20>=10))&&xg[i].xgy!=30) Setpos(xg[i].xgx,xg[i].xgy),cout<<" ",xg[i].xgy++,Setpos(xg[i].xgx,xg[i].xgy),Color(4),cout<<"▼";
else if (xg[i].fx==1&&(ch[xg[i].xgx][xg[i].xgy-1]==' '||(ch[xg[i].xgx][xg[i].xgy-1]=='^'&&T%20>=10))&&xg[i].xgy!=1) Setpos(xg[i].xgx,xg[i].xgy),cout<<" ",xg[i].xgy--,Setpos(xg[i].xgx,xg[i].xgy),Color(4),cout<<"▼";
else if (xg[i].fx==1) xg[i].fx=0;else xg[i].fx=1;}
for (int i=1;i<=k;i++){
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"怪物啊!!!";Sleep(2000);system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0) {system("cls");cout<<"护盾保护了你!";Sleep(1000);system("cls");map1(x,y,k);hd--;xg[i].sw=1;}}
if (ch[x][y]==')') {system("cls");cout<<"You Win!";Sleep(2000);system("cls");win=1;}
if (ch[x][y]=='*') {system("cls");cout<<"你找到了钥匙!";ys++;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}
if (ch[x][y]=='.') {system("cls");cout<<"你破坏了水晶!";sj++;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}
if (ch[x][y]=='-'&&ys>0) {system("cls");cout<<"门开了!";ys--;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}else if (ch[x][y]=='-') {system("cls");cout<<"你没有钥匙!";--x;Sleep(3000);system("cls");map1(x,y,k);}
if (ch[x][y]=='+') {system("cls");cout<<"你找到了护盾!";hd++;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}
if (ch[x][y]=='o'&&hd==0) {system("cls");cout<<"烫死啦!!!";Sleep(2000);return 0;}
else if (hd>0&&ch[x][y]=='o') {system("cls");cout<<"护盾保护了你!";ch[x][y]=' ';hd--;Sleep(1000);system("cls");map1(x,y,k);}
if (ch[x][y]=='^'&&T%20<10&&hd==0) {system("cls");cout<<"被刺穿啦!!!";Sleep(2000);return 0;}
else if (hd>0&&ch[x][y]=='^'&&T%20<10) {system("cls");cout<<"护盾保护了你!";ch[x][y]=' ';hd--;Sleep(1000);system("cls");map1(x,y,k);}
if ((a==3||a==6)&&sj==4) {system("cls");cout<<"You Win!";Sleep(2000);system("cls");win=1;}
for (int i=1;i<=k;i++)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"怪物啊!!!";Sleep(1000);system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0) {system("cls");cout<<"护盾保护了你!";Sleep(1000);system("cls");map1(x,y,k);map1(x,y,k);hd--;xg[i].sw=1;}
if(win==1){if(a==1)sl=1;if(a==2)mg=1;if(a==3)hp=1;if(a==4)hss=1;if(a==5)hsx=1;return 0;}
Sleep(100);
}}
bool dd()
{
system("cls");cout<<"9%......";Sleep(200);system("cls");cout<<"26%......";Sleep(200);system("cls");cout<<"33%......";Sleep(200);system("cls");cout<<"47%......";Sleep(200);system("cls");cout<<"68%......";Sleep(200);system("cls");cout<<"82%......";Sleep(200);system("cls");cout<<"94%......";Sleep(200);system("cls");cout<<"100%......"<<endl;
int r=rand()%5;R[r]++;
if(R[0]==1){R[0]=2;Sleep(1000),cout<<"你TM以为我会让你进去吗哈哈哈!",Sleep(1000);int k=100;while(k!=0) k--,Setpos(0,0),cout<<k<<"%...... ",Sleep(20);return 0;}
if(R[1]==1){R[1]=2;Sleep(1000),cout<<"你TM以为这就结束了吗哈哈哈!等到10000吧!",Sleep(1000);int k=100;while(k<=200)k++,Setpos(0,0),cout<<k<<"%...... ",Sleep(10);while(k<=1050) k+=9,Setpos(0,0),cout<<k<<"%...... ",Sleep(10);while(k<=4900) k+=123,Setpos(0,0),cout<<k<<"%...... ",Sleep(10);while(k<=9920) k+=467,Setpos(0,0),cout<<k<<"%...... ",Sleep(10);while(k<=9999) k++,Setpos(0,0),cout<<k<<"%...... ",Sleep(10);}
if(R[2]==1){R[2]=2;int k=99,i=1;Sleep(1000),Setpos(0,0),cout<<"99%...... ",Sleep(1000);while(i<=8){i++;if(i%2==1)k++;if(i%2==0)k--;Setpos(0,0),cout<<k<<"%...... ",Sleep(1000);if(i==3) Setpos(1,0),cout<<"啊咧咧咧......";}cout<<"100%......"<<endl;}
if(R[3]==1){R[3]=2;Sleep(1000);SlowDisplay(50,"\nWarning!\nSYSTEM ERROR...\nThe system is about to collapse......"),Sleep(500);int k=0;while(k!=2000){k++;int R=rand()%5+1;int p;for(int j=1;j<=R;j++) p=rand()%10+'0',printf("%c",p);cout<<"%......\n";}cout<<"100%......"<<endl;}
if(R[4]==1){R[4]=2;Setpos(0,0),cout<<"99%...... ";Sleep(1000),cout<<"long double !",Sleep(1000);double k,i=1.1;while(i<=12){i+=0.1,k=100.0-1.0/(double)i,Setpos(0,0),printf("%0.7f",k),cout<<"%...... ",Sleep(1);}cout<<"100%......"<<endl;}
system("cls");
return 1;
}
void ml(){while(1){
system("cls");Color(0);
cout<<"1、迷雾森林 ";cout<<endl;
if (sl==0) cout<<"2、 ? ? ? ? ";else cout<<"2、巨石迷宫(图中如果走可穿透墙,能避开所有的怪) "; cout<<endl;
if (mg==0) cout<<"3、 ? ? ? ? ";else cout<<"3、熔岩喷泉(BOSS,图中随机出现熔岩) ";cout<<endl;
if (hp==0) cout<<"4、 ? ? ? ? ";else cout<<"4、火山口(上) ";cout<<endl;
if (hss==0) cout<<"5、 ? ? ? ? ";else cout<<"5、火山口(下) ";cout<<endl;
if (hsx==0) cout<<"6、 ? ? ? ? ";else cout<<"6、火山祭坛(BOSS)";cout<<endl;
cout<<"选择关卡(序号)"<<endl;cout<<"退出输入0"<<endl;
int a;cin>>a;
if (a==1&&dd()) {yx(1);}if (a==2&&sl==1&&dd()){yx(2);}if (a==3&&mg==1&&dd()) {yx(3);}if (a==4&&hp==1&&dd()) {yx(4);}if (a==5&&hss==1&&dd()){yx(5);}if (a==6&&hsx==1&&dd()){yx(6);}if (a==0) return;
}}
void gz() {
system("cls");
cout<<"由上下左右键控制"<<endl;
cout<<"●是你"<<endl;
cout<<"■是墙"<<endl;
cout<<"☆是终点"<<endl;
cout<<"▼是小怪(只会左右移动)"<<endl;
cout<<"▋是门"<<endl;
cout<<"♂是钥匙"<<endl;
cout<<"◆是护盾(不可杀怪)"<<endl;
cout<<"■是可穿透墙(每一关几乎都有)"<<endl;
cout<<"◆是水晶(BOSS关破坏所有水晶通关)"<<endl;
cout<<"~ 是熔岩"<<endl;
cout<<"▁是尖刺(未升起)"<<endl;
cout<<"▲是尖刺(升起)"<<endl;
cout<<"输入1开始!"<<endl;
int a;
cin>>a;
if (a==1) ml();
else gz();
}
int main(){
CONSOLE_CURSOR_INFO cursor_info={1,0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);srand((unsigned)time(NULL));
cout<<"欢迎来到超级迷宫!"<<endl;cout<<"作者:LZY"<<endl;cout<<"修改:TSzza"<<endl;cout<<"1、开始!"<<endl;cout<<"2、规则..."<<endl;
int a;cin>>a;if (a==1){system("cls");ml();}else if (a==2){gz();}
return 0;
}
四 、城市守卫战
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<time.h>
using namespace std;
int t,nl,dl,Money,Moo,Dao,Yi,Shan,Qing,Hu;
int Biao,Biaob,Bao=1,Baob,Baod=1,Baodb,Hub,Fengb,Sha,Jian,Shab,Jianb;
int X[10];
bool Daob,Yib,Shanb,Qingb,Hubb;
struct node {int Zhong,Xue,Bing,Hui,Du;} N[100001],D[100001];
void Yan(int a)
{
if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
if(a>=6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
}
void Bai() {SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);}
void Cout(int x,int a)
{
Yan(a);int k;
if(x==1) {if(a==0) cout<<"城墙";if(a==1) cout<<"加农炮";if(a==2) cout<<"重机枪";if(a==3) cout<<"迫击炮";if(a==4) cout<<"喷火器";if(a==5) cout<<"火箭炮";if(a>=6) cout<<"电磁炮";}
if(x==2)
{
if(a==1) cout<<"步兵",Money+=20,k=20;if(a==2) cout<<"骑兵",Money+=30,k=30;if(a==3) cout<<"炮兵",Money+=30,k=30;if(a==4) cout<<"药兵",Money+=30,k=30;if(a==6||a==7) cout<<"炮灰",Money+=10,k=10;if(a==5) cout<<"坦克",Money+=50,k=50;
if(a==8) Yan(3),cout<<"金刚机甲",Money+=100;if(a==9) Yan(1),cout<<"寒冰机甲",Money+=100;if(a==10) Yan(2),cout<<"木毒机甲",Money+=100;if(a==11) Yan(3),cout<<"飓风机甲",Money+=100;if(a==12) Yan(4),cout<<"烈焰机甲",Money+=100;if(a>=8) k=100;
}
Yan(4);Sleep(200),cout<<"......爆!!!";
if(x==2) Yan(5),cout<<"掉落"<<k<<"金币!";cout<<endl<<endl,Sha++;
if(Sha%20==0&&Shab<Sha) Yan(5),cout<<"成就:杀死"<<Sha<<"个敌人,完成!加30金币!"<<endl<<endl,Sleep(500),Bai(),Money+=30,Shab=Sha;
if(Money>=300) Money=300,Yan(3),cout<<"金币储量已达上限!"<<endl<<endl,Bai(),Sleep(500);
Bai();
}
void War()
{
int zn=0,zd=0;if(nl-5>0) zn=nl%5;if(dl-5>0) zd=dl%5;cout<<"┌";
for(int i=0;i<=40;i++) cout<<'-';cout<<"┐"<<endl<<"┆";
for(int i=5;i>0;i--) if(i>=nl+1) cout<<" ";
for(int i=5;i>0;i--)
{
if(i>=nl+1) continue;
Yan(1);if(i<=0) break;
if(N[i].Bing>0) Yan(6);
if(N[i].Du>0) Yan(2);
if(N[i].Hui>0) Yan(3);
cout<<setw(4)<<N[i].Xue; Bai();
}
for(int i=1;i<=5;i++)
{
Yan(4);
if(i>dl) {cout<<" ";continue;}
if(Baodb!=0) Yan(2);
if(D[i].Zhong>=8) Yan(3);
cout<<setw(4)<<D[i].Xue; Bai();
}Bai();
cout<<" ┆"<<endl<<"┆";
for(int i=5;i>0;i--) if(i>=nl+1) cout<<" ";
for(int i=5;i>0;i--)
{
if(i>=nl+1) continue;
Yan(N[i].Zhong);if(N[i].Bing>0) Yan(6);
if(N[i].Zhong==0) cout<<" ▎";if(N[i].Zhong==1) cout<<" ●";if(N[i].Zhong==2) cout<<" ■";if(N[i].Zhong==3) cout<<" ▲";if(N[i].Zhong==4) cout<<" ▼";if(N[i].Zhong==5) cout<<" ★";if(N[i].Zhong>=6) cout<<" ◆";
Bai();
}
for(int i=1;i<=5;i++)
{
if(i>dl) {cout<<" ";continue;}
Yan(D[i].Zhong);if(D[i].Bing>0) Yan(4);
if(D[i].Zhong==1) cout<<" ○";if(D[i].Zhong==2) cout<<" □";if(D[i].Zhong==3) cout<<" △";if(D[i].Zhong==4) cout<<" ▽";if(D[i].Zhong==5) cout<<" ☆";if(D[i].Zhong>=6&&D[i].Zhong<=7) cout<<" ◇";if(D[i].Zhong==8) Yan(5),cout<<" 金";if(D[i].Zhong==9) Yan(1),cout<<" 冰";if(D[i].Zhong==10) Yan(2),cout<<" 毒";if(D[i].Zhong==11) Yan(3),cout<<" 风";if(D[i].Zhong==12) Yan(4),cout<<" 火";
Bai();
}
if(zn>0||zd>0)
{
cout<<" ┆"<<endl<<"┆";
for(int i=5-zn;i>0;i--) cout<<" ";
for(int i=5+zn;i>5;i--)
{
Yan(1);if(i<=0) break;
if(N[i].Bing>0) Yan(6);
if(N[i].Du>0) Yan(2);
if(N[i].Hui>0) Yan(3);
cout<<setw(4)<<N[i].Xue; Bai();
}
for(int i=6;i<=10;i++)
{
Yan(4);
if(i>dl) {cout<<" ";continue;}
if(Baodb!=0) Yan(2);
if(D[i].Zhong>=8) Yan(3);
cout<<setw(4)<<D[i].Xue; Bai();
}Bai();
cout<<" ┆"<<endl<<"┆";
for(int i=5-zn;i>0;i--) {cout<<" ";continue;}
for(int i=5+zn;i>5;i--)
{
Yan(N[i].Zhong);if(N[i].Bing>0) Yan(6);
if(N[i].Zhong==0) cout<<" ▎";if(N[i].Zhong==1) cout<<" ●";if(N[i].Zhong==2) cout<<" ■";if(N[i].Zhong==3) cout<<" ▲";if(N[i].Zhong==4) cout<<" ▼";if(N[i].Zhong==5) cout<<" ★";if(N[i].Zhong>=6) cout<<" ◆";
Bai();
}
for(int i=6;i<=10;i++)
{
if(i>dl) {cout<<" ";continue;}
Yan(D[i].Zhong);if(D[i].Bing>0) Yan(4);
if(D[i].Zhong==1) cout<<" ○";if(D[i].Zhong==2) cout<<" □";if(D[i].Zhong==3) cout<<" △";if(D[i].Zhong==4) cout<<" ▽";if(D[i].Zhong==5) cout<<" ☆";if(D[i].Zhong>=6&&D[i].Zhong<=7) cout<<" ◇";if(D[i].Zhong==8) Yan(5),cout<<" 金";if(D[i].Zhong==9) Yan(1),cout<<" 冰";if(D[i].Zhong==10) Yan(2),cout<<" 毒";if(D[i].Zhong==11) Yan(3),cout<<" 风";if(D[i].Zhong==12) Yan(4),cout<<" 火";
Bai();
}
}
cout<<" ┆"<<endl<<"└";
for(int i=0;i<=40;i++) cout<<'-';cout<<"┘"<<endl;
Sleep(500);
}
void Ju(int a)
{
Sleep(1000);system("cls");Bai();
if(a==0)
{
cout<<"┌---------------------┐"<<endl;
cout<<"┆新道具解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆导弹: ┆"<<endl;
cout<<"┆攻击力:300 ┆"<<endl;
cout<<"┆目标:指定目标 ┆"<<endl;
cout<<"└---------------------┘"<<endl;
}
if(a==1)
{
cout<<"┌---------------------┐"<<endl;
cout<<"┆新道具解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆医疗包: ┆"<<endl;
cout<<"┆目标:指定目标 ┆"<<endl;
cout<<"┆攻击力:-30*5(回血)┆"<<endl;
cout<<"┆持续时间:5回合 ┆"<<endl;
cout<<"└---------------------┘"<<endl;
}
if(a==2)
{
cout<<"┌---------------------┐"<<endl;
cout<<"┆新道具解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆闪光弹: ┆"<<endl;
cout<<"┆目标:指定目标 ┆"<<endl;
cout<<"┆效果:使一个指定敌人 ┆"<<endl;
cout<<"┆ 停止攻击,并使所 ┆"<<endl;
cout<<"┆ 有炮塔攻击该敌人.┆"<<endl;
cout<<"┆持续时间:5回合 ┆"<<endl;
cout<<"└---------------------┘"<<endl;
}
if(a==3)
{
cout<<"┌---------------------┐"<<endl;
cout<<"┆新道具解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆狂暴血清: ┆"<<endl;
cout<<"┆目标:所有炮塔 ┆"<<endl;
cout<<"┆效果:使炮塔攻击2次 ┆"<<endl;
cout<<"┆持续时间:2回合 ┆"<<endl;
cout<<"└---------------------┘"<<endl;
}
if(a==4)
{
cout<<"┌---------------------┐"<<endl;
cout<<"┆新道具解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆无敌护罩: ┆"<<endl;
cout<<"┆效果:使所有炮塔无敌 ┆"<<endl;
cout<<"┆持续时间:3回合 ┆"<<endl;
cout<<"└---------------------┘"<<endl;
}
Sleep(1000);system("pause");system("cls");
}
void Die(int m)
{
if(D[m].Xue<=0)
{
if(Biao==m) Biao=0;
if(D[m].Zhong>=8) Moo=0;
Cout(2,D[m].Zhong);
for(int i=m;i<dl;i++)
{
if(Biao==i) Biao--;
D[i].Xue=D[i+1].Xue;
D[i].Zhong=D[i+1].Zhong;
D[i].Bing=D[i+1].Bing;
}
D[dl].Xue=0,D[dl].Zhong=0,D[dl].Bing=0;dl--;
int a=rand()%10;
if(a==0&&t<1000)
{
Yan(4);
cout<<"从敌人尸体中发现道具——"; Sleep(500);
int b=rand()%5;
if(b==0) {cout<<"导弹!"<<endl<<endl,Dao++;Sleep(2000);if(Daob==0) Ju(0);Daob=1;}
if(b==1) {cout<<"医疗包!"<<endl<<endl,Yi++;Sleep(2000);if(Yib==0) Ju(1);Yib=1;}
if(b==2) {cout<<"闪光弹!"<<endl<<endl,Shan++;Sleep(2000);if(Shanb==0) Ju(2);Shanb=1;}
if(b==3) {cout<<"狂暴血清!"<<endl<<endl,Qing++;Sleep(2000);if(Qingb==0) Ju(3);Qingb=1;}
if(b==4) {cout<<"无敌护罩!"<<endl<<endl,Hu++;Sleep(2000);if(Hubb==0) Ju(4);Hubb=1;}
Bai();War();
}
}
}
void DieN(int m)
{
if(N[m].Xue<=0)
{
Cout(1,N[m].Zhong);
for(int i=m;i<nl;i++)
{
N[i].Xue=N[i+1].Xue;
N[i].Zhong=N[i+1].Zhong;
N[i].Bing=N[i+1].Bing;
N[i].Hui=N[i+1].Hui;
}
N[nl].Xue=0,N[nl].Zhong=0,N[nl].Bing=0,N[nl].Hui=0;nl--;
}
}
void Zao(int a)
{
if((a==1&&Money<100)||(a==2&&(Money<120||X[2]>=5))||(a==3&&(Money<150||X[3]>=5))||(a==4&&(Money<200||X[4]>=3))||(a==5&&(Money<250||X[0]>0))||(a==6&&(Money<270||X[6]+X[7]+X[8]>=2))||(a==7&&(Money<300||X[5]>=3)))
{Yan(3),cout<<endl<<"无效输入。",Bai( );Sleep(500);return;}nl++;
if(a==1) N[nl].Xue=100,N[nl].Zhong=1,Money-=100;
if(a==2) N[nl].Xue=80,N[nl].Zhong=2,Money-=120;
if(a==3) N[nl].Xue=150,N[nl].Zhong=3,Money-=150;
if(a==4) N[nl].Xue=200,N[nl].Zhong=4,Money-=200;
if(a==5){N[nl].Xue=N[nl].Zhong=0,Money-=250;for(int i=nl;i>0;i--) swap(N[i],N[i-1]);N[1].Xue=500;}
if(a==6) N[nl].Xue=400,N[nl].Zhong=6,Money-=270;
if(a==7) N[nl].Xue=300,N[nl].Zhong=5,Money-=300;
Yan(5);cout<<endl<<"建造成功!"<<endl<<endl;Sleep(500);cout<<"你的金币数量:"<<Money;Bai();Jian++;
if(Jian%10==0&&Jianb<Jian) Yan(5),cout<<endl<<endl<<"成就:建造"<<Jian<<"个炮塔,完成!加30金币!",Sleep(500),Bai(),Money+=30,Jianb=Jian;
if(Money>=300) Money=300,Yan(3),cout<<"金币储量已达上限!"<<endl<<endl,Bai(),Sleep(500);
}
void ZaoN(int a)
{
dl++;
int bp=t/2.5+rand()%11-5;
if(a==1) D[dl].Xue=50+bp,D[dl].Zhong=1;
if(a==2) D[dl].Xue=100+bp,D[dl].Zhong=2;
if(a==3) D[dl].Xue=30+bp,D[dl].Zhong=3;
if(a==4) D[dl].Xue=100+bp,D[dl].Zhong=4;
if(a==5) D[dl].Xue=200+bp,D[dl].Zhong=5;
if(a==6) D[dl].Xue=10+bp,D[dl].Zhong=6;
if(a>=8) D[dl].Xue=1000+bp*10,D[dl].Zhong=a;
}
void Yong(int a)
{
int b;
if(a==0) return;
if((a==1&&Dao==0)||(a==2&&Yi==0)||(a==3&&Shan==0)||(a==4&&Qing==0)||(a==5&&Hu==0)) {cout<<"无效输入。"<<endl;Sleep(500);return;}
if(a==1)
{
cout<<endl<<"导弹随时准备发射!";Sleep(500);cout<<"目标是第几个敌人?-- ";
char b=_getch();cout<<b<<endl;b-=48; if(b>dl||b<=0) {cout<<"无效输入。"<<endl;Sleep(500);return;}
Yan(4),cout<<endl<<"导弹发射!命中目标!"<<endl<<endl;Bai(),D[b].Xue-=300;Die(b),Bai(),Dao--; return;
}
if(a==2)
{
cout<<endl<<"医疗包随时准备空投!";Sleep(500);cout<<"目标是第几个炮塔?-- ";
char b=_getch();cout<<b<<endl;b-=48; if(b>nl||b<=0) {cout<<"无效输入。"<<endl;Sleep(500);return;}
Yan(4),cout<<endl<<"医疗包开始医疗!"<<endl<<endl;Bai(),N[nl-b+1].Hui+=5,Bai(),Yi--; return;
}
if(a==3)
{
cout<<endl<<"闪光弹随时准备发射!";Sleep(500);cout<<"目标是第几个敌人?-- ";
char b=_getch();cout<<b<<endl;b-=48; if(b>dl||b<=0) {cout<<"无效输入。"<<endl;Sleep(500);return;}
Yan(4),cout<<endl<<"闪光弹发射!命中目标!"<<endl<<endl;Bai(),Biao=b,D[b].Bing+=5,Biaob+=5,Shan--; return;
}
if(a==4) cout<<endl<<"狂暴血清爆发!"<<endl<<endl,Bai(),Baob+=2,Bai(),Qing--;
if(a==5) cout<<endl<<"无敌护罩开启!"<<endl<<endl,Bai(),Hub+=3,Bai(),Hu--;
}
void Mo()
{
int x=rand()%5;
if(x==0)
{
Yan(5);
cout<<"金刚机甲出现了!"<<endl<<endl;
Sleep(1000);system("cls");Bai();
cout<<"┌-----------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆金刚机甲: ┆"<<endl;
cout<<"┆特殊技能——扫射: ┆"<<endl;
cout<<"┆ 攻击力:40*n ┆"<<endl;
cout<<"┆ 目标:所有炮塔 ┆"<<endl;
cout<<"┆攻击力:200 ┆"<<endl;
cout<<"┆目标:第一个炮塔 ┆"<<endl;
cout<<"┆血量:1000 ┆"<<endl;
cout<<"┆掉落金币:100 ┆"<<endl;
cout<<"┆符号: ";Yan(5);cout<<"金";Bai();cout<<" ┆"<<endl;
cout<<"└-----------------------------┘"<<endl;Sleep(2000);
system("pause");system("cls");
ZaoN(8);
}
if(x==1)
{
Yan(1);
cout<<"寒冰机甲出现了!"<<endl<<endl;
Sleep(1000);system("cls");Bai();
cout<<"┌-----------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆寒冰机甲: ┆"<<endl;
cout<<"┆特殊技能——冰冻: ┆"<<endl;
cout<<"┆ 攻击力:30 ┆"<<endl;
cout<<"┆ 效果:冰冻任意一个炮塔 ┆"<<endl;
cout<<"┆ 持续时间:3回合 ┆"<<endl;
cout<<"┆血量:1000 ┆"<<endl;
cout<<"┆掉落金币:100 ┆"<<endl;
cout<<"┆符号: ";Yan(1);cout<<"冰";Bai();cout<<" ┆"<<endl;
cout<<"└-----------------------------┘"<<endl;Sleep(2000);
system("pause");system("cls");
ZaoN(9);
}
if(x==2)
{
Yan(2);
cout<<"木毒机甲出现了!"<<endl<<endl;
Sleep(1000);system("cls");Bai();
cout<<"┌-----------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆木毒机甲: ┆"<<endl;
cout<<"┆特殊技能——狂毒: ┆"<<endl;
cout<<"┆ 效果:使每个敌人攻击2次 ┆"<<endl;
cout<<"┆ 持续时间:2回合 ┆"<<endl;
cout<<"┆攻击力:10*4 ┆"<<endl;
cout<<"┆目标:所有炮塔 ┆"<<endl;
cout<<"┆持续时间:4回合 ┆"<<endl;
cout<<"┆血量:1000 ┆"<<endl;
cout<<"┆符号: ";Yan(2);cout<<"毒";Bai();cout<<" ┆"<<endl;
cout<<"└-----------------------------┘"<<endl;Sleep(2000);
system("pause");system("cls");
ZaoN(10);
}
if(x==3)
{
Yan(3);
cout<<"飓风机甲出现了!"<<endl<<endl;
Sleep(1000);system("cls");Bai();
cout<<"┌-----------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆飓风机甲: ┆"<<endl;
cout<<"┆特殊技能——幻风: ┆"<<endl;
cout<<"┆ 攻击力:50*2(对炮塔) ┆"<<endl;
cout<<"┆ 效果:调换2个单位的位置 ┆"<<endl;
cout<<"┆ 目标:任意2个炮塔或敌人 ┆"<<endl;
cout<<"┆攻击力:30%*该炮塔血量 ┆"<<endl;
cout<<"┆目标:前三个炮塔 ┆"<<endl;
cout<<"┆血量:1000 ┆"<<endl;
cout<<"┆符号: ";Yan(3);cout<<"风";Bai();cout<<" ┆"<<endl;
cout<<"└-----------------------------┘"<<endl;Sleep(2000);
system("pause");system("cls");
ZaoN(11);
}
if(x==4)
{
Yan(4);
cout<<"烈焰机甲出现了!"<<endl<<endl;
Sleep(1000);system("cls");Bai();
cout<<"┌-----------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆烈焰机甲: ┆"<<endl;
cout<<"┆特殊技能——火球: ┆"<<endl;
cout<<"┆ 攻击力:30*5 ┆"<<endl;
cout<<"┆ 目标:任意五个炮塔 ┆"<<endl;
cout<<"┆攻击力:40+30+20+10+5 ┆"<<endl;
cout<<"┆目标:前五个炮塔 ┆"<<endl;
cout<<"┆血量:1000 ┆"<<endl;
cout<<"┆符号: ";Yan(4);cout<<"火";Bai();cout<<" ┆"<<endl;
cout<<"└-----------------------------┘"<<endl;Sleep(2000);
system("pause");system("cls");
ZaoN(12);
}
Moo=1;
}
void Mai(int x)
{
char a;
if(x==0) Money+=10,Yan(5),Sleep(500),cout<<"你的金币+10。"<<endl<<endl,Bai();
if(x==1) Money+=30,Yan(3),Sleep(500),cout<<"机甲临城,",Yan(5),cout<<"你的金币+30。"<<Money<<endl<<endl,Bai();
if(Money>=300) Money=300,Yan(3),cout<<"金币储量已达上限!"<<endl<<endl,Bai(),Sleep(500);
Yan(5),Sleep(500),cout<<"你的金币数量:"<<Money<<endl<<endl,Bai(),Sleep(500);
y:
while(Money>=100)
{
memset(X,0,sizeof(X));
for(int i=1;i<=nl;i++) X[N[i].Zhong]++;
if(Money>=100) cout<<"你现在可以购买:1.加农炮 ";if(Money>=120&&X[2]<5) cout<<"2.重机枪 ";if(Money>=150&&X[3]<5) cout<<"3.迫击炮 ";if(Money>=200&&X[4]<3) cout<<"4.喷火器 ";
if(Money>=250&&X[0]==0) cout<<"5.城墙 ";if(Money>=270&&X[6]+X[7]+X[8]<2) cout<<"6.电磁炮 ";if(Money>=300&&X[5]<3) cout<<"7.火箭炮";
if(Money>=100)
{
cout<<endl<<endl<<"---你想购买什么?(按0取消)--- ";a=_getch();cout<<a<<endl;
if(a=='0') break;
if(a<'0'||a>'7') {cout<<"无效输入。"<<endl<<endl;Sleep(500);goto y;}
Zao(a-'0');cout<<endl<<endl;Bai();War();
goto y;
Yan(5),Sleep(500),cout<<"你的金币数量:"<<Money<<endl<<endl,Bai(),Sleep(500);
}
}cout<<endl;
z:
while(Dao>0||Yi>0||Shan>0||Qing>0||Hu>0)
{
War();
if(Dao>0||Yi>0||Shan>0||Qing>0||Hu>0) cout<<"你现在可以使用:"; if(Dao>0) cout<<"1.导弹("<<Dao<<"个) ";if(Yi>0) cout<<"2.医疗包("<<Yi<<"个) ";if(Shan>0) cout<<"3.闪光弹("<<Shan<<"个) ";if(Qing>0) cout<<"4.狂暴血清("<<Qing<<"个) ";if(Hu>0) cout<<"5.无敌护罩("<<Hu<<"个) ";
if(Dao>0||Yi>0||Shan>0||Qing>0||Hu>0)
{
cout<<endl<<endl<<"---你想使用什么?(按0取消)--- ";a=_getch();cout<<a<<endl;
if(a=='0') break;
if(a<'0'||a>'9') {cout<<"无效输入。"<<endl<<endl;Sleep(500);goto y;}
Yong(a-'0');cout<<endl<<endl;
goto z;
}
}cout<<endl;
}
void Chu(int y)
{
if(y<=1) Yan(1),cout<<"呀!来了个步兵!"<<endl<<endl,ZaoN(1);
if(y>=2&&y<4) Yan(2),cout<<"呀!来了个骑兵!"<<endl<<endl,ZaoN(2);
if(y>=4&&y<5) Yan(3),cout<<"呀!来了个炮兵!"<<endl<<endl,ZaoN(3);
if(y>=5&&y<6) Yan(4),cout<<"呀!来了个药兵!"<<endl<<endl,ZaoN(4);
if(y>=6&&y<7) Yan(6),cout<<"呀!来了个炮灰!"<<endl<<endl,ZaoN(6);
if(y>=7&&y<10) Yan(5),cout<<"呀!来了个坦克!"<<endl<<endl,ZaoN(5);
if(y>=10) cout<<"没有新敌人出现。"<<endl<<endl;
Sleep(1000);
}
void Huo(int n)
{
Sleep(100);
bool k[31];int R=15+rand()%11;
memset(k,0,sizeof(k));
for(int i=1;i<=7;i++)
{
int y=rand()%n+1;
if(Biao!=0) y=Biao;
D[y].Xue-=R;
k[y]=1;
cout<<y;Sleep(50);
if(i!=7) cout<<"、";Sleep(50);
}cout<<"个目标,";Sleep(100);cout<<R<<"*7点伤害!"<<endl<<endl;
for(int i=30;i>0;i--) if(k[i]==1) Die(i);
}
void Jiu(int n)
{
Sleep(100);int R=15+rand()%11;
int y=rand()%n+1;
D[y].Xue+=R;
cout<<y;Sleep(100);
cout<<"个目标,";Sleep(100);cout<<R<<"点血!"<<endl<<endl;
Bai(); War();
}
void Bjing(int n,int i)
{
int x=rand()%5;int y=rand()%10;int R=190+rand()%21,R2=30+rand()%21;
if(x==0&&D[i].Bing==0){ Yan(4),cout<<"金刚机甲锤击!"<<R<<"点伤害!"<<endl<<endl;if(Hub==0&&D[i].Bing==0) N[1].Xue-=R,DieN(1);return;}
if(x>=1&&x<3&&D[i].Bing==0)
{
Yan(4),cout<<"金刚机甲扫射!"<<R2<<"*"<<nl<<"点伤害!"<<endl<<endl;
if(Hub==0&&D[i].Bing==0) for(int i=1;i<=nl;i++) N[i].Xue-=R2,DieN(i);return;
}
if(nl<4&&dl>=3) {cout<<"金刚机甲蓄力。"<<endl<<endl;return;}
if(x==3) {Yan(4),cout<<"金刚机甲召唤!"<<endl<<endl;Chu(y);Bai();War();}
if(x==4) {Yan(4),cout<<"金刚机甲召唤!"<<endl<<endl;Chu(y);if(dl<3) y=rand()%10,Chu(y);Bai();War();}
Bai();Sleep(100);
}
void Bbing(int n,int i)
{
int x=rand()%5;int y=rand()%n+1;int z=rand()%10;int R=20+rand()%21;
if(x<2&&D[i].Bing==0)
{
if(Hub==0&&D[i].Bing==0) N[y].Bing=3,N[y].Xue-=30,DieN(y);
Yan(4),cout<<"寒冰机甲攻击!冰冻了你方第";cout<<nl-y+1;Sleep(100);
cout<<"个目标,";Sleep(300);cout<<R<<"点伤害!"<<endl<<endl;
Bai();Sleep(500),War();
return;
}
if((dl>=3&&nl<4)||x==2) {cout<<"寒冰机甲蓄力。"<<endl<<endl;return;}
if(x==3) {Yan(4),cout<<"寒冰机甲召唤!"<<endl<<endl;Chu(z);Bai();War();}
if(x==4) {Yan(4),cout<<"寒冰机甲召唤!"<<endl<<endl;Chu(z);if(dl<3) z=rand()%10,Chu(z);Bai();War();}
Bai();
}
void Bdu(int n,int i)
{
int x=rand()%8;int y=rand()%10;
if(x<2&&D[i].Bing==0)
{
Yan(4),cout<<"木毒机甲向你放毒!";
if(Hub==0&&D[i].Bing==0)
{
cout<<"所有炮塔中毒!";
for(int i=1;i<=nl;i++) N[i].Du=4;
}
cout<<endl<<endl;return;
}
if(x==2&&D[i].Bing==0) {Yan(4),cout<<"木毒机甲向己方放毒!所有敌人中毒,攻速*2!"<<endl<<endl,Baodb=2;return;}
if((x>4)||(nl<4&&dl>=3)) {cout<<"木毒机甲蓄力。"<<endl<<endl;return;}
if(x>2&&x<=4) {Yan(4),cout<<"木毒机甲召唤!"<<endl<<endl;Chu(y);Bai();War();}
if(x==5) {Yan(4),cout<<"木毒机甲召唤!"<<endl<<endl;Chu(y);if(dl<3) y=rand()%10,Chu(y);Bai();War();}
Bai();Sleep(100);
}
void Bju(int n,int m,int i)
{
int x=rand()%5,xx=rand()%10,y,yy,z,zz;int R=40+rand()%21;
if(nl==1) while (x==0) x=rand()%5;
else {y=rand()%n+1;z=y; while(z==y) z=rand()%n+1;}
if(dl==1) while (x==1) x=rand()%5;
else {yy=rand()%m+1;zz=yy; while(zz==yy) zz=rand()%m+1;}
if(x==0&&D[i].Bing==0)
{
Yan(4),cout<<"飓风机甲刮起狂风!调换了你方第"<<n-y+1<<"个和"<<n-z+1<<"个炮塔的位置,";swap(N[y],N[z]);
if(Hub==0) Sleep(300);cout<<R<<"*2点伤害!",N[y].Xue-=R,N[z].Xue-=R,DieN(y),DieN(z);
cout<<endl<<endl;Bai();Sleep(500),War();return;
}
if(x==1&&Fengb==1) x=5;
if(x==1&&D[i].Bing==0&&Fengb==0)
{
Yan(4),cout<<"飓风机甲刮起狂风!调换了己方第"<<yy<<"个和"<<zz<<"个敌人的位置!"<<endl<<endl;swap(D[yy],D[zz]);
Bai();Sleep(500),War();Fengb=1;
return;
}
if((dl>=3&&nl<4)||x==5) {cout<<"飓风机甲蓄力。"<<endl<<endl;return;}
if(x==2) if(Hub==0&&D[i].Bing==0){cout<<"飓风机甲刮起狂风!前三个炮塔血量减30%!"<<endl<<endl;if(N[3].Xue!=0) N[3].Xue*=0.7,DieN(3);if(N[2].Xue!=0) N[2].Xue*=0.7,DieN(2);if(N[1].Xue!=0) N[1].Xue*=0.7,DieN(1);}
if(x==3) {Yan(4),cout<<"飓风机甲召唤!"<<endl<<endl;Chu(xx);Bai();War();}
if(x==4) {Yan(4),cout<<"飓风机甲召唤!"<<endl<<endl;Chu(xx);if(dl<3) xx=rand()%10,Chu(xx);Bai();War();}
Bai();
}
void Byan(int n,int i)
{
int x=rand()%5;int y=rand()%10;
if(x==0&&D[i].Bing==0)
{
int R=35+rand()%11,R1=25+rand()%11,R2=15+rand()%11,R3=5+rand()%11,R4=1+rand()%10;
Yan(4),cout<<"烈焰机甲红焰迸出,火势燎原!";
if(Hub==0&&D[i].Bing==0) cout<<R<<"+"<<R1<<"+"<<R2<<"+"<<R3<<"+"<<R4<<"点伤害!";cout<<endl<<endl;
if(nl>=5) N[5].Xue-=R4,DieN(5);
if(nl>=4) N[4].Xue-=R3,DieN(4);
if(nl>=3) N[3].Xue-=R2,DieN(3);
if(nl>=2) N[2].Xue-=R1,DieN(2);
if(nl>=1) N[1].Xue-=R,DieN(1); return;
}
if(x==1&&D[i].Bing==0)
{
bool k[31];int R=25+rand()%11;
memset(k,0,sizeof(k));
Yan(4),cout<<"烈焰机甲的火焰聚成5个火球,向你飞来!";
if(Hub==0&&D[i].Bing==0)
{
cout<<"击中了第";
for(int i=0;i<5;i++)
{
int z=rand()%n+1;
N[z].Xue-=R;
k[z]=1;
cout<<nl-z+1;Sleep(50);
if(i!=4) cout<<"、";Sleep(50);
}
cout<<"个目标,";Sleep(100);cout<<R<<"*5伤害!";cout<<endl<<endl;
for(int i=30;i>0;i--) if(k[i]==1) DieN(i);
}
return;
}
if((nl<4&&dl>=3)||x==2) {cout<<"烈焰机甲蓄力。"<<endl<<endl;return;}
if(x==3) {Yan(4),cout<<"烈焰机甲召唤!"<<endl<<endl;Chu(y);Bai();War();}
if(x==4) {Yan(4),cout<<"烈焰机甲召唤!"<<endl<<endl;Chu(y);if(dl<3) y=rand()%10,Chu(y);Bai();War();}
Bai();Sleep(100);
}
void Round()
{
system("cls");t++;int R,R2,R3;
if(t>=3305536) cout<<"第"<<t-3305536<<"天"<<endl<<endl;
else cout<<"第"<<t<<"天"<<endl<<endl;
if(t%10==0&&t>=30) Yan(5),cout<<"成就:坚守"<<t<<"天,完成!加30金币!"<<endl,Bai(),Money+=30;
if(Money>=300) Money=300,Yan(3),cout<<endl<<"金币储量已达上限!"<<endl<<endl,Bai(),Sleep(500);
War();Fengb=0;
for(int i=1;i<=nl;i++) if(N[i].Hui!=0) N[i].Xue+=30;
for(int i=1;i<=nl;i++) if(N[i].Du!=0) N[i].Xue-=10,DieN(i);
if(Baob!=0) Bao=2;if(Baob==0) Bao=1;if(Baodb!=0) Baod=2;if(Baodb==0) Baod=1;if(Biaob==0) Biao=0;
if(D[1].Xue<=0)
{
if(t!=0) cout<<"炮塔暂时没有发现敌人。"<<endl<<endl;Sleep(500);
for(int i=nl;i>0;i--)
{ int b=0;Yan(N[i].Zhong);
if(N[i].Zhong==0) {cout<<"城墙巍然不动。"<<endl<<endl;}
if(b==0&&N[i].Zhong==6&&N[i].Bing==0) cout<<"电磁炮,",Yan(4),Sleep(200),cout<<"第1环,点亮!"<<endl<<endl,Bai(),N[i].Zhong++,b=1;
if(b==0&&N[i].Zhong==7&&N[i].Bing==0) cout<<"电磁炮,",Yan(4),Sleep(200),cout<<"第2环,点亮!"<<endl<<endl,Bai(),N[i].Zhong++,b=1;
if(b==0&&N[i].Zhong==8&&N[i].Bing==0) {cout<<"电磁炮,",Yan(4),Sleep(200),cout<<"第3环,点亮!";Sleep(200);cout<<"蓄势待发!"<<endl<<endl;Bai();}
}Bai();
}
else
{
if(Hub!=0) Yan(5),cout<<"无敌护罩耀耀生辉,将所有敌人的攻击阻挡在外。"<<endl<<endl,Sleep(500);
for(int j=1;j<=Baod;j++)
{
if(j==2) Yan(4),cout<<"在毒性的催发下,敌人疯狂攻击着!"<<endl<<endl,Sleep(500);
for(int i=1;i<=dl;i++)
{
int c=0;Yan(D[i].Zhong);
if(D[i].Bing!=0) Yan(4),cout<<"在闪光弹的强光下,敌人睁不开眼睛!"<<endl<<endl,Sleep(500);
if(D[i].Zhong==1&&nl>=0&&Hub==0&&D[i].Bing==0) R=20+rand()%21,cout<<"步兵开枪了!"<<R<<"点伤害!"<<endl<<endl,N[1].Xue-=R,DieN(1);
if(D[i].Zhong==2&&nl>=0&&Hub==0&&D[i].Bing==0) R=10+rand()%21,cout<<"骑兵身形一抖,向前一刺!"<<R<<"点伤害!"<<endl<<endl,N[1].Xue-=20,DieN(1);
if(D[i].Zhong==3&&nl>=0&&Hub==0&&D[i].Bing==0) R=40+rand()%21,cout<<"炮兵点火,炮声响彻天际!"<<R<<"点伤害!"<<endl<<endl,N[1].Xue-=50,DieN(1);
if(D[i].Zhong==4&&nl>=0&&D[i].Bing==0) cout<<"药兵开始治疗!恢复了第",Jiu(dl);
if(D[i].Zhong==5&&nl>=0&&Hub==0&&D[i].Bing==0) R=70+rand()%21,cout<<"坦克的穿甲弹从炮管口滚滚白烟中冲出!"<<R<<"点伤害!"<<endl<<endl,N[1].Xue-=80,DieN(1);
if(c==0&&D[i].Zhong==6&&nl>=0&&D[i].Bing==0) cout<<"炮灰点燃了",Yan(4),cout<<"炸弹的引信!"<<endl<<endl,D[i].Zhong++,c=1;
if(c==0&&D[i].Zhong==7&&nl>=0&&D[i].Bing==0) {R=490+rand()%21,cout<<"炮灰",Yan(4),cout<<"爆炸!!!",Sleep(500),cout<<R<<"点伤害!"<<endl<<endl;if(Hub==0) N[1].Xue-=500,DieN(1);D[i].Xue-=500,Die(i),c=1;}
if(D[i].Zhong==8&&nl>=0) Yan(5),Bjing(nl,i);
if(D[i].Zhong==9&&nl>=0) Yan(1),Bbing(nl,i);
if(D[i].Zhong==10&&nl>=0) Yan(2),Bdu(nl,i);
if(D[i].Zhong==11&&nl>=0) Yan(3),Bju(nl,dl,i);
if(D[i].Zhong==12&&nl>=0) Yan(4),Byan(nl,i);
if(nl>=0) Sleep(200);Bai();
}
}
for(int j=1;j<=Bao;j++)
{
if(j==2) Yan(4),cout<<"狂暴血清爆发了,炮塔疯狂地发射着子弹!"<<endl<<endl,Sleep(500),Baob--;
for(int i=nl;i>0;i--)
{
int b=0;Yan(N[i].Zhong);
if(N[i].Zhong==0) {cout<<"城墙巍然不动。"<<endl<<endl;Sleep(200);}
if(N[i].Zhong==1&&D[1].Zhong!=0&&N[i].Bing==0) {if(D[1].Zhong!=0)R=20+rand()%21,cout<<"加农炮一炮发出!"<<R<<"点伤害!"<<endl<<endl;if(Biao!=0) D[Biao].Xue-=R,Die(Biao);else D[1].Xue-=R,Die(1);Sleep(200);}
if(N[i].Zhong==2&&D[1].Zhong!=0&&N[i].Bing==0) {if(D[1].Zhong!=0)R=40+rand()%21,cout<<"重机枪射出复仇的子弹!"<<R<<"点伤害!"<<endl<<endl;if(Biao!=0) D[Biao].Xue-=R,Die(Biao);else D[1].Xue-=R,Die(1);Sleep(200);}
if(N[i].Zhong==3&&D[1].Zhong!=0&&N[i].Bing==0) {if(D[1].Zhong!=0)R=60+rand()%21,cout<<"迫击炮的炮弹划出一条完美的抛物线!"<<R<<"点伤害!"<<endl<<endl;if(Biao!=0) D[Biao].Xue-=R,Die(Biao);else D[dl].Xue-=R,Die(dl);Sleep(200);}
if(N[i].Zhong==4&&D[1].Zhong!=0&&N[i].Bing==0) {if(D[1].Zhong!=0)R=40+rand()%21,R2=20+rand()%21,R3=rand()%21,cout<<"喷火器喷出熊熊烈火!"<<R<<"+"<<R2<<"+"<<R3<<"点伤害!"<<endl<<endl;if(Biao!=0){if(D[Biao+2].Zhong!=0)D[Biao+2].Xue-=R3,Die(Biao+2);if(D[Biao+1].Zhong!=0)D[Biao+1].Xue-=R2,Die(Biao+1);if(D[Biao].Zhong!=0)D[Biao].Xue-=R,Die(Biao);}else{if(D[3].Zhong!=0)D[3].Xue-=R3,Die(3);if(D[2].Zhong!=0)D[2].Xue-=R2,Die(2);if(D[1].Zhong!=0)D[1].Xue-=R,Die(1);}Sleep(200);}
if(N[i].Zhong==5&&D[1].Zhong!=0&&N[i].Bing==0) {if(dl!=0) cout<<"火箭炮的7枚火箭依次冲出!命中第";Huo(dl);Sleep(200);}
if(b==0&&N[i].Zhong==6&&N[i].Bing==0) cout<<"电磁炮,",Yan(4),Sleep(200),cout<<"第1环,点亮!"<<endl<<endl,Bai(),N[i].Zhong++,b=1,Sleep(200);
if(b==0&&N[i].Zhong==7&&N[i].Bing==0) cout<<"电磁炮,",Yan(4),Sleep(200),cout<<"第2环,点亮!"<<endl<<endl,Bai(),N[i].Zhong++,b=1,Sleep(200);
if(b==0&&N[i].Zhong==8&&N[i].Bing==0){cout<<"电磁炮,",Yan(4),Sleep(200),cout<<"第3环,点亮!";if(D[1].Zhong!=0){R=290+rand()%21,R2=90+rand()%21,Sleep(200);cout<<"然后...",Sleep(200),cout<<"轰!!!",Sleep(200),cout<<R<<"+"<<R2<<"点伤害!"<<endl<<endl,N[i].Zhong-=2;if(Biao!=0){if(D[Biao+1].Zhong!=0)D[Biao+1].Xue-=R2,Die(Biao+1);D[Biao].Xue-=R,Die(Biao),b=1;} else {if(D[2].Zhong!=0)D[2].Xue-=R2,Die(2);D[1].Xue-=R,Die(1),b=1;}}else cout<<"蓄势待发!"<<endl<<endl;Bai();Sleep(200);}
Bai();
}
}
for(int i=nl;i>0;i--) if(N[i].Hui!=0) N[i].Hui--;
for(int i=nl;i>0;i--) if(N[i].Bing!=0) N[i].Bing--;
for(int i=nl;i>0;i--) if(N[i].Du!=0) N[i].Du--;
for(int i=dl;i>0;i--) if(D[i].Bing!=0) D[i].Bing--;
if(Baodb!=0) Baodb--;if(Biaob!=0) Biaob--;
if(nl<=0)
{
Yan(4);Sleep(2000);system("cls");
cout<<endl<<"城破了,你输了!!!"<<endl<<endl;Sleep(1000);
cout<<"你坚守了"<<t<<"天。"<<endl<<endl;Bai();Sleep(1000);system("pause");
return;
}
}
if(Hub!=0) Hub--;
if(t>=3305536&&dl<=0) return;
if(t<3305536) Mai(Moo);
if(t<3305536&&Moo==0)
{
int u=0;
x: Bai();
Sleep(200);
int y=rand()%11;
if(t<10)
{
if(dl>=2) y=0;
if(y<5) cout<<"没有新敌人出现。"<<endl<<endl;
if(y>=5&&y<9) Yan(1),cout<<"呀!来了个步兵!"<<endl<<endl,ZaoN(1);
if(y>=9) Yan(2),cout<<"呀!来了个骑兵!"<<endl<<endl,ZaoN(2);
}
if(t<20&&t>=10)
{
if(dl>=2) y=7;
if(y>=7) {cout<<"没有新敌人出现。"<<endl<<endl;y=0;}
else Chu(y);u++;
int w=rand()%3;
if(dl<2&&w<3&&u<2) goto x;
}
if(t<29&&t>=20)
{
if(dl>=2) y=9;
if(y>=9) {cout<<"没有新敌人出现。"<<endl<<endl;}
else Chu(y);u++;
int w=rand()%3;
if(dl<2&&w<3&&u<2) goto x;
}
if(t==29) Mo();
if(t<45&&t>=30)
{
if(dl>=3) y=10;
if(y>=10) {cout<<"没有新敌人出现。"<<endl<<endl;}
else Chu(y);u++;
int w=rand()%2;
if(dl<2&&w<1&&u<2) goto x;
}
if(t<59&&t>=45)
{
if(dl>=nl+1) y=20;
if(y==20) {cout<<"没有新敌人出现。"<<endl<<endl;}
else Chu(y);u++;
if(u<3) goto x;
}
if(t==59) Mo();if(t==60) Mo();
if(t<79&&t>60)
{
if(dl>=nl+2) y=20;
if(y==20) {cout<<"没有新敌人出现。"<<endl<<endl;}
else Chu(y);u++;
if(u<3) goto x;
if(u==3&&y==0) goto x;
}
if(t==79) Mo();if(t==80) Mo();if(t==81) Mo();
if(t<99&&t>81)
{
if(dl>=nl+2) y=20;
if(y==20) {cout<<"没有新敌人出现。"<<endl<<endl;}
else Chu(y);u++;
if(u<3) goto x;
if(u==3&&y==0) goto x;
}
if(t==99)
{
system("cls");Sleep(500);
cout<<"第100天"<<endl<<endl;Yan(5);
cout<<"飞机的轰鸣声响过,你的视野变为雪白......"<<endl<<endl; Sleep(1000);
cout<<"激烈的战场瞬间寂静,机甲轰然倒塌......"<<endl<<endl; Sleep(1000);
cout<<"在层层迷雾中,远方若隐若现地显出军队的轮廓......"<<endl<<endl; Sleep(1000);
cout<<"啊,你的援军到了!!!"<<endl<<endl; Sleep(1000);
cout<<"伟大的将帅啊,我们的首都,保住了!!!"<<endl<<endl;Sleep(3000);
system("cls");Bai();
cout<<endl<<"游戏目标达成,游戏结束!"<<endl<<endl;Sleep(2000);
system("pause");return;
}
Bai();
}
Sleep(300);
Round();
}
void Jiao()
{
char a;Bai();
cout<<endl<<" 现在进行教学模式。"<<endl;Sleep(1000);system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新武器解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆加农炮: ┆"<<endl;
cout<<"┆攻击力:30 ┆"<<endl;
cout<<"┆血量:100 ┆"<<endl;
cout<<"┆价值:100 ┆"<<endl;
cout<<"┆目标:第一个敌人 ┆"<<endl;
cout<<"┆最多建造数量:∞ ┆"<<endl;
cout<<"┆符号: ";Yan(1);cout<<"●";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"请按1键以建造加农炮。"<<endl<<endl;a=_getch();N[1].Zhong=1,N[1].Xue=100,nl++;War();
cout<<"好极了,他应该能帮我们守住城市。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆步兵: ┆"<<endl;
cout<<"┆攻击力:30 ┆"<<endl;
cout<<"┆血量:50 ┆"<<endl;
cout<<"┆掉落金币:20 ┆"<<endl;
cout<<"┆目标:第一个炮塔 ┆"<<endl;
cout<<"┆符号: ";Yan(1);cout<<"○";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
D[1].Zhong=1,D[1].Xue=50,dl=1;
system("pause");system("cls");War();
cout<<"现在看看你的加农炮能把它怎么样!"<<endl<<endl;Sleep(1000);
t=3305536,Round();
cout<<"加农炮血多价廉,是战斗前期的必备。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新武器解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆重机枪: ┆"<<endl;
cout<<"┆攻击力:50 ┆"<<endl;
cout<<"┆血量:80 ┆"<<endl;
cout<<"┆价值:120 ┆"<<endl;
cout<<"┆目标:第一个敌人 ┆"<<endl;
cout<<"┆最多建造数量:5 ┆"<<endl;
cout<<"┆符号: ";Yan(2);cout<<"■";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"重机枪攻击力高,可以大量输出火力。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆骑兵: ┆"<<endl;
cout<<"┆攻击力:20 ┆"<<endl;
cout<<"┆血量:100 ┆"<<endl;
cout<<"┆掉落金币:30 ┆"<<endl;
cout<<"┆目标:第一个炮塔 ┆"<<endl;
cout<<"┆符号: ";Yan(2);cout<<"□";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"骑兵血多,但攻击力低。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新武器解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆迫击炮: ┆"<<endl;
cout<<"┆攻击力:70 ┆"<<endl;
cout<<"┆血量:150 ┆"<<endl;
cout<<"┆价值:150 ┆"<<endl;
cout<<"┆最多建造数量:5 ┆"<<endl;
cout<<"┆目标:最后一个敌人 ┆"<<endl;
cout<<"┆符号: ";Yan(3);cout<<"▲";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"迫击炮攻击力高,并可以在一些血少敌人出场时将其击杀。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆炮兵: ┆"<<endl;
cout<<"┆攻击力:50 ┆"<<endl;
cout<<"┆血量:30 ┆"<<endl;
cout<<"┆掉落金币:20 ┆"<<endl;
cout<<"┆目标:第一个炮塔 ┆"<<endl;
cout<<"┆符号: ";Yan(3);cout<<"△";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"炮兵攻击力高,需要速决。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新武器解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆喷火器: ┆"<<endl;
cout<<"┆攻击力:50+30+10 ┆"<<endl;
cout<<"┆血量:200 ┆"<<endl;
cout<<"┆价值:200 ┆"<<endl;
cout<<"┆目标:前三个敌人 ┆"<<endl;
cout<<"┆最多建造数量:5 ┆"<<endl;
cout<<"┆符号: ";Yan(4);cout<<"▼";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"喷火器,超值攻击礼包。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新武器解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆城墙: ┆"<<endl;
cout<<"┆血量:500 ┆"<<endl;
cout<<"┆价值:250 ┆"<<endl;
cout<<"┆最多建造数量:1 ┆"<<endl;
cout<<"┆符号: ▎ ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"救场神器!相当于无敌多回合!"<<endl<<endl;
cout<<"城墙会自动放置在战场最前方。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆药兵: ┆"<<endl;
cout<<"┆攻击力:-20(治愈己方) ┆"<<endl;
cout<<"┆血量:100 ┆"<<endl;
cout<<"┆掉落金币:30 ┆"<<endl;
cout<<"┆目标:任意一个己方 ┆"<<endl;
cout<<"┆符号: ";Yan(4);cout<<"▽";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"药兵血多,不过不会攻击。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新武器解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆电磁炮: ┆"<<endl;
cout<<"┆攻击力:300+100 ┆"<<endl;
cout<<"┆ (蓄力2回合) ┆"<<endl;
cout<<"┆血量:400 ┆"<<endl;
cout<<"┆价值:270 ┆"<<endl;
cout<<"┆目标:第一个敌人 ┆"<<endl;
cout<<"┆最多建造数量:2 ┆"<<endl;
cout<<"┆符号: ";Yan(6);cout<<"◆";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"电磁炮是对付坦克的必备法宝。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆炮灰: ┆"<<endl;
cout<<"┆攻击力:500(蓄力1回合) ┆"<<endl;
cout<<"┆血量:10 ┆"<<endl;
cout<<"┆掉落金币:10 ┆"<<endl;
cout<<"┆目标:第一个炮塔 ┆"<<endl;
cout<<"┆符号: ";Yan(6);cout<<"◇";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"炮灰出场时,务必第一时间将其击杀。"<<endl<<endl;
cout<<"炮灰爆炸时,自己也会死亡。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新武器解锁! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆火箭炮: ┆"<<endl;
cout<<"┆攻击力:20*7 ┆"<<endl;
cout<<"┆血量:300 ┆"<<endl;
cout<<"┆价值:300 ┆"<<endl;
cout<<"┆目标:任意九个敌人 ┆"<<endl;
cout<<"┆最多建造数量:3 ┆"<<endl;
cout<<"┆符号: ";Yan(5);cout<<"★";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"火箭炮极其有用,后期必备。"<<endl<<endl;Sleep(1000);
system("pause");system("cls");
cout<<"┌-------------------------┐"<<endl;
cout<<"┆新敌人出现! ┆"<<endl;
cout<<"┆ ┆"<<endl;
cout<<"┆坦克: ┆"<<endl;
cout<<"┆攻击力:80 ┆"<<endl;
cout<<"┆血量:200 ┆"<<endl;
cout<<"┆掉落金币:50 ┆"<<endl;
cout<<"┆目标:第一个炮塔 ┆"<<endl;
cout<<"┆符号: ";Yan(5);cout<<"☆";Bai();cout<<" ┆"<<endl;
cout<<"└-------------------------┘"<<endl;Sleep(2000);
cout<<"坦克,你的噩梦!"<<endl<<endl;Sleep(2000);
system("pause");system("cls");
cout<<endl<<"开局时,你有一个城墙。"<<endl<<endl;Sleep(2000);
cout<<"建造炮塔要花费金币,你的金币每回合+10。"<<endl<<endl;Sleep(2000);
cout<<"后期会出BOSS——机甲,这时你的金币每回合+30。"<<endl<<endl;Sleep(2000);
cout<<"你的金币储量上限为300。"<<endl<<endl,Sleep(2000);
cout<<"敌人的血量随天数增加!"<<endl<<endl;Sleep(2000);
cout<<"打爆一个敌人有几率掉道具。"<<endl<<endl;Sleep(2000);
cout<<"每个炮塔一回合只能攻击一次。"<<endl<<endl;Sleep(2000);
cout<<"当所有炮塔阵亡时,游戏结束。"<<endl<<endl;Sleep(2000);
cout<<"伟大的将帅啊,请你保卫我们的首都!"<<endl<<endl;Sleep(2000);
system("pause");system("cls");
}
int main()
{
srand((unsigned)time(NULL));
system("mode con cols=46 lines=40");
ST:system("cls");
memset(N,0,sizeof(N));memset(D,0,sizeof(D));memset(X,0,sizeof(X));
t=nl=dl=Moo=Biao=Biaob=Bao=Baob=Baod=Baodb=Hub=Fengb=Sha=Jian=Shab=Jianb=0;
Bai(); cout<<endl<<" ----------------城市守卫战------------------"<<endl;
cout<<" --------------------------作者:胎神--------"<<endl<<endl;
cout<<" 2.5版本:"<<endl<<endl;
cout<<" 5大更新主题:"<<endl<<endl;
cout<<" --新武器解锁!救场神器---城墙!"<<endl<<endl;
cout<<" --伤害变随机!更多变的战局!"<<endl<<endl;
cout<<" --3大成就全新来袭,获得金币更容易!"<<endl<<endl;
cout<<" --全新战场输出模式!不串行!"<<endl<<endl;
cout<<" --金币与炮塔上限已加入。"<<endl<<endl;
cout<<" 难度上调:敌人血量随时间增加!"<<endl<<endl;
cout<<" 另:建塔和用道具";Yan(3);cout<<"不需要按回车!"<<endl<<endl;Bai();
cout<<" 输入: 1.教学模式 2.战争模式"<<endl;
st:
char a;a=_getch();
if(a=='1') {Jiao(),N[1].Zhong=0,N[1].Xue=500,nl=1,Money=90;cout<<endl<<"现在进行战争模式。"<<endl<<endl;Sleep(1000);t=0;Round();goto ST;}
else if(a=='2') {N[1].Zhong=0,N[1].Xue=500,nl=1,Money=90;cout<<endl<<" 现在进行战争模式。"<<endl<<endl;Sleep(1000);t=0;Round();goto ST;}
else goto st;
Bai();
return 0;
}
五、 愤怒的小胎
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
const double pi=3.1415926536;
int toint(float a){return ((int)(a*10+5))/10;}
void Color(int a)
{
if(a==0||a==14||a==20) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==1||a==12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
if(a==4||a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==5||a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==15) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
if(a==16) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
if(a==17) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
if(a==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_RED|BACKGROUND_GREEN);
}
void SetPos(float x,float y)
{
int xx=toint(x),yy=toint(y);
COORD pos;pos.X=yy*2,pos.Y=xx;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
struct node
{
int W,W2,S,mS;
float X,Y;
float vx,vy;
float ax,ay;
bool go,boom;
}blt[100001],pig[100001],boo[100001];
int T,yX,yY,Xy,put,K,K2,Sle,What;
int Bot,Pit,Blt,Pig,Sco,pigk,scok;
int m[41][41];
void Cout(int a,int x,int y)
{
if(a==1) SetPos(x,y),Color(5),cout<<put<<' ';
if(y==202)
{
SetPos(pig[a].X,pig[a].Y);cout<<" ";
if((pig[a].W==2||pig[a].W==3)&&pig[a].X>=2) SetPos(pig[a].X-2,pig[a].Y);cout<<" ",SetPos(pig[a].X-1,pig[a].Y);cout<<" ";
if(pig[a].W==4) SetPos(pig[a].X,pig[a].Y-1),cout<<" ";
if(pig[a].W==5) SetPos(pig[a].X-1,pig[a].Y),cout<<" ",SetPos(pig[a].X-1,pig[a].Y-1),cout<<" ";
}
if(a==2)
for(int i=0;i<=40;i++)
for(int j=0;j<=40;j++)
{
if(i<=18&&m[i][j]==1) SetPos(i,j),Color(7),cout<<"■";
if(m[i][j]>=2&&m[i][j]<=19) SetPos(i,j),Color(5),cout<<"█",m[i][j]++;
if(m[i][j]>19&&m[i][j]<=29) SetPos(i,j),Color(0),cout<<"█",m[i][j]++;
if(m[i][j]==30) SetPos(i,j),Color(0),cout<<" ",m[i][j]=0;
if(m[i][j]>=31&&m[i][j]<=49) SetPos(i,j),Color(0),cout<<"■",m[i][j]++;
if(m[i][j]==50) SetPos(i,j),Color(7),cout<<"■",m[i][j]=1;
}
if(y==666)
{
SetPos(blt[a].X,blt[a].Y);
Color(10+blt[a].W),cout<<"●";
}Color(0);
}
void Go(int a)
{
SetPos(blt[a].X,blt[a].Y);cout<<" ";
blt[a].X+=blt[a].vx/2;blt[a].Y+=blt[a].vy/2;blt[a].vx+=blt[a].ax/2;blt[a].vy+=blt[a].ay/2;
if(blt[a].X>=20) blt[a].X=19;
if(blt[a].X>20||blt[a].Y>38||blt[a].X<0||blt[a].Y<=0) blt[a].go=1;
if(blt[a].W2==1&&blt[a].Y>=Xy) blt[a].go=1,Sle=0;//地跑鸟
if(blt[a].W2==0)
{
for(int i=0;i<=blt[a].vx/2+1;i++)
{
if(blt[a].vx>0&&m[toint(blt[a].X)+i][toint(blt[a].Y)]==1) //上反弹
{
if(blt[a].W!=5) blt[a].boom=1;
blt[a].X=toint(blt[a].X)+i-1,blt[a].Y+=blt[a].vy/2,blt[a].vx=-blt[a].vx*0.4,blt[a].vy=blt[a].vy*0.8;
if(blt[a].W==3) blt[a].ax=0.5;if(blt[a].W==7) blt[a].vx*=2;
if(blt[a].W==10) blt[a].go=1,Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
}
if(blt[a].vx<0&&m[toint(blt[a].X)-i][toint(blt[a].Y)]==1) //下反弹
{
if(blt[a].W!=5) blt[a].boom=1;
blt[a].X=toint(blt[a].X)+i+1,blt[a].Y+=blt[a].vy/2,blt[a].vx=-blt[a].vx,blt[a].vy=blt[a].vy*0.8;
if(blt[a].W==3) blt[a].ax=0.5;if(blt[a].W==7) blt[a].vx*=2;
if(blt[a].W==10) blt[a].go=1,Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
}
}
if(abs(blt[a].vx)<=0.1&&abs(blt[a].vy)<=0.1&&abs(blt[a].ay)<=0.1)
{
blt[a].go=1;
if(blt[a].W==5) Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4,blt[a].go=1;
}
}
if(blt[a].go==0) Cout(a,0,666);
}
void Kill(int a)
{
if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
int R=rand()%50;Cout(a,202,202);
/清除猪猪
pig[a].X+=pig[a].vx/2;pig[a].Y+=pig[a].vy/2;pig[a].vx+=pig[a].ax/2;pig[a].vy+=pig[a].ay/2;
for(int i=-2;i<=pig[a].vx/2+1;i++)
{
if(m[toint(pig[a].X)+i][toint(pig[a].Y)]==1) //上反弹
pig[a].X=toint(pig[a].X)+i-1,pig[a].Y+=pig[a].vy/2,pig[a].vx=-pig[a].vx*0.5,pig[a].vy=pig[a].vy*0.8;
}
for(int i=Blt-10;i<=Blt;i++)
{
if(pig[a].W==5&&blt[i].go==0&&abs(pig[a].X-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1) {m[toint(pig[a].X)-1][toint(pig[a].Y)]=2,pig[a].W2++;Sco+=2;break;}
if(pig[a].W==5&&m[toint(pig[a].X)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X)][toint(pig[a].Y)]<30) {m[toint(pig[a].X)-1][toint(pig[a].Y)]=2,pig[a].W2++;Sco+=2;break;}
if(blt[i].go==0&&abs(pig[a].X-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1)
{
if(pig[a].W==6) Bot++,boo[Bot].X=pig[a].X,boo[Bot].Y=pig[a].Y,boo[Bot].S=1,boo[Bot].mS=4,blt[i].go=1;
m[toint(pig[a].X)][toint(pig[a].Y)]=2,pig[a].go=1,Pig--,Sco+=10;break;
}
if(m[toint(pig[a].X)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X)][toint(pig[a].Y)]<30)
{
if(pig[a].W==6) Bot++,boo[Bot].X=pig[a].X,boo[Bot].Y=pig[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
pig[a].go=1,Pig--,Sco+=10;break;
}
if((pig[a].W==2||pig[a].W==3)&&blt[i].go==0&&abs(pig[a].X-2-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1) {m[toint(pig[a].X)][toint(pig[a].Y)]=2,pig[a].go=1,Pig--,Sco+=10;break;}
if((pig[a].W==2||pig[a].W==3)&&m[toint(pig[a].X-2)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X-2)][toint(pig[a].Y)]<30) {pig[a].go=1,Pig--,Sco+=10;break;}
}
/弄死猪猪
if(pig[a].go==0)
{
if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
int Xx=toint(pig[a].X),Xy=toint(pig[a].Y);
if(pig[a].W==6) SetPos(pig[a].X,pig[a].Y),Color(9),cout<<"TN",Color(0);
else{
SetPos(pig[a].X,pig[a].Y),Color(2),cout<<"●";
if((pig[a].W==2||pig[a].W==3)&&pig[a].X>=2) SetPos(pig[a].X-2,pig[a].Y),Color(0),cout<<"○",SetPos(pig[a].X-1,pig[a].Y),cout<<"|";
if(pig[a].W==4) SetPos(pig[a].X,pig[a].Y-1),Color(2),cout<<"﹃";
if(pig[a].W==5)
{
SetPos(pig[a].X-1,pig[a].Y),Color(8);SetPos(pig[a].X-1,pig[a].Y-1),cout<<"▁";
if(pig[a].W2==0)cout<<"▅";if(pig[a].W2==1)cout<<"▃";if(pig[a].W2==2)cout<<"▂";if(pig[a].W2==3) pig[a].W=1,pig[a].W2=0,SetPos(pig[a].X-1,pig[a].Y-1),cout<<" ";
}
}
/输出猪猪
if(pig[a].W==2&&pig[a].X>pig[a].S) pig[a].W=3,pig[a].ax=-0.4,pig[a].vx=1.5;
else if(pig[a].W==3&&pig[a].X<=pig[a].S) pig[a].W=2,pig[a].ax=0.4,pig[a].vx=-1.5;
if((pig[a].W==2||pig[a].W==3)&&(pig[a].Y<=10||pig[a].Y>=38)) pig[a].vy*=-1;
if(pig[a].W==4&&R==0&&pig[a].X==20) pig[a].vx=-((rand()%40)/10);
if(pig[a].W==4)
{
int r=rand()%20;
for(int i=Blt-10;i<=Blt;i++) if(r<=5&&blt[i].go==0&&pig[a].Y-blt[i].Y<=5&&abs(blt[i].X-pig[a].X)<=1.5&&r<5) r=0;
if(r==0)
{
m[toint(pig[a].X)][toint(pig[a].Y)-2]=10;m[toint(pig[a].X)][toint(pig[a].Y)-3]=2;
for(int j=toint(pig[a].Y)-1;j>=toint(pig[a].Y)-5;j--)
{
for(int i=Blt-10;i<=Blt;i++) if(blt[i].go==0&&!(blt[i].W==3&&blt[i].boom==1)&&blt[i].W2==0&&toint(blt[i].Y)==j&&abs(blt[i].X-pig[a].X)<=2) blt[i].vy=-2;
for(int i=Pit-50;i<=Pit;i++) if(pig[i].go==0&&toint(pig[i].Y)==j&&abs(pig[i].X-pig[a].X)<=2) pig[i].vy=-1;
}
}
}
/移动猪猪
if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
if(pig[a].X>20||pig[a].Y>38||pig[a].X<0||pig[a].Y<=0) pig[a].go=1,Pig--,Cout(a,202,202);
/清除猪猪
}
}
void Creat(int a,int p)
{
if(a==-1&&p==-1)
{
Blt++;blt[Blt].W=What;blt[Blt].W2=1;
blt[Blt].vy=1;blt[Blt].X=19;blt[Blt].Y=0;blt[Blt].boom=1;
}
else if(a==0&&p==-1)
{
int u=rand()%7+1,U=rand()%30;
if(u>=5) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=1;
if(u==1) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].vy=0.5,pig[Pit].ax=0.5,pig[Pit].S=rand()%5+7,pig[Pit].W=2;
if(u==2) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=4;
if(u==3) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=5;
if(u==4) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=6;
if(U==1) Bot++,boo[Bot].Y=rand()%13+15,boo[Bot].X=(rand()%4)*3+8,boo[Bot].S=0,boo[Bot].mS=rand()%2+2,boo[Bot].W2=1;
}
else
{
Blt++;blt[Blt].W=What;
if(a==1) blt[Blt].X=yX;blt[Blt].Y=yY;blt[Blt].ax=0.5; //抛物线
blt[Blt].vx=-3.5*sin(p*pi/180);
blt[Blt].vy=3*cos(p*pi/180);
if(p<=45) blt[Blt].vy*=1+(0.33-0.01*(45-p));
if(p>=45) blt[Blt].vy*=1+(0.33-0.01*(p-45));
if(blt[Blt].W==6) blt[Blt].vy*=1.2,blt[Blt].ax=0.4;
}
}
void Boom(int a)
{
if(boo[a].W2==0)
{
int ms=boo[a].mS,s=boo[a].S,x=boo[a].X,y=boo[a].Y;
if(s==ms) return;
for(int i=x-s;i<=x+s;i++)
for(int j=y-s;j<=y+s;j++)
{
float k=(i-x)*(i-x)+(j-y)*(j-y)-s*s;
if(k<=s&&k>=-s&&i<=20&&j<=38&&i>=0&&j>0&&m[i][j]!=1) m[i][j]=2;
}boo[a].S++;
}
if(boo[a].W2==1)
{
int ms=boo[a].mS,s=boo[a].S,x=boo[a].X,y=boo[a].Y;
if(s==ms) return;
if(y-s>10) m[x][y-s]=31-31*(boo[a].W2-1);
if(y+s<40) m[x][y+s]=31-31*(boo[a].W2-1);
boo[a].S++;
}
}
void Move(int a)
{
Color(5);
if(a==-2) SetPos(17,Xy),cout<<" ",SetPos(18,Xy),cout<<" ",SetPos(19,Xy),cout<<" ",SetPos(20,Xy),cout<<" ";
if(a==-1) SetPos(17,Xy),cout<<" ",SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==0) SetPos(18,Xy),cout<<" ┃",Color(What+10),cout<<"●",Color(5),cout<<"┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==1) SetPos(18,Xy),cout<<" ",Color(What+10),cout<<"●",Color(5),cout<<" ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==2) SetPos(18,Xy),Color(What+10),cout<<"●",Color(5),cout<<"┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==3) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),Color(What+10),cout<<"●",Color(5),cout<<"╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==4) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),Color(What+10),cout<<"●",Color(5),cout<<" ▏";
if(a==5) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ",Color(What+10),cout<<"●",Color(5),cout<<" ▏";
if(a==6) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ",Color(What+10),cout<<"●",Color(5),cout<<" ";
Color(0);
}
void Start()
{
char g;Color(5);system("cls");
SetPos(1,1);cout<<"------- 愤 怒 的 小 胎 -------";Color(0);
SetPos(3,1);cout<<"空格瞄准,按X触发小胎技能,←→移动弹弓";
SetPos(5,1);cout<<"猪猪技能自动触发,空中会有墙出现。";
SetPos(7,1);cout<<"危险值由命中率,猪的存活时间计算!";
SetPos(9,1);cout<<"危险值点满后失败!1500分通关!";
SetPos(1,20);cout<<"-------- 小 胎 技 能 --------";
SetPos(3,20);Color(11),cout<<"●",Color(0),cout<<":无技能";
SetPos(5,20);Color(12),cout<<"●",Color(0),cout<<":分身!不同分身初速度大小相同,";
SetPos(6,20);cout<<" 方向不同。";
SetPos(7,20);Color(13),cout<<"●",Color(0),cout<<":加速!以当前速度做匀速直线运动,";
SetPos(8,20);cout<<" 且免疫狙击猪的冲击。";
SetPos(9,20);Color(14),cout<<"●",Color(0),cout<<":投蛋!并获得向上速度做匀速直线";
SetPos(10,20);cout<<" 运动,快达可以穿墙。";
SetPos(11,20);Color(15),cout<<"●",Color(0),cout<<":爆炸!";
SetPos(13,20);Color(16),cout<<"●",Color(0),cout<<":回旋!开始做向左加速运动!发射";
SetPos(14,20);cout<<" 时获得双倍水平速度。";
SetPos(15,20);Color(17),cout<<"●",Color(0),cout<<":[被动] 弹跳力为普通鸟三倍。发射";
SetPos(16,20);cout<<" 时获得1.5倍水平、竖直速度。";
SetPos(11,1);cout<<"-------- 猪 猪 技 能 --------";
SetPos(13,2);Color(2),cout<<"●",Color(0),cout<<":无技能";
SetPos(14,1);Color(8),cout<<"▁▅";
SetPos(15,2);Color(2),cout<<"●",Color(0),cout<<":防御力为普通猪三倍";
SetPos(16,2);cout<<"○";
SetPos(17,2);cout<<"│:做空中简谐运动,受死范围";
SetPos(18,2);Color(2),cout<<"●",Color(0),cout<<" 为普通猪两倍。";
SetPos(19,2);cout<<" 有几率跳起或发射冲击波,冲";
SetPos(20,1);Color(2),cout<<"﹃●",Color(0),cout<<":开小胎与同类,可以引爆TNT!";
SetPos(18,20);Color(5),cout<<"按 y 开始游戏!";
A:if(kbhit()) g=_getch();
if(g!='y') goto A;
}
int main()
{
system("mode con cols=79 lines=22");
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
srand((unsigned)time(NULL));St:Start();system("cls");
memset(blt,0,sizeof(blt));memset(pig,0,sizeof(pig));
memset(boo,0,sizeof(boo));memset(m,0,sizeof(m));
T=put=K=K2=Sle=What=Pig=Sco=0;pigk=scok=-1;
Xy=4,yX=18,yY=6;Blt=20,Bot=20,Pit=60;Color(7);
SetPos(19,14);cout<<"■";
SetPos(20,13);cout<<" █▍";m[19][14]=m[20][13]=m[20][14]=1;
SetPos(21,0);for(int i=0;i<39;i++) cout<<"■",m[21][i]=1;
Color(0);What=rand()%5+1;
while(1)
{
if(Sco>=1500) break;
T++;K=0;Color(0);
if(Sco!=scok) SetPos(1,1),cout<<"分数:"<<Sco<<' ';
if(Pig!=pigk){SetPos(3,1);cout<<"危险值:";int aa=min(Sco/100,10);Pig+=aa;
SetPos(3,5);if(Pig<=2) Color(2);else if(Pig<=4) Color(16);else if(Pig<=6) Color(7);else if(Pig<=9) Color(6);
else if(Pig<=12) Color(3);else if(Pig<=15) Color(17);else Color(11);
for(int i=1;i<=Pig;i++) cout<<"■";Color(0);cout<<' '<<Pig;for(int i=1;i<=5;i++) cout<<" ";
if(Pig>18) break;Pig-=aa;}
scok=Sco;pigk=Pig;
if(GetAsyncKeyState(VK_LEFT)&0x8000&&Xy>0) Move(-2),Xy--,K=1;
if(GetAsyncKeyState(VK_RIGHT)&0x8000&&Xy<10) Move(-2),Xy++,K=1;
if(K==1)
{
if(put==0&&Sle==0) Move(0);
else Move(-1);
}
if(kbhit())
{
char g=_getch();
if(g=='x'||g=='X')
{
for(int i=Blt-10;i<=Blt;i++)
if(blt[i].go==0&&blt[i].boom==0&&blt[i].W!=1&&blt[i].W!=7)
{
blt[i].boom=1;
if(blt[i].W==2)
{
Blt++;blt[Blt].W=2;blt[Blt].vy=blt[i].vy*1.2;blt[Blt].vx=blt[i].vx+1;
blt[Blt].ax=blt[i].ax;blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].boom=1;
Blt++;blt[Blt].W=2;blt[Blt].vy=blt[i].vy*0.7;blt[Blt].vx=blt[i].vx-1;
blt[Blt].ax=blt[i].ax;blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].boom=1;
}
if(blt[i].W==3) blt[i].vy=fmax(blt[i].vy*1.5,2.5),blt[Blt].vx+=1,blt[i].ax=0;
if(blt[i].W==4)
{
blt[i].vx=-3;blt[i].ax=0.1;Blt++;blt[Blt].boom=1;blt[Blt].W=10;
blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].ax=blt[i].ax,blt[Blt].vx=1;
}
if(blt[i].W==5) Bot++,boo[Bot].X=blt[i].X,boo[Bot].Y=blt[i].Y,boo[Bot].S=1,boo[Bot].mS=5,blt[i].go=1;
if(blt[i].W==6) blt[i].ay=-1,blt[i].ax=0.3,blt[i].vx=min(blt[i].vx/2,(float)0);
break;
}
}
}
if(GetAsyncKeyState(' ')&0x8000&&K==0&&Sle==0)
{
if(put<=5) Move(1),yX=18,yY=Xy+1;
else if(put<=20) Move(2),yX=18,yY=Xy;
else if(put<=40) Move(3),yX=19,yY=Xy;
else if(put<=60) Move(4),yX=20,yY=Xy;
else if(put<=80) Move(5),yX=20,yY=Xy+1;
else Move(6),yX=20,yY=Xy+2;
if(put==0) K2=1;if(put==90) K2=-1;
if(K2==1) put+=min(rand()%7+1,90-put);
if(K2==-1) put-=min(rand()%7+1,put);
Cout(1,17,Xy+2);
}
if((!(GetAsyncKeyState(' ')&0x8000)&&(put!=0))||(put!=0&&K==1))
Move(-1),Creat(1,put),put=0,yX=18,yY=5,Sle=1,What=rand()%7+1,Creat(-1,-1),Sco=max(Sco-5,0);
for(int i=Blt-10;i<=Blt;i++) if(blt[i].go==0) Go(i);
for(int i=Bot-10;i<=Bot;i++) if(boo[i].go==0) Boom(i),Cout(2,0,0);
for(int i=Pit-50;i<=Pit;i++) if(pig[i].go==0) Kill(i);
if(Sle!=0) Move(-1);
else if(put==0) Move(0);
if(T%300==0) system("cls"),pigk=scok=-1;
if(T%100==0)
{
Color(7);
for(int i=0;i<=18;i++)
for(int j=0;j<=40;j++) if(m[i][j]==1&&T%100==0) SetPos(i,j),cout<<"■";
SetPos(19,14),cout<<"■",SetPos(20,13),cout<<" █▍";
SetPos(21,0);for(int i=0;i<39;i++) cout<<"■";Color(0);
}
if(T%min(50,(2000-Sco)/30)==0) Pig++,Creat(0,-1);
Sleep(30);
}
if(Sco<1500) {SetPos(9,17);system("color 7F");Color(11);cout<<"YOU DIE !";}
else {SetPos(9,17);system("color 6E");Color(5);cout<<"YOU WIN !";}
SetPos(11,16);Sleep(1000);cout<<"play again? (y/n)";Sleep(1000);char g;
A:if(kbhit()) g=_getch();SetPos(18,0);
if(g=='n') return 0;
else if(g!='y') goto A;
else if(g=='y') goto St;
}
由于东西太多了,下期继续出
如果你对我感兴趣的话,就关注我吧(づ ̄3 ̄)づ╭❤~