0
已解决
朱瑾文
新手光能
新手光能
游戏收集+认领
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
int a[1000][1000],fs=0;
void mp(int x,int y)
{
int x1=x-9,x2=x+9,y1=y-9,y2=y+9;
if(x1<1)
{
x2+=(1-x1);
x1=1;
}
if(y1<1)
{
y2+=(1-y1);
y1=1;
}
if(x2>20)
{
x1-=(x2-20);
x2=20;
}
if(y2>20)
{
y1-=(y2-20);
y2=20;
}
cout<<"你有";
cout<<fs<<"分\n";
cout<<" ";
for(int i=x1;i<=x2;i++)
if(i<10)
cout<<' '<<i;
else
cout<<i;
cout<<"\n ______________________________________\n";
for(int i=y1;i<=y2;i++)
{
if(i<10)cout<<" "<<i<<'|';
else cout<<i<<'|';
for(int j=x1;j<=x2;j++)
{
if(a[j][i]==1)cout<<"你";
else if(a[j][i]==2)cout<<"■";
else if(a[j][i]==3)cout<<"☆";
else cout<<" ";
}
if(i<10)cout<<'|'<<" "<<i;
else cout<<'|'<<i;
cout<<endl;
}
cout<<"___________________________________________\n";
cout<<" ";
for(int i=x1;i<=x2;i++)
if(i<10)
cout<<' '<<i;
else
cout<<i;
}
int main()
{
int x,y;
cin>>x>>y;
a[x][y]=1;
for(int i=1;i<=20;i++)
for(int j=1;j<=20;j++)
if(rand()%8<2)
a[i][j]=2;
else if(rand()%3==1)
a[i][j]=3;
while(1)
{
system("cls");
mp(x,y);
char c;
c=getche();
if(c==75&&x-1>0&&a[x-1][y]!=2)
{
if(a[x-1][y]==3)fs++;
a[x][y]=0;
a[x-1][y]=1;
x-=1;
}
if(c==72&&y-1>0&&a[x][y-1]!=2)
{
if(a[x][y-1]==3)fs++;
a[x][y]=0;
a[x][y-1]=1;
y-=1;
}
if(c==77&&x+1<=20&&a[x+1][y]!=2)
{
if(a[x+1][y]==3)fs++;
a[x][y]=0;
a[x+1][y]=1;
x+=1;
}
if(c==80&&y+1<=20&&a[x][y+1]!=2)
{
if(a[x][y+1]==3)fs++;
a[x][y]=0;
a[x][y+1]=1;
y+=1;
}
}
}
//游戏吃星星
#include<stdio.h>
#include<windows.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
#include<queue>
#include<ctype.h>
#define A 17 //地图的高
#define B 17 //地图的宽
#define C 30 //雷的总数
using namespace std;
//全局变量
DWORD a,b;
char map[A][B],news,spare;
int BoomTotalNum,floatx,floaty,flag[A][B],flagnum,mode,slect[A][B],game;
//颜色属性
const WORD FORE_BLUE = FOREGROUND_BLUE; //蓝色文本属性
const WORD FORE_GREEN = FOREGROUND_GREEN; //绿色文本属性
const WORD FORE_RED = FOREGROUND_RED; //红色文本属性
//开垦地图结构体
struct node {
int x;
int y;
};
queue <node> dui;
//打印位置
void position(int x,int y) {
COORD pos={x,y};
HANDLE Out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(Out,pos);
}
//隐藏光标
void Hide() {
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);//获取控制台光标信息
CursorInfo.bVisible = false; //隐藏控制台光标
SetConsoleCursorInfo(handle, &CursorInfo);//设置控制台光标状态
}
//初始化
void Beginning() {
while(!dui.empty()) {
dui.pop();
}
game=1;
//BoomTotalNum=C;
floatx=A/2;
floaty=B/2;
flagnum=0;
BoomTotalNum=C;
mode=0;
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); //获得标准输出设备句柄
CONSOLE_SCREEN_BUFFER_INFO csbi; //定义窗口缓冲区信息结构体
GetConsoleScreenBufferInfo(handle_out, &csbi); //获得窗口缓冲区信息
int x,y;
srand((unsigned)time(0));
for(int i=0;i<A;i++) for(int j=0;j<B;j++) {
map[i][j]=' ';
flag[i][j]=0;
slect[i][j]=0;
}
while(BoomTotalNum) {
x=rand()%A;
y=rand()%B;
if(map[x][y]==' ') {
map[x][y]='@';
BoomTotalNum--;
}
}
SetConsoleTextAttribute(handle_out, FORE_GREEN);
for(int i=0;i<A;i++) {
for(int j=0;j<B;j++) printf("█");
printf("\n");
}
position(floaty*2,floatx);
SetConsoleTextAttribute(handle_out, FORE_RED);
printf(""); //光标位置
position(44,9);
printf("扫雷模式");
position(44,5);
printf("剩余雷数:%d ",C-flagnum);
SetConsoleTextAttribute(handle_out, FORE_GREEN);
position(5,22);
printf("按“空格”切换模式");
position(5,23);
printf("按“Enter”确认");
position(5,24);
printf("按“方向键”选择方块");
}
//打印地图的一块儿
void Lump(int xx,int yy) {
switch(map[xx][yy]) {
case '1' : printf("①");break; //周围雷的数量(下同)
case '2' : printf("②");break;
case '3' : printf("③");break;
case '4' : printf("④");break;
case '5' : printf("⑤");break;
case '6' : printf("⑥");break;
case '7' : printf("⑦");break;
case '8' : printf("⑧");break;
case ' ' :
if(xx==floatx&&yy==floaty) {
if(flag[xx][yy]==0) {
if(mode%2==0) printf("");
else printf("");
}
else printf("");
}
else {
if(flag[xx][yy]==0) printf("█");
else printf("");
}
break;
case '@' :
if(xx==floatx&&yy==floaty) {
if(flag[xx][yy]==0) {
if(mode%2==0) printf("");
else printf("");
}
else printf("");
}
else {
if(flag[xx][yy]==0) printf("█");
else printf("");
}
break;
case 'x' : if(floatx==xx&&floaty==yy) printf(""); else printf(" ");break; //已经挖开的空白
}
}
//移动光标
void Move() {
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); //获得标准输出设备句柄
CONSOLE_SCREEN_BUFFER_INFO csbi; //定义窗口缓冲区信息结构体
GetConsoleScreenBufferInfo(handle_out, &csbi); //获得窗口缓冲区信息
int xxx,yyy;
xxx=floatx;
yyy=floaty;
switch(news) {
case 72 : floatx--;break; //上
case 80 : floatx++;break; //下
case 75 : floaty--;break; //左
case 77 : floaty++;break; //右
}
if(floatx==-1) floatx=A-1; floatx%=A; //两端穿模处理
if(floaty==-1) floaty=B-1; floaty%=B;
position(yyy*2,xxx);
SetConsoleTextAttribute(handle_out, FORE_GREEN);
Lump(xxx,yyy); //删除原位置
if(map[floatx][floaty]=='x') {
position(floaty*2,floatx);
printf(" ");
}
position(floaty*2,floatx);
SetConsoleTextAttribute(handle_out, FORE_BLUE);
Lump(floatx,floaty); //更新新位置
}
//插旗和排雷模式切换
void Mode() {
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); //获得标准输出设备句柄
CONSOLE_SCREEN_BUFFER_INFO csbi; //定义窗口缓冲区信息结构体
GetConsoleScreenBufferInfo(handle_out, &csbi); //获得窗口缓冲区信息
mode++;
SetConsoleTextAttribute(handle_out, FORE_BLUE);
position(floaty*2,floatx);
if(mode%2==0) printf("");
else printf("");
position(44,9);
if(mode%2==0) {
SetConsoleTextAttribute(handle_out, FORE_BLUE);
printf("扫雷模式");
}
else {
SetConsoleTextAttribute(handle_out, FORE_RED);
printf("插旗模式");
}
}
//该点周围地雷数
int Boomnum(int xx,int yy) {
int num=0;
if((xx-1>=0)&&(yy-1>=0)&&(map[xx-1][yy-1]=='@')) num++;
if((xx-1>=0)&&(yy+0>=0)&&(map[xx-1][yy]=='@')) num++;
if((xx-1>=0)&&(yy+1<B) &&(map[xx-1][yy+1]=='@')) num++;
if((xx+0>=0)&&(yy-1>=0)&&(map[xx][yy-1]=='@')) num++;
if((xx+0>=0)&&(yy+1<B) &&(map[xx][yy+1]=='@')) num++;
if((xx+1<A)&&(yy-1>=0) &&(map[xx+1][yy-1]=='@')) num++;
if((xx+1<A)&&(yy+0>=0) &&(map[xx+1][yy]=='@')) num++;
if((xx+1<A)&&(yy+1<B) &&(map[xx+1][yy+1]=='@')) num++;
return num;
}
//更新地图
void Open() {
node c;
node d;
while(!dui.empty()) {
dui.pop();
}
c.x=floatx;
c.y=floaty;
dui.push(c);
slect[c.x][c.y]=1;
while(!dui.empty()) {
c=dui.front();
dui.pop();
if(Boomnum(c.x,c.y)!=0) {
map[c.x][c.y]=(Boomnum(c.x,c.y)+48);
continue;
}
else {
map[c.x][c.y]='x';
if((c.x-1>=0)&&(c.y-1>=0)&&(map[c.x-1][c.y-1]==' ')&&(slect[c.x-1][c.y-1]==0)) {
d.x=c.x-1;
d.y=c.y-1;
dui.push(d);
slect[d.x][d.y]=1;
}
if((c.x-1>=0)&&(c.y-0>=0)&&(map[c.x-1][c.y]==' ')&&(slect[c.x-1][c.y]==0)) {
d.x=c.x-1;
d.y=c.y-0;
dui.push(d);
slect[d.x][d.y]=1;
}
if((c.x-1>=0)&&(c.y+1<B)&&(map[c.x-1][c.y+1]==' ')&&(slect[c.x-1][c.y+1]==0)) {
d.x=c.x-1;
d.y=c.y+1;
dui.push(d);
slect[d.x][d.y]=1;
}
if((c.x-0>=0)&&(c.y-1>=0)&&(map[c.x][c.y-1]==' ')&&(slect[c.x][c.y-1]==0)) {
d.x=c.x-0;
d.y=c.y-1;
dui.push(d);
slect[d.x][d.y]=1;
}
if((c.x-0>=0)&&(c.y+1<B)&&(map[c.x][c.y+1]==' ')&&(slect[c.x][c.y+1]==0)) {
d.x=c.x-0;
d.y=c.y+1;
dui.push(d);
slect[d.x][d.y]=1;
}
if((c.x+1<A)&&(c.y-1>=0)&&(map[c.x+1][c.y-1]==' ')&&(slect[c.x+1][c.y-1]==0)) {
d.x=c.x+1;
d.y=c.y-1;
dui.push(d);
slect[d.x][d.y]=1;
}
if((c.x+1<A)&&(c.y-0>=0)&&(map[c.x+1][c.y]==' ')&&(slect[c.x+1][c.y]==0)) {
d.x=c.x+1;
d.y=c.y-0;
dui.push(d);
slect[d.x][d.y]=1;
}
if((c.x+1<A)&&(c.y+1<B)&&(map[c.x+1][c.y+1]==' ')&&(slect[c.x+1][c.y+1]==0)) {
d.x=c.x+1;
d.y=c.y+1;
dui.push(d);
slect[d.x][d.y]=1;
}
}
}
}
int main() {
freopen("排名.txt","r",stdin);
Relife: //重玩处
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); //获得标准输出设备句柄
CONSOLE_SCREEN_BUFFER_INFO csbi; //定义窗口缓冲区信息结构体
GetConsoleScreenBufferInfo(handle_out, &csbi); //获得窗口缓冲区信息
Hide(); //隐藏光标
Beginning();//初始化地图
a=GetTickCount();
while(1) {
if(kbhit()!=0) {
spare=getch();
//按其他
if((spare!=(-32))&&(spare!=13)&&(spare!=' ')) continue;//跳过
//按Enter
if(spare==13) { //确认
//排雷
if(mode%2==0) {
if(map[floatx][floaty]=='@'&&flag[floatx][floaty]==0) {
break; //触雷
game=0;
}
if(flag[floatx][floaty]==1) continue; //有旗跳过
Open();
position(0,0);
SetConsoleTextAttribute(handle_out, FORE_GREEN);
for(int i=0;i<A;i++) {
for(int j=0;j<B;j++) Lump(i,j);
printf("\n");
}
position(floaty*2,floatx);
SetConsoleTextAttribute(handle_out, FORE_BLUE);
Lump(floatx,floaty);
}
//插拔旗
else {
//不能插旗的地方
if(map[floatx][floaty]=='x'||(map[floatx][floaty]>'0'&&map[floatx][floaty]<'9'))
continue; //跳过
//插旗
if(flag[floatx][floaty]==0) {
flagnum++;
flag[floatx][floaty]=1;
position(floaty*2,floatx);
SetConsoleTextAttribute(handle_out, FORE_BLUE);
Lump(floatx,floaty);
}
//拔旗
else {
flagnum--;
flag[floatx][floaty]=0;
position(floaty*2,floatx);
SetConsoleTextAttribute(handle_out, FORE_BLUE);
Lump(floatx,floaty);
}
}
}
//按空格
if(spare==' ') Mode(); //切换模式
//按方向键
if(spare==-32) {
news=getch();
Move(); //移动光标
}
for(int i=0;i<A;i++) for(int j=0;j<B;j++) if(map[i][j]=='x'||(map[i][j]>'0'&&map[i][j]<'9')) game++;
if(game==A*B-C+1) break;
else game=1;
SetConsoleTextAttribute(handle_out, FORE_RED);
position(44,5);
printf("剩余雷数:%d ",C-flagnum);
}
else Sleep(10);
b=GetTickCount();
SetConsoleTextAttribute(handle_out, FORE_RED);
position(44,7);
printf("用时:"); //用时
if((b-a)/60000<10) printf("0");
printf("%d:",(b-a)/60000);
if(((b-a)/1000)%60<10) printf("0");
printf("%d:",((b-a)/1000)%60);
if(((b-a)/10)%100<10) printf("0");
printf("%d",((b-a)/10)%100);
}
SetConsoleTextAttribute(handle_out, FORE_RED);
position(5,5);
if(game==1) printf("游戏结束!");
else printf("恭喜通关!");
position(5,8);
printf("任意键重玩");
scanf("%c%c",&spare,&spare);
system("cls");
position(0,0);
goto Relife;
}
//扫雷
https://wenda.codingtang.com/questions/7192/
//曹砚青
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<sstream>
using namespace std;
struct p
{
int s=1000,g=100,f=100,j=1,q=200,dg=0;
string na;
}a;
long long mytime;
void print()
{
string tmp=a.na+",欢迎来到勇者小镇!\n";
printf(
"刘景程制作\n"
);
cout<<tmp;
tmp=".\\Tools\\"+a.na+".tim2";
ifstream fin(tmp.c_str(),ios::in|ios::out);
int tim2;
fin>>tim2;
fin.close();
long long timn=time(NULL);
long long h,m,d;
long long t=timn-tim2;
mytime=t;
t=max(0ll,t);
m=t/60%60;
h=t/3600%24;
d=t/86400;
cout<<"您在勇者小镇生活了"<<m<<"分钟"<<h<<"小时"<<d<<"天\n";
printf("----------勇者小游戏4.4版----------\n" );
printf(
"输入1,药店\n"
"输入2,武器店\n"
"输入3,防具店\n"
"输入4,彩票店\n"
"输入5,打怪物\n"
"输入6,查看状态\n"
"输入7,升级\n"
"输入8,决斗\n"
"输入9,串门\n"
"输入10,排行榜\n"
"输入11,团队\n"
"输入12,勋章\n"
"输入13,注销账号\n"
"输入14,聊天\n"
"输入15,设置\n"
"输入0,退出\n"
);
}
void yao()
{
int maxn=8;
loop:
system("CLS");
int n,s[11][2]={{0,0},{10,5},{20,9},{75,30},{200,90},{400,180},{1000,400},{2000,700}};
printf(
"输入1:创可贴 生命值+10 价格 5\n"
"输入2:绷带 生命值+20 价格 9\n"
"输入3:神奇小药丸 生命值+75 价格 30\n"
"输入4:阿司匹林 生命值+200 价格 90\n"
"输入5:灵药 生命值+400 价格 180\n"
"输入6:超级灵芝 生命值+1000 价格 400\n"
"输入7:起死回生术 生命值+2000 价格 700\n"
"输入8:一键升满\n"
"输入0 退出药店\n"
);
cin>>n;
if(n==0)return ;
if(n>=1&&n<maxn)
{
if(a.q<s[n][1])
{
cout<<"没钱!\n";
Sleep(1500);
}
else
{
a.q-=s[n][1];
a.s=a.s+s[n][0];
if(a.s>a.j*1000)a.s=a.j*1000;
}
}
else if(n>=1)
{
double maxx=a.j*1000;
double dif=maxx-a.s;
double money=0;
if(dif<=10)money=dif/1.8;
else if(dif>10&&dif<=75)money=5.556+(dif-10)/2.1;
else if(dif>75&&dif<=400)money=36.508+(dif-75)/2.4;
else if(dif>400&&dif<=1000)money=171.925+(dif-400)/2.7;
else if(dif>1000)money=394.147+(dif-1200)/2.95;
a.q-=(int)(money);
if(a.q<0)
{
a.q+=(int)(money);
cout<<"没钱!";
Sleep(2000);
system("CLS");
return ;
}
a.s=maxx;
cout<<"已升满。";
Sleep(2000);
}
system("CLS");
}
void wuqi()
{
loop:
system("CLS");
int maxn=8;
int n,s[11][3]={{0,0},{5,10},{10,20},{20,40},{50,95},{100,175},{200,320},{500,750}};
printf(
"输入1:小刀 攻击值+5 价格 10\n"
"输入2:中刀 攻击值+10 价格 20\n"
"输入3:大刀 攻击值+20 价格 40\n"
"输入4:寒冰刃 攻击值+50 价格 95\n"
"输入5:屠龙刃 攻击值+100 价格 175\n"
"输入6:倚天屠龙刃 攻击值+200 价格 330\n"
"输入7:死神之镰 攻击值+500 价格 750\n"
"输入8:一键升满\n"
"输入0 退出武器店\n"
);
cin>>n;
if(n==0)return ;
if(n>maxn||n<1)
{
cout<<"输入错误!";
goto loop;
}
if(a.q<s[n][1])
{
cout<<"没钱!\n";
Sleep(1500);
}
else if(n!=maxn)
{
a.q-=s[n][1];
a.g=a.g+s[n][0];
if(a.g>a.j*100)a.g=a.j*100;
}
else if(n==maxn)
{
int maxx=a.j*100;
int dif=maxx-a.g;
double money=0;
if(dif<=20)money=dif*2;
else if(dif>20&&dif<=100)money=40+(dif-20)*1.8;
else if(dif>100&&dif<=500)money=184+(dif-100)*1.5;
else if(dif>500&&dif<=1200)money=859+(dif-500)*1.2;
else if(dif>1200)money=1699+(dif-1200)*1.05;
a.q-=(int)(money);
if(a.q<0)
{
a.q+=(int)(money);
cout<<"没钱!";
Sleep(2000);
system("CLS");
return ;
}
a.g=maxx;
cout<<"已升满。";
Sleep(2000);
}
system("CLS");
}
void fangju()
{
loop:
system("CLS");
int maxn=8;
int n,s[11][3]={{0,0},{5,10},{10,20},{20,35},{50,90},{100,150},{300,500},{700,1100}};
printf(
"输入1:防身衣 防御值+5 价格 10\n"
"输入2:木盾 防御值+10 价格 20\n"
"输入3:铁盾 防御值+20 价格 35\n"
"输入4:黄金盾 防御值+50 价格 90\n"
"输入5:钻石盾 防御值+100 价格 150\n"
"输入6:铁甲 防御值+300 价格 475\n"
"输入7:黄金甲 防御值+700 价格1000\n"
"输入8:一键升满\n"
"输入0 退出防具店\n"
);
cin>>n;
if(n==0)return ;
if(n>maxn||n<1)
{
cout<<"输入错误!";
goto loop;
}
if(a.q<s[n][1])
{
cout<<"没钱!\n";
Sleep(1500);
}
else if(n!=maxn)
{
a.q-=s[n][1];
a.f=a.f+s[n][0];
if(a.f>a.j*100)a.f=a.j*100;
}
else if(n==maxn)
{
int maxx=a.j*100;
int dif=maxx-a.f;
double money=0;
if(dif<=20)money=dif*2;
else if(dif>20&&dif<=50)money=40+(dif-20)*1.8;
else if(dif>50&&dif<=700)money=94+(dif-50)*1.5;
else if(dif>700&&dif<=1500)money=1069+(dif-700)*1.2;
else if(dif>1500)money=2029+(dif-1500)*1.05;
a.q-=(int)(money);
if(a.q<0)
{
a.q+=(int)(money);
cout<<"没钱!";
Sleep(2000);
system("CLS");
return ;
}
a.f=maxx;
cout<<"已升满。";
Sleep(2000);
}
system("CLS");
}
void caipiao()
{
system("CLS");
int maxn;
maxn=a.q/2.0;
if(maxn>2000)maxn=2000;
else if(maxn<0)maxn=50;
int r=rand()%maxn+maxn;
int jiage;
if(r<=500)jiage=7;
else if(r<=1000)jiage=6;
else if(r<=2000)jiage=5;
else jiage=4;
printf(
"快买张彩票吧!\n"
"彩票价格:");
cout<<jiage;
printf(
"元/张\n"
"彩票号范围:1~"
);
cout<<r<<endl;
cout<<"你只需要输入购买的彩票数目以及每张彩票的号码即可。\n";
int n;
cin>>n;
if(a.q<n*5)
{
cout<<"没钱!\n";
Sleep(1500);
system("CLS");
return ;
}
a.q-=n*5;
int b[1001];
int r1=rand()%r+1;
for(int i=1;i<=n;++i)cin>>b[i];
for(int i=1;i<=n;++i)
{
if(b[i]==r1)
{
cout<<"恭喜你中奖了!\n";
a.q+=r*4+n*5;
Sleep(1500);
system("CLS");
return ;
}
}
cout<<"啊哦,好像并没有中奖。\n中奖号:"<<r1<<endl;
Sleep(1500);
system("CLS");
}
int rand2=1,rand3=1;
void daguai()
{
system("CLS");
int hh=1;
p b;
b.j=a.j;
b.s=rand()%((b.j*1000)/2)+((b.j*1000)/2);
b.g=rand()%((b.j*100)/2)+((b.j*100)/2);
b.f=rand()%((b.j*100)/2)+((b.j*100)/2);
while(1)
{
system("CLS");
cout<<"这是第"<<hh<<"回合\n1:攻击\n2:逃跑\n";
cout<<"你的生命值:"<<a.s<<endl<<"怪物的生命值:"<<b.s<<endl;
hh++;
if(rand3%7==0)cout<<"没打中!"<<endl;
int ss;
cin>>ss;
if(ss==2)
{
if(rand()%2==0)
{
cout<<"逃跑成功!\n";
Sleep(1500);
system("CLS");
return ;
}
else
{
cout<<"逃跑失败!\n";
Sleep(1500);
system("CLS");
ss=1;
}
}
if(ss==1)
{
rand2=rand()%7;
rand3=rand()%7;
if(rand2!=0)a.s=a.s-(b.g-a.f/4);
if(rand3!=0)b.s=b.s-(a.g-b.f/4);
int jq=min((b.g-a.f/4+a.g-b.f/4)/5,(a.g-b.f/4+b.g-a.f/4)/5);
if(jq<0)jq=0;
if(rand2!=0)a.q+=jq;
if(rand3!=0)b.q+=jq;
}
if(b.s<=0)
{
cout<<"你赢了!\n";
Sleep(1500);
system("CLS");
if(a.s>a.j*1000)a.s=a.j*1000;
if(a.s<0)
{
a.s=0;
a.j--;
if(a.j==0)
{
a.j=1;
a.g=100;
a.f=100;
a.s=900;
}
else
{
a.g=a.j*100;
a.f=a.j*100;
}
}
a.dg++;
return ;
}
else if(a.s<=0)
{
cout<<"你输了!\n";
a.j--;
if(a.j==0)
{
a.j=1;
a.s=900;
a.g-=10;
a.f-=10;
if(a.g>a.j*100)b.g=b.j*100;
if(a.f>a.j*100)b.f=b.j*100;
if(a.g<0)a.g=10;
if(a.f<0)a.f=10;
a.q-=300;
if(a.q<0)a.q=0;
}
else
{
a.s=a.j*1000;
if(a.g>a.j*100)a.g=a.j*100;
if(a.f>a.j*100)a.f=a.j*100;
a.q-=250;
if(a.q<0)a.q=0;
}
Sleep(1500);
system("CLS");
return ;
}
if(a.s>a.j*1000)a.s=a.j*1000;
}
}
void zhuangtai()
{
system("CLS");
cout<<"生命值:"<<a.s<<endl<<"攻击值:"<<a.g<<endl<<"防御值:"<<a.f<<endl<<"金币数:"<<a.q<<endl<<"级别:"<<a.j<<endl<<"杀死对手:"<<a.dg<<endl;
system("pause");
system("CLS");
}
void shengji()
{
system("CLS");
int money;
if(a.j<=10)money=a.j*50;
else if(a.j<=50)money=a.j*45;
else if(a.j<=100)money=a.j*40;
else if(a.j<=200)money=a.j*35;
else if(a.j<=500)money=a.j*30;
else if(a.j<=1000)money=a.j*25;
else if(a.j<=2000)money=a.j*20;
else if(a.j<=5000)money=a.j*15;
else if(a.j<=10000)money=a.j*10;
else if(a.j<=20000)money=a.j*5;
else if(a.j<=50000)money=a.j*3;
else if(a.j<=100000)money=a.j;
else money=100000;
stringstream ssm;
ssm<<money;
string abcba;
ssm>>abcba;
abcba="确认升级?"+abcba+"元";
if(a.q>=money)
{
int aa=MessageBox(NULL,abcba.c_str(),"勇者小游戏",MB_YESNO);
if(aa==IDYES)
{
a.q-=money;
a.j++;
}
else return ;
}
else
{
cout<<"没钱!\n";
Sleep(1500);
system("CLS");
return ;
}
cout<<"已升级\n";
Sleep(1500);
system("CLS");
}
int random5=1,random6=1;
string names[10001];
void juedou()
{
system("CLS");
int hh=1;
ifstream fin4(".\\Tools\\name.ini",ios::in|ios::out);
int i=1;
while(fin4>>names[i])i++;
cout<<"敌人:\n";
for(int j=1;j<i;++j)
{
cout<<j<<"号:"<<names[j]<<endl;
}
int ss;
cout<<"输入代号:\n";
cin>>ss;
if(ss<1||ss>=i)
{
cout<<"输入错误!";
return ;
}
string bb=".\\Tools\\"+names[ss]+".yz";
ifstream fin5(bb.c_str(),ios::in|ios::out);
string pas;
int sheng,fang,gong,qian,ji,shadi;
fin5>>pas>>sheng>>gong>>fang>>ji>>qian>>shadi;
p b;
b.s=sheng;
b.g=gong;
b.f=fang;
b.j=ji;
b.q=qian;
b.dg=shadi;
b.na=names[ss];
ofstream fout4(bb.c_str(),ios::in|ios::out);
string bbb=".\\Tools\\"+b.na+".tlk";
while(1)
{
system("CLS");
cout<<"这是第"<<hh<<"回合\n1:攻击\n2:逃跑\n";
cout<<"你的生命值:"<<a.s<<endl<<"敌人的生命值:"<<b.s<<endl;
if(random6%7==0)cout<<"没打中!";
hh++;
int ss;
cin>>ss;
if(ss==2)
{
if(rand()%2==0)
{
cout<<"逃跑成功!\n";
ofstream fout4(bb.c_str(),ios::in|ios::out);
fout4<<pas<<endl<<b.s<<" "<<b.g<<" "<<b.f<<" ";
fout4<<b.j<<" "<<b.q<<" "<<b.dg<<endl;
fout4.close();
ofstream fout5(bbb.c_str(),ios::in|ios::out|ios::app);
fout5<<3<<" "<<a.na<<endl;
fout5.close();
/*bug_is_at_there*/
Sleep(1500);
system("CLS");
return ;
}
else
{
cout<<"逃跑失败!\n";
Sleep(1500);
system("CLS");
ss=1;
}
}
if(ss==1)
{
random5=rand()%7;
random6=rand()%7;
if(random5!=0)
{
int jian=(b.g-a.f/4);
if(jian<0)jian=0;
a.s=a.s-jian;
}
if(random6!=0)
{
int jian2=(a.g-b.f/4);
if(jian2<0)jian2=0;
b.s=b.s-jian2;
}
if(1)
{
int ajian=b.g-a.f/4,bjian=a.g-b.f/4;
if(ajian<0||random6==0)ajian=0;
if(bjian<0||random5==0)bjian=0;
int jq=min((ajian+bjian)/5,(bjian+ajian)/5);
if(jq<0)jq=0;
a.q+=jq;
b.q+=jq;
if(b.s>b.j*1000)b.s=b.j*1000;
if(a.s>a.j*1000)a.s=a.j*1000;
}
}
if(b.s<=0)
{
cout<<"你赢了!\n";
Sleep(1500);
system("CLS");
if(a.s>a.j*1000)a.s=a.j*1000;
b.j--;
if(b.j==0)
{
b.j=1;
b.s=900;
b.q-=300;
if(b.q<0)b.q=0;
}
else
{
b.s=b.j*1000;
b.q-=250;
if(b.q<0)b.q=0;
}
if(a.s<0)
{
a.s=0;
a.j--;
if(a.j==0)
{
a.j=1;
a.g=100;
a.f=100;
a.s=900;
}
else
{
a.g=a.j*100;
a.f=a.j*100;
}
}
a.dg++;
ofstream fout40(bb.c_str(),ios::in|ios::out);
fout40<<pas<<endl<<b.s<<" "<<b.g<<" "<<b.f<<" ";
fout40<<b.j<<" "<<b.q<<" "<<b.dg<<endl;
fout40.close();
ofstream fout5(bbb.c_str(),ios::in|ios::out|ios::app);
fout5<<3<<" "<<a.na<<endl;
fout5.close();
/*bug_is_at_there*/
return ;
}
else if(a.s<=0)
{
cout<<"你输了!\n";
a.j--;
if(a.j==0)
{
a.j=1;
a.s=900;
a.q-=300;
if(a.q<0)a.q=0;
}
else
{
a.s=a.j*1000;
a.g-=10;
a.f-=10;
a.q-=250;
if(a.q<0)a.q=0;
}
b.dg++;
Sleep(1500);
system("CLS");
ofstream fout41(bb.c_str(),ios::in|ios::out);
fout4<<pas<<endl<<b.s<<" "<<b.g<<" "<<b.f<<" ";
fout4<<b.j<<" "<<b.q<<" "<<b.dg<<endl;
fout4.close();
ofstream fout5(bbb.c_str(),ios::in|ios::out|ios::app);
fout5<<3<<" "<<a.na<<endl;
fout5.close();
/*bug_is_at_there*/
return ;
}
if(b.s>b.j*1000)b.s=b.j*1000;
if(a.s>a.j*1000)a.s=a.j*1000;
}
}
void chuanmen()
{
system("CLS");
ifstream fin4(".\\Tools\\name.ini",ios::in|ios::out);
int i=1;
while(fin4>>names[i])i++;
cout<<"去哪家?\n";
for(int j=1;j<i;++j)
{
cout<<j<<"号:"<<names[j]<<endl;
}
int ss;
cout<<"输入代号:\n";
cin>>ss;
string bb=".\\Tools\\"+names[ss]+".yz";;
ifstream fin5(bb.c_str(),ios::in|ios::out);
string pas;
int sheng,fang,gong,qian,ji,sha;
fin5>>pas>>sheng>>gong>>fang>>ji>>qian>>sha;
cout<<"生命值:"<<sheng<<endl;
cout<<"防御值:"<<fang<<endl;
cout<<"攻击值:"<<gong<<endl;
cout<<"级别:"<<ji<<endl;
cout<<"钱:"<<qian<<endl;
cout<<"杀死对手:"<<sha<<endl;
Sleep(2000);
system("CLS");
}
p r[10001];
int cmp(p a1,p b1)
{
return (a1.s*0.95+a1.g*1.1+a1.f/2+a1.j*100+a1.q*1.5+a1.dg*5.5)>(b1.s*0.95+b1.g*1.1+b1.f/2+b1.j*100+b1.q*1.5+b1.dg*5.5);
}
void paihangbang()
{
system("CLS");
cout<<"*******排行榜*******\n";
ifstream fin4(".\\Tools\\name.ini",ios::in|ios::out);
int i=1;
while(fin4>>names[i])i++;
for(int j=1;j<i;++j)
{
string bb=".\\Tools\\"+names[j]+".yz";
ifstream fin5(bb.c_str(),ios::in|ios::out);
string pas;
int sheng,fang,gong,qian,ji,shadi;
fin5>>pas>>sheng>>gong>>fang>>ji>>qian>>shadi;
r[j].s=sheng;
r[j].g=gong;
r[j].f=fang;
r[j].j=ji;
r[j].q=qian;
r[j].na=names[j];
r[j].dg=shadi;
}
sort(r+1,r+i,cmp);
for(int j=1;j<i;++j)
{
cout<<"★"<<j<<"★:"<<r[j].na;
if(r[j].na==a.na)cout<<"(自己)";
cout<<endl;
}
system("pause");
system("CLS");
}
string tua[10001],tuu[10001],tume[10001],man[10001],man10[10001];
int an;
int tu;
int peo;
int flag10;
int n12;
string man12[10001];
string men[10001];
int mbs;
string invp[10001];
map <string,bool> invite;
void tuandui()
{
ifstream fin11(".\\Mbs\\tuan.txt",ios::in|ios::out);
ofstream fout11(".\\Mbs\\tuan.txt",ios::in|ios::out);
if(!fin11)
{
fout11<<0;
tu=0;
}
else fin11>>tu;
for(int i=1;i<=tu;++i)fin11>>tua[i];
while(1)
{
system("CLS");
int s2;
printf(
"这里是团队主中心\n"
"输入1 进入团队中心\n"
"输入2 查找/加入团队\n"
"输入3 创建团队\n"
"输入0 退出\n"
);
cin>>s2;
if(s2==0)break;
else if(s2==1)
{
an=0;
system("CLS");
for(int i=1;i<=tu;++i)
{
string tuan_tmp1=".\\Mbs\\"+tua[i];
ifstream filn(tuan_tmp1.c_str(),ios::in|ios::out);
int s3;
filn>>s3;
for(int j=1;j<=s3;++j)
{
filn>>tuu[j];
if(tuu[j]==a.na)
{
an++;
cout<<an<<":"<<tua[i]<<endl;
}
}
filn.close();
}
if(an==0)
{
cout<<"您好像没有加入任何一个团队。\n";
system("pause");
system("CLS");
continue;
}
cout<<"去哪个团队中心里?(输序号即可)";
int number;
cin>>number;
if(number<1||number>an)
{
cout<<"输入错误!";
system("PAUSE");
continue;
}
string tmp=".\\Mbs\\"+tua[number];
ifstream finm(tmp.c_str(),ios::in|ios::out);
finm>>mbs;
for(int i=1;i<=mbs;++i)finm>>men[i];
finm.close();
while(1)
{
lop:
system("CLS");
cout<<"欢迎来到"<<tua[number]<<"的团队中心!"<<endl;
printf(
"输入1:退出该团队\n"
"输入2:查看团队成员\n"
);
if(men[1]==a.na)
{
printf(
"输入3:驱逐成员\n"
"输入4:邀请新成员\n"
"输入5:解散团队\n"
);
}
printf("输入0:离开团队中心\n");
int s3;
cin>>s3;
if(s3==0)
{
system("CLS");
break;
}
else if(s3==1&&a.na!=men[1])
{
if(MessageBox(NULL,"确认退出?","勇者小游戏",MB_YESNO)==IDYES)
{
string tuan_tmp2=".\\Mbs\\"+tua[number];
ifstream fin12(tuan_tmp2.c_str(),ios::in|ios::out);
fin12>>n12;
for(int i=1;i<=n12;++i)fin12>>man12[i];
ofstream fout12(tuan_tmp2.c_str());
fout12<<n12-1<<endl;
for(int i=1;i<=n12;++i)
{
if(man12[i]!=a.na)fout12<<man12[i];
}
MessageBox(NULL,"已退出。","勇者小游戏",MB_OK);
system("CLS");
break;
}
else
{
system("CLS");
continue;
}
}
else if(s3==1&&a.na==men[1])
{
system("CLS");
cout<<"对不起,您是团主,无法退出!";
Sleep(1500);
continue;
}
else if(s3==2)
{
string tuan_tmp4=".\\Mbs\\"+tua[number];
ifstream fin21(tuan_tmp4.c_str(),ios::in|ios::out);
int n21;
string namesoft;
fin21>>n21;
for(int i=1;i<=n21;++i)
{
fin21>>namesoft;
cout<<i<<":"<<namesoft;
if(namesoft==a.na)cout<<"(自己)";
cout<<endl;
}
system("PAUSE");
}
else if(s3==3&&a.na==men[1])
{
for(int i=2;i<=mbs;++i)
{
cout<<i-1<<":"<<men[i]<<endl;
}
if(mbs==1)
{
system("CLS");
cout<<"没有人可以驱逐。";
Sleep(1500);
continue;
}
cout<<"驱逐谁?(如不驱逐输入0)";
int s4;
cin>>s4;
s4++;
if(s4<=1||s4>mbs)
{
if(s4!=1)
{
cout<<"输入错误!";
Sleep(1500);
}
system("CLS");
goto lop;
}
string yuanying;
cout<<"请输入原因:\n";
cin>>yuanying;
int ID=MessageBox(NULL,"真的要驱逐他吗?","勇者小游戏",MB_YESNO);
if(ID==IDYES)
{
ofstream quzhu(tmp.c_str());
quzhu<<mbs-1<<endl;
for(int i=1;i<=mbs;++i)
{
if(i!=s4)quzhu<<men[i]<<endl;
}
string tmpp2=".\\Tools\\"+men[s4]+".tlk";
ofstream notice_quzhu(tmpp2.c_str(),ios::in|ios::out|ios::app);
notice_quzhu<<4<<" "<<a.na<<" "<<tua[number]<<" "<<yuanying<<endl;
MessageBox(NULL,"已驱逐。","勇者小游戏",MB_OK);
}
system("CLS");
break;
}
else if(s3==4&&a.na==men[1])
{
for(int i=1;i<=mbs;++i)
{
invite[men[i]]=1;
}
llp:
system("CLS");
int inp=0;
ifstream fin_n(".\\Tools\\name.ini",ios::in|ios::out);
while(fin_n>>invp[++inp])
{
if(invite[invp[inp]])inp--;
}
if(inp==1)
{
system("CLS");
cout<<"没人可以邀请。";
system("CLS");
continue;
}
for(int i=1;i<inp;++i)
{
cout<<"第"<<i<<"号:"<<invp[i]<<endl;
}
cout<<"邀请哪位?请输入序号(如不邀请请输入0)\n";
int ivp;
cin>>ivp;
if(ivp==0)continue;
if(ivp<1||ivp>inp)
{
system("CLS");
cout<<"输入错误!";
Sleep(1500);
goto llp;
}
string tmp_inv=".\\Tools\\"+invp[ivp]+".tlk";
ofstream foutv(tmp_inv.c_str(),ios::in|ios::out|ios::app);
foutv<<5<<" "<<a.na<<" "<<tua[number]<<endl;
MessageBox(NULL,"已邀请!","勇者小游戏",MB_OK);
system("CLS");
invite.clear();
}
else if(s3==5&&a.na==men[1])
{
//tua[number] mbs men
system("CLS");
int Id=MessageBox(NULL,"你确定吗?该操作无法恢复!","勇者小游戏!",MB_YESNO);
if(Id==IDYES)
{
cout<<"请写出解散原因:";
string why;
cin>>why;
for(int k=2;k<=mbs;++k)
{
string Tmp=".\\Tools\\"+men[k]+".tlk";
ofstream foutj(Tmp.c_str(),ios::in|ios::out|ios::app);
foutj<<2<<" "<<a.na<<" "<<tua[number]<<" "<<why<<endl;
}
ifstream finjj("\\Mbs\\tuan.txt",ios::in|ios::out);
int mennumbers;
finjj>>mennumbers;
ofstream fouj(".\\Mbs\\tuan.txt");
fouj<<tu-1<<endl;
for(int s=1;s<=tu;++s)
{
if(s!=number)fouj<<tua[s]<<endl;
}
string TMP="del .\\Mbs\\"+tua[number]+" /F /Q";
system("CLS");
string ttmp=".\\Mbs\\"+tua[number];
ofstream meiyouyongdedongxi(ttmp.c_str());
meiyouyongdedongxi.close();
system(TMP.c_str());
MessageBox(NULL,"已解散。","勇者小游戏",MB_OK);
return ;
}
}
else
{
cout<<"输入错误!";
Sleep(1500);
system("CLS");
}
}
}
else if(s2==2)
{
system("CLS");
if(tu==0)
{
cout<<"暂无团队。。。\n";
system("PAUSE");
continue;
}
for(int i=1;i<=tu;++i)
{
cout<<i<<":"<<tua[i]<<endl;
string tuan_tmp3=".\\Mbs\\"+tua[i];
ifstream fii(tuan_tmp3.c_str(),ios::in|ios::out);
int ps;
fii>>ps;
for(int j=1;j<=ps;++j)
{
fii>>man[j];
}
int money;
cout<<"人数:"<<ps<<endl;
}
if(tu==0)
{
cout<<"暂无团队可供加入。。。\n";
system("PAUSE");
continue;
}
cout<<"加入哪个团队?(输入序号(若不加入输入0即可))";
int num;
cin>>num;
if(num==0) ;
else
{
string tuan_tmp5=".\\Mbs\\"+tua[num];
ifstream fin10(tuan_tmp5.c_str(),ios::in|ios::out);
fin10>>peo;
for(int i=1;i<=peo;++i)fin10>>man10[i];
ofstream fout10(tuan_tmp5.c_str());
for(int i=1;i<=peo;++i)
{
if(man10[i]==a.na)
{
flag10=1;
break;
}
}
if(flag10==1)
{
flag10=0;
fout10<<peo<<endl;
for(int i=1;i<=peo;++i)fout10<<man10[i]<<endl;
cout<<"您此前已加入该团队!\n";
system("pause");
}
else
{
fout10<<peo+1<<endl;
for(int i=1;i<=peo;++i)fout10<<man10[i]<<endl;
fout10<<a.na;
cout<<"加入成功!\n";
system("pause");
}
}
}
else if(s2==3)
{
int yesno=MessageBox(NULL,"是否创建一个团队?100元","勇者小游戏",MB_YESNO);
if(yesno==IDYES)
{
if(a.q<100)
{
cout<<"没钱!\n";
system("pause");
system("CLS");
}
else
{
flag10=0;
a.q-=100;
cout<<"团队名称:";
string tn;
cin>>tn;
ifstream filein(".\\Mbs\\tuan.txt",ios::in|ios::out);
if(!filein)peo=0;
else filein>>peo;
for(int i=1;i<=peo;++i)filein>>man10[i];
for(int i=1;i<=peo;++i)
{
if(man10[i]==tn)
{
cout<<"重名!\n";
a.q+=100;
flag10=1;
system("pause");
system("CLS");
break;
}
}
if(!flag10)
{
ofstream fiout(".\\Mbs\\tuan.txt");
fiout<<peo+1<<endl;
for(int i=1;i<=peo;++i)fiout<<man10[i]<<endl;
fiout<<tn<<endl;
string tuan_tmp6=".\\Mbs\\"+tn;
ofstream file_out(tuan_tmp6.c_str());
file_out<<1<<endl<<a.na<<endl;
MessageBox(NULL,"创建成功!","勇者小游戏",MB_OK);
system("CLS");
return ;
}
flag10=0;
}
}
}
}
system("CLS");
}
void xunzhang()
{
system("CLS");
cout<<"您获得了:\n";
if(a.j>=2)cout<<"2级小兵勋章\n";
if(a.j>=10)cout<<"10级军官勋章\n";
if(a.j>=50)cout<<"50级上将勋章\n";
if(a.j>=100)cout<<"100级大将勋章\n";
if(a.j>=200)cout<<"200级军神勋章\n";
if(a.j>=1000)cout<<"1000级Mars勋章\n";
if(a.j>=2000)cout<<"2000级宇宙主宰勋章\n";
if(a.g>=200)cout<<"200攻击力斗士勋章\n";
if(a.g>=400)cout<<"400攻击力战士勋章\n";
if(a.g>=800)cout<<"800攻击力战将勋章\n";
if(a.g>=1200)cout<<"1200攻击力战狼勋章\n";
if(a.g>=2000)cout<<"2000攻击力战王勋章\n";
if(a.g>=4000)cout<<"4000攻击力战神勋章\n";
if(a.f>=200)cout<<"200防御力护卫勋章\n";
if(a.f>=400)cout<<"400防御力保镖勋章\n";
if(a.f>=800)cout<<"800防御力神护勋章\n";
if(a.f>=1200)cout<<"1200防御力钢铁卫兵勋章\n";
if(a.f>=2000)cout<<"2000防御力镖人勋章\n";
if(a.f>=3500)cout<<"3500防御力无惧勋章\n";
if(a.s>=2000)cout<<"2000生命长命勋章\n";
if(a.s>=4000)cout<<"4000生命仙人勋章\n";
if(a.s>=9000)cout<<"9000生命天猫勋章\n";
if(a.s>=12000)cout<<"12000生命铁人勋章\n";
if(a.s>=20000)cout<<"20000生命铁战士勋章\n";
if(a.s>=50000)cout<<"50000生命不死者勋章\n";
if(a.q>=2000)cout<<"2000金币有钱人勋章\n";
if(a.q>=4000)cout<<"4000金币地主勋章\n";
if(a.q>=8000)cout<<"8000金币百万富翁勋章\n";
if(a.q>=12000)cout<<"12000金币千万富翁勋章\n";
if(a.q>=20000)cout<<"20000金币亿万富翁勋章\n";
if(a.q>=40000)cout<<"40000金币富三代勋章\n";
if(a.q>=100000)cout<<"100000金币聚宝盆勋章\n";
if(a.dg>=10)cout<<"杀死10人小试牛刀勋章\n";
if(a.dg>=50)cout<<"杀死50人杀手勋章\n";
if(a.dg>=100)cout<<"杀死100人杀人狂勋章\n";
if(a.dg>=200)cout<<"杀死200人嗜血狂勋章\n";
if(a.dg>=500)cout<<"杀死500人侠客勋章\n";
if(a.dg>=1000)cout<<"杀死1000人小魔王勋章\n";
if(a.dg>=2000)cout<<"杀死2000人魔王勋章\n";
if(a.dg>=5000)cout<<"杀死5000人大魔头勋章\n" ;
if(a.dg>=10000)cout<<"杀死10000人阎王勋章\n";
if(a.s>=100000&&a.j>=100&&a.g>=10000&&a.f>=10000&&a.dg>=100)cout<<"百级九殿阎罗王勋章\n";
if(a.s>=1000000&&a.j>=1000&&a.g>=100000&&a.f>=100000&&a.dg>=2000)cout<<"千级朱庇特勋章\n";
if(a.s>=1000000&&a.j>=1000&&a.g>=100000&&a.f>=100000&&a.dg>=10000&&a.q>=100000)cout<<"拥有所有勋章勋章收集者称号勋章\n";
if(mytime>=86400)cout<<"注册时间超过1天日升日落勋章\n";
if(mytime>=604800)cout<<"注册时间超过7天星期勋章\n";
if(mytime>=2592000)cout<<"注册时间超过30天月圆月缺勋章\n";
if(mytime>=7776000)cout<<"注册时间超过90天季度勋章\n";
if(mytime>=31104000)cout<<"注册时间超过一年春夏秋冬勋章\n";
if(mytime>=62208000)cout<<"注册时间超过两年风雨兼程勋章\n";
if(mytime>=311040000)cout<<"注册时间超过十年老朋友勋章\n";
if(mytime>=622080000)cout<<"注册时间超过二十年长老勋章\n";
if(mytime>=1555200000)cout<<"注册时间超过五十年老勇者勋章\n";
if(a.j==1&&a.dg<10&&a.f<200&&a.g<200&&a.s<2000&&mytime<86400)
{
system("CLS");
cout<<"你什么勋章都没有获得。\n";
}
system("PAUSE");
system("CLS");
}
string men2[10001],men3[10001];
void zhuxiao()
{
system("CLS");
int id=MessageBox(NULL,"想好了吗?你的信息将不可恢复!","勇者小游戏",MB_YESNO);
if(id==IDYES)
{
cout<<"正在注销中。。。";
string dele="del .\\Tools\\"+a.na+".yz";
system(dele.c_str());
dele="del .\\Tools\\"+a.na+"_time.tim";
system(dele.c_str());
dele="del .\\Tools\\"+a.na+"set.ini";
system(dele.c_str());
dele="del .\\Tools\\"+a.na+".tim2";
system(dele.c_str());
int peon=1;
ifstream fin60(".\\Tools\\name.ini");
while(fin60>>men2[peon])
{
if(men2[peon]!=a.na)peon++;
}
peon--;
cout<<endl;
ofstream fout60(".\\Tools\\name.ini");
for(int i=1;i<=peon;++i)fout60<<men2[i]<<endl;
ifstream fin70(".\\Mbs\\tuan.txt",ios::in|ios::out);
int tuanum;
fin70>>tuanum;
for(int i=1;i<=tuanum;++i)
{
string tuaname;
fin70>>tuaname;
string tmp2020;
tmp2020=".\\Mbs\\"+tuaname;
int memnum;
ifstream fin80(tmp2020.c_str(),ios::in|ios::out);
fin80>>memnum;
for(int j=1;j<=memnum;++j)
{
fin80>>men3[j];
if(men3[j]==a.na)
{
j--;
memnum--;
}
}
ofstream fout80(tmp2020.c_str());
fout80<<memnum<<endl;
for(int j=1;j<=memnum;++j)
{
fout80<<men3[j]<<endl;
}
}
MessageBox(NULL,"已注销。再见!","勇者小游戏",MB_OK);
exit(0);
}
}
string speak[100001],namess[100001],speak2[100001];
int spk,talking;
void liaotian()
{
system("CLS");
if(spk==-1)return ;
while(1)
{
system("CLS");
cout<<"欢迎来到聊天版块!(尚未开放)\n";
printf(
"输入1:一个巨大的聊天室\n"
"输入2:私聊\n"
"输入0:离开\n"
);
int m;
cin>>m;
if(m==0)return ;
if(m==1)
{
system("CLS");
ifstream fin_e(".\\Tools\\say.ini",ios::in|ios::out);
ofstream fout_e(".\\Tools\\say.ini",ios::in|ios::out|ios::app);
while(fin_e)getline(fin_e,speak[++spk]);
if(spk<=0)cout<<"还木有人发言呢~\n";
else
{
if(spk>talking&&talking!=-1)
{
for(int i=spk-talking;i<=spk;++i)cout<<speak[i]<<endl;
}
else
{
for(int i=1;i<=spk;++i)cout<<speak[i]<<endl;
}
}
cout<<"说几句吧。说好了按Ctrl+Z即可发送!(不想说也得说)\n";
int spk2=spk;
while(cin)getline(cin,speak[++spk2]);
int id=MessageBox(NULL,"确认发送?","勇者小游戏",MB_YESNO);
if(id==IDYES)
{
for(int i=spk+2;i<spk2;++i)if(speak[i]!="\n")fout_e<<a.na<<":"<<speak[i]<<endl;
a.q+=abs(rand()%10*(spk2-spk-2));
MessageBox(NULL,"发送成功!","勇者小游戏",MB_OK);
id=0;
spk=-1;
system("CLS");
return ;
}
else
{
spk=-1;
id=0;
return ;
}
}
else if(m==2)
{
ifstream finn(".\\Tools\\name.ini");
int kk=0;
while(finn>>namess[++kk])
{
//getline(finn,namess[++kk]);
if(namess[kk]=="\n")
{
--kk;
break;
}
}
system("CLS");
--kk;
for(int i=1;i<=kk;++i)
{
cout<<i<<"号聊天对象:"<<namess[i]<<endl;
}
cout<<"和谁聊天?(退出请按零)\n";
int s;
cin>>s;
if(s==0)return ;
string tm=".\\Tools\\"+namess[s]+".tlk";
ofstream fouut(tm.c_str(),ios::in|ios::out|ios::app);
system("CLS");
int spk2=0;
cout<<"说几句吧。说好了按Ctrl+Z即可发送!(不想说也得说)\n";
while(cin)getline(cin,speak2[++spk2]);
int id=MessageBox(NULL,"确认发送?","勇者小游戏",MB_YESNO);
if(id==IDYES)
{
for(int i=2;i<spk2;++i)if(speak2[i]!="\n")fouut<<1<<" "<<a.na<<" "<<speak2[i]<<endl;
a.q+=abs(rand()%4*(spk2-2));
MessageBox(NULL,"发送成功!","勇者小游戏",MB_OK);
id=0;
system("CLS");
return ;
}
else
{
return ;
}
}
}
}
void shezhi()
{
system("CLS");
while(1)
{
cout<<"这里是设置中心(修改ing)\n";
cout<<"输入1:更改密码\n";
cout<<"输入2:更改屏幕颜色\n";
cout<<"输入3:更改公告选项\n";
cout<<"输入4:更改聊天记录显示数目\n";
cout<<"输入0:退出\n";
int shu;
cin>>shu;
if(shu==0)break;
else if(shu==1)
{
string lujin=".\\Tools\\"+a.na+".yz";
ifstream fin30(lujin.c_str(),ios::in|ios::out);
ofstream fout30(lujin.c_str(),ios::in|ios::out);
cout<<"请输入新密码:\n";
string hhh_hhh_new;
cin>>hhh_hhh_new;
fout30<<hhh_hhh_new<<endl<<a.s<<" "<<a.g<<" "<<a.f<<" "<<a.j<<" "<<a.q<<" "<<a.dg;
cout<<"修改成功!请重启该游戏.\n";
fin30.close();
fout30.close();
system("pause");
exit(0);
}
else if(shu==2)
{
system("CLS");
printf(
"颜色属性由两个十六进制数字指定 -- 第一个为背景,第二个则为前景。每个数字可以为以下任何值之一:\n0 = 黑色 8 = 灰色\n1 = 蓝色 9 = 淡蓝色\n2 = 绿色 A = 淡绿色\n3 = 浅绿色 B = 淡浅绿色\n4 = 红色 C = 淡红色\n5 = 紫色 D = 淡紫色\n6 = 黄色 E = 淡黄色\n7 = 白色 F = 亮白色\n例如: COLOR fc 在亮白色上产生亮红色\n"
);
cout<<"请输入前景色颜色代码:\n";
string qj;
cin>>qj;
cout<<"请输入背景色颜色代码:\n";
string bj;
cin>>bj;
string luji=".\\Tools\\"+a.na+"set.ini";
ofstream fout40(luji.c_str(),ios::in|ios::out);
fout40<<bj<<" "<<qj;
string xiug="color "+bj+qj;
system(xiug.c_str());
cout<<"修改成功!\n";
Sleep(2000);
system("CLS");
fout40.close();
break;
}
else if(shu==3)
{
system("CLS");
string luj=".\\Tools\\"+a.na+"set.ini";
ofstream fout2020(luj.c_str(),ios::in|ios::out);
ifstream fin2020(luj.c_str(),ios::in|ios::out);
int a20201,b20201,c20201;
fin2020>>a20201>>b20201>>c20201;
if(c20201==1)
{
int d20201=MessageBox(NULL,"是否关闭公告功能?","勇者小游戏",MB_YESNO);
if(d20201==IDYES)
{
fout2020<<a20201<<" "<<b20201<<endl<<0;
MessageBox(NULL,"成功!","勇者小游戏",MB_OK);
}
}
else
{
int e20201=MessageBox(NULL,"是否开启公告功能?","勇者小游戏",MB_YESNO);
if(e20201==IDYES)
{
fout2020<<a20201<<" "<<b20201<<endl<<1;
MessageBox(NULL,"成功!","勇者小游戏",MB_OK);
}
}
fin2020.close();
fout2020.close();
}
else if(shu==4)
{
system("CLS");
string tmp_2020=".\\Tools\\"+a.na+"set.ini";
ifstream fin_2020(tmp_2020.c_str(),ios::in|ios::out);
char aa,bb,cc;
fin_2020>>aa>>bb>>cc;
int dd=-1;
fin_2020>>dd;
cout<<"您现在的设置是:";
if(dd==-1)cout<<"最大值\n";
else cout<<dd<<"条\n";
cout<<"请输入您现在的设置的条数(若选择最大值请输入-1):";
int de;
cin>>de;
ofstream fout_2020(tmp_2020.c_str());
fout_2020<<aa<<" "<<bb<<endl<<cc<<endl<<de;
MessageBox(NULL,"更改成功!","勇者小游戏",MB_OK);
talking=de;
break;
}
else cout<<"输入错误!";
}
system("CLS");
}
map<string,int> mpp;
string s3[10001],s4[10001],s5[10001];
int mm;
string names_,nameo2;
string nam[10001];
string n2020[10001],un2020[10001];
string nn2020,nn20;
string messagess;
string tumessages,tunames,whyme,mennames;
string tuanren[10001];
int main(int argc,char* argv[])
{
//system("@echo off");
SetConsoleTitle("勇者小游戏4.4");
cout<<"加载中。。。\n";
srand(time(NULL));
ifstream fiin(".\\to.txt",ios::in|ios::out);
ofstream fileout(".\\to.txt",ios::in|ios::out);
int hhhh;
fiin>>hhhh;
if(hhhh!=0)
{
system("CLS");
cout<<"请输入验证码或联系liujingcheng2019@hotmail.com要验证码\n";
string ssss;
cin>>ssss;
cout<<"感谢输入!请重启该游戏。\n";
if(ssss=="_54ljc_welcome_2020!")
{
fileout<<0;
system("pause");
return 0;
}
else
{
system("pause");
return 0;
}
}
system("ping www.baidu.com -n 1>C:\\nEt.txt");
ifstream finnet("C:\\nEt.txt",ios::in|ios::out);
string nneett;
getline(finnet,nneett);
finnet.close();
string::size_type position=nneett.find("找不到");
if(position!=string::npos)
{
system("CLS");
MessageBox(NULL,"请连接网络!","勇者小游戏",MB_OK);
system("del C:\\nEt.txt");
return 0;
}
system("del C:\\nEt.txt");
system("CLS");
loop2:
string str,str1,pass,aa;
int number;
ifstream fin2(".\\Tools\\name.ini",ios::in|ios::out|ios::app);
ofstream fout2(".\\Tools\\name.ini",ios::in|ios::out|ios::app);
cout<<"欢迎来到勇者小游戏!\n输入1:登录\n输入2:注册\n";
cin>>number;
if(number==1)
{
cout<<"你的名字:";
cin>>str;
cout<<"你的密码:";
cin>>str1;
aa=".\\Tools\\"+str+".yz";
system("CLS");
ifstream fin(aa.c_str());
if(fin)
{
a.na=str;
fin>>pass;
if(pass==str1)
{
fin>>a.s>>a.g>>a.f>>a.j>>a.q>>a.dg;;
}
else
{
MessageBox(NULL,"密码错误!","勇者小游戏",MB_OK);
system("pause");
return 0;
}
}
else
{
cout<<"查无此人!\n";
system("pause");
system("CLS");
return 0;
}
}
else if(number==2)
{
loop:
cout<<"注册名(不能有大写字母和空格):";
string nameo;
cin>>nameo;
ifstream fiin(".\\Tools\\name.ini",ios::in|ios::out);
int ss2=1;
while(fiin>>s5[ss2])ss2++;
if(ss2>=10000)
{
MessageBox(NULL,"注册人数超过10000名,无法注册!","勇者小游戏",MB_OK);
return 0;
}
for(int i=1;i<=ss2;++i)
{
if(s5[i]==nameo)
{
cout<<"有重名!请重新输入。。。\n";
system("pause");
system("CLS");
goto loop;
}
}
for(int i=0;i<nameo.size();++i)
{
if((nameo[i]>='A'&&nameo[i]<='Z')||nameo[i]==' ')
{
MessageBox(NULL,"出现大写字母或空格,请重新输入!","勇者小游戏",MB_OK);
system("CLS");
goto loop;
}
}
cout<<"密码:";
string passo;
cin>>passo;
nameo2=".\\Tools\\"+nameo+".yz";
ifstream fin20(nameo2.c_str());
ofstream fout20(nameo2.c_str());
str=nameo;
a.na=nameo;
a.s=1000;
a.f=100;
a.q=200;
a.g=200;
a.j=1;
a.dg=0;
fout20<<passo<<endl<<1000<<" "<<100<<" "<<100<<" "<<1<<" "<<200<<" "<<0<<endl;
cout<<"注册成功!\n";
string tmptime=".\\Tools\\"+a.na+".tim2";
ofstream ftime2(tmptime.c_str());
ftime2<<time(NULL);
ftime2.close();
system("pause");
system("CLS");
}
else
{
system("CLS");
cout<<"输入错误!";
Sleep(1500);
system("CLS");
goto loop2;
}
int m;
fout2<<str<<endl;
int i=1;
while(fin2>>s3[i])i++;
sort(s3+1,s3+i);
for(int j=1;j<i;++j)
{
if(j==1||s3[j]!=s3[j-1])
{
mm++;
s4[mm]=s3[j];
}
}
ofstream fout3(".\\Tools\\name.ini");
for(int i=1;i<=mm;++i)fout3<<s4[i]<<endl;
string times=".\\Tools\\"+str+"_time.tim";
long long timenow=time(NULL);
ifstream fintime(times.c_str(),ios::in|ios::out);
long long timeover;
fintime>>timeover;
ofstream foutime(times.c_str());
foutime<<timenow<<endl;
fintime.close();
foutime.close();
a.na=str;
string sttr=".\\Tools\\"+a.na+"set.ini",qj1,bj1;
ifstream fin401(sttr.c_str(),ios::in|ios::out);
fin401>>bj1>>qj1;
string tmp="color "+bj1+qj1;
system(tmp.c_str());
if(timenow-timeover>=86400)
{
ofstream foutime(times.c_str(),ios::in|ios::out);
int qq=rand()%10+1;
a.q+=qq;
string qqq="恭喜您获得";
char qqqqq=qq+'0';
if(qq<10)qqq=qqq+qqqqq+"元!";
else qqq=qqq+"10元!";
MessageBox(NULL,qqq.c_str(),"勇者小游戏",MB_OK);
}
a.na=str;
if(a.s>a.j*1000) a.s=a.j*1000;
if(a.g>a.j*100) a.g=a.j*100;
if(a.f>a.j*100) a.f=a.j*100;
string lujin2=".\\Tools\\"+a.na+"set.ini";
ifstream fin30(lujin2.c_str(),ios::in|ios::out);
string qianjin,beijin;
fin30>>qianjin>>beijin;
int about_news,talkings;
fin30>>about_news>>talkings;
if(!fin30)
{
ofstream fout30(lujin2.c_str());
qianjin="0";
beijin="7";
about_news=1;
talkings=10;
fout30<<qianjin<<" "<<beijin<<endl<<1;
}
string setting_c="color "+qianjin+beijin;
system(setting_c.c_str());
talking=talkings;
if(about_news)
{
ifstream news(".\\Tools\\news.ini",ios::in|ios::out);
int flagn=0;
news>>flagn;
if(flagn==0||!news);
if(flagn==1)
{
string newss,longnews;
while(news>>newss)longnews=longnews+newss+"\n";
MessageBox(NULL,longnews.c_str(),"勇者小游戏公告",MB_OK);
}
}
fin30.close();
fin401.close();
string mtmp=".\\Tools\\"+a.na+".tlk";
ifstream mesin(mtmp.c_str(),ios::in|ios::out);
string renmin;
while(mesin)
{
nmp:
int tl=0;
mesin>>tl;
if(tl==1)
{
mesin>>nn2020;
getline(mesin,nn20);
//if(mesidx[nn2020[ks]]!=1)messagess[nn2020[ks]]=nn2020[ks]+"对你说:";
//mesidx[nn2020[ks]]=1;
//messagess[nn2020[ks]]+=nn20[ks]+"\n";
messagess=nn2020+"对你说:"+nn20;
MessageBox(NULL,messagess.c_str(),"勇者小游戏",MB_OK);
}
else if(tl==2)
{
mesin>>mennames>>tunames>>whyme;
//cout<<ks2<<" "<<mennames[ks2]<<" "<<tunames[ks2]<<" "<<whyme[ks2]<<endl;
tumessages="团队"+tunames+"的团主"+mennames+"将该团解散\n理由:"+whyme;
MessageBox(NULL,tumessages.c_str(),"勇者小游戏",MB_OK);
}
else if(tl==3)
{
mesin>>renmin;
mpp[renmin]++;
}
else if(tl==4)
{
string quzhuzhe,tuanduiming,yuanyin;
mesin>>quzhuzhe>>tuanduiming>>yuanyin;
string quzhudemessage="您被"+tuanduiming+"的团主"+quzhuzhe+"驱逐出团。\n原因:"+yuanyin;
MessageBox(NULL,quzhudemessage.c_str(),"勇者小游戏",MB_OK);
}
else if(tl==5)
{
string inv1,inv2;
mesin>>inv1>>inv2;
string invtmp=inv1+"邀请你加入团队"+inv2+"\n是否加入?";
int inv_r=MessageBox(NULL,invtmp.c_str(),"勇者小游戏",MB_YESNO);
if(inv_r==IDYES)
{
string invj=".\\Mbs\\"+inv2;
ifstream fin_j(invj.c_str(),ios::in|ios::out);
ofstream fout_j(invj.c_str(),ios::in|ios::out);
int mbsn=0;
fin_j>>mbsn;
for(int i=1;i<=mbsn;++i)
{
fin_j>>tuanren[i];
if(tuanren[i]==a.na)
{
MessageBox(NULL,"您此前已加入该团队!","勇者小游戏",MB_OK);
goto nmp;
}
}
tuanren[mbsn+1]=a.na;
fout_j<<mbsn+1<<endl;
for(int i=1;i<=mbsn+1;++i)
{
fout_j<<tuanren[i]<<endl;
}
MessageBox(NULL,"已加入","勇者小游戏",MB_OK);
}
}
}
//for(int i=1;i<ks;++i)MessageBox(NULL,messagess[i].c_str(),"勇者小游戏",MB_OK);
//for(int i=1;i<ks2;++i)MessageBox(NULL,tumessages[i].c_str(),"勇者小游戏",MB_OK);
map<string,int>::iterator it;
for(it=mpp.begin();it!=mpp.end();++it)
{
stringstream ssz;
ssz<<it->second;
string tmptmp;
ssz>>tmptmp;
string ttmmpp="您被"+it->first+"攻击了"+tmptmp+"次!";
MessageBox(NULL,ttmmpp.c_str(),"勇者小游戏",MB_OK);
}
mesin.close();
string mtmp2="erase /S "+mtmp;
system("@echo off");
system(mtmp2.c_str());
system("@echo on");
string stmp=".\\Tools\\"+a.na+".tim2";
ifstream fiinn(stmp.c_str(),ios::in|ios::out);
int ttiimmee;
if(!fiinn>>ttiimmee)
{
ifstream ffiinn(stmp.c_str());
ofstream foonn(stmp.c_str());
foonn<<time(NULL);
fiinn.close();
ffiinn.close();
foonn.close();
}
fiinn.close();
system("CLS");
while(1)
{
print();
cin.clear();
cin>>m;
if(!m)
{
int at=MessageBox(NULL,"确认退出?","勇者小游戏",MB_YESNO);
if(at==IDYES)break;
else
{
system("CLS");
continue ;
}
system("CLS");
continue;
}
if(m==1)
{
system("CLS");
yao();
}
else if(m==2)
{
system("CLS");
wuqi();
}
else if(m==3)
{
system("CLS");
fangju();
}
else if(m==4)
{
system("CLS");
caipiao();
}
else if(m==5)
{
system("CLS");
daguai();
}
else if(m==6)
{
system("CLS");
zhuangtai();
}
else if(m==7)
{
system("CLS");
shengji();
}
else if(m==8)
{
system("CLS");
juedou();
}
else if(m==9)
{
system("CLS");
chuanmen();
}
else if(m==10)
{
system("CLS");
paihangbang();
}
else if(m==11)
{
system("CLS");
tuandui();
}
else if(m==12)
{
system("CLS");
xunzhang();
}
else if(m==13)
{
system("CLS");
zhuxiao();
}
else if(m==14)
{
system("CLS");
cin.clear();
spk=0;
liaotian();
}
else if(m==15)
{
system("CLS");
cin.clear();
shezhi();
}
else
{
cout<<"输入错误!\n";
Sleep(1500);
system("CLS");
}
system("CLS");
}
ShowWindow(FindWindow("ConsoleWindowClass",argv[0]),0);
if(a.g>a.j*100)a.g=a.s*100;
if(a.f>a.j*100)a.f=a.s*100;
if(a.s>a.j*1000)a.s=a.j*1000;
ofstream fout(aa.c_str());
fout<<str1<<endl;
fout<<a.s<<" "<<a.g<<" "<<a.f<<" "<<a.j<<" "<<a.q<<" "<<a.dg<<endl;
return 0;
}
/*
.tlk
1聊天
2解散群聊
*/
//勇者小游戏4.4
//刘景程
https://wenda.codingtang.com/questions/8444/
0
0
0
0
0
许金夫
初级天翼
初级天翼
酷町问答十大法则第一:不要洪浪滔天、百川入海、惊涛骇浪、倾盆雨下、暴雨如注、水积成川、水天一色。碧波荡漾、水趣盎然、波光潋滟、清澈见底、悠悠烟水、碧波浩渺、溪流淙淙、白浪滔天、波涛澎湃、狂风怒潮、黑风巨浪
0