#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
int up=100000000000000,zd=0,xb=1,q=0;
int gjl[10]={1,2,3,4,5,6,7,8,9,10};
int zx[4]={0,0,-1,1};
int zy[4]={-1,1,0,0};
char mat[101][101];
int x,y,zrs=0,tt=0;
void print(char a[]){
int t=strlen(a);
for(int i=0;i<=t;i++){
cout<<a[i];
Sleep(10);
}
cout<<endl;
}
void start();
int main(){
system("title !战火英雄!-诚享传奇出品");
MessageBox(NULL,"抵制不良游戏,拒绝盗版游戏 注意自我保护,谨防受骗上当 适度游戏益脑,过度游戏伤身 合理安排时间,享受健康生活","温馨提示",MB_OKCANCEL);
cout<<
"一个军事海岛突然遭受黑衣人的袭击,上面的军队抵挡不住,军事海岛最终被黑衣人控制。"<<
"这向人们预示了灾难可能将要到来......"<<endl;
system("pause");
system("cls");
cout<<
"战火英雄1-新的征途"<<endl<<
"版本号2.0"<<endl;
system("pause");
start();
cout<<"再来一次?输入1"<<endl;
int ttttt;
cin>>ttttt;
if(ttttt==1)start();
return 0;
}
void start(){
bool flag=1;
system("cls");
print("地图大小?(n*n)");
int n;
cin>>n;
print("(飞机的呼呼声)");
print("长官:准备跳伞!祝你好运,新兵");
print("落点x,y?");
cout<<"x:";
cin>>x;
cout<<"y:";
cin>>y;
system("pause");
system("cls");
srand(time(NULL));
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++){
int k=rand()%10+1;
if(k==1)mat[i][j]='.';
else if(k==2)mat[i][j]='H';
else if(k==3)mat[i][j]='X';
else if(k==4)mat[i][j]='P';
else if(k==5)mat[i][j]='D';
else if(k==6)mat[i][j]='.';
else if(k==7)mat[i][j]='.';
else mat[i][j]='.';
}
mat[x][y]='.';
mat[x+1][y]='.';
mat[x-1][y]='.';
mat[x][y+1]='.';
mat[x][y-1]='.';
int bs=0,dp=0;
while(1){
bs++;
if(bs==90||bs==190)cout<<"还有10步缩圈!"<<endl;
if(bs==95||bs==195)cout<<"还有5步缩圈!"<<endl;
if(bs==99||bs==199)cout<<"还有1步缩圈!"<<endl;
if(bs==100){
dp++;
for(int i=1;i<=n;i++)mat[dp][i]='#',mat[n-dp+1][i]='#',mat[i][dp]='#',mat[i][n-dp+1]='#';
}
if(bs==200){
dp++;
for(int i=1;i<=n;i++)mat[dp][i]='#',mat[n-dp+1][i]='#',mat[i][dp]='#',mat[i][n-dp+1]='#';
}
if(bs%15==0){
int kx=rand()%10+1,ky=rand()%10+1;
mat[kx][ky]='B';
}
zrs=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++){
int ttt=rand()%4;
if(mat[i][j]=='P'){
if(mat[i+zx[ttt]][j+zy[ttt]]=='.'){
mat[i][j]='.';
mat[i+zx[ttt]][j+zy[ttt]]='P';
}
if(i+zx[ttt]==x&&j+zy[ttt]==y){
mat[i][j]='.';
mat[i+zx[ttt]][j+zy[ttt]]='P';
}
}
else if(mat[i][j]=='D'){
if(mat[i+zx[ttt]][j+zy[ttt]]=='.'||mat[i+zx[ttt]][j+zy[ttt]]=='P'){
mat[i][j]='.';
mat[i+zx[ttt]][j+zy[ttt]]='D';
}
if(i+zx[ttt]==x&&j+zy[ttt]==y){
mat[i][j]='.';
mat[i+zx[ttt]][j+zy[ttt]]='D';
}
}
}
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++){
if(mat[i][j]=='P'){
zrs++;
}
else if(mat[i][j]=='D'){
zrs+=4;
}
}
system("cls");
cout<<"你有"<<up<<"滴血,剩下"<<zd<<"个子弹,剩下"<<xb<<"个血包,枪的攻击力为"<<gjl[q]<<endl;
cout<<"+";
for(int i=1;i<=n;i++)cout<<" -";
cout<<" +"<<endl;
for(int i=1;i<=n;i++){
cout<<"| ";
for(int j=1;j<=n;j++){
if(i==x&&j==y)cout<<"+ ";
else if(abs(i-x)>2||abs(j-y)>2)cout<<"? ";
else if(mat[i][j]=='#')cout<<"# ";
else cout<<mat[i][j]<<" ";
}
cout<<"|"<<endl;
}
cout<<"+";
for(int i=1;i<=n;i++)cout<<" -";
cout<<" +"<<endl;
cout<<"当前剩下"<<zrs<<"个人,你淘汰了"<<tt<<"个人,时间是"<<bs<<"秒"<<endl;
cout<<
"+ 当前位置 "<<
"H 房子"<<endl<<
"K 空房子 "<<
"X 陷阱"<<endl<<
"P 敌人 "<<
"D 敌人4人小队"<<endl<<
". 平原 "<<"B 空投(开局每15步跟新)"<<endl<<
"? 视野外区域 "<<"# 毒圈(开局100步后开始)"<<endl;
cout<<"输入m打开地图"<<endl;
cout<<"可以输入:w:向上走一格。a:向左走一格。s:向下走一格。d:向右走一格。q: 使用血包 \n";
if(bs%15==12)cout<<"还有3步发放空投"<<endl;
if(bs%15==13)cout<<"还有2步发放空投"<<endl;
if(bs%15==14)cout<<"还有1步发放空投"<<endl;
char t=getch();
if(t=='m'){
for(int i=1;i<=n;i++){
cout<<"| ";
for(int j=1;j<=n;j++){
if(i==x&&j==y)cout<<"+ ";
else if(mat[i][j]=='P'||mat[i][j]=='D')cout<<". ";
else cout<<mat[i][j]<<" ";
}
cout<<"|"<<endl;
}
system("pause");
}
int nx=x,ny=y;
if(t=='q'&&xb>=1){
xb--;
up=min(100,up+5);
}
if(mat[x][y]=='P'){
int ttt=rand()%100+1;
cout<<"遇到了生命为"<<ttt<<"的敌人!"<<endl;mat[x][y]='.';
if(ttt<zd*gjl[q]&&(rand()%100)>=25){
cout<<"打死了敌人,花费了"<<ttt/gjl[q]<<"颗子弹"<<endl;
zd-=ttt/gjl[q];
int xx=rand()%10+1,yy=rand()%1+1;
cout<<"获得"<<xx<<"个子弹,获得"<<yy<<"个血包"<<endl;
zd+=xx,xb+=yy;
int tttt=rand()%10;
cout<<"获得一把攻击力为"<<gjl[tttt]<<"的枪"<<endl;
if(tttt>=q)q=tttt;
tt+=1;
}else{
int ttt=rand()%50+1;
cout<<"没打过敌人!损失"<<ttt<<"滴血"<<endl;
up-=ttt;
}
system("pause");
}else if(mat[x][y]=='D'){
int ttt=rand()%500+1;
cout<<"遇到了总生命为"<<ttt<<"的敌人!"<<endl;mat[x][y]='.';
if(ttt<zd*gjl[q]&&(rand()%100)>=60){
cout<<"打死了敌人,花费了"<<ttt/gjl[q]<<"颗子弹"<<endl;
zd-=ttt/gjl[q];
int xx=rand()%50+1,yy=rand()%3+1;
cout<<"获得"<<xx<<"个子弹,获得"<<yy<<"个血包"<<endl;
zd+=xx,xb+=yy;
int tttt=rand()%10;
cout<<"获得一把攻击力为"<<gjl[tttt]<<"的枪"<<endl;
if(tttt>=q)q=tttt;
tt+=4;
}else{
int ttt=rand()%100;
cout<<"没打过敌人!损失"<<ttt<<"滴血"<<endl;
up-=ttt;
}
system("pause");
}
if(t=='w')x--;
if(t=='s')x++;
if(t=='a')y--;
if(t=='d')y++;
if(x==0 || y==0 || x==n+1 || y==n+1){
cout<<"走出了边界!\n";
x=nx,y=ny;system("pause");
}
else if(mat[x][y]=='H'||mat[x][y]=='A'||mat[x][y]=='B'){
cout<<"搜刮房子,获得物资!\n";
mat[x][y]='K';
int xx=rand()%50+1,yy=rand()%2+1;
cout<<"获得"<<xx<<"个子弹,获得"<<yy<<"个血包"<<endl;
zd+=xx,xb+=yy;
int ttt=rand()%10+1;
if(ttt==10){
int tttt=rand()%10;
cout<<"获得一把攻击力为"<<gjl[tttt]<<"的枪"<<endl;
if(tttt>=q)q=tttt;
}
system("pause");
}
else if(mat[x][y]=='X'){
cout<<"遇到了陷阱,减少5滴血!\n";
up-=5;system("pause");
}else if(mat[x][y]=='#'){
cout<<"遇到了毒圈,减少5滴血!\n";
up-=5;system("pause");
}else if(mat[x][y]=='P'){
int ttt=rand()%150+1;
cout<<"遇到了生命为"<<ttt<<"的敌人!"<<endl;mat[x][y]='.';
if(ttt<zd*gjl[q]&&(rand()%100)>=25){
cout<<"打死了敌人,花费了"<<ttt/gjl[q]<<"颗子弹"<<endl;
zd-=ttt/gjl[q];
int xx=rand()%10+1,yy=rand()%1+1;
cout<<"获得"<<xx<<"个子弹,获得"<<yy<<"个血包"<<endl;
zd+=xx,xb+=yy;
int tttt=rand()%5;
cout<<"获得一把攻击力为"<<gjl[tttt]<<"的枪"<<endl;
if(tttt>=q)q=tttt;
tt+=1;
}else{
int ttt=rand()%50+1;
cout<<"没打过敌人!损失"<<ttt<<"滴血"<<endl;
up-=ttt;
}
system("pause");
}else if(mat[x][y]=='D'){
int ttt=rand()%700+1;
cout<<"遇到了总生命为"<<ttt<<"的敌人!"<<endl;mat[x][y]='.';
if(ttt<zd*gjl[q]&&(rand()%100)>=60){
cout<<"打死了敌人,花费了"<<ttt/gjl[q]<<"颗子弹"<<endl;
zd-=ttt/gjl[q];
int xx=rand()%50+1,yy=rand()%3+1;
cout<<"获得"<<xx<<"个子弹,获得"<<yy<<"个血包"<<endl;
zd+=xx,xb+=yy;
int tttt=rand()%5;
cout<<"获得一把攻击力为"<<gjl[tttt]<<"的枪"<<endl;
if(tttt>=q)q=tttt;
tt+=4;
}else{
int ttt=rand()%100;
cout<<"没打过敌人!损失"<<ttt<<"滴血"<<endl;
up-=ttt;
}
system("pause");
}
if(up<1){
flag=0;
break;
}
if(zrs==0){
break;
}
}
if(flag==0){
system("cls");
cout<<"你倒在了血泊之中..."<<endl;
Sleep(1000);
cout<<"耳边传来敌人的讥笑声..."<<endl;
Sleep(1000);
cout<<"眼前一片黑暗..."<<endl;
Sleep(1000);
cout<<"任务失败"<<endl;
}else{
cout<<"任务成功"<<endl;
system("cls");
cout<<"你望着晚霞,陷入了沉思..."<<endl;
Sleep(1000);
cout<<"这里根本没有敌人基地,派我来干什么呢..."<<endl;
Sleep(1000);
cout<<"你回忆着刚刚发生的一幕...好像有什么不对经..."<<endl;
Sleep(1000);
cout<<"敌人拿的居然是我军的枪!"<<endl;
Sleep(1000);
cout<<"来接你的直升机缓缓降落在你身旁。任务看似结束了,但是又有一个意味深长的结局......敬请期待下一部"<<endl;
}
return;
}
02-06
7262
01-21
1472