C++#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
const int xex[]={0,200,500,1000,1000,1000,3000,3000,5000,5000,5000,10000,10000,10000,10000,10000,20000,30000,40000,50000,100000};
int dhp,hp,t,t1,t2,kill,dide,didechenjiu[110],killchenjiu[110],start,ex,dengji=1,tot,hdjf;
int main()
{
SetConsoleTitle("勇士之征(正式公测版1.0.0.0))");
cout<<"勇士之征公测啦!(游戏改为右键输入,降低攻击随机性)"<<endl;
Sleep(3000);
system("cls");
hp=150;
srand(time(0));
freopen("dhp.txt","r",stdin);
cin>>dhp;
cin>>dide;
cin>>kill;
cin>>ex;
cin>>dengji;
cin>>hdjf;
for(int i=1;i<=5;i++)
{
cin>>didechenjiu[i];
}
for(int i=1;i<=7;i++)
{
cin>>killchenjiu[i];
}
fclose(stdin);
if(!dhp)
{
dhp=40000;
dide=0;
kill=0;
ex=0;
dengji=1;
hdjf=0;
}
system("cls");
while(1)
{
if(dengji!=20){
printf("——————————————————————————————————————\n");
printf("| 人物 |\n");
printf("| 离下一级还有:%7d/%7d |\n",ex,xex[dengji]);
printf("——————————————————————————————————————\n");
printf("| | |\n");
printf("| | boss战 |\n");
printf("| 闯关 | boss血:%5d/40000 |\n",dhp);
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("——————————————————————————————————————\n");
printf("| | |\n");
printf("| | |\n");
printf("| 宠物 | 活动 |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("——————————————————————————————————————\n");
}
else
{
printf("——————————————————————————————————————\n");
printf("| 人物 |\n");
printf("| 已满级 |\n",ex,xex[dengji]);
printf("——————————————————————————————————————\n");
printf("| | |\n");
printf("| | boss战 |\n");
printf("| 闯关 | boss血:%5d/40000 |\n",dhp);
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("——————————————————————————————————————\n");
printf("| | |\n");
printf("| | |\n");
printf("| 宠物 | 活动 |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("| | |\n");
printf("——————————————————————————————————————\n");
}
while(KEY_DOWN(VK_RBUTTON)==0) ex=ex;
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X=0; pos.Y=0;
POINT p;
GetCursorPos(&p);
SetConsoleCursorPosition(hOut,pos);
system("cls");
if(p.x<115||p.y<140||p.x>640||p.y>430) continue;
if(p.x<475&&p.y<425)
{
system("cls");
MessageBox(NULL,"该功能未开放!","帅气的开发者",MB_ICONINFORMATION|MB_OK);
}
else
{
if(p.x>475&&p.y<425)
{
while(dhp>0)
{
if(hp<=0)
{
cout<<"你倒下了!"<<endl;
Sleep(3000);
system("cls");
dide++;
if(dide==10)
{
cout<<"解锁成就:萌新的感觉";
didechenjiu[1]=1;
Sleep(4000);
}
if(dide==50)
{
cout<<"解锁成就:坚持";
didechenjiu[2]=1;
Sleep(4000);
}
if(dide==100)
{
cout<<"解锁成就:非常会肝";
didechenjiu[3]=1;
Sleep(4000);
}
if(dide==300)
{
cout<<"解锁成就:疯狂地肝";
didechenjiu[4]=1;
Sleep(4000);
}
if(dide==1000)
{
cout<<"解锁成就:一代肝师";
didechenjiu[5]=1;
Sleep(4000);
}
freopen("dhp.txt","w",stdout);
cout<<dhp<<endl;
cout<<dide<<endl;
cout<<kill<<endl;
cout<<ex<<endl;
cout<<dengji<<endl;
cout<<hdjf<<endl;
for(int i=1;i<=5;i++)
{
cout<<didechenjiu[i]<<endl;
}
for(int i=1;i<=7;i++)
{
cout<<killchenjiu[i]<<endl;
}
fclose(stdout);
break;
}
t=rand()%20;
if(t==0)
{
cout<<"你回血了!"<<endl;
tot=(rand()%50+50);
ex+=tot*35;
hp=hp+tot;
cout<<"你的血:"<<hp;
Sleep(1000);
system("cls");
}
if(t==1||t==2||t==3)
{
cout<<"你打出暴击了!"<<endl;
tot=(rand()%1500)+1000;
ex+=tot;
dhp=dhp-tot;
cout<<"怪的血:"<<dhp;
Sleep(1000);
system("cls");
}
if(t==4)
{
cout<<"你打出天崩地裂:火球术了!"<<endl;
tot=(rand()%5000)+1000;
ex+=tot;
dhp=dhp-tot;
t2+=rand()%1+2;
cout<<"怪的血:"<<dhp;
Sleep(2500);
system("cls");
}
if(t==5)
{
cout<<"你打出冰冻术了!"<<endl;
tot=(rand()%300)+200;
ex+=tot;
dhp=dhp-tot;
t1+=rand()%1+1;
cout<<"怪的血:"<<dhp;
Sleep(2500);
system("cls");
}
if(t==6)
{
cout<<"你打出雷击术了!"<<endl;
tot=(rand()%3000)+2000;
ex+=tot;
dhp=dhp-tot;
cout<<"怪的血:"<<dhp;
Sleep(2500);
system("cls");
for(int i=1;i<=7;i++)
{
tot=(rand()%60)+30;
ex+=tot;
dhp=dhp-tot;
cout<<"怪的血:"<<dhp<<endl;
Sleep(400);
}
Sleep(2500);
system("cls");
}
if(t==7)
{
cout<<"你打出天崩地裂:集气攻击了!"<<endl;
for(int i=1;i<=3;i++)
{
cout<<"聚气:第"<<i<<"回合"<<endl;
Sleep(800);
system("cls");
if(!t1)
{
cout<<"怪物攻击!"<<endl;
hp=hp-10-(rand()%5+1);
cout<<"你的血:"<<hp;
Sleep(1000);
system("cls");
}
else
{
t1--;
cout<<"怪物被冰冻!"<<endl;
tot=(rand()%10)+10;
ex+=tot;
dhp=dhp-tot;
cout<<"怪的血:"<<dhp;
Sleep(1000);
system("cls");
}
if(hp<=0)
{
cout<<"你倒下了!"<<endl;
Sleep(3000);
system("cls");
dide++;
if(dide==10)
{
cout<<"解锁成就:萌新的感觉";
didechenjiu[1]=1;
Sleep(4000);
}
if(dide==50)
{
cout<<"解锁成就:坚持";
didechenjiu[2]=1;
Sleep(4000);
}
if(dide==100)
{
cout<<"解锁成就:非常会肝";
didechenjiu[3]=1;
Sleep(4000);
}
if(dide==300)
{
cout<<"解锁成就:疯狂地肝";
didechenjiu[4]=1;
Sleep(4000);
}
if(dide==1000)
{
cout<<"解锁成就:一代肝师";
didechenjiu[5]=1;
Sleep(4000);
}
freopen("dhp.txt","w",stdout);
cout<<dhp<<endl;
cout<<dide<<endl;
cout<<kill<<endl;
cout<<ex<<endl;
cout<<dengji<<endl;
cout<<hdjf<<endl;
for(int i=1;i<=5;i++)
{
cout<<didechenjiu[i]<<endl;
}
for(int i=1;i<=7;i++)
{
cout<<killchenjiu[i]<<endl;
}
fclose(stdout);
break;
}
if(dhp<=0)
{
cout<<"你赢了!"<<endl;
Sleep(5000);
system("cls");
kill++;
if(kill==1)
{
cout<<"解锁成就:第一个怪";
killchenjiu[1]=1;
Sleep(4000);
}
if(kill==2)
{
cout<<"解锁成就:小试牛刀";
killchenjiu[2]=1;
Sleep(4000);
}
if(kill==3)
{
cout<<"解锁成就:初露锋芒";
killchenjiu[3]=1;
Sleep(4000);
}
if(kill==10)
{
cout<<"解锁成就:渐入佳境";
killchenjiu[4]=1;
Sleep(4000);
}
if(kill==50)
{
cout<<"解锁成就:锋芒毕露";
killchenjiu[5]=1;
Sleep(4000);
}
if(kill==100)
{
cout<<"解锁成就:斩妖除魔";
killchenjiu[6]=1;
Sleep(4000);
}
if(kill==300)
{
cout<<"解锁成就:妖之克星";
killchenjiu[7]=1;
Sleep(4000);
}
freopen("dhp.txt","w",stdout);
cout<<40000<<endl;
cout<<dide<<endl;
cout<<kill<<endl;
cout<<ex<<endl;
cout<<dengji<<endl;
cout<<hdjf<<endl;
for(int i=1;i<=5;i++)
{
cout<<didechenjiu[i]<<endl;
}
for(int i=1;i<=7;i++)
{
cout<<killchenjiu[i]<<endl;
}
fclose(stdout);
break;
}
}
dhp=dhp-(rand()%1000+1)-4000;
cout<<"Boom!怪的血:"<<dhp;
Sleep(2500);
system("cls");
if(rand()%20+1==1)
{
cout<<"由于集气攻击,空气爆炸了"<<endl;
Sleep(600);
cout<<"磁... ..."<<endl;
Sleep(400);
cout<<"裂... ..."<<endl;
Sleep(400);
cout<<"爆... ..."<<endl;
Sleep(400);
dhp=dhp-15000;
if(dhp<=0)
{
cout<<"你赢了!"<<endl;
Sleep(5000);
system("cls");
kill++;
if(kill==1)
{
cout<<"解锁成就:第一个怪";
killchenjiu[1]=1;
Sleep(4000);
}
if(kill==2)
{
cout<<"解锁成就:小试牛刀";
killchenjiu[2]=1;
Sleep(4000);
}
if(kill==3)
{
cout<<"解锁成就:初露锋芒";
killchenjiu[3]=1;
Sleep(4000);
}
if(kill==10)
{
cout<<"解锁成就:渐入佳境";
killchenjiu[4]=1;
Sleep(4000);
}
if(kill==50)
{
cout<<"解锁成就:锋芒毕露";
killchenjiu[5]=1;
Sleep(4000);
}
if(kill==100)
{
cout<<"解锁成就:斩妖除魔";
killchenjiu[6]=1;
Sleep(4000);
}
if(kill==300)
{
cout<<"解锁成就:妖之克星";
killchenjiu[7]=1;
Sleep(4000);
}
freopen("dhp.txt","w",stdout);
cout<<40000<<endl;
cout<<dide<<endl;
cout<<kill<<endl;
cout<<ex<<endl;
cout<<dengji<<endl;
cout<<hdjf<<endl;
for(int i=1;i<=5;i++)
{
cout<<didechenjiu[i]<<endl;
}
for(int i=1;i<=7;i++)
{
cout<<killchenjiu[i]<<endl;
}
fclose(stdout);
break;
}
cout<<"怪的血:"<<dhp;
Sleep(2000);
system("cls");
cout<<"你倒下了!"<<endl;
Sleep(3000);
system("cls");
dide++;
if(dide==10)
{
cout<<"解锁成就:萌新的感觉";
didechenjiu[1]=1;
Sleep(4000);
}
if(dide==50)
{
cout<<"解锁成就:坚持";
didechenjiu[2]=1;
Sleep(4000);
}
if(dide==100)
{
cout<<"解锁成就:非常会肝";
didechenjiu[3]=1;
Sleep(4000);
}
if(dide==300)
{
cout<<"解锁成就:疯狂地肝";
didechenjiu[4]=1;
Sleep(4000);
}
if(dide==1000)
{
cout<<"解锁成就:一代肝师";
didechenjiu[5]=1;
Sleep(4000);
}
freopen("dhp.txt","w",stdout);
cout<<dhp<<endl;
cout<<dide<<endl;
cout<<kill<<endl;
for(int i=1;i<=5;i++)
{
cout<<didechenjiu[i]<<endl;
}
for(int i=1;i<=7;i++)
{
cout<<killchenjiu[i]<<endl;
}
fclose(stdout);
return 0;
}
}
if(t>7)
{
cout<<"你打出普攻了!"<<endl;
tot=(rand()%300)+300;
ex+=tot;
dhp=dhp-tot;;
cout<<"怪的血:"<<dhp;
Sleep(1000);
system("cls");
}
if(t2)
{
t2--;
cout<<"怪物被灼烧!"<<endl;
tot=(rand()%150)+100;
ex+=tot;
dhp=dhp-tot;
cout<<"怪的血:"<<dhp;
Sleep(1000);
system("cls");
}
if(!t1)
{
cout<<"怪物攻击!"<<endl;
hp=hp-10-((rand())%5+1);
cout<<"你的血:"<<hp;
Sleep(1000);
system("cls");
}
else
{
t1--;
cout<<"怪物被冰冻!"<<endl;
tot=(rand()%15)+10;
ex+=tot;
dhp=dhp-tot;
cout<<"怪的血:"<<dhp;
Sleep(1000);
system("cls");
}
}
cout<<"你赢了!"<<endl;
Sleep(5000);
system("cls");
kill++;
if(kill==1)
{
cout<<"解锁成就:第一个怪";
killchenjiu[1]=1;
Sleep(4000);
}
if(kill==2)
{
cout<<"解锁成就:小试牛刀";
killchenjiu[2]=1;
Sleep(4000);
}
if(kill==3)
{
cout<<"解锁成就:初露锋芒";
killchenjiu[3]=1;
Sleep(4000);
}
if(kill==10)
{
cout<<"解锁成就:渐入佳境";
killchenjiu[4]=1;
Sleep(4000);
}
if(kill==50)
{
cout<<"解锁成就:锋芒毕露";
killchenjiu[5]=1;
Sleep(4000);
}
if(kill==100)
{
cout<<"解锁成就:斩妖除魔";
killchenjiu[6]=1;
Sleep(4000);
}
if(kill==300)
{
cout<<"解锁成就:妖之克星";
killchenjiu[7]=1;
Sleep(4000);
}
freopen("dhp.txt","w",stdout);
cout<<40000<<endl;
cout<<dide<<endl;
cout<<kill<<endl;
for(int i=1;i<=5;i++)
{
cout<<didechenjiu[i]<<endl;
}
for(int i=1;i<=7;i++)
{
cout<<killchenjiu[i]<<endl;
}
fclose(stdout);
break;
}
else
{
if(p.x<475&&p.y>425)
{
system("cls");
MessageBox(NULL,"该功能未开放!","帅气的开发者",MB_ICONINFORMATION|MB_OK);
}
else
{
if(p.x>475&&p.y>425)
{
system("cls");
MessageBox(NULL,"该功能未开放!","帅气的开发者",MB_ICONINFORMATION|MB_OK);
}
else
{
system("cls");
}
}
}
}
}
}