大富翁竞技场
-
大富翁竞技场.转自
#include<iostream> #include<string> #include<cstring> #include<stdio.h> #include<stdlib.h> #include<windows.h> //Xcode涓嶈兘鐢ㄣ€? #include<time.h> #include<unistd.h> //sleep()//1s//usleep()//1/1000000s #include<cstdlib>//system("cls") #include<conio.h>//getch() #define random(x) (rand()%x) using namespace std; int a[5000],a2[5000],a3[5000],game=0,start=0,move1=0,move2=1,move3=0,e=0,now[5],money[5]={10,10,10,10,10},i=0,j=0,fight=0,b=0,p=0,prop[5][11],st[30],pstar[5],fg[15][15],fn=0,fm=0,f2n=0,f2m=0,win; double tim; struct player{ int m; int hp; int arrow; string bow; string knife; }; player pp[3]; void outside(string o){ for(int k=0;k<o.length();k++){ cout<<o[k]; usleep(38000); } cout<<endl<<endl; } void colour(int d){ if(d==1){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_GREEN| FOREGROUND_BLUE); }else if(d==2){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_RED); }else if(d==3){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_GREEN); }else if(d==4){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED| FOREGROUND_BLUE); }else if(d==5){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); }else if(d==6){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_BLUE); }else if(d==7){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_BLUE|FOREGROUND_INTENSITY | FOREGROUND_RED|FOREGROUND_GREEN); }else if(d==8){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |BACKGROUND_INTENSITY|FOREGROUND_GREEN|BACKGROUND_RED| BACKGROUND_BLUE|FOREGROUND_BLUE); }else if(d==9){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY); }else SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY | FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); cout<<d<<" "; } void say(int a){ cout<<endl<<endl<<endl; outside("1会给你三块钱。"); outside("2会扣掉你三块钱。"); outside("3会给你一个随机事件。"); outside("4会给你一个邪恶的转盘。"); outside("5会给你一个好的转盘。"); outside("6会让你和一个人决斗。如果你赢了,你可以拿走那个玩家一半的钱。"); outside("7是星星商家的家,你可以用30元换一个星星。在你买了星星后,星星商人会去地图上的任何地方。一张地图上有30个星星商人。"); outside("8是道具店。(开发中)"); outside("9号是道具供应点。你可以通过经过或停留来获得道具。"); outside("10,11,12,13 分别是玩家 1,2,3,4。"); outside("收集10颗星的玩家就获胜。"); outside("游戏中有10种道具。"); outside("道具1:两倍樱桃。功能:步数乘以2(5块钱)"); outside("道具二:三倍樱桃。功能:步数乘3(10块钱)"); outside("道具三:钱包。功能:给你10元(5元)"); outside("道具四:加速蘑菇。功能:加5步(10元)"); outside("道具5:黄金加速蘑菇。功能:加10步(15元)"); outside("道具六:管道。功能:把你送到地图上的任意位置(15元)"); outside("道具七:金色的管子。功能:传送你到地图上随机星星商人的位置(25元)"); outside("道具八:夹娃娃机。功能:可作为任何道具使用(30元)"); outside("道具9:嘘(boo)。功能:从指定玩家那里偷10块钱,再加35元可以从指定玩家那里偷一颗星星(15块钱)"); outside("道具十:战斗手套。功能:让你和一个指定的玩家战斗,如果你赢了,你可以偷那个玩家的一半钱(15钱)"); outside("按1掷骰子"); outside("按2使用道具"); system("pause"); return; } void say2(){ outside("Alpha 1.7.2:增加了更新日志。修复了一些bug。"); outside("Alpha 1.8.0:改进了随机事件。修复了一些bug。"); outside("Alpha 1.9.0:添加了好转盘。修复了一些bug。"); outside("Alpha 1.9.2:修复了一些bug。"); outside("Alpha 1.9.3:增加了夹娃娃机。修复了一些bug。"); outside("Alpha 1.9.4:增加了嘘(boo)。修复了一些bug。"); outside("Alpha 1.9.5:修复了一些bug。"); outside("Alpha 1.10.0:增加了战斗1和战斗手套。修复了一些bug。"); outside("Alpha 1.10.1:修复了一些bug。"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN); outside("Bata 1.0.0:添加了星星商人。你可以成为这场比赛的赢家!!!"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); system("pause"); return; } void merchant(int c){ int cc=0,cd=0; pstar[j]++; outside("Loading..."); for(int i=0;i<30;i++){ if(st[i]==now[j]){ cc=i; break; } } a3[now[j]]=a2[now[j]]; a[now[j]]=a2[now[j]]; a3[cd=(random(5000))]=7; a[cd=(random(5000))]=7; return; } void begg(int ran,int use){ int give=0; if(ran>use*25){ outside("Thank you"); outside("I have a prop"); outside("But I can't use it"); outside("So I want to give you!"); sleep(1); give=(random(10)); switch(give){ case 0:outside("The begger will give you a double cherry");prop[j][0]++;prop[j][10]++; break; case 1:outside("The begger will give you a triple cherry");prop[j][1]++;prop[j][10]++; break; case 2:outside("The begger will give you a wallet");prop[j][2]++;prop[j][10]++; break; case 3:outside("The begger will give you a sprint mushroom");prop[j][3]++;prop[j][10]++; break; case 4:outside("The begger will give you a golden mushroom");prop[j][4]++;prop[j][10]++; break; case 5:outside("The begger will give you a pipe");prop[j][5]++;prop[j][10]++; break; case 6:outside("The begger will give you a golden pipe");prop[j][6]++;prop[j][10]++; break; case 7:outside("The begger will give you a doll clamping machine");prop[j][7]++;prop[j][10]++; break; case 8:outside("The begger will give you a boo");prop[j][8]++;prop[j][10]++; break; case 9:outside("The begger will give you the combat gloves");prop[j][9]++;prop[j][10]++; break; } }else outside("Sorry.I don't have any props. :("); return; } void event(int player){ int e=0,use=0,ran=0,qqq,qqqq,qqqqq,qn; e=(random(6)); switch(e){ case 0:outside("Nothing happened");break; case 1:cout<<"Player "<<j<<" meets a beggar"<<endl; outside("Press 1 to gives the begger twenty money"); outside("Press 2 to gives the begger ten money"); outside("Press 3 to gives the begger five money"); outside("Press 4 not to give money to beggars"); cin>>use; ran=(random(100)); switch(use){ case 1:if(money[j]<20){ outside("You don't have enouth money"); break; }money[j-1]-=20; begg(ran,use); break; case 2:if(money[j]<10){ outside("You don't have enouth money"); break; }money[j-1]-=10;begg(ran,use); break; case 3:if(money[j]<5){ outside("You don't have enouth money"); break; }money[j]-=5;begg(ran,use); break; case 4:outside("QAQ");break; } break; case 2:cout<<"Player "<<j<<" meets a student"<<endl; outside("Your money -10 because you give a student 10 money");money[j]-=10;break; case 3:cout<<"Player "<<j<<" going to the park now"<<endl; outside("Please waiting 20 seconds. :)"); sleep(20);break; case 4:cout<<"Player "<<j<<" going to the school now"<<endl; sleep(1); qqq=(random(1000000000)); qqqq=(random(1000000000)); cout<<"teacher:"<<qqq<<"+"<<qqqq<<"=? :)"<<endl; cin>>qqqqq; if(qqqqq==qqq+qqqq){ outside("GREAT!give you 15 money. :D"); money[j]+=15;break; }else outside("NO! (your money-13)"); money[j]-=13;break; case 5:cout<<"Player "<<j<<" going to the S* tree."<<endl; sleep(1); outside("tree:can you give me 11 money?(1 or 0)"); cin>>qn; if(qn==1){ outside("tree: thank you.");money[j]-=11;break; }else outside("tree: ww... (waiting 40 seconds)"); sleep(40);break; } } void evil(int pl,int &yuan){ int ran=0,w=0; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_BLUE); outside("clear your 10 money(2/9)"); outside("clear your 20 money(2/9)"); outside("clear your a half of money(2/9)"); outside("clear your a prop(2/9)"); outside("clear your all money(1/18)"); outside("clear your a star(1/18)"); system("pause"); ran=(random(18)); if(ran<4){ yuan-=10; cout<<"player "<<pl<<"'s tan money has been cleared. :|"<<endl<<endl; sleep(1); return; }else if(ran<8){ yuan-=20; cout<<"player "<<pl<<"'s twenty money has been cleared. :("<<endl<<endl; sleep(1); return; }else if(ran<12){ yuan/=2; cout<<"player "<<pl<<"'s half of the money has been cleared. :|"<<endl<<endl; sleep(1); return; }else if(ran<16){ cout<<"player "<<pl<<" will clear a prop. :|"<<endl<<endl; sleep(1); w=(random(10)); prop[pl][w]--; cout<<"The prop "<<w<<" has been removed."<<endl<<endl; sleep(1); if(prop[pl][w]<0){ prop[pl][w]++; outside("But he or she doesn't have the prop. :)"); sleep(1); }else prop[pl][10]--; return; }else if(ran=16){ yuan=0; cout<<"player "<<pl<<"'s money has been cleared. X("<<endl<<endl; sleep(1); return; }else pstar[pl]--; cout<<"player "<<pl<<"'s star -1. XX("<<endl<<endl; if(pstar[pl]<0){ pstar[pl]++; outside("But he or she doesn't have a star. XD"); } sleep(1); return; } void ppp(){ int ran; ran=(random(100)); prop[j][10]++; cout<<"player "<<j<<" get a "; if(ran<20){ cout<<"double cherry!"<<endl<<endl;//20% prop[j][1]++; }else if(ran<40){ cout<<"sprint mushroom!"<<endl<<endl;//20% prop[j][4]++; }else if(ran<60){ cout<<"pipe!"<<endl<<endl;//20% prop[j][6]++; }else if(ran<70){ cout<<"wallet!"<<endl<<endl;//10% prop[j][3]++; }else if(ran<78){ cout<<"triple cherry!!"<<endl<<endl;//8% prop[j][2]++; }else if(ran<86){ cout<<"combat gloves!!"<<endl<<endl;//8% prop[j][9]++; }else if(ran<91){ cout<<"boo!!"<<endl<<endl;//5% prop[j][8]++; }else if(ran<95){ cout<<"golden mushroom!!"<<endl<<endl;//4% prop[j][5]++; }else if(ran<98){ cout<<"golden pipe!!!"<<endl<<endl;//3% prop[j][7]++; }else cout<<"doll clamping machine!!!"<<endl<<endl;//2% prop[j][8]++; sleep(2); return; } void good(int pl){ int ran=0,w=0; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_BLUE|FOREGROUND_GREEN); outside("give you 10 money(2/9)"); outside("give you 20 money(2/9)"); outside("give you 10~25 money(2/9)"); outside("give you a prop(2/9)"); outside("give you a star(1/9)"); system("pause"); ran=(random(9)); if(ran<2){ cout<<"player "<<pl<<"'s money+10."<<endl;money[j]+=10;sleep(1);return; }else if(ran<4){ cout<<"player "<<pl<<"'s money+20."<<endl;money[j]+=20;sleep(1);return; }else if(ran<6){ w=(random(15))+11; cout<<"player "<<pl<<"'s money+"<<w<<endl;money[j]+=w;sleep(1);return; }else if(ran<8){ cout<<"player "<<pl<<"'s prop+1."<<endl;ppp();sleep(1);return; }else cout<<"player "<<pl<<"'s star+1!!!"<<endl;pstar[j]++;return; } void fight1_1b(){ pp[1].arrow--; if(fn==f2n||fm==f2m){ pp[2].hp--; } return; } void fight1_2b(){ pp[2].arrow--; if(fn==f2n||fm==f2m){ pp[1].hp--; } return; } void fight1_1c(){ if(fg[fn-1][fm]=='2'||fg[fn+1][fm]=='2'||fg[fn][fm-1]=='2'||fg[fn][fm+1]=='2'||fg[fn-1][fm-1]=='2'||fg[fn-1][fm+1]=='2'||fg[fn+1][fm-1]=='2'||fg[fn+1][fm+1]=='2'){ pp[2].hp-=7; } } void fight1_2c(){ if(fg[f2n-1][f2m]=='1'||fg[f2n+1][f2m]=='1'||fg[f2n][f2m-1]=='1'||fg[f2n][f2m+1]=='1'||fg[f2n-1][f2m-1]=='1'||fg[f2n-1][f2m+1]=='1'||fg[f2n+1][f2m-1]=='1'||fg[f2n+1][f2m+1]=='1'){ pp[1].hp-=7; } } void fight1_2(int mo2,int &p1m,int &p2m){ if(mo2=='w'){ if(fn>0&&fg[fn-1][fm]!='2'){ fn--; fg[fn+1][fm]=' '; fg[fn][fm]='1'; } p1m+=(random(5))+1; return; } if(mo2=='s'){ if(fn<12&&fg[fn+1][fm]!='2'){ fn++; fg[fn-1][fm]=' '; fg[fn][fm]='1'; } p1m+=(random(5))+1; return; } if(mo2=='a'){ if(fm>0&&fg[fn][fm-1]!='2'){ fm--; fg[fn][fm+1]=' '; fg[fn][fm]='1'; } p1m+=(random(5))+1; return; } if(mo2=='d'){ if(fm<12&&fg[fn][fm+1]!='2'){ fm++; fg[fn][fm-1]=' '; fg[fn][fm]='1'; } p1m+=(random(5))+1; return; } if(mo2=='8'){ if(f2n>0&&fg[f2n-1][f2m]!='1'){ f2n--; fg[f2n+1][f2m]=' '; fg[f2n][f2m]='2'; } p2m+=(random(5))+1; return; } if(mo2=='5'){ if(f2n<12&&fg[f2n+1][f2m]!='1'){ f2n++; fg[f2n-1][f2m]=' '; fg[f2n][f2m]='2'; } p2m+=(random(5))+1; return; } if(mo2=='4'){ if(f2m>0&&fg[f2n][f2m-1]!='1'){ f2m--; fg[f2n][f2m+1]=' '; fg[f2n][f2m]='2'; } p2m+=(random(5))+1; return; } if(mo2=='6'){ if(f2m<12&&fg[f2n][f2m+1]!='1'){ f2m++; fg[f2n][f2m-1]=' '; fg[f2n][f2m]='2'; } p2m+=(random(5))+1; return; } if(mo2=='q'){ if(p1m>=50&&pp[1].bow=="no"){ p1m-=50; pp[1].bow="yes"; return; } if(pp[1].arrow>=1){ fight1_1b(); } return; } if(mo2=='x'){ if(pp[1].m>=20){ pp[1].arrow+=5; p1m-=20; } return; } if(mo2=='7'){ if(p2m>=50&&pp[2].bow=="no"){ p2m-=50; pp[2].bow="yes"; return; } if(pp[2].arrow>=1){ fight1_2b(); } return; } if(mo2=='2'){ if(pp[2].m>=20){ pp[2].arrow+=5; p2m-=20; } return; } if(mo2=='e'){ if(p1m>=80&&pp[1].knife=="no"){ p1m-=80; pp[1].knife="yes"; return; } fight1_1c(); } if(mo2=='9'){ if(p2m>=80&&pp[1].knife=="no"){ p2m-=80; pp[2].knife="yes"; return; } fight1_2c(); } } int fight1_1(){ char mo; for(int i=1;i<=2;i++){ pp[i].hp=100; pp[i].m=100; pp[i].arrow=0; pp[i].bow="no"; pp[i].knife="no"; } memset(fg,' ',sizeof(fg)); fg[0][0]='1'; fg[13][0]='2'; fn=0;fm=0;f2n=12;f2m=0; for( ; ; ){ system("cls"); if(pp[1].hp<=0){ return j; } if(pp[2].hp<=0){ return fight; } cout<<"# # # # # # # # # # # # # # #| | | | | | | | | | | | | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[0][i]<<" ";cout<<"| | | player 1 | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[1][i]<<" ";cout<<"| | | $:"<<pp[1].m<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[2][i]<<" ";cout<<"| | | hp:"<<pp[1].hp<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[3][i]<<" ";cout<<"| | | arrow:"<<pp[1].arrow<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[4][i]<<" ";cout<<"| | | Bow:"<<pp[1].bow<<" Knife:"<<pp[1].knife<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[5][i]<<" ";cout<<"| | | | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[6][i]<<" ";cout<<"| | | | | | | | | | | | | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[7][i]<<" ";cout<<"| | | player 2 | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[8][i]<<" ";cout<<"| | | $:"<<pp[2].m<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[9][i]<<" ";cout<<"| | | hp:"<<pp[2].hp<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[10][i]<<" ";cout<<"| | | arrow:"<<pp[2].arrow<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[11][i]<<" ";cout<<"| | | Bow:"<<pp[2].bow<<" Knife:"<<pp[2].knife<<" | | |"<<endl; cout<<"# ";for(int i=0;i<13;i++) cout<<fg[12][i]<<" ";cout<<"| | | | | |"<<endl; cout<<"# # # # # # # # # # # # # # #| | | | | | | | | | | | | | |"<<endl<<endl<<endl; mo=getch(); fight1_2(mo,pp[1].m,pp[2].m); } return 0; } void winner(){ cout<<"Player "<<win<<" won the game!"; cout<<"Time uesd: "<<(double)clock()/CLOCKS_PER_SEC-tim<<" second!"<<endl<<endl; sleep(1); cout<<"You get he or she a half of money!"<<endl<<endl; if(win==j){ money[j]+=money[fight]/2; money[fight]/=2; }else{ money[fight]+=money[j]/2; money[j]/=2; } system("pause"); return; } void fight1(){ int e; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |BACKGROUND_INTENSITY|FOREGROUND_GREEN| FOREGROUND_BLUE|BACKGROUND_RED|BACKGROUND_GREEN); system("cls"); cout<<"------------C++ good game-----------"<<endl; outside("Press 1 to start this game.\nPress 2 to view help."); cin>>e; if(e==1){ outside("GOGOGO!!!"); tim=(double)clock()/CLOCKS_PER_SEC; win=fight1_1(); winner(); }else{ outside("1./*map*/"); cout<<"# # # # # # # # # # # # # # #| | | | | | | | | | | | | | |"<<endl; cout<<"# 1/*player 1*/ #| | | player 1 | | |"<<endl; cout<<"# #| | /*money*/$:100 | | |"<<endl; cout<<"# #| | | hp:100 | | |"<<endl; cout<<"# #| | | arrow:0/*arrow's namber*/|"<<endl; cout<<"# #| | | Bow:no Knife:no | | |"<<endl; cout<<"# #| | | | | |"<<endl; cout<<"# #| | | | | | | | | | | | | | |"<<endl; cout<<"# #| | | player 2 | | |"<<endl; cout<<"# #| | | $:100 | | |"<<endl; cout<<"# #| | | hp:100 | | |"<<endl; cout<<"# #| | | arrow:0 | | |"<<endl; cout<<"# #| | | Bow:no Knife:no | | |"<<endl; cout<<"# 2/*player 2*/ #| | | | | |"<<endl; cout<<"# # # # # # # # # # # # # # #| | | | | | | | | | | | | | |"<<endl<<endl<<endl; sleep(5); outside("2.How to play."); outside("player 1:\n w:up s:down a:left d:right"); outside(" q:buy or use the bow(50 $ to buy.1 arrow to use)"); outside(" e:buy or use the knife(80 $ to buy)"); outside(" x:buy the arrow(20$ 5 arrow)"); outside("player 2:\n 8:up 5:down 4:left 6:right"); outside(" 7:buy or use the bow(50 $ to buy.1 arrow to use)"); outside(" 9:buy or use the knife(80 $ to buy)"); outside(" 2:buy the arrow(20$ 5 arrow)"); outside("Bow:attack 1 you need use an arrow to use it.\n You and a player in a straight line you can fight it."); outside("Knife:attack 7.\n You near a player 1M you can fight it."); outside("every round your $ +1~5"); system("pause"); tim=(double)clock()/CLOCKS_PER_SEC; win=fight1_1(); winner(); } return; } void fight_(int fgame){ outside("Which player do you want to fight?"); cin>>fight; cout<<"Player "<<j<<" will fight player "<<fight; sleep(1); fight1(); return; } void star(int yy){ outside("这就跟你问声好!你想要一个星星吗?(1或0)");sleep(1); outside("30元买1个~~~"); cin>>yy; if(yy==1){ if(money[j]>=30){ outside("谢谢~~~");sleep(1); outside("星星商人将去一个随机的地点。"); merchant(yy); return; } outside("你没有足够的钱。");sleep(1); } outside("BYE~~~~~~~~~~"); return; } void shop(int &yuan){ } void moved(int max){ move1=0; move1+=(random(4)); move1+=(random(4)); move1+=(random(4)); move1+=1; move1*=move2; move1+=move3; sleep(1); cout<<"Loading..."<<endl; sleep(1); cout<<"玩家"<<j<<"可以走"<<move1<<"步。"<<endl<<endl; while(move1>1){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); a[now[j]]=9+j; a[now[j]-1]=a2[now[j]-1]; cout<<a[now[j]-2]<<" "<<a[now[j]-1]<<" "<<a[now[j]]<<" "<<a[now[j]+1]<<" "<<a[now[j]+2]<<endl<<endl<<endl<<endl<<endl; cout<<" 钱"<<endl; cout<<" 玩家1:"<<money[1]<<endl; cout<<" 玩家2:"<<money[2]<<endl; cout<<" 玩家3:"<<money[3]<<endl; cout<<" 玩家4:"<<money[4]<<endl; now[j]++; sleep(1); move1--; cout<<endl<<endl<<endl<<endl<<endl<<endl; if(a[now[j]]==7&&move1>1){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);cout<<"玩家"<<j<<"将要去买星星!!!"<<endl<<endl;star(b);system("cls");sleep(3);system("cls"); } if(a[now[j]]==8&&move1>1){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE); cout<<"玩家"<<j<<"将要去购物!"<<endl<<endl;system("cls");shop(money[j]);sleep(2);system("cls"); } if(a[now[j]]==9&&move1>1){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY); cout<<"玩家"<<j<<"将要获得一个道具"<<endl<<endl;sleep(2),system("cls");ppp();system("cls"); } } a[now[j]]=9+j; a[now[j]-1]=a2[now[j]-1]; cout<<a[now[j]-2]<<" "<<a[now[j]-1]<<" "<<a[now[j]]<<" "<<a[now[j]+1]<<" "<<a[now[j]+2]<<endl<<endl; switch(a3[now[j]]){ case 1:cout<<"玩家"<<j<<"将要加3块钱"<<endl<<endl;money[j]+=3;sleep(2);system("cls");break; case 2:cout<<"玩家"<<j<<"将要扣3块钱"<<endl<<endl;money[j]-=3;sleep(2);system("cls");break; case 3:cout<<"玩家"<<j<<"将遇到一个事件发生"<<endl<<endl;event(j);sleep(2);system("cls");break; case 4:cout<<"玩家"<<j<<"将要转动一个邪恶的转盘"<<endl<<endl;system("cls");evil(j,money[j]);sleep(2);system("cls");break; case 5:cout<<"玩家"<<j<<"将要转动一个好的转盘"<<endl<<endl;system("cls");good(j);sleep(2);system("cls");break; case 6:cout<<"玩家"<<j<<"将要与一个玩家决斗"<<endl<<endl;system("cls");fight_(b);sleep(2);system("cls");break; case 7:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);cout<<"玩家"<<j<<"将要去买星星!!!"<<endl<<endl;system("cls");star(b);sleep(3);system("cls");break; case 8:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE); cout<<"玩家"<<j<<"将要去购物!"<<endl<<endl;system("cls");shop(money[j]);sleep(2);system("cls");break; case 9:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);cout<<"玩家"<<j<<"将要获得一个道具"<<endl<<endl;system("cls");sleep(2),ppp();system("cls");break; default:cout<<"HaHa"<<endl<<endl;sleep(2);system("cls");a[now[j]-1]=a2[now[j]-1];break; } move2=1; move3=0; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); return; } void boo(){ int p,s; outside("你想抢哪个人的钱?"); cin>>p; if(money[p]>=10){ if(money[j]>=45&&pstar[p]>0){ outside("你想偷他或她一颗星星吗?(钱-35)(1 or 0)"); cin>>s; if(s>0){ outside("OK!"); money[j]-=35; pstar[p]--;pstar[j]++; prop[j][8]--;prop[j][10]--; return; }else outside("OK!"); sleep(1); } outside("你偷了他或她10块钱。"); prop[j][8]--;prop[j][10]--; }else outside("他或她没有10块钱"); return; } void dcm(){ int p; outside("你想用什么道具(输入编号)"); cin>>p; outside("道具已使用"); switch(p){ case 1:move2=2;moved(b);break; case 2:move2=3;moved(b);break; case 3:money[j]+=10;moved(b);break; case 4:move3+=5;moved(b);break; case 5:move3+=10;moved(b);break; case 6:now[j]=(random(5000));moved(b);break; case 7:now[j]=st[(random(30))];moved(b);break; } } int main(){ int m,m2,ran,s=0; char mm,mm2,ee; memset(now,0,sizeof(now)); memset(prop,0,sizeof(prop)); memset(pstar,0,sizeof(pstar)); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); cout<<"---------------大富翁----------------"<<endl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_GREEN); cout<<" \\ Bata 1.0.0 / "<<endl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); cout<<"--------请输入你们的玩家数-----------"<<endl; cout<<" (2~4)"<<endl; mm=getch(); m=mm-'0'; if(m<2){ m=2; } if(m>4){ m=4; } cout<<m<<endl; cout<<"-------------按1查看帮助-------------"<<endl; cout<<"------------按2不查看帮助------------"<<endl; cout<<"-----------按3查看更新日志-----------"<<endl; mm2=getch(); m2=mm2-'0'; cout<<m2<<endl; cout<<" GO "<<endl; cout<<"Tip:Press '9999'view help."<<endl; sleep(3); cout<<endl; srand((int)time(0)); for(i=0;i<5000;i++){ ran=(random(100)); if(ran<40){//40% a[i]=1; }else if(ran<70){//30% a[i]=2; }else if(ran<87){//17% a[i]=3; }else if(ran<92){//5% a[i]=4; }else if(ran<97){//5% a[i]=5; }else if(ran<99){//2% a[i]=6; }else a[i]=0;//1% a2[i]=a[i]; a3[i]=a[i]; cout<<i<<"/5000 loading..."<<endl; usleep(10); } system("cls"); if(m2==1){ say(b); }else if(m2==3){ say2(); } cout<<"loading..."<<endl; sleep(3); system("cls"); for(int i=0;i<200;i++){ ran=(random(5000)); a[ran]=9; a2[ran]=9; a3[ran]=9; } for(int i=0;i<150;i++){ ran=(random(5000)); a[ran]=8; a2[ran]=8; a3[ran]=8; } for(int i=0;i<30;i++){ ran=(random(5000)); a[ran]=7; a3[ran]=7; } for(int i=0;i<5000;i++){ colour(a[i]); if(a[i]==7){ st[s]=i; s++; } } SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE |FOREGROUND_INTENSITY); system("pause"); system("cls"); game=0; for(int i=1;game!=38264;i++){ cout<<"第"<<i<<"轮"<<endl; for(j=1;j<=m;j++){ if(money[j]<0){ money[j]=0; } if(pstar[j]>=10){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN); cout<<"PLAYER ";sleep(1);cout<<j;sleep(1);cout<<" WIN!!!"<<endl<<endl;sleep(1); return 0; } cout<<"现在是玩家"<<j<<"的回合"<<endl; ee=getch(); e=ee-'0'; cout<<e<<endl; if(e==1){ if(i>1){ now[j]+=1; } moved(m); } if(e==2){ if(prop[j][10]==0){ cout<<"错误!!!"<<endl; outside("你必须有道具!"); sleep(3); outside("自动调整为骰子。"); moved(b); break; }else outside("你想用什么道具(输入编号)"); cin>>p; if(prop[j][p]==0){ cout<<"错误!!!"<<endl; outside("你必须有这个道具!"); sleep(3); outside("自动调整为骰子。"); moved(m); break; }else outside("道具已使用"); switch(p){ case 1:move2=2;prop[j][10]--;prop[j][0]--;moved(b);break; case 2:move2=3;prop[j][10]--;prop[j][1]--;moved(b);break; case 3:money[j]+=10;prop[j][10]--;prop[j][2]--;moved(b);break; case 4:move3+=5;prop[j][10]--;prop[j][3]--;moved(b);break; case 5:move3+=10;prop[j][10]--;prop[j][4]--;moved(b);break; case 6:now[j]=(random(5000));prop[j][10]--;prop[j][5]--;moved(b);break; case 7:now[j]=st[(random(30))]-1;prop[j][10]--;prop[j][6]--;moved(b);break; case 8:dcm();prop[j][10]--;prop[j][7]--;moved(b);break; case 9:boo();moved(b);break; case 10:fight_(b);prop[j][10]--;prop[j][9]--;moved(b);break; } } } } return 0; }