这个小游戏别人发布的,我拿去改了一下,改了一些bug,加入了出售,完善了外挂功能和状态界面,加入了第二十五关(伤害有点变态),有什么意见或者有什么新玩法可以说,我看到了会改。
原作点这
下面是我改的代码
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
double shanghai[26]={
1,2,4,8,16,32,64,128,256,512,1024,2048,5096,10192,20384,40768,81536,163072,326144,652288,1304576,2609152,5218304,10436608,20873216,104366080};
double bosshealth[26]={
1,2,4,8,16,32,64,128,256,512,1024,2048,5096,10192,20384,40768,81536,163072,326144,652288,1304576,2609152,5218304,10436608,20873216,104366080};
double wj_shanghai=1,wj_health=10,wj_max_health=10,boss,wj_money;
double wgshuru,wgshanghai=0,wgzuidashengming=0;
void chushihua();
void game();
void gongji();
void goumai();
void shangdian();
void zhujiemian();
void fangyu();
void cend();
void chushou();
void gongji_cs();
void fangyu_cs();
void dd();
void cd();
void print(char[]);
int bishou=0,caidao=0,jian=0,shenjian=0;
double bishou_1=5,caidao_1=17,jian_1=68,shenjian_1=210;
int hat=0,douhui=0,hudun=0,hunjia=0,shendun=0;
double hat_1=7,douhui_1=21,hudun_1=49,hunjia_1=89,shendun_1=210;
long double c[100];
void dd()
{
ifstream infile;
ofstream outfile;
int i=1;
infile.open("打怪小游戏存档信息.dll");
while (!infile.eof()&&i<=200)
{
infile >> c[i];
i++;
}
wj_money=c[1];
bishou=c[2];
caidao=c[3];
jian=c[4];;
shenjian=c[5];
hat=c[6];
douhui=c[7];
hudun=c[8];
hunjia=c[9];
shendun=c[10];
wgshanghai=c[11];
wgzuidashengming=c[12];
}
void cd()
{
ofstream outfile[3];
c[1]=wj_money;
c[2]=bishou;
c[3]=caidao;
c[4]=jian;
c[5]=shenjian;
c[6]=hat;
c[7]=douhui;
c[8]=hudun;
c[9]=hunjia;
c[10]=shendun;
c[11]=wgshanghai;
c[12]=wgzuidashengming;
outfile[0].open("打怪小游戏存档信息.dll");
for(int i=1;i<=200;i++)
outfile[0]<<c[i]<<endl;
}
void cend()
{
system("cls");
ABC:
cout<<"G";
Sleep(5);
cout<<"A";
Sleep(5);
cout<<"M";
Sleep(5);
cout<<"E ";
Sleep(5);
cout<<"O";
Sleep(5);
cout<<"V";
Sleep(5);
cout<<"E";
Sleep(5);
cout<<"R"<<endl;
Sleep(5);
cout<<"是否保留存档内游戏数据?(清除后无法找回)\n1.yes 2.no";
char a=getch();
if(a!='1'&&a!='2')
{
system("cls");
goto ABC;
}
else
{
if(a=='1')
{
system("cls");
cout<<"游戏数据保留成功!"<<endl;
}
if(a=='2')
{
system("cls");
ofstream outfile[3];
c[1]=0;
c[2]=0;
c[3]=0;
c[4]=0;
c[5]=0;
c[6]=0;
c[7]=0;
c[8]=0;
c[9]=0;
c[10]=0;
c[11]=0;
c[12]=0;
outfile[0].open("打怪小游戏存档信息.dll");
for(int i=1;i<=200;i++)
outfile[0]<<c[i]<<endl;
cout<<"游戏数据已清除!"<<endl;
}
Sleep(1000);
exit(1);
}
}
void game()
{
int k;
chushihua();
IO:
printf("请输入对手等级\n普通对手(0~24) 最终boss(25)\n");
cout<<"提醒:最终boss单次伤害最低高达208732162。"<<endl;
scanf("%d",&k);
if(k>25||k<0)
{
system("cls");
goto IO;
}
boss=bosshealth[k];
system("cls");
while(wj_health>=0)
{
srand(time(NULL));
QP:
printf("1.逃跑 2.进攻\n");
char s=getch();
if(s<'1'||s>'2')
{
system("cls");
goto QP;
}
if(s=='1')
{
system("cls");
zhujiemian();
}
system("cls");
double l=shanghai[k]*((rand()%2)+1)+fabs(double(rand()%100/100-2));
printf("对手对你造成了%lf点伤害\n",l);
wj_health-=l;
printf("你当前剩余血量:%lf\n",wj_health);
if(wj_health<=0)
cend();
double o=wj_shanghai*((rand()%2)+1)+double(rand()%10/10);
boss-=o;
if(boss<=0)
boss=0;
printf("你对对手造成了%lf点伤害\n",o);
printf("对手当前剩余血量:%lf\n\n",boss);
if(boss<=0)
{
printf("胜利!\n获得%lf金币\n\n当前剩余血量