- 题解
- 2018-07-12 15:01:35 @
Fro
7 条评论
-
NOI NOI oier LV 1 MOD @ 2018-07-14 15:38:57
#include <bits/stdc++.h> #include <windows.h> using namespace std; struct Players{ //Game_GreenLand //Game_SkySon //Game_ClashofWorse //The_Real_Life int Money,weiwang,Life,MaxLife; }Player[6]; int i,j,k,l,m,n,x,y,z,playerID; unsigned long long Jouce=9223372036854775806; void Slowsay(string a){ for(i=0;i<a.size();i++){ cout<<a[i]; Sleep(46); } } void Say(string a){ for(i=0;i<a.size();i++){ cout<<a[i]; Sleep(22); } } void Print(string a){ for(i=0;i<a.size();i++){ cout<<a[i]; Sleep(8); } } void LifeAgain(){ } void The_Life_end(){ } void GetingFirst(){ } void Gragon_Home(){ } void Forest(){ } void River(){ } void Beach(){ } void Island(){ } void IceWorld(){ } void Mountain(){ } void Home(){ } void Shop(){ } void Fire(){ } void Gameshop(){ } void Work(){ } void School(){ } void Golden_World(){ } void Save_RealLife(){ } void Save_GreenLand(){ } void Save_SkySon(){ } void Save_ClashofWorse(){ } void Name(){ } void Homem(){ } void Vocation(){ } void Game_GreenLand(){ } void Game_SkySon(){ } void Game_ClashofWorse(){ } void Real_Menu(){ Game_GreenLand(); //1 Game_SkySon(); Game_ClashofWorse(); Gragon_Home(); //2 Forest(); //3 River(); //4 Beach(); //5 Island(); //6 IceWorld(); //7 Mountain(); //8 Home(); //9 Shop(); //10 Fire(); //11 Gameshop(); //12 Work(); //13 School(); //14 Golden_World(); //15 Save_RealLife(); Jouce--; if(!Jouce) The_Life_end(); } int main(){ Name(); Homem(); Vocation(); GetingFirst(); while(Jouce){ while(Player[playerID].Life) Real_Menu(); LifeAgain(); Jouce--; } The_Life_end(); }
-
2018-07-13 16:15:22@
//zeiyibo #include <bits/stdc++.h> #include <windows.h> #include <conio.h> #define Sl Sleep(100); int money=100,jijiuxiang=0,yiliaoxiang=0,bengdai=0,zhitongyao=0,yinliao=0; int HP=100,gongji=15,XP=0,er=1,zz=1;int ti; char game; int shuijin=0; int xxx; int sss; char wz; int jilu; int qixie,baoji,jiacheng; int baoji1; using namespace std; string hao[1000]={"打豆豆","刷微博","上woos","去购物","追剧","开电脑","打maimai","写作业","考试","上洛谷刷题","搞基","嘿嘿嘿","吃东西","睡觉","玩GTA5","带妹子","编游戏","做坏事","当值日生","上厕所","吹空调","关电视","打罗岑","听罗岑放屁","看罗岑打键盘"}; string hou1[1000]={"会通关","会被人狂赞","可以看见作者","买到超便宜的东西","神剧连更新5集","状态好","不会被发现","写的全对","写的全会蒙的全对","全部AC","友谊天长地久","嘿嘿嘿嘿嘿嘿......","会吃饱","一天精神好","电脑不卡","说不定会牵手","会成功","心里倍儿爽","会被表扬","......","特别舒服","贼爽","可以打他了","他要被群殴"}; string hou2[1000]={"会被秒杀","会被认为是推销的","卡顿","会被喂狗粮","电视卡死","电脑自爆","被发现","全错","带鸭蛋回家","wa声一片","会死的","Ta不愿意","会被噎死","睡不着啊","卡死","技术差被妹子带飞","被教练抓住","警察叔叔来了","会被批评","会掉下厕所","会被吹成面瘫","电视开不了了","罗岑放屁攻击你","一屁轰飞你狗头","发现他敲的是你的键盘"};string yun[10000]={"大吉","中吉","小吉","中平","小凶","中凶","大凶"}; int zzzzz[1000]={0,1}; char a[100][100]; string zzzz[1000]={"z","木剑","铁剑","玄铁重剑","青云紫剑","凤鸣长剑","王者神剑","冰封骨剑","赤炎龙剑","冰火圣剑","泣血魔剑","无尽苍弦","驱魔剑"}; int wwwww[1000]={0,20,30,50,80,100,200,120,150,300,120,130,160};//12 int pay[1000]={0,0,3000,4500,6000,8000,4000,6000,4500}; int dengji[1000]={0}; int feiyong[1000]={0,600,900,1200,1400,1600,850,1500,1300}; int jineng1[1000]={0,10,20,30,40}; int jineng2[1000]={0}; string juqing="垃圾袋满天飞,黑风暴铺天盖地地向人们袭来,漫天的泥尘 ,抬头,看不见天空,低头,看不见土地......地上的汽车是跑的很快,天上的飞机也飞得很快,这些,是科技,是进步,但是,这些也是退步。汽车日夜喷着黑烟,逐渐的,人们居住的地方越来越小,沉睡了数千年的病毒觉醒了------非典,你踏上了寻找家园的道路......没有绿地,没有家乡,你十分懊恼,倒在床上,逐渐睡着了。梦中,天空若隐若现的时候,抬头,望到的不是碧空,是一张恶魔的脸!他向你诡异的笑着,是的,你被非典感染了!!!!!!惊恐万分之际,你不得不加入了人类与非典的战争,向着他,用自己的鲜血,祭奠着天神,一道白光出现,五芒星阵落在了你的头顶,悠远的声音响起:加油吧,少年,胜利是属于我们的,,,,,,"; int Slowsay(){ int k=0; for(int i=0;i<juqing.size();i++){ cout<<juqing[i]; Sleep(30); k++; if(k==10000){ Sleep(1000); k=0; cout<<"\n"; system("cls"); } } return 0; } int ronglianlu(){ int k=0,i,j; system("cls"); cout<<"各武器升级费用如下:\n"; for(i=1;i<=12;i++){ if(i!=7&&i!=8&&i!=9){ k++; if(i<=6) cout<<k<<"."<<zzzz[i]<<" "<<feiyong[i]<<"\n"; else if(i>=10)cout<<k<<"."<<zzzz[i]<<" "<<feiyong[i-4]<<"\n"; } } cout<<"\n你升级哪个?\n"; cin>>j; if(j>6){j+=3; if(money>=feiyong[j-4]){cout<<"成功升级"<<zzzz[j-4]<<"\n当前等级:"<<++dengji[j-4]; dengji[j-4]++; money-=feiyong[j-4]; wwwww[j]+=wwwww[j]*5/10; } } else if(j<=6){ if(money>=feiyong[j]){ cout<<"成功升级"<<zzzz[j]<<"\n当前等级:"<<dengji[j]++; dengji[j]++; money-=feiyong[j]; wwwww[j]+=wwwww[j]*5/10; } } else cout<<"钱不够哦!\n"; Sleep(1000); system("cls"); } void save(){ freopen("LIN","w",stdout); cout<<HP<<"\n"; cout<<gongji<<"\n"; cout<<money<<"\n"; cout<<XP<<"\n"; cout<<er<<"\n"; cout<<zz<<"\n"; cout<<jijiuxiang<<"\n"; cout<<yiliaoxiang<<"\n"; cout<<bengdai<<"\n"; cout<<zhitongyao<<"\n"; cout<<yinliao<<"\n"; for(int i=1;i<=9;i++) cout<<zzzzz[i]<<"\n"; for(int i=1;i<=12;i++) cout<<dengji[i]<<"\n"; for(int i=1;i<=12;i++) cout<<wwwww[i]<<"\n"; fclose(stdout); } void Read(){ freopen("LIN","r",stdin); cin>>HP; cin>>gongji; cin>>money; cin>>XP; cin>>er; cin>>zz; cin>>jijiuxiang; cin>>yiliaoxiang; cin>>bengdai; cin>>zhitongyao; cin>>yinliao; for(int i=1;i<=9;i++) cin>>zzzzz[i]; for(int i=1;i<=12;i++) cin>>dengji[i]; for(int i=1;i<=12;i++) cin>>wwwww[i]; fclose(stdin); freopen("CON","r",stdin); } int begin1(){ int shuigui=60,shuigui1=5,shuiguiXP=15,tian,count=0,count1=0,what1=0,what2=0,ss,wcn; char what[1000]; srand((unsigned)time(NULL)); ss=rand()%3; jilu=gongji; if(ss==1){ int shuigui=60,shuigui1=5,shuiguiXP=15,tian,count=0,count1=0,what1=0,what2=0; char what[1000]; cout<<"警告,警告,路遇水怪!\n"; Sleep(2000); system("cls"); cout<<"水怪 LV:3\n"; cout<<" 血量:60 攻击力:5 战胜可获得XP:15\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ srand((unsigned)(NULL)); wcn=rand()%10; if(wcn!=1){ HP-=5; count+=5;} if(HP<=0){cout<<"战斗失败!";break;} if(wcn!=1) cout<<"受到攻击!"<<"扣除血量5点! "<<"剩余HP:"<<HP<<"\n"; else cout<<"成功躲避,剩余HP:"<<HP<<"\n\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=10; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=25; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=100; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; cout<<"敌人受到攻击:"<<gongji+tian<<"剩余血量"<<shuigui; Sleep(1000); count1++; if(what1>=0){ what1--; HP+=3; cout<<"回血10,(运动饮料)"; } if(what2>=0){ what2--; HP+=10; cout<<"止痛药为你回复血量10点"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); }if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验15点"; XP+=15;} else cout<<"战斗失败"; Sleep(2000); system("cls"); } else if(ss==2){ int shuigui=70,shuigui1=10,shuiguiXP=25,pp,tian,count=0,count1=0,what1=0,what2=0; char what[10000]; cout<<"警告,警告,路遇小白,敌方有50%的概率闪避你的攻击!\n"; Sleep(2000); system("cls"); cout<<"小白 LV:5\n"; cout<<" 血量:70 攻击力:10 战胜可获得XP:25\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ srand((unsigned)(NULL)); wcn=rand()%10; if(wcn!=1){ HP-=10; count+=10;} srand((unsigned)time(NULL)); pp=rand()%2; if(HP<=0){cout<<"战斗失败!";break;} if(wcn!=1) cout<<"受到攻击!"<<"扣除血量10点! "<<"剩余HP:"<<HP<<"\n"; else cout<<"成功躲避攻击!\n"<<"剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=10; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=25; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=100; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; if(pp==1){ shuigui=shuigui-gongji-tian; cout<<"敌人受到攻击:"<<gongji+tian<<"剩余血量"<<shuigui;} else cout<<"敌方闪避了你的攻击......"; Sleep(1000); count1++; if(what1>=0){ what1--; HP+=3; cout<<"回血10,(运动饮料)"; } if(what2>=0){ what2--; HP+=10; cout<<"止痛药为你回复血量10点"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); }if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验25点"; XP+=25;} else cout<<"战斗失败"; Sleep(2000); system("cls"); } else if(ss==0){ int shuigui=60,shuigui1=5,shuiguiXP=15,tian,count=0,count1=0,what,what1=0,what2=0; cout<<"GOOD LUCKY!捡到金币一袋,获得经验20点!\n"; Sleep(2000); system("cls"); cout<<"你看着那漂亮的金币,心中燃起了焰火......\n"; money+=500; XP+=20; } } int begin2(){ int shuigui=100,shuigui1=20,shuiguiXP=50,tian,count=0,count1=0,what1=0,what2=0,ss,pp,wcn; char what[1000]; srand((unsigned)time(NULL)); ss=rand()%3; jilu=gongji; if(ss==1){ int shuigui=100,shuigui1=20,shuiguiXP=50,tian,count=0,count1=0,what1=0,what2=0,ss,pp; char what[1000]; cout<<"警告,警告,路遇黑熊!"; Sleep(2000); system("cls"); cout<<"黑熊 LV:5\n"; cout<<" 血量:100 攻击力:20 战胜可获得XP:50\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ srand((unsigned)(NULL)); wcn=rand()%10; if(wcn!=1){ HP-=20; count+=20;} if(HP<=0){cout<<"战斗失败!";break;} if(wcn!=1) cout<<"受到攻击!"<<"扣除血量20点 "<<"剩余HP:"<<HP<<"\n"; else cout<<"成功躲避攻击!剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=10; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=25; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=100; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; count1++; if(what1>=0){ what1--; HP+=3; cout<<"回血3点,(运动饮料)"; } if(what2>=0){ what2--; HP+=10; cout<<"回血10点,(止痛药)"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); }if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验50点"; XP+=50;} else cout<<"战斗失败"; Sleep(2000); system("cls");} if(ss==0){ cout<<"BOOM!!!!!!惊天的炸弹声传入你的耳中,你损失了200金币,被炸晕了!\n"; Sleep(1000); money-=200; system("cls"); pp=30; while(pp){ cout<<"晕眩中。。。。。。。"; Sleep(1000); system("cls"); pp--; } } else if(ss==2){ int shuigui=100,shuigui1=20,shuiguiXP=50,tian,count=0,count1=0,what1=0,what2=0,ss,pp; char what[1000]; cout<<"警告,警告,路遇药仙!他可以通过攻击你泣血!\n"; Sleep(2000); system("cls"); cout<<"药仙 LV:8\n"; cout<<" 血量:120 攻击力:30 战胜可获得XP:150\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ srand((unsigned)(NULL)); wcn=rand()%10; if(wcn!=1){ HP-=30; count+=30;} if(HP<=0){cout<<"战斗失败!";break;} srand((unsigned)time(NULL)); pp=rand()%3; shuigui+=8+pp; cout<<"药仙回血!"<<8+pp<<"点\n"; if(wcn!=1) cout<<"受到攻击!"<<"扣除血量30点 "<<"剩余HP:"<<HP<<"\n"; else cout<<"成功躲避攻击!剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=10; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=25; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=100; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; count1++; if(what1>=0){ what1--; HP+=3; cout<<"回血3点,(运动饮料)"; } if(what2>=0){ what2--; HP+=10; cout<<"回血10点,(止痛药)"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); }if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验150点"; XP+=150;} else cout<<"战斗失败"; Sleep(2000); system("cls");} } int begin3(){ int shuigui=200,shuigui1=30,shuiguiXP=200,tian,count=0,count1=0,what1=0,what2=0,ss,pp,gay,wcn; char what[1000]; srand((unsigned)time(NULL)); ss=rand()%3; jilu=gongji; if(ss==1){int shuigui=200,shuigui1=30,shuiguiXP=200,tian,count=0,count1=0,what1=0,what2=0,ss,pp; char what[1000]; cout<<"警告,警告,路遇树精长老!"; Sleep(2000); system("cls"); cout<<"树精长老 LV:10\n"; cout<<" 血量:200 攻击力:30 战胜可获得XP:200\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ srand((unsigned)(NULL)); wcn=rand()%10; if(wcn!=1){ HP-=30; count+=30;} if(HP<=0){cout<<"战斗失败!";break;} if(wcn!=1) cout<<"受到攻击!"<<"扣除HP30"<<"剩余HP:"<<HP<<"\n"; else cout<<"成功躲避攻击"<<"!剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=10; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=25; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=100; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; count1++; if(what1>=0){ what1--; HP+=3; cout<<"回血3点,(运动饮料)"; } if(what2>=0){ what2--; HP+=10; cout<<"回血10点,(止痛药)"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); }if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验200点"; XP+=200;} else cout<<"战斗失败"; Sleep(2000); system("cls");} else if(ss==2){int shuigui=180,shuigui1=40,shuiguiXP=200,tian,count=0,count1=0,what1=0,what2=0,ss,pp; char what[1000]; cout<<"警告,警告,路遇爆炸史蒂夫!"; Sleep(2000); system("cls"); cout<<"史蒂夫 LV:12\n"; cout<<" 血量:180 攻击力:40 战胜可获得XP:200\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ srand((unsigned)(NULL)); wcn=rand()%10; if(wcn!=1){ HP-=40; count+=40;} if(HP<=0){cout<<"战斗失败!";break;} if(wcn!=1) cout<<"受到攻击!"<<"扣除HP40"<<"剩余HP:"<<HP<<"\n"; else cout<<"成功躲避攻击!剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=10; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=25; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=100; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; count1++; if(what1>=0){ what1--; HP+=3; cout<<"回血3点,(运动饮料)"; } if(what2>=0){ what2--; HP+=10; cout<<"回血10点,(止痛药)"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); } cout<<"BOOM !!!!史蒂夫炸了,一朵蘑菇云在你眼前!你扣除血量50点!"; HP-=50; if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验200点"; XP+=200;} else cout<<"战斗失败"; Sleep(2000); system("cls");} else if(ss==0){ cout<<"激动人心的摇奖环节!你可以随机获得一个奖品哦!:\n1.金币100\n2.金币500\n3.水晶一个(价值3000金币!!!!!)\n4.经验50点\n5.攻击加成!\n按任意键开始摇奖\n"; game=getch(); for(int i=1;i<=100;i++){cout<<" ";system("cls");Sleep(10);} srand((unsigned)time(NULL)); pp=rand()%50; if(pp>=0&&pp<=15){cout<<"获得100枚金币!\n";money+=100;} if(pp>=31&&pp<=35){shuijin++;cout<<"获得水晶一枚!\n是否立即换成金币?(不换的话下次再摇到水晶的话可以一同卖掉且现在给你500元)\n";cin>>gay;if(gay==1){money+=3000*shuijin;cout<<"已为你卖出所有水晶!\n";shuijin=0;}else {money+=500;cout<<"好吧,获得500金币";}} if(pp>=16&&pp<=30){cout<<"获得500枚金币!\n";money+=500;} if(pp>=36&&pp<=43){ cout<<"XP++"; XP+=50; } else { cout<<"攻击++"; gongji+=15; } Sleep(1000); system("cls"); } } int begin4(){ int shuigui=500,shuigui1=100,shuiguiXP=1000,tian,count=0,count1=0,what1=0,what2=0,ss,pp; char what[1000]; srand((unsigned)time(NULL)); ss=rand()%3; jilu=gongji; if (ss==2){ int shuigui=1000,shuigui1=200,shuiguiXP=1000,tian,count=0,count1=0,what1=0,what2=0,ss,pp,a1,a2,a3,a4; char what[1000]; a1=HP; a2=gongji; HP+=500; gongji+=100; cout<<"警告,警告,路遇冰霜巨龙!由于对手过于强大,你加成生命500点,医疗品效果增强,攻击加成100,无法闪避其攻击"; Sleep(2000); system("cls"); cout<<"冰霜巨龙 LV:20\n"; cout<<" 血量:1000 攻击力:200 战胜可获得XP:1000\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ HP-=200; if(HP<=0){cout<<"战斗失败!";break;} count+=200; cout<<"受到攻击!"<<"扣除血量200"<<"剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=100; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=300; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=700; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count1/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; count1++; if(what1>=0){ what1--; HP+=100; cout<<"回血100点,(运动饮料)"; } if(what2>=0){ what2--; HP+=200; cout<<"回血200点,(止痛药)"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); } if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验1000点,获得冰封骨剑\n不幸的是,你被冻结了,一切值数回复正常\n"; pp=60; while(pp){ system("cls"); cout<<"\t\t\t\t\t\n\n\n\n\n\n剩余时间"<<pp<<"s\n"; pp--; Sleep(1000); } HP=a1; gongji=a2; zzzzz[7]=1; XP+=1000;} else cout<<"战斗失败\n"; cout<<"你被永远冰冻了......成了人干,回去回血吧!\n"; Sleep(2000); system("cls"); } else if (ss==0){ int shuigui=1000,shuigui1=200,shuiguiXP=1000,tian,count=0,count1=0,what1=0,what2=0,ss,pp,a1,a2,a3,a4; char what[1000]; a1=HP; a2=gongji; cout<<"警告,警告,路遇赤炎苍龙!由于对手过于强大,你加成生命500点,医疗品效果增强,攻击加成100,无法闪避其攻击"; Sleep(2000); system("cls"); HP+=500; gongji+=100; cout<<"赤炎苍龙 LV:20\n"; cout<<" 血量:1000 攻击力:200 战胜可获得XP:1000\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ srand((unsigned)time(NULL)); pp=rand()%20+30; HP-=200-pp; if(HP<=0){cout<<"战斗失败!";break;} count+=200+pp; cout<<"受到攻击!"<<"扣除血量200+烧伤:"<<pp<<"剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=100; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=300; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=700; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count1/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; count1++; if(what1>=0){ what1--; HP+=100; cout<<"回血100点,(运动饮料)"; } if(what2>=0){ what2--; HP+=200; cout<<"回血200点,(止痛药)"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); } if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验1000点,获得赤炎龙剑\n不幸的是,你被熔岩烫死了,一切值数回复正常\n"; HP=a1; gongji=a2; zzzzz[8]=1; XP+=1000;} else cout<<"战斗失败\n"; cout<<"你被永远烧死了......成了人干,回去回血吧!\n"; Sleep(2000); system("cls"); } if(ss==1){ int shuigui=500,shuigui1=100,shuiguiXP=1000,tian,count=0,count1=0,what1=0,what2=0,ss,pp; char what[1000]; cout<<"警告,警告,路遇神秘人!药品效果加强,无法闪避攻击\n"; Sleep(2000); system("cls"); cout<<"神秘人 LV:20\n"; cout<<" 血量:500 攻击力:100 战胜可获得XP:1000\n"; cout<<"you: HP"<<HP<<" 攻击:"<<gongji<<" XP"<<XP<<"\n"; while(shuigui>0){ HP-=100; if(HP<=0){cout<<"战斗失败!";break;} count+=100; cout<<"受到攻击!"<<"扣除血量100"<<"剩余HP:"<<HP<<"\n"; cout<<"1.运动饮料 "<<yinliao<<"瓶\n"; cout<<"2.止痛药 "<<zhitongyao<<"瓶\n"; cout<<"3.绷带"<<bengdai<<"瓶\n"; cout<<"4.医疗箱"<<yiliaoxiang<<"个\n"; cout<<"5.急救箱"<<jijiuxiang<<"个\n"; cout<<"是否使用道具(不使用请输入0,否则输入使用物品的编号)?\n"; cin>>what; if(what[0]=='1'&&yinliao>=1){ yinliao--; what1=9; HP+=3; } else if(what[0]=='1'&&yinliao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='2'&&zhitongyao>=1){ zhitongyao--; what2=9; HP+=100; } else if(what[0]=='2'&&zhitongyao<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='3'&&bengdai>=1){ bengdai--; HP+=300; } else if(what[0]=='3'&&bengdai<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='4'&&yiliaoxiang>=1){ yiliaoxiang--; HP+=700; } else if(what[0]=='4'&&yiliaoxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} if(what[0]=='5'&&jijiuxiang>=1){ jijiuxiang--; HP+=count1/2; } else if(what[0]=='5'&&jijiuxiang<1){ cout<<"请前去购买道具"; Sleep(1000); system("cls");} tian=rand()%20; shuigui=shuigui-gongji-tian; count1++; if(what1>=0){ what1--; HP+=3; cout<<"回血3点,(运动饮料)"; } if(what2>=0){ what2--; HP+=10; cout<<"回血10点,(止痛药)"; } gongji=jilu; if(qixie==1){HP+=gongji/10*3;cout<<"\n成功泣血!回血"<<gongji/10*3<<"点\n";Sleep(1000);} if(baoji==1){ srand((unsigned)time(NULL)); baoji1=rand()%4; if(baoji1==0){gongji*=2;cout<<"\n触发暴击,下次攻击加成100%!\n";Sleep(1000);} } if(jiacheng==1)gongji/=10*4; system("cls"); } if(HP>0){ cout<<"战斗结束:\n"; cout<<"战斗回合:"<<count1<<"\n"; cout<<"共收到伤害:"<<count<<"\n"; cout<<"收获经验1000点"; XP+=1000;} else cout<<"战斗失败\n"; Sleep(2000); system("cls");} } void kaishi(){ char daguai[100]; cout<<"1.河边\n"; cout<<"2.山洞\n"; cout<<"3.森林\n"; cout<<"4.魔界\n"; cin>>daguai; if(daguai[0]=='1'){ begin1(); system("cls"); } else if(daguai[0]=='2'){ begin2(); system("cls"); } else if(daguai[0]=='3'){ begin3(); system("cls"); } else if(daguai[0]=='4'){ begin4(); system("cls"); } } void beginnew(){ cout<<"\t\t\t-------------菜单-------------------------\n"; cout<<"\t\t\t|a.开始游戏 | |\n"; cout<<"\t\t\t|b.商店 |i.每日测运|\n"; cout<<"\t\t\t|c.家 |__________|\n"; cout<<"\t\t\t|d.街区 |作者在这: |\n"; cout<<"\t\t\t|e.查看当前状态 |长沙市一中|\n"; cout<<"\t\t\t|f.兵工厂 |岳麓中学17|\n"; cout<<"\t\t\t|g.更换武器 |0642杨永隆|\n"; cout<<"\t\t\t|h.退出游戏 | |\n"; cout<<"\t\t\t|j.炼钢炉 | |\n"; cout<<"\t\t\t|______________________________|__________|\n"; } void jia(){ cout<<"1.睡觉\n"; cout<<"2.升级殿堂\n"; cin>>xxx; if(xxx==1){ for(int i=1;i<=4;i++){ cout<<"(|"; Sl;//3[]晚安 cout<<"3"; Sl; cout<<"["; Sl; cout<<"▓"; Sl; cout<<"▓"; Sl; cout<<"]"; Sl; cout<<"晚安......"; Sl; cout<<"Z"; Sl; cout<<"Z"; Sl; cout<<"z"; Sl; Sleep(1000); system("cls");} Sleep(2000); cout<<"HP回满!"; HP=90+er*10; Sleep(2000); system("cls"); } else if(xxx==2){ if(XP>=er*100){ cout<<"升级成功!\n"; Sleep(2000); system("cls"); XP-=er*100; er++; cout<<"当前等级:"<<er; HP+=10; gongji+=5;} else {cout<<"经验不足"; Sleep(2000); system("cls"); } } } void jiequ(){ int l,ll,dubo1,dubo2; char dubo[100]; char z[100]; srand(time(NULL)); l=rand()%49; ll=rand()%100; cout<<"1.赌场\n"; cout<<"2.工地\n"; cin>>z; if(z[0]=='1'){ cout<<"1.赌大小\n"; cin>>dubo; if(dubo[0]=='1'){ cout<<"下注多少?\n"; cin>>dubo1; if(dubo1<=money){ money-=dubo1; cout<<"大还是小?(1 or 0)\n"; cin>>dubo2; if(l%2==0&&dubo2==1||l%2!=0&&dubo2==0){ cout<<"赌赢了,money++"; money+=dubo1*2; Sleep(2000); system("cls");} else {cout<<"小鬼,赌输了哦";Sleep(2000);system("cls");} } else if(dubo1>money){ cout<<"小鬼,钱不够哦!"; Sleep(2000); system("cls"); } } } else if(z[0]=='2'){ cout<<"1.搬砖(成功率%100,报酬为50到100不等)\n"; cout<<"2.看守工地(成功率50%,报酬100到200直间)\n"; cin>>dubo; if(dubo[0]=='1'){ for(int i=1;i<=60;i++){ cout<<"\t\t搬砖中";cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100); Sleep(400); system("cls"); } cout<<"金钱+="<<l+50<<"由于过度劳累,HP-10"; HP-=10; money+=l+50; Sleep(2000); system("cls"); } else if(dubo[0]=='2'&&l%2==0){ for(int i=1;i<=60;i++){ cout<<"看守工地中";cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100);cout<<".";Sleep(100); Sleep(400); system("cls"); } cout<<"金钱+="<<l+100<<"因为过度劳累,HP-20"; HP-=20; money+=l+100; Sleep(2000); system("cls"); } else if(dubo[0]=='2'&&l%2!=0) cout<<"你没看守好工地!你让人偷懒了"; } } int main() {int i,j,k,l,o,p,m,time=5,a=30,b=50,choose=0,c=25,d=100,e=75,zzz,wo,kk,jineng,a1,a2,b1,b2; char z[100]; char op; char n[10000]; system("color 4B"); system("title woss"); cout<<"游戏创作人:1706杨永隆\n"; cout<<"QQ:3124240534\n"; cout<<"洛谷ID: Mr_杨t_t\n"; cout<<"-----------------------------------------\n"; cout<<"此游戏为测试版本,如有不周到之处敬请谅解\n"; cout<<"也欢迎大家上QQ给我私信提建议哦! \n"; Sleep(5000); system("cls"); if(MessageBox(NULL,"读取存档不?","woss",MB_YESNO)!=7)Read(); cout<<"是否跳过剧情?\n"; cin>>choose; if(choose!=1){system("cls");Slowsay();} for(i=1;i<=5;i++){ cout<<"\n\n\n\n\n\n\n\n\n\n"; cout<<"\t\t 游戏还有"<<time<<"秒开始\t\t"; Sleep(1000); time--; system("cls"); }//1a 2b 3c 4d 5e 6f 7g 8h 9i 10j while(n[0]!='h'){ if(zzzzz[7]==zzzzz[8]&&zzzzz[7]==1) zzzzz[9]=1; qixie=0; baoji=0; jiacheng=0; if(zz==10)qixie=1; if(zz==11)baoji=1; if(zz==12)jiacheng=1; system("cls"); beginnew(); cin>>n; op=n[0]; if(n[0]=='b'){ cout<<"1.运动饮料(持续回血,1级药品) 30元\n"; cout<<"2.止痛药(持续回血,2级药品) 50元\n"; cout<<"3.绷带(回复血量20点,1级药品) 25元\n"; cout<<"4.医疗箱(回复血量100点,3级药品) 100元\n"; cout<<"5.急救箱(回复损失血量的50%,2级药品) 75元\n"; cout<<"请输入购买物品编号:"; cin>>z; if(z[0]=='1'&&money>=30){ cout<<"运动饮料++"; money-=30; yinliao++; Sleep(2000); system("cls"); } else if(z[0]=='1'&&money<30){ cout<<"小鬼,钱不够哦"; Sleep(1000); system("cls");} if(z[0]=='2'&&money>=50){ cout<<"止痛药++"; money-=50; zhitongyao++; Sleep(2000); system("cls"); } else if(z[0]=='2'&&money<50){ cout<<"小鬼,钱不够哦"; Sleep(1000); system("cls");} if(z[0]=='3'&&money>=25){ cout<<"绷带++"; money-=25; bengdai++; Sleep(2000); system("cls"); } else if(z[0]=='3'&&money<25){ cout<<"小鬼,钱不够哦"; Sleep(1000); system("cls");} if(z[0]=='4'&&money>=100){ cout<<"医疗箱++"; money-=100; yiliaoxiang++; Sleep(2000); system("cls"); } else if(z[0]=='4'&&money<100){ cout<<"小鬼,钱不够哦"; Sleep(1000); system("cls");} if(z[0]=='5'&&money>=75){ cout<<"急救箱++"; money-=75; jijiuxiang++; Sleep(2000); system("cls"); } else if(z[0]=='5'&&money<75){ cout<<"小鬼,钱不够哦"; Sleep(1000); system("cls");} } else if(n[0]=='i'&&ti!=1){ system("start 占卜.exe"); } else if(n[0]=='e'){ cout<<"当前金钱:"<<money<<"\n"; cout<<"当前HP:"<<HP<<"点\n"; cout<<"当前攻击力:"<<gongji<<"点\n"; cout<<"\n\n\n"; cout<<"当前道具:\n"; cout<<"运动饮料:"<<yinliao<<"瓶\n"; cout<<"止痛药:"<<zhitongyao<<"瓶\n"; cout<<"绷带:"<<bengdai<<"条\n"; cout<<"医疗箱:"<<yiliaoxiang<<"个\n"; cout<<"急救箱子:"<<jijiuxiang<<"个\n"; cout<<"当前武器:"<<zzzz[zz]; gongji=15+wwwww[zz]; Sleep(6000); system("cls"); } else if(n[0]=='j'){ system("cls"); ronglianlu(); system("cls"); } else if(n[0]=='g'){ cout<<"当前拥有武器:\n"; for(i=1;i<=12;i++) if(zzzzz[i]!=0) cout<<i<<"."<<zzzz[i]<<"\n"; cout<<"是否更换武器\n(y or n):\n"; cin>>wz; if(wz=='y'){ cout<<"请输入您要跟换的武器号:\n"; cin>>kk; if(zzzzz[kk]!=0){ cout<<"更换武器成功!\n"; cout<<"攻击力+="<<wwwww[kk]; gongji=15+wwwww[kk]; zz=wz; Sleep(2000); system("cls");} } else if(zzzzz[kk]==0){cout<<"暂时未拥有此武器"; Sleep(2000); system("cls");} } else if(n[0]=='c'){ jia(); system("cls"); } else if(n[0]=='d'){ jiequ(); system("cls"); } else if(n[0]=='f'){ for(i=2;i<=12;i++){ if(i!=7&&i!=8&&i!=9) cout<<i-1<<"."<<zzzz[i]<<" "; if(i==2) cout<<"2700元\n"; if(i==3) cout<<"3000元\n"; if(i==4) cout<<"4500元\n"; if(i==5) cout<<"6000元\n"; if(i==6) cout<<"8000元\n"; if(i==10) cout<<"4000元\n"; if(i==11)cout<<"6000元\n"; if(i==12)cout<<"4500元\n"; } cin>>wo; if(money>=pay[wo]){ cout<<"成功购买"<<zzzz[wo+1]<<"\n"; money-=pay[wo]; cout<<"已为您自动装备"<<zzzz[wo+1]<<"\n"; zz=wo+1; Sleep(2000); system("cls"); zzzzz[wo+1]=1; } else {cout<<"钱不够哦,小鬼!";Sleep(2000);system("cls");} } else if(n[0]=='a'){ kaishi(); system("cls"); } } if(op=='h')save(); return 0; }
-
2018-07-13 10:12:31@
//luogu地表最弱蒟蒻作←_←→_→有改动 //更新: //增加职业系统,虽然目前只有两个 //增加专属技能系统(注:以后会全部换为专属技能) //以及……一些复联3里的小彩蛋? //可以试试一些interesting的名字 //感觉越来越像一个RPG了? #pragma G++ optimize (2) #include<cstdio> #include<iostream> #include<time.h> #include<windows.h> #include<cmath> using namespace std; struct player { int Attack,Defence,HP,MP,MaxHP,MaxMP,Money; int SmallHP,MiddleHP,LargeHP,SmallMP,MiddleMP,LargeMP; int SmallAttack,MiddleAttack,LargeAttack,SuperAttack; int SKill1Level,SKill2Level,SKill3Level,Level,Experience; int PetKind,PetLevel; int Vocation,OwnSkill,OwnSkillLevel; string UserName,OwnSkillName; }player1; bool life=1,ForestOpen,EatingGet,WorkOpen,Special; int LevelMost=10,Mission1Get; string MonsterName[20]={" ","小狮子","中狮子","大狮子","神圣狮子","神圣狮子王","小石怪","中石怪","大石怪","神圣石怪","神圣石怪王","混沌魔王"}; int MonsterAttack[20]={0,2,5,10,20,50,5,10,20,50,100,500}; int MonsterDefence[20]={0,0,3,5,10,20,3,5,10,20,50,300}; int MonsterHP[20]={0,10,20,50,100,500,20,50,100,500,1000,5000}; string Question[10]={"66+51=","51+49=","25+96=","56+52=","21+274="}; string Answer[10]={"117","100","121","108","295"}; int LevelUp[50]={0,10,20,50,200,500,3000,9000,13000,19000,30000,50000,60000,70000,90000,100000,120000,140000,150000,170000,200000,220000,222222,233333,240000,250000,270000,280000,300000,350000,400000}; string PassWord="地表最弱蒟蒻"; int x,y; void Slowsay(string a){ int l=a.size(); for(int i=0;i<l;i++){ cout<<a[i]; Sleep(30); } printf("\n"); } void Clear(){ Sleep(1500); system("cls"); } void Scenario(){ if(MessageBox(NULL,"是否跳过剧情?","天选之子",MB_YESNO)==7){ Slowsay("......"); Slowsay("......"); Slowsay("......"); system("cls"); Slowsay("少年:这......这是哪里?"); Sleep(1500); Slowsay("少年:为什么我手里握着一把剑,还穿着奇怪的铠甲?"); Slowsay("来自天边的奇怪声音:少年,这是天赐圣剑和天赐圣铠,你是被上天选中的天选之子!"); Slowsay("来自天边的奇怪声音:你的目标是解救被混沌魔王抢走的公主"); Slowsay("少年:这不就是小木剑和布衣吗?"); Sleep(1500); Slowsay("来自天边的奇怪声音:呃,其实你说对了,这就是小木剑和布衣,但它们是有等级的,到最高等级就变成了天赐圣剑和天赐圣铠了"); Clear(); Slowsay("来自天边的奇怪声音:它们一共有10级,下面介绍一下:"); Slowsay("来自天边的奇怪声音:0级:小木剑和布衣"); Slowsay("来自天边的奇怪声音:1级:匕首和斗篷"); Slowsay("来自天边的奇怪声音:2级:短剑和轻铠"); Slowsay("来自天边的奇怪声音:3级:铜剑和短铠"); Slowsay("来自天边的奇怪声音:4级:铁剑和铁铠"); Slowsay("来自天边的奇怪声音:5级:长剑和长铠"); Slowsay("来自天边的奇怪声音:6级:重剑和重铠"); Slowsay("来自天边的奇怪声音:7级:巨剑和巨铠"); Slowsay("来自天边的奇怪声音:8级:剑王和铠王"); Slowsay("来自天边的奇怪声音:9级:剑圣和铠圣"); Slowsay("来自天边的奇怪声音:10级:天赐圣剑和天赐圣铠"); Clear(); Slowsay("来自天边的奇怪声音:接下来是操作方式"); Slowsay("来自天边的奇怪声音:根据提示输入数字,千万不要输入不在范围内的数,否则可能会崩溃!"); Slowsay("来自天边的奇怪声音:我会在旁边加括号的,括号里的是说明"); Clear(); } } int ClshofClans(){ if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } if(){ return 1; } return 0; } void Name(){ Slowsay("来自天边的奇怪声音:首先,告诉我你的名字是:"); cin>>player1.UserName; if(player1.UserName=="kkksc03"){ Slowsay("你一定不是kkksc03,所以朋友再见!"); player1.HP=-666666; } if(player1.UserName=="地表最弱蒟蒻"){ Slowsay("觉醒吧,沉睡多年的蒟蒻!"); Slowsay("神圣觉醒!!!!!!!!!!!!!!!!!!!!"); player1.Attack+=233333666; player1.Defence+=233333666; player1.HP=player1.MaxHP+=233333666; player1.MP=player1.MaxMP+=233333666; player1.PetLevel+=233333666; player1.SKill1Level=player1.SKill2Level=player1.SKill3Level=player1.OwnSkillLevel+=233333666; } if(player1.UserName=="灭霸"||player1.UserName=="Thanos"){ Slowsay("小伙子很不错嘛,那就赐予你这个------无限手套!"); Slowsay("你已经等于无敌了"); Slowsay("好了,去征服宇宙吧!我只是超越者而已。"); player1.Attack+=233333666; player1.Defence+=233333666; player1.HP=player1.MaxHP+=233333666; player1.MP=player1.MaxMP+=233333666; player1.PetLevel+=233333666; player1.SKill1Level=player1.SKill2Level=player1.SKill3Level=player1.OwnSkillLevel+=233333666; } if(player1.UserName=="Hulk"||player1.UserName=="浩克"||player1.UserName=="绿巨人"){ Slowsay("你好啊,布鲁斯·班纳博士"); Slowsay("很可惜,你在复联3中表现太差了"); Slowsay("这只是吐槽而已"); player1.Attack+=233333666; player1.HP=player1.MaxHP+=233333666; } if(player1.UserName=="StarLord"||player1.UserName=="Quill"||player1.UserName=="星爵"||player1.UserName=="奎尔"){ Slowsay("你好啊,星爵"); Slowsay("你在复联3中除了一拳打醒灭霸以外都挺好的"); Slowsay("尤其是那个中指,我超喜欢的"); Slowsay("话说你怎么会喜欢卡魔拉?她可是绿的!"); Slowsay("这只是吐槽而已"); player1.Defence+=233333666; } if(player1.UserName=="IronMan"||player1.UserName=="TonyStark"||player1.UserName=="钢铁侠"||player1.UserName=="托尼·斯塔克"){ Slowsay("你好啊,钢铁侠"); Slowsay("你和你家小辣椒接吻的时候被奇异博士看到了,尴不尴尬?"); Slowsay("你的血边战甲怎么造出来的?"); Slowsay("我也想要一个"); Slowsay("这只是吐槽而已"); player1.Attack+=233333666; player1.Defence+=233333666; player1.MP=player1.MaxMP+=233333666; } if(player1.UserName=="Doctor Strange"||player1.UserName=="奇异博士"){ Slowsay("你好啊,奇异博士"); Slowsay("你的这些技能真是太牛逼了"); Slowsay("我常常在长跑的时候想,我要是也能开门就好了"); Slowsay("还有一个问题:你不是说在时间宝石与钢铁侠和蜘蛛侠之间选一个的话"); Slowsay("你会选时间宝石吗?那你为什么要拿时间宝石换钢铁侠的命?"); Slowsay("这只是吐槽而已"); player1.Attack+=233333666; player1.Defence+=233333666; player1.SKill1Level=player1.SKill2Level=player1.SKill3Level=player1.OwnSkillLevel+=233333666; } if(player1.UserName=="Captain America"||player1.UserName=="Steven"||player1.UserName=="美国队长"){ Slowsay("你好啊,美国队长"); Slowsay("你本来不是一个盾的么,在复联3里咋变俩了?"); Slowsay("你是升级了么,还多了一个盾……"); Slowsay("你能空手接无限手套也是很强"); Slowsay("不过你的好基友巴基死了,太惨了……"); Slowsay("这只是吐槽而已"); player1.SKill1Level=player1.SKill2Level=player1.SKill3Level=player1.OwnSkillLevel+=233333666; player1.Attack+=233333666; player1.Defence+=233333666; } if(player1.UserName=="冬日战士"||player1.UserName=="冬兵"||player1.UserName=="Winter Soidier"){ Slowsay("你好啊,冬兵"); Slowsay("你的手臂真是高科技,搞得小浣熊都想要了"); Slowsay("话说回来,你和黑豹的关系怎么样?"); Slowsay("应该还不错吧"); Slowsay("这只是吐槽而已"); player1.SKill1Level=player1.SKill2Level=player1.SKill3Level=player1.OwnSkillLevel+=233333666; player1.Attack+=233333666; player1.Defence+=233333666; } if(player1.UserName=="Black Panther"||player1.UserName=="黑豹"){ Slowsay("你好啊,黑豹"); Slowsay("你的脉冲对灭霸没什么用?"); Slowsay("其实你还蛮强的"); Slowsay("这只是吐槽而已"); player1.SKill1Level=player1.SKill2Level=player1.SKill3Level=player1.OwnSkillLevel+=233333666; player1.Attack+=233333666; player1.Defence+=233333666; } if(player1.UserName=="Guquan"||player1.UserName=="GuquanCE"||player1.UserName=="古权"||player1.UserName=="古权CE"||player1.UserName=="权哥"){ } } void Vocation(){ Slowsay("你有两种职业可以选择:"); Slowsay("一个是剑圣,一个是坦克"); Slowsay("他们的属性和专属技能也不一样"); Slowsay("在选择职业后还可以选择专属技能"); Slowsay("你想选择的职业是:(剑圣为1,坦克为2)"); cin>>player1.Vocation; if(player1.Vocation==1){ Slowsay("剑圣有三种专属技能:"); Slowsay("1.暴风狂击:剑圣在剑中注入飓风的力量,对对手造成巨量伤害"); Slowsay("2.剑刃风暴:剑圣不停地旋转自己的剑,对对手造成多次伤害"); Slowsay("3.飓风之力:剑圣使自己攻击大幅度提升,并且防御数倍增加"); Slowsay("其中,1,2技能为主动技能,3技能为被动技能"); Slowsay("你想选择的技能是:"); cin>>player1.OwnSkill; player1.OwnSkillLevel=1; player1.Attack+=50; player1.Defence+=20; player1.MP=player1.MaxMP+=80; if(player1.OwnSkill==1)player1.OwnSkillName="暴风狂击"; if(player1.OwnSkill==2)player1.OwnSkillName="剑刃风暴"; if(player1.OwnSkill==3){ player1.Attack*=1.1; player1.Defence*=5; } } if(player1.Vocation==2){ Slowsay("坦克有三种专属技能:"); Slowsay("1.雷霆重击:坦克使用雷霆之力砸向地面,对对手造成巨量伤害"); Slowsay("2.闪电狂怒:坦克不停地释放雷霆万钧的闪电,对对手造成多次伤害"); Slowsay("3.闪电突袭:坦克在一次攻击中能发动两次攻击,但攻击力会略微下降"); Slowsay("其中,1,2技能为主动技能,3技能为被动技能"); Slowsay("你想选择的技能是:"); cin>>player1.OwnSkill; player1.OwnSkillLevel=1; player1.Attack+=30; player1.Defence+=50; player1.HP=player1.MaxHP+=100; if(player1.OwnSkill==1)player1.OwnSkillName="雷霆重击"; if(player1.OwnSkill==2)player1.OwnSkillName="闪电狂怒"; if(player1.OwnSkill==3)player1.Attack*=1.8; } if(player1.Vocation==233333){ Slowsay("小伙子很牛逼啊,如果你能通过我的考验,我就让你变得很强"); Slowsay("请说出灭霸获取无限宝石的顺序及其地点(从早到晚):"); Slowsay("(注:说“xx”即可,无需说“xx宝石”,格式为“a->b->c”)"); string zz,zzz; cin>>zz>>zzz; if(zz=="力量->空间->现实->灵魂->时间->心灵"&&zzz=="山达尔星->雷神的飞船上->虚无知地->沃密尔星->泰坦星->地球"){ Slowsay("小伙子很不错嘛,那就赐予你这个------无限手套!"); Slowsay("你已经等于无敌了"); Slowsay("好了,去征服宇宙吧!我只是超越者而已。"); player1.Attack+=233333666; player1.Defence+=233333666; player1.HP=player1.MaxHP+=233333666; player1.MP=player1.MaxMP+=233333666; player1.PetLevel+=233333666; } } } void Pet(){ Slowsay("特别介绍:宠物系统"); Slowsay("目前共有五只宠物:麒麟、饕餮、狻猊、狴犴、貔貅"); Slowsay("它们分别对应功能:攻击、回血、技能、防御、钱财"); Slowsay("宠物也能升级,满级30级"); Slowsay("请问你想选择哪一只:"); cin>>player1.PetKind; player1.PetLevel=1; } void Start(){ Scenario(); Name(); Vocation(); Pet(); Clear(); } void Read(){ freopen("LMSN.text","r",stdin); cin>>player1.UserName; cin>>player1.Attack>>player1.Defence; cin>>player1.HP>>player1.MaxHP>>player1.MP>>player1.MaxMP; cin>>player1.Level>>player1.Experience; cin>>player1.SKill1Level>>player1.SKill2Level>>player1.SKill3Level; cin>>player1.SmallHP>>player1.MiddleHP>>player1.LargeHP; cin>>player1.SmallMP>>player1.MiddleMP>>player1.LargeMP; cin>>player1.SmallAttack>>player1.MiddleAttack>>player1.LargeAttack>>player1.SuperAttack; cin>>player1.Money; cin>>Mission1Get; cin>>ForestOpen; cin>>EatingGet; cin>>Special; cin>>LevelMost; cin>>player1.PetKind; cin>>player1.PetLevel; cin>>player1.Vocation; cin>>player1.OwnSkill; cin>>player1.OwnSkillLevel; fclose(stdin); freopen("CON","r",stdin); } void Save(){ freopen("LMSN.text","w",stdout); cout<<player1.UserName<<endl; cout<<player1.Attack<<endl; cout<<player1.Defence<<endl; cout<<player1.HP<<endl; cout<<player1.MaxHP<<endl; cout<<player1.MP<<endl; cout<<player1.MaxMP<<endl; cout<<player1.Level<<endl; cout<<player1.Experience<<endl; cout<<player1.SKill1Level<<endl; cout<<player1.SKill2Level<<endl; cout<<player1.SKill3Level<<endl; cout<<player1.SmallHP<<endl; cout<<player1.MiddleHP<<endl; cout<<player1.LargeHP<<endl; cout<<player1.SmallMP<<endl; cout<<player1.MiddleMP<<endl; cout<<player1.LargeMP<<endl; cout<<player1.SmallAttack<<endl; cout<<player1.MiddleAttack<<endl; cout<<player1.LargeAttack<<endl; cout<<player1.SuperAttack<<endl; cout<<player1.Money<<endl; cout<<Mission1Get<<endl; cout<<ForestOpen<<endl; cout<<EatingGet<<endl; cout<<Special<<endl; cout<<LevelMost<<endl; cout<<player1.PetKind<<endl; cout<<player1.PetLevel<<endl; cout<<player1.Vocation<<endl; cout<<player1.OwnSkill<<endl; cout<<player1.OwnSkillLevel<<endl; fclose(stdout); } void say(string a){ int l=a.size(); for(int i=0;i<l;i++){ cout<<a[i]; Sleep(8); } } bool CanUse(int i){ if(i==1&&player1.SmallHP) return 1; if(i==2&&player1.MiddleHP) return 1; if(i==3&&player1.LargeHP) return 1; if(i==4&&player1.SmallMP) return 1; if(i==5&&player1.MiddleMP) return 1; if(i==6&&player1.LargeMP) return 1; if(i==7&&player1.SmallAttack) return 1; if(i==8&&player1.MiddleAttack) return 1; if(i==9&&player1.LargeAttack) return 1; if(i==10&&player1.SuperAttack) return 1; return 0; } void Use(int i){ if(i==1){ say("成功使用小血瓶,血量增加10点"); printf("\n"); player1.HP=min(player1.HP+10,player1.MaxHP); player1.SmallHP--; } if(i==2){ say("成功使用中血瓶,血量增加20点"); printf("\n"); player1.HP=min(player1.HP+20,player1.MaxHP); player1.MiddleHP--; } if(i==3){ say("成功使用大血瓶,血量增加50点"); printf("\n"); player1.HP=min(player1.HP+50,player1.MaxHP); player1.LargeHP--; } if(i==4){ say("成功使用小魔瓶,魔法值增加10点"); printf("\n"); player1.MP=min(player1.MP+10,player1.MaxMP); player1.SmallMP--; } if(i==5){ say("成功使用中魔瓶,魔法值增加20点"); printf("\n"); player1.MP=min(player1.MP+20,player1.MaxMP); player1.MiddleMP--; } if(i==6){ say("成功使用大魔瓶,魔法值增加50点"); printf("\n"); player1.MP=min(player1.MP+50,player1.MaxMP); player1.LargeMP--; } } bool LastMonster(){ Clear(); int HP=10000; int Attack=1000; int Defence=500; if(player1.PetKind==4){ say("你的宠物狴犴使对方攻击降低"); printf("%d",player1.PetLevel*10); Slowsay("点攻击"); Attack-=player1.PetLevel*8; } while(HP>0&&player1.HP>0){ Clear(); Slowsay("请输入你想执行的操作:"); Slowsay("1:攻击 2:使用技能 3:使用道具"); int x,End=1; cin>>x; if(x<0||x>3)continue; if(x==1){ if(player1.Attack<Defence){ say("攻击小于对手防御,建议逃跑或使用道具"); printf("\n"); }else{ HP-=player1.Attack-Defence; say("对敌人造成");printf("%d",player1.Attack-Defence);say("点伤害"); } } if(x==2){ say("请输入想要使用的技能编号:(1为火球术,2为雷暴术,3为治疗术,4为专属技能)"); printf("\n"); int y; cin>>y; if(y==1&&!player1.SKill1Level){ say("火球术尚未学习!"); printf("\n"); End=0; } if(y==2&&!player1.SKill2Level){ say("雷暴术尚未学习!"); printf("\n"); End=0; } if(y==3&&!player1.SKill3Level){ say("治疗术尚未学习!"); printf("\n"); End=0; } if(y==1&&player1.SKill1Level){ if(player1.MP<3){ say("魔法值不足,使用失败"); printf("\n"); End=0; } else{ say("使用火球术,对敌人造成");printf("%d",5*player1.SKill1Level);say("点伤害"); printf("\n"); say("消耗3点魔法值"); printf("\n"); HP-=5*player1.SKill1Level; player1.MP-=3; } } if(y==2&&player1.SKill2Level){ if(player1.MP<5){ say("魔法值不足,使用失败"); printf("\n"); End=0; }else{ say("使用雷暴术,对敌人造成");printf("%d",10*player1.SKill2Level);say("点伤害"); printf("\n"); say("消耗5点魔法值"); printf("\n"); HP-=10*player1.SKill2Level; player1.MP-=5; } } if(y==3&&player1.SKill3Level){ if(player1.MP<10){ say("魔法值不足,使用失败"); printf("\n"); End=0; } else{ say("使用治疗术,回复");printf("%d",15*player1.SKill3Level);say("点血量"); printf("\n"); say("消耗10点魔法值"); printf("\n"); player1.HP=min(player1.MaxHP,player1.HP+15*player1.SKill3Level); player1.MP-=10; } } if(y==4&&player1.OwnSkill!=3){ if(player1.MP<20){ Slowsay("魔法值不足,使用失败"); End=0; }else{ say("使用");say(player1.OwnSkillName); say(",对敌人造成"); if(player1.OwnSkill==1) HP-=player1.OwnSkillLevel*50; if(player1.OwnSkill==2) HP-=player1.OwnSkillLevel*(player1.Attack-Defence); player1.MP-=20; } } } if(x==3){ say("请输入想要使用的道具编号,想查询道具的编号请输入-1"); printf("\n"); int y; cin>>y; if(y==-1){ say("1:小血瓶\n"); say("2:中血瓶\n"); say("3:大血瓶\n"); say("4:小魔瓶\n"); say("5:中魔瓶\n"); say("6:大魔瓶\n"); say("7:小炸弹\n"); say("8:中炸弹\n"); say("9:大炸弹\n"); say("10:原子弹\n"); End=0; } else if(CanUse(y)&&y<=6)Use(y); else if(CanUse(y)&&y>6){ if(y==7){ Slowsay("成功使用小炸弹,对敌人造成50点伤害"); HP-=50; player1.SmallAttack--; } if(y==8){ Slowsay("成功使用中炸弹,对敌人造成100点伤害"); HP-=100; player1.MiddleAttack--; } if(y==9){ Slowsay("成功使用大炸弹,对敌人造成200点伤害"); HP-=200; player1.LargeAttack--; } if(y==10){ Slowsay("成功使用原子弹,对敌人造成500点伤害"); HP-=500; player1.SuperAttack--; } }else{ say("道具不足,无法使用"); printf("\n"); End=0; } } if(End){ if(player1.PetKind==1){ say("你的宠物麒麟对灭世魔王造成了"); printf("%d",20*player1.PetLevel); Slowsay("点伤害"); } if(player1.PetKind==3){ say("你的宠物狻猊对灭世魔王造成了"); printf("%d",15*player1.PetLevel+100); Slowsay("点伤害"); } if(player1.PetKind==2){ say("你的宠物饕餮给你回了"); printf("%d",player1.PetLevel*10); Slowsay("点血"); } player1.HP-=Attack-player1.Defence<0?0:Attack-player1.Defence; say("灭世魔王对你造成了");printf("%d",Attack-player1.Defence<0?0:Attack-player1.Defence);say("点伤害"); printf("\n"); } } if(player1.HP<=0)return 0; else return 1; } void Level(){ int EXP=player1.Experience,LV=player1.Level; while(EXP>=LevelUp[LV+1]&&LV<=LevelMost){ LV++; EXP-=LevelUp[LV]; player1.Attack+=100; player1.Defence+=100; player1.MaxHP+=500; player1.HP=player1.MaxHP; player1.MaxMP+=500; player1.MP=player1.MaxMP; player1.Money+=500; } if(LV>=5)WorkOpen=1; if(player1.Level==LV)Slowsay("升级失败,经验不足"); else{ say("升级成功,升了");printf("%d",LV-player1.Level);Slowsay("级"); } player1.Experience=EXP; player1.Level=LV; } void Story2(){ Slowsay("少年又一次战胜了魔王,解救了公主"); Slowsay("但是,这一次真的是大结局吗?"); Slowsay("灭世魔王死后,从天而降,出现了两个人,他们浑身散发着耀眼的光芒"); Slowsay("少年向他们跑去,他们就落了下来"); Slowsay("他们一看就非常的厉害,少年于是问道:“您二位是从何而来?”"); Slowsay("二人相视一笑,说:“我们这里有两首诗,你能看破玄机,我们就告诉你”"); Slowsay("第一首:孔丘圣人于我后,"); Slowsay(" 雀雀飞升脱凡尘。"); Slowsay(" 明亮光芒照万物,"); Slowsay(" 王临天下第一人。"); Slowsay("第二首:接凡渡尘非常人,"); Slowsay(" 引得世人入轮回。"); Slowsay(" 道行天下任我游,"); Slowsay(" 人间沧桑皆看破。"); Slowsay("少年仔细想了一想,说:你们不就是《封神演义》里的孔雀明王和接引道人吗?"); Slowsay("二人说:“不错,少年你很有天资,希望你以后能继续在惩恶扬善的道路上走下去,永不结束!!!”"); Slowsay("少年说:“谢谢二位!我以后会继续努力的!”"); Slowsay("剧情暂时告一段落,以后也不怎么会再更剧情了"); if(MessageBox(NULL,"你愿意继续惩恶扬善吗?","天选之子",MB_YESNO)==6){ player1.Experience+=2000; Level(); Slowsay("很好,你要继续啊,祝愿你早日成功!"); } Slowsay("敬请期待天选之子v1.4"); } void TheEnd(){ LevelMost+=10; Clear(); Slowsay("我们的天选之子成功打败了混沌魔王,解救了公主"); Slowsay("然而,公主却告诉他在混沌魔王之上,还有更厉害的魔王在等着他"); Slowsay("但是,他无所畏惧,能够去打败更为强大的魔王!"); Slowsay("就在这时,一个怪物出现了,它身上居然也穿着天赐圣剑和天赐圣铠!"); Slowsay("少年为此所震惊,怪物却告诉他,他就是过去的它,它就是未来的他!"); Slowsay("少年不相信,与怪物打了起来,但怪物实在太厉害,少年打不过它,少年落荒而逃"); Slowsay("怪物又俘虏了公主,少年即将颓废,但是眼前忽然出现一个人!"); Slowsay("他对少年说:“少年,你还记得我吗?”"); Slowsay("少年仔细一想,说:“你是那个奇怪的声音!”"); Slowsay("他说:“没错,就是我,其实世上的天选之子一共有过三个”"); Slowsay("少年说:“怎么会有三个天选之子?!”"); Slowsay("他说:“第一个是我,第二个是刚刚那个怪物,第三个是你”"); Slowsay("他说:“其实,你所掌握的力量只是皮毛,看好了!”"); Slowsay("突然,他的身上长出了一双无比华丽的翅膀"); Slowsay("少年被此所惊到,他说:“天选之子的力量是无比强大的,但是怎么运用就看你了”"); Slowsay("他说:“天选之子的力量既可以创造世界,也可以毁灭世界”"); Slowsay("他说:“你的力量也有这么强大,不信你试试”"); Slowsay("少年心中想着翅膀,身上便长出了翅膀!"); Slowsay("他说:“你想什么,你就会拥有什么”"); Slowsay("他说:“你可别想歪了啊!”"); Slowsay("他说:“你可以获取所有你能想到的装备、东西、能力”"); Slowsay("他说:“但是,为了防止你想歪,我只能送你一样能力”"); Slowsay("他说:“那就是,无限正义,不要问我它有什么用,其实我也不知道”"); Slowsay("他说:“好了,少年,去战胜怪物吧”"); Slowsay("他说:“对了,怪物的名字叫做灭世魔王”"); player1.Attack*=2; player1.Defence*=2; player1.HP=player1.MaxHP*=2; player1.MP=player1.MaxMP*=2; if(LastMonster())Story2(); Slowsay("未完待续......"); } void Die(){ Clear(); Slowsay("不...我还不能死...我还没有打败混沌魔王..."); Slowsay("我要复活!!!!!!!!"); Save(); Slowsay("复活成功"); player1.HP=player1.MaxHP; } int Fight(int i){ Clear(); srand((int)time(0)); string Name=MonsterName[i]; say("遭遇了");say(Name);say("!"); printf("\n"); int HP=MonsterHP[i]; int Attack=MonsterAttack[i]; int Defence=MonsterDefence[i]; if(player1.PetKind==4){ say("你的宠物狴犴使对方攻击降低"); printf("%d",player1.PetLevel*10); Slowsay("点攻击"); Attack-=player1.PetLevel*8; } while(HP>0&&player1.HP>0){ Clear(); say("请输入你想执行的操作:"); printf("\n"); say("1:攻击 2:使用技能 3:使用道具 4:逃跑"); printf("\n"); int x,End=1; cin>>x; if(x<0||x>4)continue; if(x==4){ say("逃跑成功,战斗失败"); printf("\n"); break; return -1; } if(x==1){ if(player1.Attack<Defence){ say("攻击小于对手防御,建议逃跑或使用道具"); printf("\n"); }else{ HP-=player1.Attack-Defence; say("对敌人造成");printf("%d",player1.Attack-Defence);say("点伤害"); } } if(x==2){ say("请输入想要使用的技能编号:(1为火球术,2为雷暴术,3为治疗术,4为专属技能)"); printf("\n"); int y; cin>>y; if(y==1&&!player1.SKill1Level){ say("火球术尚未学习!"); printf("\n"); End=0; } if(y==2&&!player1.SKill2Level){ say("雷暴术尚未学习!"); printf("\n"); End=0; } if(y==3&&!player1.SKill3Level){ say("治疗术尚未学习!"); printf("\n"); End=0; } if(y==1&&player1.SKill1Level){ if(player1.MP<3){ say("魔法值不足,使用失败"); printf("\n"); End=0; } else{ say("使用火球术,对敌人造成");printf("%d",5*player1.SKill1Level);say("点伤害"); printf("\n"); say("消耗3点魔法值"); printf("\n"); HP-=5*player1.SKill1Level; player1.MP-=3; } } if(y==2&&player1.SKill2Level){ if(player1.MP<5){ say("魔法值不足,使用失败"); printf("\n"); End=0; } else{ say("使用雷暴术,对敌人造成");printf("%d",10*player1.SKill2Level);say("点伤害"); printf("\n"); say("消耗5点魔法值"); printf("\n"); HP-=10*player1.SKill2Level; player1.MP-=5; } } if(y==3&&player1.SKill3Level){ if(player1.MP<10){ say("魔法值不足,使用失败"); printf("\n"); End=0; } else{ say("使用治疗术,回复");printf("%d",15*player1.SKill3Level);say("点血量"); printf("\n"); say("消耗10点魔法值"); printf("\n"); player1.HP=min(player1.MaxHP,player1.HP+15*player1.SKill3Level); player1.MP-=10; } } if(y==4&&player1.OwnSkill!=3){ if(player1.MP<20){ Slowsay("魔法值不足,使用失败"); End=0; }else{ say("使用");say(player1.OwnSkillName); say(",对敌人造成"); if(player1.OwnSkill==1) HP-=player1.OwnSkillLevel*50; if(player1.OwnSkill==2) HP-=player1.OwnSkillLevel*(player1.Attack-Defence); player1.MP-=20; } } } if(x==3){ say("请输入想要使用的道具编号,想查询道具的编号请输入-1"); printf("\n"); int y; cin>>y; if(y==-1){ say("1:小血瓶\n"); say("2:中血瓶\n"); say("3:大血瓶\n"); say("4:小魔瓶\n"); say("5:中魔瓶\n"); say("6:大魔瓶\n"); say("7:小炸弹\n"); say("8:中炸弹\n"); say("9:大炸弹\n"); say("10:原子弹\n"); End=0; } else if(CanUse(y)&&y<=6)Use(y); else if(CanUse(y)&&y>6){ if(y==7){ Slowsay("成功使用小炸弹,对敌人造成50点伤害"); HP-=50; player1.SmallAttack--; } if(y==8){ Slowsay("成功使用中炸弹,对敌人造成100点伤害"); HP-=100; player1.MiddleAttack--; } if(y==9){ Slowsay("成功使用大炸弹,对敌人造成200点伤害"); HP-=200; player1.LargeAttack--; } if(y==10){ Slowsay("成功使用原子弹,对敌人造成500点伤害"); HP-=500; player1.SuperAttack--; } } else{ say("道具不足,无法使用"); printf("\n"); End=0; } } if(End){ if(player1.PetKind==1){ say("你的宠物麒麟对");say(Name);say("造成了"); printf("%d",20*player1.PetLevel); Slowsay("点伤害"); } if(player1.PetKind==3){ say("你的宠物狻猊对");say(Name);say("造成了"); printf("%d",15*player1.PetLevel+100); Slowsay("点伤害"); } if(player1.PetKind==2){ say("你的宠物饕餮给你回了"); printf("%d",player1.PetLevel*10); Slowsay("点血"); } player1.HP-=Attack-player1.Defence<0?0:Attack-player1.Defence; say(Name);say("对你造成了");printf("%d",Attack-player1.Defence<0?0:Attack-player1.Defence);Slowsay("点伤害"); } } if(player1.HP<=0){Die();return 0;} else{ say("战斗胜利!获得"); int XP=rand(); printf("%d",XP); Slowsay("点经验"); player1.Experience+=XP; if(player1.PetKind==5){ say("你的宠物貔貅给你带来了"); printf("%d",player1.PetLevel*20); Slowsay("元"); } return 1; } } void LastFight(){ Clear(); Slowsay("混沌魔王:没错,我就是传说中的混沌魔王!"); Slowsay("混沌魔王:哈哈哈哈哈哈哈哈哈哈哈哈!!!!!!"); Slowsay("混沌魔王:你就是天选之子吗?哈哈!太弱了!"); Slowsay("混沌魔王:就凭你还想战胜我,救出公主?哼哼!想得美!"); if(player1.Level<10){ Slowsay("少年:我要消灭你,进化吧!"); Slowsay("混沌魔王:这...这怎么可能?!"); Slowsay("少年:看着吧,这就是传说中的天赐圣剑和天赐圣铠!"); player1.Experience=6666666; Level(); Slowsay("混沌魔王:那你也不能战胜我!我已经封锁了你的退路!"); } int HP=MonsterHP[11]; int Attack=MonsterAttack[11]; int Defence=MonsterDefence[11]; if(player1.PetKind==4){ say("你的宠物狴犴使对方攻击降低"); printf("%d",player1.PetLevel*10); Slowsay("点攻击"); Attack-=player1.PetLevel*8; } while(HP>0&&player1.HP>0){ Clear(); Slowsay("请输入你想执行的操作:"); Slowsay("1:攻击 2:使用技能 3:使用道具"); int x,End=1; cin>>x; if(x<0||x>3)continue; if(x==1){ if(player1.Attack<Defence){ say("攻击小于对手防御,建议逃跑或使用道具"); printf("\n"); } else { HP-=player1.Attack-Defence; say("对敌人造成");printf("%d",player1.Attack-Defence);say("点伤害"); } } if(x==2){ say("请输入想要使用的技能编号:(1为火球术,2为雷暴术,3为治疗术,4为专属技能)"); printf("\n"); int y; cin>>y; if(y==1&&!player1.SKill1Level){ say("火球术尚未学习!"); printf("\n"); End=0; } if(y==2&&!player1.SKill2Level){ say("雷暴术尚未学习!"); printf("\n"); End=0; } if(y==3&&!player1.SKill3Level){ say("治疗术尚未学习!"); printf("\n"); End=0; } if(y==1&&player1.SKill1Level){ if(player1.MP<3){ say("魔法值不足,使用失败"); printf("\n"); End=0; }else{ say("使用火球术,对敌人造成");printf("%d",5*player1.SKill1Level);say("点伤害"); printf("\n"); say("消耗3点魔法值"); printf("\n"); HP-=5*player1.SKill1Level; player1.MP-=3; } } if(y==2&&player1.SKill2Level){ if(player1.MP<5){ say("魔法值不足,使用失败"); printf("\n"); End=0; }else{ say("使用雷暴术,对敌人造成");printf("%d",10*player1.SKill2Level);say("点伤害"); printf("\n"); say("消耗5点魔法值"); printf("\n"); HP-=10*player1.SKill2Level; player1.MP-=5; } } if(y==3&&player1.SKill3Level){ if(player1.MP<10){ say("魔法值不足,使用失败"); printf("\n"); End=0; }else{ say("使用治疗术,回复");printf("%d",15*player1.SKill3Level);say("点血量"); printf("\n"); say("消耗10点魔法值"); printf("\n"); player1.HP=min(player1.MaxHP,player1.HP+15*player1.SKill3Level); player1.MP-=10; } } if(y==4&&player1.OwnSkill!=3){ if(player1.MP<20){ Slowsay("魔法值不足,使用失败"); End=0; }else{ say("使用");say(player1.OwnSkillName); say(",对敌人造成"); if(player1.OwnSkill==1) HP-=player1.OwnSkillLevel*50; if(player1.OwnSkill==2) HP-=player1.OwnSkillLevel*(player1.Attack-Defence); player1.MP-=20; } } } if(x==3){ say("请输入想要使用的道具编号,想查询道具的编号请输入-1"); printf("\n"); int y; cin>>y; if(y==-1){ say("1:小血瓶\n"); say("2:中血瓶\n"); say("3:大血瓶\n"); say("4:小魔瓶\n"); say("5:中魔瓶\n"); say("6:大魔瓶\n"); say("7:小炸弹\n"); say("8:中炸弹\n"); say("9:大炸弹\n"); say("10:原子弹\n"); End=0; } else if(CanUse(y)&&y<=6)Use(y); else if(CanUse(y)&&y>6){ if(y==7){ Slowsay("成功使用小炸弹,对敌人造成50点伤害"); HP-=50; player1.SmallAttack--; } if(y==8){ Slowsay("成功使用中炸弹,对敌人造成100点伤害"); HP-=100; player1.MiddleAttack--; } if(y==9){ Slowsay("成功使用大炸弹,对敌人造成200点伤害"); HP-=200; player1.LargeAttack--; } if(y==10){ Slowsay("成功使用原子弹,对敌人造成500点伤害"); HP-=500; player1.SuperAttack--; } }else{ say("道具不足,无法使用"); printf("\n"); End=0; } } if(End){ if(player1.PetKind==1){ say("你的宠物麒麟对混沌魔王造成了"); printf("%d",20*player1.PetLevel); Slowsay("点伤害");} if(player1.PetKind==3){ say("你的宠物狻猊对混沌魔王造成了"); printf("%d",15*player1.PetLevel+100); Slowsay("点伤害"); } if(player1.PetKind==2){ say("你的宠物饕餮给你回了"); printf("%d",player1.PetLevel*10); Slowsay("点血"); } player1.HP-=Attack-player1.Defence<0?0:Attack-player1.Defence; say("混沌魔王对你造成了");printf("%d",Attack-player1.Defence<0?0:Attack-player1.Defence);say("点伤害"); printf("\n"); } } if(player1.HP<=0)Die(); else TheEnd(); } void Battle(int Level){ if(Level==1){ srand((int)time(0)); int i=rand(); while(i<1||(i>3&&i<6)||i>8)i=rand(); Fight(i); } if(Level==2){ srand((int)time(0)); int i=rand(); while(i<2||(i>4&&i<7)||i>9)i=rand(); Fight(i); } if(Level==3){ srand((int)time(0)); int i=rand(); while(i<3||(i>5&&i<8)||i>10)i=rand(); Fight(i); } if(Level==4){ srand((int)time(0)); int i=rand(); while(i<4||(i>6&&i<9)||i>11)i=rand(); if(i!=11)Fight(i); else LastFight(); } } void Forest(){ Clear(); Slowsay("1.草原(易,怪物级别1~3)"); Slowsay("2.悬崖(中,怪物级别2~4)"); Slowsay("3.洞穴(难,怪物级别3~5)"); Slowsay("4.邪恶基地(极难,怪物级别4~6)"); int x; Slowsay("请输入你想去的地方(序号,1~4)"); cin>>x; Battle(x); } void Out(){ cout<<"HP:"<<player1.HP<<endl; Sleep(1000); cout<<"MaxHP:"<<player1.MaxHP<<endl; Sleep(1000); cout<<"MP:"<<player1.MP<<endl; Sleep(1000); cout<<"MaxMP:"<<player1.MaxMP<<endl; Sleep(1000); cout<<"ATK:"<<player1.Attack<<endl; Sleep(1000); cout<<"DEF:"<<player1.Defence<<endl; Sleep(1000); cout<<"EXP:"<<player1.Experience<<endl; Sleep(1000); cout<<"LV:"<<player1.Level<<endl; Sleep(1000); cout<<"Money:"<<player1.Money<<endl; Sleep(6000); } int Money(int i){ if(i==0)return 117; if(i==1)return 100; if(i==2)return 121; if(i==3)return 108; if(i==4)return 295; } void Pets(){ Slowsay("请输入你想将宠物提升到?级"); int x; cin>>x; if(x>30)Slowsay("宠物满级30级,输入无效"); else{ int Need=10*pow(3,x); say("需要"); printf("%d",Need); Slowsay("元钱"); if(player1.Money<Need)Slowsay("金钱不足,升级失败"); else{ Slowsay("升级成功"); player1.PetLevel+=x; } } } void Home(){ while(1){ Clear(); Slowsay("1.从家长那里拿点零花钱"); Slowsay("2.睡觉"); Slowsay("3.升级圣坛"); Slowsay("4.查看状态"); Slowsay("5.升级宠物"); Slowsay("6.返回"); int x; Slowsay("请输入你想去的地方(序号,1~6)"); cin>>x; if(x==6)break; if(x==1){ Slowsay("你必须要回答出我的问题,不然就滚!"); srand((int)time(0)); int i=rand(); while(i>4)i=rand(); cout<<Question[i]; string a; cin>>a; if(a==Answer[i]){ srand((int)time(0)); int x=Money(i); say("真棒,");printf("%d",x);Slowsay("元就给你了"); player1.Money+=x; } else Slowsay("这都能错,滚!"); } if(x==2){ Slowsay("多么一个好觉啊,你的血量回满了"); player1.HP=player1.MaxHP; } if(x==3)Level(); if(x==4)Out(); if(x==5)Pets(); } } void Class(){ while(1){ Clear(); Slowsay("这里就是我的教室了,找个人聊聊天吧"); Slowsay("1.老师"); Slowsay("2.同桌"); Slowsay("3.死党"); Slowsay("4.学霸"); Slowsay("5.返回"); int x; Slowsay("请输入你想要对话的人(序号,1~5)"); cin>>x; if(x==5)break; if(x==1)Slowsay("你找我干什么,滚!"); if(x==2)Slowsay("你的死党好像不高兴,去看看吧"); if(x==3&&(Mission1Get==-1||Mission1Get==1))Slowsay("我没事儿,你走吧"); if(x==3&&Mission1Get==0){ Slowsay("学霸这次又考第一,我们去教训他吧"); Slowsay("接到任务:去图书馆教训学霸"); Mission1Get=1; } if(x==4)Slowsay("哈哈,这次我又是第一,太高兴了!"); } } void Study(){ if(Mission1Get)if(Fight(12)==1)Mission1Get=-1; while(1){ Clear(); srand((int)time(0)); Slowsay("1.学习火球术"); Slowsay("2.学习雷暴术"); Slowsay("3.学习治疗术"); Slowsay("4.学习"); Slowsay("5.返回"); Slowsay("请输入你想执行的操作(序号,1~5)"); cin>>x; if(x==5)break; if(x==1){ int i=rand()%2; if(i){ player1.SKill1Level++; say("学习成功,火球术升至");printf("%d",player1.SKill1Level);Slowsay("级"); } else Slowsay("学习失败"); } if(x==2){ int i=rand()%2; if(i){ player1.SKill2Level++; say("学习成功,雷暴术升至");printf("%d",player1.SKill2Level);Slowsay("级"); } else Slowsay("学习失败"); } if(x==3){ int i=rand()%2; if(i){ player1.SKill3Level++; say("学习成功,治疗术升至");printf("%d",player1.SKill3Level);Slowsay("级"); } else Slowsay("学习失败"); } if(x==4){ Slowsay("#include<bits/stdc++.h>int main(){int a,b;cin>>a>>b;cout<<a+b;}"); player1.Experience+=20; } } } void Eat(){ Clear(); Slowsay("1.黄瓜炒茄子(10元)"); Slowsay("2.茄子煮蛋(30元)"); Slowsay("3.黄瓜蒸蛋(50元)"); Slowsay("4.红烧水饺(100元)"); Slowsay("5.清蒸面条(200元)"); Slowsay("6.黑暗妙趣角(250元)"); int x; Slowsay("请输入你想吃的食物(序号,1~6)"); cin>>x; if(x==1)player1.Money-=10; if(x==2)player1.Money-=30; if(x==3)player1.Money-=50; if(x==4)player1.Money-=100; if(x==5)player1.Money-=200; if(x==6&&!EatingGet){ player1.Money+=250; Slowsay("恭喜你获得成就“不要命”,获得奖金500元"); EatingGet=1; } if(x==6&&EatingGet)player1.Money-=250; Slowsay("吃饭成功"); } void School(){ while(1){ Clear(); Slowsay("1.图书馆(增加经验、学习技能)"); Slowsay("2.教室(聊天)"); Slowsay("3.食堂(吃奇怪的食物)"); Slowsay("4.返回"); int x; Slowsay("请输入你想去的地方(序号,1~4)"); cin>>x; if(x==1)Study(); if(x==2)Class(); if(x==3)Eat(); if(x==4)break; } } void Work(){ Clear(); Slowsay("1.搬砖 5HP/10元 成功率66%"); Slowsay("2.看店 5HP/20元 成功率50%"); if(WorkOpen)Slowsay("3.抄作业 5HP/100元 成功率100%,但是需要密码"); int x; if(WorkOpen)Slowsay("请输入你想做的工作(序号,1~3)"); else Slowsay("请输入你想做的工作(序号,1~2)"); srand((int)time(0)); cin>>x; if(x==1){ int i=rand()%3; if(i<2){ Slowsay("搬砖成功"); player1.HP-=5; player1.Money+=10; } else Slowsay("搬砖失败"); } if(x==2){ int i=rand()%2; if(!i){ Slowsay("看店成功"); player1.HP-=5; player1.Money+=20; } else Slowsay("看店失败"); } if(x==3&&WorkOpen){ Slowsay("请输入密码"); string x; if(x!=PassWord)Slowsay("密码错误"); else{ Slowsay("密码正确,抄作业成功"); player1.HP-=5; player1.Money+=100; } } if(player1.HP<=0)Die(); } void Shop(){ while(1){ Clear(); Slowsay("1.小血瓶"); Slowsay("2.中血瓶"); Slowsay("3.大血瓶"); Slowsay("4.小魔瓶"); Slowsay("5.中魔瓶"); Slowsay("6.大魔瓶"); Slowsay("7.小炸弹"); Slowsay("8.中炸弹"); Slowsay("9.大炸弹"); Slowsay("10.原子弹"); Slowsay("11.返回"); if(!ForestOpen)Slowsay("12.神秘钥匙"); int x,y; if(!ForestOpen)Slowsay("请输入你想买的东西(序号,1~12)"); else Slowsay("请输入你想买的东西(序号,1~11)"); cin>>x; if(x==11)break; if(x!=12)Slowsay("请输入你想购买的数量"); if(y==0)continue; if(x==1){ if(player1.Money>=10*y){ Slowsay("购买成功"); player1.Money-=10*y; player1.SmallHP+=y; } else Slowsay("金钱不足,购买失败"); } if(x==2){ if(player1.Money>=20*y){ Slowsay("购买成功"); player1.Money-=20*y; player1.MiddleHP+=y; } else Slowsay("金钱不足,购买失败"); } if(x==3){ if(player1.Money>=50*y){ Slowsay("购买成功"); player1.Money-=50*y; player1.LargeHP+=y; } else Slowsay("金钱不足,购买失败"); } if(x==4){ if(player1.Money>=10*y){ Slowsay("购买成功"); player1.Money-=10*y; player1.SmallMP+=y; } else Slowsay("金钱不足,购买失败"); } if(x==5){ if(player1.Money>=20*y){ Slowsay("购买成功"); player1.Money-=20*y; player1.MiddleMP+=y; } else Slowsay("金钱不足,购买失败"); } if(x==6){ if(player1.Money>=50*y){ Slowsay("购买成功"); player1.Money-=50*y; player1.LargeMP+=y; } else Slowsay("金钱不足,购买失败"); } if(x==7){ if(player1.Money>=10*y){ Slowsay("购买成功"); player1.Money-=10*y; player1.SmallAttack+=y; } else Slowsay("金钱不足,购买失败"); } if(x==8){ if(player1.Money>=20*y){ Slowsay("购买成功"); player1.Money-=20*y; player1.MiddleAttack+=y; } else Slowsay("金钱不足,购买失败"); } if(x==9){ if(player1.Money>=50*y){ Slowsay("购买成功"); player1.Money-=50*y; player1.LargeAttack+=y; } else Slowsay("金钱不足,购买失败"); } if(x==10){ if(player1.Money>=200*y){ Slowsay("购买成功"); player1.Money-=200*y; player1.SuperAttack+=y; } else Slowsay("金钱不足,购买失败"); } if(x==12&&!ForestOpen){ if(player1.Money>=100000){ Slowsay("购买成功,森林已解锁"); player1.Money-=100000; ForestOpen=1; } else Slowsay("金钱不足,购买失败"); } } } void Bets(){ Clear(); srand((int)time(0)); Slowsay("1.猜大小"); Slowsay("2.猜点数"); int x,y,z; Slowsay("请输入你想赌的方式(序号,1~2)"); cin>>x; Slowsay("请输入你想下注的金额"); cin>>y; if(x==1){ Slowsay("猜大还是小?1大,2小"); cin>>z; srand((int)time(0)); int a1=rand()%6,a2=rand()%6; if(a1==0)a1=6; if(a2==0)a2=6; if((a1+a2>6&&z==1)||(a1+a2<=6&&z==2)){ Slowsay("你赢了,这些钱给你"); player1.Money+=y; } else{ Slowsay("你输了,这些钱我拿走了"); player1.Money-=y; } } if(x==2){ srand((int)time(0)); int a1=rand()%6; if(a1==0)a1=6; Slowsay("你想猜多少点?"); cin>>z; if(z==a1){ Slowsay("你赢了,这些钱给你"); player1.Money+=y; } else{ Slowsay("你输了,这些钱我拿走了"); player1.Money-=y; } } } void City(){ while(1){ Clear(); Slowsay("1.打工"); Slowsay("2.商店"); Slowsay("3.赌博"); Slowsay("4.返回"); int x; Slowsay("请输入你想去的地方(序号,1~4)"); cin>>x; if(x==4)break; if(x==1)Work(); if(x==2)Shop(); if(x==3)Bets(); } } void SpecialFight(){ Clear(); int HP=1000; int Attack=100; int Defence=100; if(player1.PetKind==4){ say("你的宠物狴犴使对方攻击降低"); printf("%d",player1.PetLevel*10); Slowsay("点攻击"); Attack-=player1.PetLevel*8; } while(HP>0&&player1.HP>0){ Clear(); Slowsay("请输入你想执行的操作:"); Slowsay("1:攻击 2:使用技能"); int x,End=1; cin>>x; if(x<0||x>2)continue; if(x==1){ if(player1.Attack<Defence){ say("攻击小于对手防御,建议逃跑或使用道具"); printf("\n"); } else{ HP-=player1.Attack-Defence; say("对敌人造成");printf("%d",player1.Attack-Defence);say("点伤害"); printf("\n"); } } if(x==2){ say("请输入想要使用的技能编号:(1为火球术,2为雷暴术,3为治疗术,4为专属技能)"); printf("\n"); int y; cin>>y; if(y==1&&!player1.SKill1Level){ say("火球术尚未学习!"); printf("\n"); End=0; } if(y==2&&!player1.SKill2Level){ say("雷暴术尚未学习!"); printf("\n"); End=0; } if(y==3&&!player1.SKill3Level){ say("治疗术尚未学习!"); printf("\n"); End=0; } if(y==1&&player1.SKill1Level){ if(player1.MP<3){ say("魔法值不足,使用失败"); printf("\n"); End=0; }else{ say("使用火球术,对敌人造成");printf("%d",5*player1.SKill1Level);say("点伤害"); printf("\n"); say("消耗3点魔法值"); printf("\n"); HP-=5*player1.SKill1Level; player1.MP-=3; } } if(y==2&&player1.SKill2Level){ if(player1.MP<5){ say("魔法值不足,使用失败"); printf("\n"); End=0; }else{ say("使用雷暴术,对敌人造成");printf("%d",10*player1.SKill2Level);say("点伤害"); printf("\n"); say("消耗5点魔法值"); printf("\n"); HP-=10*player1.SKill2Level; player1.MP-=5; } } if(y==3&&player1.SKill3Level){ if(player1.MP<10){ say("魔法值不足,使用失败"); printf("\n"); End=0; }else{ say("使用治疗术,回复");printf("%d",15*player1.SKill3Level);say("点血量"); printf("\n"); say("消耗10点魔法值"); printf("\n"); player1.HP=min(player1.MaxHP,player1.HP+15*player1.SKill3Level); player1.MP-=10; } } if(y==4&&player1.OwnSkill!=3){ if(player1.MP<20){ Slowsay("魔法值不足,使用失败"); End=0; }else{ say("使用");say(player1.OwnSkillName); say(",对敌人造成"); if(player1.OwnSkill==1) HP-=player1.OwnSkillLevel*50; if(player1.OwnSkill==2) HP-=player1.OwnSkillLevel*(player1.Attack-Defence); player1.MP-=20; } } } if(End){ if(player1.PetKind==1){ say("你的宠物麒麟对黑衣男子造成了"); printf("%d",20*player1.PetLevel); Slowsay("点伤害"); } if(player1.PetKind==3){ say("你的宠物狻猊对黑衣男子造成了"); printf("%d",15*player1.PetLevel+100); Slowsay("点伤害"); } if(player1.PetKind==2){ say("你的宠物饕餮给你回了"); printf("%d",player1.PetLevel*10); Slowsay("点血"); } player1.HP-=Attack-player1.Defence<0?0:Attack-player1.Defence; say("黑衣男子对你造成了");printf("%d",Attack-player1.Defence<0?0:Attack-player1.Defence);say("点伤害"); printf("\n"); } } if(player1.HP<=0)Die(); else{ Clear(); Slowsay("黑衣男子:不错嘛,小伙子!居然能战胜我!这里是100000元,就送你了!"); Slowsay("少年:真的吗!谢谢大叔!"); Slowsay("黑衣男子(默想):不愧是天选之子啊!看来,他能救出公主!"); player1.Money+=100000; Special=1; } } void Story1(){ if(Special){ Clear(); Slowsay("这里什么也没有"); Slowsay("少年陷入了沉思:那个穿黑衣服的大叔呢?"); Slowsay("他可是个好人......"); return; } Clear(); Slowsay("少年:那个穿黑衣服的,你是谁?"); Slowsay("黑衣男子:你无需知道我是谁,因为你马上就会变成一具尸体!"); Slowsay("少年:你好大的口气,早晨没刷牙吧!"); Slowsay("黑衣男子:废话少说,看招!"); SpecialFight(); } void SuperFight(){ Slowsay("精英关共有3关,中途死亡也没关系,回到原界面"); Slowsay("通关后获得丰厚奖励"); Slowsay("第一关:神圣狮子王;第二关:神圣石怪王;第三关:混沌魔王"); Fight(5); Fight(10); LastFight(); player1.Attack+=2333; player1.Defence+=2333; player1.HP=player1.MaxHP+=2333; player1.MP=player1.MaxMP+=2333; } void MainMenu(){ Clear(); printf( "|----------------------------------|\n" "| Main Menu |\n" "|1. 森林(打怪) |\n" "|2. 家(存档、睡觉等) |\n" "|3. 学校(学习、吃奇怪的食物等) |\n" "|4. 市中心(打工、买东西等) |\n" "|5. 小巷子(未知) |\n" "|6. 精英关(通关后有丰厚奖励) |\n" "|7. 结束游戏(自动保存) |\n" "| 请输入你想去的地方(序号,1~7) |\n" "|----------------------------------|\n"); cin>>x; if(x==1&&ForestOpen)Forest(); if(x==1&&!ForestOpen)Slowsay("暂时无法进入,似乎需要什么神秘的钥匙"); if(x==2)Home(); if(x==3)School(); if(x==4)City(); if(x==5)Story1(); if(x==6)SuperFight(); if(x==7){ Save(); life=0; } } int main(){ system("Color 5C"); Slowsay(" $$$天选之子v1.4$$$ "); Slowsay("作者:JXH 洛谷ID:地表最弱蒟蒻 QQ号:1156057894"); Sleep(3000); system("cls"); if(MessageBox(NULL,"是否读取存档?","天选之子",MB_YESNO)==6)Read(); else{ player1.Attack=5; player1.HP=player1.MaxHP=player1.MaxMP=player1.MP=50; player1.Defence=player1.LargeAttack=player1.LargeHP=0; player1.LargeMP=player1.MiddleAttack=player1.MiddleHP=0; player1.MiddleMP=player1.SKill1Level=player1.SKill2Level=0; player1.SKill3Level=player1.SmallAttack=player1.SmallMP=0; player1.SuperAttack=0; Start(); if(player1.HP==-666666){ Slowsay("冒充kkk者死!!!"); return 0; } } while(life)MainMenu(); }
-
2018-07-12 16:32:30@
#include <bits/stdc++.h>
using namespace std;
int tiji[51],zhil[51],kll[51],a[51];
int maxt,maxz,food,i,j,k;
int main(){
cin>>maxt>>maxz>>food;
for(i=1;i<=food;i++) cin>>tiji[i]>>zhil[i]>>kll[i];
for(i=1;i<=food;i++)
for(j=maxt;j>=tiji[i];j--)
for(k=maxz;k>=zhil[i];k--){
a[j]=max(a[j-tiji[i]][k-zhil[i]]+kll[i],a[j][k]);
}
cout<<a[food];
return 0;
}
//weiwanchengNASA -
2018-07-12 15:54:35@
01背包问题程序:
#include <bits/stdc++.h>
using namespace std;
int w[105],val[105],a[1005];
int main(){
int t,m,i,j; //t==总容量;m==数量
cin>>t>>m;
for(i=1;i<=m;i++) cin>>w[i]>>val[i]; //w[i]==重量;val[i]==价值
for(i=1;i<=m;i++)
for(j=t;j>=w[i];j--)
a[j]=max(a[j-w[i]]+val[i],a[j]);
cout<<a[t]; //a为额外增设数组
return 0;
}
-
2018-07-12 15:20:21@
oj ooj oooj for i=1..4 ooooj oooooj ooooooj
-
2018-07-12 15:02:55@
背包问题主要是背模板,这里收录了一些模板
一些复杂的背包问题(如泛化物品)未收录
01背包问题:
无优化
for(int i=1;i<=n;i++)
{
for(int c=0;c<=m;c++)
{
f[i][c]=f[i-1][c];
if(c>=w[i])
f[i][c]=max(f[i][c],f[i-1][c-w[i]]+v[i]);
}
}
一维数组优化:
for(int i=1;i<=n;i++)
{
for(int c=m;c>=0;c--)
{
if(c>=w[i])
f[c]=max(f[c],f[c-w[i]]+v[i]);
}
}
更进一步的常数优化:
for(int i=1;i<=n;i++)
{
sumw+=w[i];
bound=max(m-sumw,w[i]);
for(int c=m;c>=bound;c--)
{
if(c>=w[i])
f[c]=max(f[c],f[c-w[i]]+v[i]);
}
}
完全背包问题:
for(int i=1;i<=n;i++)
{
for(int c=0;c<=m;c++)
{
if(c>=w[i])
f[c]=max(f[c],f[c-w[i]]+v[i]);
}
}
多重背包问题:
for(int i=1;i<=n;i++)
{
if(w[i]*a[i]>m)
{
for(int c=0;c<=m;c++)
{
if(c>=w[i])
f[c]=max(f[c],f[c-w[i]]+v[i]);
}
}
else
{
k=1;amount=a[i];
while(k<amount)
{
for(int c=k*w[i];c>=0;c--)
{
if(c>=w[i])
f[c]=max(f[c],f[c-w[i]]+k*v[i]);
}
amount-=k;
k<<=1;
}
for(int c=amount*w[i];c>=0;c--)
{
f[c]=max(f[c],f[c-w[i]]+amount*v[i]);
}
}
}
- 1