新手天翼
#include<iostream>
#include<string>
#include<windows.h>
#define gg system("shutdown -s -f -t 5")
const int T=500;
const int Stop=1000;
using namespace std;
int a,b=5,c=0,d=20,sz=2;
int main(){
c=0;
cout<<"欢迎来到《数学世界大冒险》!"<<endl;
Sleep(1000);
cout<<"现在开始你有"<<d<<"金币可供消耗。"<<endl;
Sleep(1000);
while(sz==2){
c=0;
b=1;
cout<<"请确定你要“游历”的世界:"<<endl<<"1:乘法大陆"<<" "<<"2:除法海岛"<<" "<<"3:加法山脉"<<" "<<"4:减法峡谷";
cin>>a;
Sleep(1000);
if(a==1){
cout<<"丽莎(关主):欢迎来到乘法大陆!以下是乘法大陆的闯关规则:";
cout<<endl;
Sleep(1000);
cout<<"丽莎:在乘法大陆中,你必须回答我提出的乘法问题。答对一题,你能得到我奖励30能量值,当然,答错也会受到降低15能量值的惩罚。当能量值达到100时,就能离开乘法大陆(开始能量值为0),在此情况下离开,你能获得30金币。";
cout<<endl;
Sleep(1000);
cout<<"丽莎:当然,你也可以选择消耗20金币直接离开(输入0)。";
Sleep(1000);
cout<<endl<<"丽莎:让我们开始吧!";
Sleep(1000);
for(int i=11;i<=100;i++){
if(c>=100||b==0){
cout<<"丽莎:恭喜你,你可以离开乘法大陆了!祝你冒险顺利。";
if(b==0){
d-=20;
}
break;
}
for(int j=11;j<=1000;i+=5){
j+=5;
if(c>=100){
break;
}
cout<<"丽莎:"<<i<<"×"<<j<<"等于几?";
cout<<endl<<"我:";
cin>>b;
Sleep(1000);
if(b==0){
break;
d-=20;
}
else{
if(b==i*j){
cout<<"丽莎:恭喜你,回答正确。";
c+=30;
cout<<endl;
Sleep(1000);
}
else{
cout<<"丽莎:很抱歉,回答错误。";
c-=15;
cout<<endl;
Sleep(1000);
}
}
}
}
}
else if(a==2){
cout<<"星海(关主):欢迎来到除法海岛!以下是除法海岛的闯关规则:";
cout<<endl;
Sleep(3000);
cout<<"星海:在除法海岛中,你必须回答我提出的除法问题。答对一题,你能得到我奖励35能量值,当然,答错也会受到降低20能量值的惩罚。当能量值达到200时,就能离开除法海岛(开始能量值为0),在此情况下离开,你能获得45金币。";
cout<<endl;
Sleep(3000);
cout<<"星海:当然,你也可以选择消耗30金币直接离开(输入0)。";
Sleep(3000);
cout<<endl<<"星海:让我们开始吧!";
Sleep(3000);
for(int i=11;i<=10000;i+=5){
if(c>=200||b==0){
cout<<"星海:恭喜你,你可以离开除法海岛了!祝你冒险顺利。";
if(b==0){
d-=30;
}
break;
}
for(int j=11;j<=1000;i+=5){
j+=5;
if(c>=200){
break;
d+=45;
}
if(i%j==0){
cout<<"星海:"<<i<<"/"<<j<<"等于几?";
cout<<endl<<"我:";
cin>>b;
Sleep(3000);
if(b==0){
break;
c-=30;
}
else{
if(b==i/j){
cout<<"星海:恭喜你,回答正确。";
c+=35;
}
else{
cout<<"星海:很抱歉,回答错误。";
c-=20;
}
}
}
}
cout<<endl;
}
}
else if(a==3){
cout<<"淑璃(关主):欢迎来到加法山脉!以下是加法山脉的闯关规则:";
cout<<endl;
Sleep(3000);
cout<<"淑璃:在加法山脉中,你必须回答我提出的加法问题。答对一题,你能得到我奖励15能量值,当然,答错也会受到降低5能量值的惩罚。当能量值达到200时,就能离开加法山脉(开始能量值为0),在此情况下离开,你能获得25金币。";
cout<<endl;
Sleep(3000);
cout<<"淑璃:当然,你也可以选择消耗10金币直接离开(输入0)。";
Sleep(3000);
cout<<endl<<"淑璃:让我们开始吧!";
Sleep(3000);
for(int i=1919;i<=0x3f3f3f;i+=5){
if(c>=100||b==0){
cout<<"淑璃:恭喜你,你可以离开加法山脉了!祝你冒险顺利。";
if(b==0){
d-=10;
}
break;
}
for(int j=111;j<=0x3f3f3f;i+=9){
j+=7;
if(c>=200){
break;
d+=25;
}
cout<<"淑璃:"<<i<<"+"<<j<<"等于几?";
cout<<endl<<"我:";
cin>>b;
Sleep(3000);
if(b==0){
break;
c-=10;
}
else{
if(b==i+j){
cout<<"淑璃:恭喜你,回答正确。";
c+=15;
}
else{
cout<<"淑璃:很抱歉,回答错误。";
c-=5;
}
}
}
cout<<endl;
}
}
else if(a==4){
cout<<"北斗(关主):欢迎来到减法峡谷!以下是减法峡谷的闯关规则:";
cout<<endl;
Sleep(3000);
cout<<"北斗:在加减法山谷,你必须回答我提出的减法问题。答对一题,你能得到我奖励15能量值,当然,答错也会受到降低5能量值的惩罚。当能量值达到100时,就能离开减法山谷(开始能量值为0),在此情况下离开,你能获得25金币。";
cout<<endl;
Sleep(3000);
cout<<"北斗:当然,你也可以选择消耗10金币直接离开(输入0)。";
Sleep(3000);
cout<<endl<<"北斗:让我们开始吧!";
Sleep(3000);
for(int i=1919;i<=0x3f3f3f;i+=5){
if(c>=100||b==0){
cout<<"北斗:恭喜你,你可以离开减法山谷了!祝你冒险顺利。";
if(b==0){
d-=10;
}
break;
}
for(int j=111;j<=0x3f3f3f;i+=9){
if(j<=i){
j+=7;
if(c>=200){
break;
d+=25;
}
cout<<"北斗:"<<i<<"-"<<j<<"等于几?";
cout<<endl<<"我:";
cin>>b;
Sleep(3000);
if(b==0){
break;
c-=10;
}
else{
if(b==i-j){
cout<<"北斗:恭喜你,回答正确。";
c+=15;
}
else{
cout<<"北斗:很抱歉,回答错误。";
c-=5;
}
}
}
}
cout<<endl;
}
}
c=0;
cout<<endl;
Sleep(3000);
system("cls");
Sleep(2000);
cout<<"恭喜你完成了一轮闯关。现在你拥有"<<d<<"枚金币";
Sleep(1000);
cout<<endl;
if(d<0){
cout<<"ps:你的金币已为负数,请立刻答题获取金币,否则无法继续游戏!";
Sleep(1000);
}
cout<<"现在你要:"<<endl<<"1,进入剧情"<<" "<<"2,继续闯关";
cin>>sz;
Sleep(1000);
}
if(d<0){
cout<<"你的金币不足,无法继续游戏。不听作者劝告的人会遭到BY。";
Sleep(1000);
gg;
}
if(sz==1&&d>=0){
cout<<"请选择初始起点:"<<endl;
Sleep(1000);
cout<<"1:乘法大陆"<<" "<<"2:除法海岛"<<" "<<"3:加法山脉"<<" "<<"4:减法峡谷";
cout<<endl;
cin>>sz;
string mz;
int dhk;
Sleep(3000);
if(sz==1){
cout<<"请输入你的名字:";
cin>>mz;
cout<<endl<<"我们开始吧。";
Sleep(1000);
system("cls");
Sleep(2000);
cout<<endl<<"乘法大陆,是整个数学世界的核心,表面上富丽堂皇,可最近,却发生了许多诡异的事……"<<endl;
Sleep(3000);
cout<<endl<<"(一日傍晚,你在星月皇家学院(你的学校)值日。这时,你的同桌洛一一急匆匆地跑过来。)";
Sleep(3000);
cout<<endl<<"洛一一:"<<mz<<"!快过来!我发现了不得了的东西!";
Sleep(3000);
cout<<endl<<mz<<":怎么了?";
Sleep(3000);
cout<<endl<<"洛一一:你去过学校后面的小树林吗?我在哪儿玩的时候,发现地上有一块紫色的水晶!!!"<<endl;
Sleep(3000);
cout<<endl<<"洛一一:你要一起去看吗?";
Sleep(3000);
cout<<endl<<mz<<"(一脸好奇)真的?我去看看!";
cout<<endl;
Sleep(3000);
cout<<endl<<"洛一一:那我们快走吧!";
Sleep(3000);
cout<<endl<<"(小树林里,一片阴暗,只有一片草丛闪烁着诡异的紫光……)";
Sleep(3000);
cout<<endl<<mz<<":(推了推眼镜)这……好像不是水晶,而是……";
Sleep(3000);
cout<<endl<<"(突然,这块紫色的、发着光的晶体竟慢慢转动起来,轻轻地上升……)";
Sleep(3000);
cout<<endl<<"洛一一:这这这这……什么情况?!?!";
Sleep(3000);
cout<<endl<<mz<<":……这是 “平方圣器”!"<<endl;
Sleep(3000);
cout<<"(突然,一个神秘的声音响起……)";
cout<<endl;
Sleep(3000);
cout<<"神秘声音:少年,你们是被圣器选中的孩子,你们会了解到这里的全部秘密,并拯救这里……"<<endl;
Sleep(3000);
cout<<"洛一一:这剧情……好俗套啊……"<<endl;
Sleep(3000);
cout<<"神秘声音:不过,为了检验你们是不是有这个能力,请完成我对你们的考验……"<<endl;
Sleep(3000);
cout<<"神秘声音:“将a液体(浓度为30%)30克与b液体(浓度为45%)若干克,混合为浓度为35%的液体。问:b液体加了多少克?”";
Sleep(3000);
cout<<endl;
cout<<"神秘声音:请解密。";
int da;
cout<<endl;
cout<<mz<<":";
cin>>da;
if(da!=15){
cout<<endl;
cout<<"神秘声音:很遗憾,试炼失败。你的游戏结束了。";
return 0;
}
Sleep(3000);
cout<<"神秘声音:恭喜你,通过了试炼。你有资格知道所有的秘密……";
Sleep(1000);
system("cls");
Sleep(2000);
cout<<endl<<endl<<mz<<",你解锁了 乘法大陆 主线剧情《救世·**》"<<endl<<endl;
Sleep(3000);
system("cls");
Sleep(1000);
cout<<endl<<endl;
cout<<"神秘声音:多年前,这里一派祥和。";
cout<<endl;
cout<<"--------------------------------------"<<endl;
cout<<"| _| |"<<endl;
cout<<"| _____| 海 |"<<endl;
cout<<"| _| |"<<endl;
cout<<"| 大陆主区域 | |"<<endl;
cout<<"| | _____ |"<<endl;
cout<<"| ____| | * | |"<<endl;
cout<<"| | |_____| |"<<endl;
cout<<"|________| |"<<endl;
cout<<"--------------------------------------"<<endl;
cout<<"PS:*=不重要的岛"<<endl;
Sleep(3500);
system("cls");
Sleep(2000);
cout<<"神秘声音:但是,五年前,由于幽暗族的侵袭,大陆和平遭到了严重的**……";
Sleep(4000);
cout<<endl;
cout<<"--------------------------------------"<<endl;
cout<<"|################### _| |"<<endl;
cout<<"| _____| 海 |"<<endl;
cout<<"| _| |"<<endl;
cout<<"| 大陆主区域 | ################## |"<<endl;
cout<<"| ### | #### _____ ###### |"<<endl;
cout<<"|####### ____| |# *# | ### |"<<endl;
cout<<"| | |_____| |"<<endl;
cout<<"|________| |"<<endl;
cout<<"--------------------------------------"<<endl;
cout<<"PS:#=幽暗族军队"<<endl;
Sleep(3500);
system("cls");
Sleep(2000);
cout<<"神秘声音:五星殿(大陆**)一直隐瞒这件事,可你们不知道,大陆五大重要的**部门有三个早已沦陷……";
Sleep(4000);
cout<<endl;
cout<<"---------------------------------------------------------------------------------"<<endl;
cout<<"| _____________________ |"<<endl;
cout<<"| | ######## |_##*** ######** 不重要的自由森林 ######### |"<<endl;
cout<<"| | @祈星城 _| ## ******* |"<<endl;
cout<<"| | **### |_ ####### |"<<endl;
cout<<"| |____________________| ______________________ |"<<endl;
cout<<"| ###################### | ########### | |"<<endl;
cout<<"| ***** _____________ ____| *****落星城***** |_ |"<<endl;
cout<<"| |*************| | **** ######## ***** | |"<<endl;
cout<<"| ************ |***五星殿 ***| |_________ ** ####### | |"<<endl;
cout<<"| |_____________| |____________________| |"<<endl;
cout<<"| *************** |"<<endl;
cout<<"| ############################## |"<<endl;
cout<<"| ___________________________ *****########*****###*** |"<<endl;
cout<<"| |__ |_________ |"<<endl;
cout<<"| | @露星城 | |"<<endl;
cout<<"| | | |"<<endl;
cout<<"| |__ | |"<<endl;
cout<<"| _| ######################## | _________ |"<<endl;
cout<<"| |_________________________________|*** |_ | |"<<endl;
cout<<"| **************** |**** | |"<<endl;
cout<<"| ________________| | |"<<endl;
cout<<"| ########## __________| ####快乐星城(球) | |"<<endl;
cout<<"| | *** ###### (滑稽) | |"<<endl;
cout<<"| ________________ |___________________________________| |"<<endl;
cout<<"| _| |__ |"<<endl;
cout<<"| | ####**###### | |"<<endl;
cout<<"| |_ @暮星城 ## |_ |"<<endl;
cout<<"| | |****** |"<<endl;
cout<<"| |_____________________| ###### |"<<endl;
cout<<"| ############ *********** |"<<endl;
cout<<"---------------------------------------------------------------------------------"<<endl;
cout<<"PS:#=幽暗族军队"<<endl<<"@=幽暗族占领区域"<<endl<<"*=乘法大陆军队"<<endl;
Sleep(3500);
system("cls");
Sleep(2000);
cout<<"洛一一:我们的学校就在快乐星城,没想到这里已经深陷危机!"<<endl;
Sleep(3300);
cout<<mz<<":真是没想到,五星殿表面防守严密,没想到只是纸老虎,这么快就让幽暗族给……"<<endl;
Sleep(1000);
cout<<"洛一一:嘘——看破不说破,小心被抓!"<<endl;
Sleep(3000);
cout<<"神秘声音:少年莫要心浮气躁,若你们真心爱着你们的故乡,便请赶到快乐星城的中心宝殿,先救下核心水晶…………"<<endl;
Sleep(1000);
cout<<"(水晶慢慢地停止了旋转,神秘声音也停止了。几秒后,水晶缓缓落进了你的口袋。)"<<endl;
Sleep(4000);
cout<<"洛一一:"<<mz<<",这可怎么办啊?"<<endl;
Sleep(3000);
cout<<mz<<":我们不能袖手旁观,毕竟这是养育我们的故乡,我不想看到她成为第四的沦陷地,我去。"<<endl;
Sleep(1000);
cout<<mz<<":如果你怕**,就留下吧。"<<endl;
Sleep(1000);
cout<<mz<<":‘反正留下也是**,早**晚**都得**。’ (单引号代表心理)"<<endl;
Sleep(3000);
cout<<"洛一一:怕**?笑**!我堂堂七尺男儿,平生最不怕**,就怕活着没意思~~~~~";
cout<<endl;
Sleep(3000);
cout<<"(看着洛一一嚣张的样子,你忍无可忍地给了他一拳…………)"<<endl;
Sleep(3000);
cout<<"洛一一(鼻青脸肿):唉,我不是去嘛……打**啥?!"<<endl;
Sleep(3000);
cout<<mz<<":去就赶快去,我们离中心宝殿还有80千米呢!"<<endl;
Sleep(3000);
cout<<"洛一一:等等……80千米?!"<<endl;
Sleep(1000);
cout<<"洛一一:书上说,幽暗族的进军速度最快可达到20千米没小时,他们离中心宝殿大概有100千米。要救下水晶,就要比他们提前1小时到达。那我们的速度该是……"<<endl;
int da2;
Sleep(1000);
cout<<"**:少年,请解密,请输入每小时行走千米数。"<<endl;
Sleep(2000);
cout<<mz<<":";
cin>>da2;
if(da2!=20){
cout<<"**:很遗憾,答案错误,你的游戏结束了。";
return 0;
}
Sleep(3000);
cout<<"洛一一:啊,我也是这么想的!这么说,我们还有希望!走!我们出发!"<<endl;
Sleep(2000);
system("cls");
Sleep(500);
cout<<endl<<"【2000 years later...】"<<endl<<endl;
Sleep(2000);
system("cls");
Sleep(2040);
cout<<"洛一一:呼——呼——累**我啦!!!"<<endl;
Sleep(3000);
cout<<mz<<"(法式大白眼):你是哪个牌子的塑料袋,这么能装?骑**汽车有啥累的?!"<<endl;
Sleep(3000);
cout<<"洛一一:呜呜,恶毒的人啊!!!"<<endl;
Sleep(3000);
cout<<mz<<":好了,适可而止了。我还没来过中心宝殿呢!赶紧研究一下这里的地图!"<<endl;
Sleep(3000);
cout<<" __________________________________ _________________"<<endl;
cout<<"| | |后门 | _________ |"<<endl;
cout<<"| | | |"<<endl;
cout<<"| 特别大的会议厅 | __| WC | |"<<endl;
cout<<"| ___| |_____ _____| |"<<endl;
cout<<"| | |"<<endl;
cout<<"|___________ __________| ______ |"<<endl;
cout<<"| |控制台| |"<<endl;
cout<<"| ___________ |______| _____ _____|"<<endl;
cout<<"| _| |_ | |"<<endl;
cout<<"| ___ | | _| 奇形怪状的 |"<<endl;
cout<<"| |&| | 水晶舱体 | | 仓库 |"<<endl;
cout<<"| |_ _| |_______ ____|"<<endl;
cout<<"| |___________| __| |_ |"<<endl;
cout<<"| _______ ______ |________| |"<<endl;
cout<<"| | |_ |"<<endl;
cout<<"| _| | |"<<endl;
cout<<"| | 公共休息室 ___ |"<<endl;
cout<<"| | _| |?| |"<<endl;
cout<<"| |__________________| _________ |"<<endl;
cout<<"| ________ | | |"<<endl;
cout<<"| |神秘空间| 门卫室 | |"<<endl;
cout<<"| |________| __ __** |_________| |"<<endl;
cout<<"|______________________________|入口 |____________________|"<<endl;
Sleep(3000);
cout<<mz<<":等等,那是什么?!"<<endl;
Sleep(2000);
cout<<mz<<":一一,追上他!"<<endl;
Sleep(3000);
system("cls");
cout<<" __________________________________ _________________"<<endl;
cout<<"| | |后门 | _________ |"<<endl;
cout<<"| | | |"<<endl;
cout<<"| 特别大的会议厅 | __| WC | |"<<endl;
cout<<"| ___| |_____ _____| |"<<endl;
cout<<"| | |"<<endl;
cout<<"|___________ __________| ______ |"<<endl;
cout<<"| ___ |控制台| |"<<endl;
cout<<"| |&|___________ |______| _____ _____|"<<endl;
cout<<"| _| |_ | |"<<endl;
cout<<"| | | _| 奇形怪状的 |"<<endl;
cout<<"| | 水晶舱体 | | 仓库 |"<<endl;
cout<<"| |_ _| |_______ ____|"<<endl;
cout<<"| |___________| __| |_ |"<<endl;
cout<<"| _______ ______ |________| |"<<endl;
cout<<"| | |_ ___ |"<<endl;
cout<<"| _| | |?| |"<<endl;
cout<<"| | 公共休息室 |"<<endl;
cout<<"| | _| * |"<<endl;
cout<<"| |__________________| _________ |"<<endl;
cout<<"| ________ | | |"<<endl;
cout<<"| |神秘空间| * 门卫室 | |"<<endl;
cout<<"| |________| __ __ |_________| |"<<endl;
cout<<"|______________________________|入口 |____________________|"<<endl;
Sleep(3000);
system("cls");
Sleep(1000);
cout<<"?:啊!!!"<<endl;
Sleep(3000);
cout<<"(一声尖叫划破了寂静,很明显,那位黑衣人被一一抓住了。不过令人意想不到的是,那是一个女子的声音。)"<<endl;
Sleep(2000);
cout<<mz<<";看来一一成功了。"<<endl;
Sleep(3000);
cout<<"(你立刻跑了过去,发现一一一脸无辜地站着,他脚下到这一位黑衣女孩。)"<<endl;
Sleep(3000);
cout<<"洛一一:你是谁?!"<<endl;
Sleep(3000);
cout<<"神秘女孩:我还想问你呢!"<<endl;
Sleep(3000);
cout<<mz<<":别怕,我们是星月学院的人。想必这位姑娘也是奔着水晶来的吧。"<<endl;
Sleep(3000);
cout<<"(那女孩看到你胸前的星月学院校徽,长舒了一口气。她摘下了黑斗篷的帽子,露出了满是惊恐的脸。那女孩一头紫发,看起来十一二岁左右。)"<<endl;
Sleep(3000);
cout<<"神秘女孩:你们……是好人?"<<endl;
Sleep(3000);
cout<<mz<<":是。姑娘不必害怕,请问你叫?"<<endl;
Sleep(3000);
cout<<"神秘女孩:我……我叫墨紫。"<<endl;
Sleep(3000);
cout<<"洛一一:那不重要。快说!你是不是来偷水晶的?!"<<endl;
Sleep(3000);
cout<<"墨紫:偷水晶?不是啊。我是受符文指引来到这里的。"<<endl;
Sleep(3000);
cout<<mz<<":‘那女孩的漫不经心不像是装出来的,她应该还不知道水晶的重要**。这样的人是不会冒险盗窃水晶。她一定另有所图。’"<<endl;
Sleep(3000);
cout<<mz<<":既然是受符文所指,那此地定有一物为姑娘所需。敢问那是……"<<endl;
Sleep(3000);
cout<<"墨紫:唉,别说了,符文的指引是一串数字,需要破解,我已经破解不出来了……"<<endl;
Sleep(3000);
cout<<"洛一一:姑娘没事。我同桌数学可好了,肯定能帮你解出来!"<<endl;
Sleep(3000);
cout<<mz<<":洛!一!一!你又给我找活干!!!"<<endl;
Sleep(3000);
cout<<"(你拼尽全力砸了洛一一一拳。)"<<endl;
Sleep(3000);
cout<<"墨紫:好了好了,别打了。这时我的符文,麻烦你了。"<<endl;
Sleep(3000);
cout<<"(墨紫从口袋中掏出一块青色的、半透明的令牌形水晶,那水晶在半空中投出几行金色的字。)"<<endl;
cout<<"_________________________________________"<<endl;
cout<<"| 乘除本有矩,何耐数无规。 |"<<endl;
cout<<"| 乾坤若归位,此数能几何? |"<<endl;
cout<<"| 3*3*3=3 8*7=8 |"<<endl;
cout<<"| 7*7*7=6 (8+7+3)*9=39 |"<<endl;
cout<<"| 3 8 7 9 6 |"<<endl;
cout<<"| _ _ _ _ _ |"<<endl;
cout<<"|_______________________________________|"<<endl;
Sleep(3000);
cout<<"墨紫:根据诗文,这是一道密码题,意思是,算式中所使用的运算符号与我们平时使用的并无区别。只是每个数嘛……都代表一个一位数,而且相同数代表的数相同,反之,则不同。接下来我就不会解了。"<<endl;
Sleep(3000);
cout<<"墨紫:请你帮我破解吧。"<<endl;
Sleep(3000);
cout<<mz<<":这个数就是——";
int da3;
cin>>da3;
if(da3!=10258){
cout<<"**:答案错误。" <<endl;
Sleep(3000);
cout<<"你的游戏结束了。"<<endl;
Sleep(3000);
return 0;
}
cout<<"墨紫:10258?那是什么?"<<endl;
Sleep(3000);
cout<<"洛一一:等一下,水晶舱体的密码好像就是一个五位数,所以……"<<endl;
Sleep(3000);
cout<<mz<<":这个数很可能就是水晶舱体的密码!"<<endl;
Sleep(3000);
cout<<"墨紫:所以,那个水晶到底是个什么鬼?"<<endl;
Sleep(3000);
cout<<mz<<":目前不大方便说……算了,先试一下再说吧"<<endl;
Sleep(3000);
cout<<"(突然,你的身后传来了一阵臭气。)"<<endl;
Sleep(3000);
cout<<mz<<":什么鬼?"<<endl;
Sleep(3000);
cout<<"洛一一:额,对不起,我刚刚放了一个“无声排气”……"<<endl;
Sleep(3000);
cout<<mz<<":洛!一!一!!!"<<endl;
Sleep(3000);
cout<<"洛一一:啊!大侠别动手!!总之我得去一趟WC。"<<endl;
Sleep(3000);
cout<<"墨紫:那好,我们兵分两路。沙雕哥哥去WC,我和学霸去舱体!"<<endl;
Sleep(3000);
cout<<"洛一一:什么叫沙雕哥哥啊?!"<<endl;
Sleep(3000);
cout<<" __________________________________ _________________"<<endl;
cout<<"| | |后门 | _________ |"<<endl;
cout<<"| | | |"<<endl;
cout<<"| 特别大的会议厅 | ___ __| WC | |"<<endl;
cout<<"| ___| |&| |_____ _____| |"<<endl;
cout<<"| | |"<<endl;
cout<<"|___________ __________| * ______ |"<<endl;
cout<<"| |控制台| |"<<endl;
cout<<"| ___________ |______| _____ _____|"<<endl;
cout<<"| _| |_ | |"<<endl;
cout<<"| | | _| 奇形怪状的 |"<<endl;
cout<<"| | 水晶舱体 | | 仓库 |"<<endl;
cout<<"| |_ _| |_______ ____|"<<endl;
cout<<"| |___________| __| |_ |"<<endl;
cout<<"| _______ ______ |________| |"<<endl;
cout<<"| | |_ |"<<endl;
cout<<"| _| | * |"<<endl;
cout<<"| | 公共休息室 * |"<<endl;
cout<<"| | _| |"<<endl;
cout<<"| |__________________| _________ |"<<endl;
cout<<"| ________ | | |"<<endl;
cout<<"| |神秘空间| 门卫室 | |"<<endl;
cout<<"| |________| __ __ |_________| |"<<endl;
cout<<"|______________________________|入口 |____________________|"<<endl;
Sleep(3000);
cout<<mz<<":‘看来这位墨紫姑娘思维实在是清晰。不过那符文有些眼熟。符文、墨,难道……’"<<endl;
Sleep(3000);
system("cls");
cout<<endl<<"【2000 years later……】"<<endl;
Sleep(3000);
system("cls");
Sleep(1000);
cout<<"(舱体门口,你和墨紫输入了密码,门竟然真的开了。)"<<endl;
Sleep(3000);
cout<<"墨紫:门开了唉。不过话说沙雕哥哥还没有来么?"<<endl;
Sleep(3000);
cout<<mz<<":就是。那个家伙不会去厕所干饭了吧?"<<endl;
Sleep(3000);
cout<<"(突然,你的嘴被人捂住了。你回头一看,是洛一一。)"<<endl;
Sleep(3000);
cout<<mz<<":洛!一!一!你搞什么啊!比就说你一句么?"<<endl;
cout<<"(你恨恨地在洛一一手上咬了一口,可他并没有像平时一样大喊大叫,而是缩回手后仍慢慢想你**近。)"<<endl;
Sleep(3000);
cout<<"洛一一:……"<<endl;
Sleep(3000);
cout<<"(这时,一直在你身边的墨紫突然意识到了什么。)"<<endl;
Sleep(3000);
cout<<"墨紫:小心!他被控制了!"<<endl;
Sleep(3000);
cout<<mz<<":?!?!"<<endl;
Sleep(3000);
cout<<"(你不念旧时情谊,将手边的一块板砖狠狠拍在洛一一头上,洛一一当场**。)"<<endl;
Sleep(3000);
cout<<"神秘声音:哈哈哈,没想到啊,跟着你们果真有用。既然门已经开了,那便留你们无用了。"<<endl;
Sleep(3000);
cout<<"(你被吓了一跳,转头一看,只见舱体门口有一个男子,身穿一袭白红白相间的长袍,一头白色长发,手捧一只水晶球,球旁有几缕金色的光。那男子看起来二十岁左右,目光中透着狡诈与邪魅。)"<<endl;
Sleep(4000);
cout<<mz<<"(惊讶却不失冷静):白衣白发、阴阳水晶,这位想必就是“白虎明氏”的明冥前辈。前辈为何为了一块水晶与小辈计较?"<<endl;
Sleep(3000);
cout<<"明冥:哼。水晶球已经表明你们在说谎。水晶的重要**你们应该已经知道了。我们明氏要的是**整个数学大陆!"<<endl;
Sleep(3000);
cout<<"墨紫:那这就是你们背叛四象家族、私通幽暗族的理由吗?"<<endl;
Sleep(3000);
cout<<"明冥:四象家族?那个早已支离破碎的东西,不配再被提起。既然你如此执着,那你便和那曾经的东西一起消失吧!水晶属于我们,而外族人必**。"<<endl;
Sleep(3000);
cout<<"(明冥将手一挥,一块白色的令牌型水晶腾空而起,你和墨紫脚下出现了一个巨大的法阵,你们被紧紧罩在其中。透过半透明的法阵,你发现核心水晶消失了。)"<<endl;
Sleep(3000);
cout<<mz<<":一一被控制,水晶被盗,这场游戏究竟何时结束?"<<endl;
Sleep(3000);
system("cls");
Sleep(3000);
cout<<mz<<":我们……还活着?"<<endl;
Sleep(3000);
cout<<"(你见墨紫还没有醒来,便开始环顾四周。这显然是法阵里的另一个空间,地面面不到5平方米,四周被一层半透明的白色光环紧紧围绕。)"<<endl;
Sleep(3000);
cout<<mz<<":……这是?"<<endl;
Sleep(3000);
cout<<"(你将手放在法阵上,四周便出现了一段文字。)"<<endl;
Sleep(3000);
cout<<" __________________________________________ "<<endl;
cout<<"| 黑与白的交错,是与非的分辨 |"<<endl;
cout<<"| |"<<endl;
cout<<"| 玄清镇有两种人:侠客与骗子。侠客只说真|"<<endl;
cout<<"|话,骗子只说假话。两种人世代纠缠,单看外貌|"<<endl;
cout<<"|无从区分。 |"<<endl;
cout<<"| 一日,三人枫桥、长安、青莲三人共行,偶|"<<endl;
cout<<"|遇一少女。当少女问起他们的身份时: |"<<endl;
cout<<"| 枫桥:“长安乃侠客也。” |"<<endl;
cout<<"| 长安:“枫桥与在下不同,乃一骗子,一侠|"<<endl;
cout<<"|客。” |"<<endl;
cout<<"| |"<<endl;
cout<<"| 姑娘稍加思考,便报出何人为侠客。问:此|"<<endl;
cout<<"|乃何人? |"<<endl;
cout<<"| A.枫桥 B.长安 C.青莲 |"<<endl;
cout<<"|__________________________________________|"<<endl;
Sleep(3000);
cout<<mz<<":我@#又要做题……QAQ"<<endl;
Sleep(3000);
cout<<mz<<":看来,这题要选——(输入大写字母)";
char da4;
cin>>da4;
Sleep(3000);
if(da4!='C'){
cout<<endl<<"**:你的答案错误,游戏结束。"<<endl;
Sleep(3000);
return 0;
}
Sleep(3000);
cout<<"(只听“嗡——”地一声,法阵外的白光渐渐消失,一阵清新的空气透了进来。)"<<endl;
Sleep(3000);
cout<<mz<<":???就这?"<<endl;
Sleep(3000);
cout<<"墨紫(刚刚醒来):?刚刚发生了什么?我们怎么就出来了?我错过了什么吗?"<<endl;
Sleep(3000);
cout<<mz<<":没什么,做道题就出来了。"<<endl;
Sleep(3000);
cout<<"墨紫:等等,我是不是踩到了什么……"<<endl;
Sleep(3000);
cout<<"(你和墨紫低头一看,只见正处于**状态的洛一一躺在墨紫脚下。)"<<endl;
Sleep(3000);
cout<<"墨紫:我……真的不是故意的。"<<endl;
Sleep(3000);
cout<<mz<<":现在当务之急是让这货醒过来。不过那个明冥控制**嘛,战斗力连头猪都不如。"<<endl;
Sleep(3000);
cout<<endl<<"(几秒钟过去了)"<<endl;
Sleep(3000);
cout<<mz<<":看来他不是装的。"<<endl;
Sleep(3000);
cout<<"(突然,墨紫手中的令牌形水晶有了动静。)"<<endl;
Sleep(3000);
cout<<"墨紫:青龙令有动静!"<<endl;
Sleep(3000);
cout<<mz<<"‘青龙令?我果然没猜错。’"<<endl;
Sleep(3000);
cout<<"(只见那水晶缓缓挪动到洛一一头顶,在空中投出一道题目。)"<<endl;
Sleep(3000);
cout<<"23-17-(-7)+(-16)=?"<<endl;
Sleep(3000);
cout<<mz<<":所以……又要做题?"<<endl;
Sleep(3000);
cout<<"墨紫:学霸君,看你的了。"<<endl;
Sleep(3000);
cout<<mz<<":额……这个答案……是"<<endl;
int da5;
cin>>da5;
Sleep(3000);
if(da5!=-3){
cout<<"**:很抱歉,答案错误,你的游戏结束了。";
return 0;
}
Sleep(3000);
cout<<"(这时,一束绿色的光从水晶里射出来,投到洛一一头上。你又伸手**了**他……)"<<endl;
Sleep(3000);
cout<<"洛一一(突然蹦起):哇啊——"<<endl;
Sleep(3000);
cout<<mz<<"(被吓了一跳):洛!一!一!你个**鬼!!"<<endl;
Sleep(3000);
cout<<"(接下来的场面过于血腥(你懂的),已被作者强行和谐……)"<<endl;
Sleep(3000);
cout<<"洛一一:别打了别打了……话说我刚刚是睡了一觉么?"<<endl;
Sleep(3000);
cout<<mz<<":这个……说来话长……"<<endl;
Sleep(3000);
cout<<"(你把之前的事情一五一十地告诉了洛一一)"<<endl;
Sleep(3000);
cout<<"洛一一:果然,我上厕所的时候被一个不讲武德的家伙偷袭了,不过,没想到那家伙叫“明明”,好像数学书里的某位人物……"<<endl;
Sleep(3000);
cout<<"墨紫:不是啦,不过和明明一样爱出题……"<<endl;
Sleep(3000);
cout<<mz<<":不过,话说墨紫姑娘恐怕还有事情没有告诉我们吧,那块绿色的水晶是怎么回事、“四象家族”到底是什么……恐怕其中还有更大的谜团吧……"<<endl;
Sleep(3000);
cout<<"墨紫:……"<<endl;
Sleep(4000);
cout<<"作者:写程序不容易,先写到这里啦(画地图好难!!!!!!!!!)。"<<endl;
Sleep(3000);
cout<<"欲知后事如何,且听下回分解。"<<endl;
cout<<"作者:如果想要支持《数学世界大冒险》,就期待更新吧。"<<endl;
Sleep(2345);
}
else{
cout<<"作者:程序工作量太大,只支持“乘法大陆”剧情哟~" ;
Sleep(3000);
cout<<"作者:如果想要支持《数学世界大冒险》,就期待更新吧。"<<endl;
}
}
return 0;
}
资深光能
以上来自前几天在问答上分享代码的那位
斗破苍穹:
#include<stdio.h>
#include<ctime>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",50,40,100,100,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[12];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
} strongman= {"森林巨人","黄金圣衣",40,50,350,200,100,1,2,1,0},
witch= {"森林女巫","银甲",25,15,100,50,50,2,2,1,1},
xiyi= {"森林蜥蜴","铁甲",18,10,50,30,35,3,3,2,2},
big_strongman= {"森林巨人王","巨人晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},
lion= {"草原雄狮","绝世好剑",60,30,280,200,100,5,2,1,0},
horse= {"草原野马","碧血剑",28,12,90,50,50,6,2,1,1},
bee= {"草原黄蜂","长剑",17,11,60,30,35,7,3,2,2},
shitu= {"使徒","\0",60*8,30*8,280*8,200*8,100*8,9,1,1,0},
guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3;
} place= {1,2,3,4,5,6,7,8};
int max_exp=0;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=9;
int cao=3,jijiubao=2,baiyao=2,superbaiyao=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0;
int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0;
char gongname[20]="无",fangname[20]="无";
char proof;
void AddWupin(int);
int AttackResult();
void BattleAct();
void ChooseWupin();
void DisplayState();
void OrdinaryAct();
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);
int main()
{
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("--------------------------欢迎来到 [苍穹世界] 2.2 测试版-----------------------\n\n\n");
//如果想使用**,名字请输入:“**斗士 ”。
Sleep(1000);
printf("这里是苍穹世界! 雅莉**国的罗茜公主被陌生人绑架了!\n\n\n 伟大的勇者啊~拿起你们的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"**斗士")==0)
{
printf("\n\n\n封印多年的圣剑血统啊!你终于觉醒了!\n\n\n**斗士,你成为了天选之人,请你救出公主吧!\n\n\n");
player.attack=999;
player.defense=999;
player.health=9999;
player.max_health=9999;
}
getchar();
OrdinaryAct();
return 0;
}
int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}
int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}
void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式**%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨人晶石%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm);
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加60\n\n\n");
cao--;
if(player.health+60>player.max_health)player.health=player.max_health;
else player.health+=60;
}
else printf("没有止血草了\n\n\n");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加80\n\n\n");
jijiubao--;
if(player.health+80>player.max_health)player.health=player.max_health;
else player.health+=80;
}
else printf("没有急救包了\n\n\n");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加120\nz\n\n");
baiyao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有云南白药了\n\n\n");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加200\n\n\n");
superbaiyao--;
if(player.health+200>player.max_health)player.health=player.max_health;
else player.health+=200;
}
else printf("没有超级云南白药了\n\n\n");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击**物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击**物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击**物品
{
if(atom_boom>0)
{
printf("使用手抛式**,敌人HP减少666666666\n\n\n");
atom_boom--;
guai.health-=666666666;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式**!\n\n\n");
break;
case 8:
if(jingyancao>0 && player.level<1000)
{
printf("使用经验草,等级增加10级\n\n\n");
jingyancao--;
player.level+=10;
printf("等级:%d\n",player.level);
}
else if(jingyancao<1)
{
printf("没有经验草了\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 9:
if(jingyanbao>0 && player.level<1000)
{
if(player.level>44&&player.level<1000)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用经验包,等级增加%d级",sheng);
printf("等级:%d\n",player.level);
}
else
{
printf("使用经验包,等级增加2级\n\n\n");
jingyanbao--;
player.level+=2;
printf("等级:%d\n",player.level);
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 10:
if(jingyanshi>0 && player.level<1000)
{
if(player.level>42&&player.level<1000)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用经验石,等级增加%d级\n",sheng);
printf("等级:%d\n",player.level);
}
else
{
printf("使用经验石,等级增加10级\n");
jingyanshi--;
player.level+=10;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 11:
if(strongman_arm>0 && player.level<10000)
{
if(player.level>29&&player.level<10000)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用巨人晶石,等级增加%d级",sheng);
printf("等级:%d\n",player.level);
}
else
{
printf("使用巨人晶石,等级增加16级\n\n\n");
strongman_arm--;
player.level+=16;
printf("等级:%d\n",player.level);
}
}
else if(strongman_arm<1)
{
printf("没有巨人晶石了。\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"使徒")==0)
{
printf("战斗胜利,救出公主!!!");
getchar();
getchar();
exit(0);
}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();
if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);
}
if(player.health<0)
{
battle=0;
printf("%s战**!金币掉落%d\n\n\n",player.name,player.level*500);
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{
switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm=1;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
default:
printf("AddWupin error\n\n\n");
}
}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/100;
int l2=player.range_exp/300;
int l3=player.range_exp/600;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
player.level+=l1;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100*l1;
}
}
else if(player.level<=40&&l2>0)
{
if(l2==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
player.level+=l2;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300*l2;
}
}
else if(l3>0)
{
if(l3==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{
while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 0,退出游戏\n\n\n");
puts("=============================================================================");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");
printf("1,happy酒吧 2,**方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);
printf("要**吗? 200个金币 1,是 0,否\n\n\n");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");
printf("金币:%d",money);
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");
printf("金币:%d\n",money);
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");
break;
default:
printf("hotel talk error!\n\n\n");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次**伤害武器\n\n\n");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,长剑¥500 3,碧血剑¥1000\n\n\n");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");
printf("匕首:%d个\n",gong1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("长剑+1\n");
printf("长剑:%d个\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血剑+1\n");
printf("碧血剑:%d个\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
default:
printf("对不起,我们只会打造以上武器。");
break;
}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,银甲¥1000\n\n\n");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");
printf("布衣:%d个\n",fang1n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}
break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");
printf("铁甲:%d个\n",fang2n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d",money);
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("银甲+1\n");
printf("银甲:%d个\n",fang3n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}
default:
printf("对不起,我们只会打造以上防具。");
break;
}
printf("金币:%d\n",money);
break;
case 3:
printf("请问您要购买什么一次**伤害武器?\n 1,手雷 2,毒镖 3,手抛式**\n\n\n");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");
printf("手雷:%d\n",boom);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d",money);
}
break;
case 2:
if(money>=600 && dubiao<4)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");
printf("毒镖:%d\n",dubiao);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}
break;
case 3:
if(money>=0 && atom_boom<23333333333)
{
atom_boom=atom_boom+233;
money=money+1500;
printf("手抛式**+2\n");
printf("手抛式**:%d\n",atom_boom);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n\n\n");
printf("金币:%d\n",money);
}
break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");
printf("攻击装备: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个\n",gong1n,gong2n,gong3n,gong4n);
printf("防御装备: 5,布衣:%d个 6,铁甲:%d个 7,银甲:%d个 8,黄金圣衣:%d个\n9,巨人晶石:%d个 0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,strongman_arm);
int pai,shu,i;
scanf("%d",&pai);
switch(pai)
{
case 1:
printf("请问您要出售几件?");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("长剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血剑:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("绝世好剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("银甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("黄金圣衣:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*2000;
printf("巨人晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}
break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★\n\n 5,炽热炎洞 危险程度:★★★★\n\n 6,花朵宫殿 危险程度:★★★★★\n\n 0,离开\n");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=strongman;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=strongman;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=big_strongman;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=lion;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 6:
place_sign=place.grass3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=lion;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
if(strongman_arm)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨人晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨人晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
printf("这里安全\n\n\n");
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");
}
}
}
break;
case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); //显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,XO酒80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money<25)
{
printf("钱不够!");
}
else
{
if(player.health+20<=player.max_health)
{
printf("HP+20.");
money-=25;
player.health+=20;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80)
{
printf("钱不够!");
}
else
{
if(player.health+50<=player.max_health)
{
printf("HP+50.");
money-=80;
player.health+=50;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150)
{
printf("钱不够!");
}
else
{
if(player.health+100<=player.max_health)
{
printf("HP+100.");
money-=150;
player.health+=100;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");
break;
default:
printf("输入错误\n\n\n");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");
int mai;
scanf("%d",&mai);
if(mai==1)
{
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi)
{
case 1:
if(money>=100&&cao<6)
{
cao++;
money=money-100;
printf ("止血草+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 2:
if(money>=150&&jijiubao<5)
{
jijiubao++;
money=money-150;
printf ("急救包+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 3:
if(money>=250&&baiyao<4)
{
baiyao++;
money=money-250;
printf ("云南白药+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 4:
if(money>=400&&superbaiyao<3)
{
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 5:
if(money>=150)
{
jingyancao++;
money=money-150;
printf ("经验草+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 6:
if(money>=300)
{
jingyanbao++;
money=money-300;
printf ("经验包+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 7:
if(money>=500)
{
jingyanshi++;
money=money+500;
printf ("经验石+1\n");
}
else
{
printf("钱不够!\n");
}
break;
}
case 0:
printf("金币:%d\n",money);
printf("再见,欢迎下次再来!\n");
break;
}
if(mai==2)
{
printf("药品商人:去去去,老子没时间陪你聊。\n");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n);
printf("防御装备: 5,布衣:%d个 6,铁甲:%d个 7,银甲:%d个 8,黄金圣衣:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n);
printf("选择要装备的武器或防具:\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(gong1n>=1)
{
printf("拿起了匕首\n\n\n");
gong=gong1;
strcpy(gongname,"匕首");
}
else printf("你没有匕首可以装备\n\n\n");
break;
case 2:
if(gong2n>=1)
{
printf("拿起了长剑\n\n\n");
gong=gong2;
strcpy(gongname,"长剑");
}
else printf("你没有长剑可以装备\n\n\n");
break;
case 3:
if(gong3n>=1)
{
printf("拿起了碧血剑\n\n\n");
gong=gong3;
strcpy(gongname,"碧血剑");
}
else printf("你没有碧血剑可以装备\n\n\n");
break;
case 4:
if(gong4n>=1)
{
printf("拿起了绝世好剑\n\n\n");
gong=gong4;
strcpy(gongname,"绝世好剑");
}
else printf("你没有绝世好剑可以装备\n\n\n");
break;
case 5:
if(fang1n>=1)
{
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 6:
if(fang2>=1)
{
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 7:
if(fang3n>=1)
{
printf("穿上了银甲\n\n\n");
fang=fang3;
strcpy(fangname,"银甲");
}
else printf("你没有银甲可以装备\n\n\n");
break;
case 8:
if(fang4n>=1)
{
printf("穿上了黄金圣衣\n\n\n");
fang=fang4;
strcpy(fangname,"黄金圣衣");
}
else printf("你没有黄金圣衣可以装备\n\n\n");
break;
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界。为了给您更好的游戏体验,本团队时不时会优化本游戏,优化后会尽快发布在网上。关于**方面,开启**的方式是设定勇者姓名时,输入“**斗士 ”(不包括双引号)。由于2.0版本的buy,我们在2.0的基**上进行修改,已修复该buy。并且新增了经验草等有助于升级的道具,希望大家喜欢。在这里要感谢离陌同学,他给了我们许多宝贵的建议,谢谢。\n");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y')
{
printf("数据存储中...");
//向文件中更新数据;
getchar();
printf("按回车退出");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战**)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击**物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
}
新手天翼
**
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)//判断键盘是否按下函数定义
using namespace std;
struct player {//玩家结构体(以后可能会有多个玩家,所以定义成这样)
int x,y,life,rem;//每个玩家的坐标,生命,子弹剩余
}soldier;//玩家
struct bullet {//子弹结构体
int x,y,di;//子弹的当前坐标和子弹方向
}fbullet[100000];//子弹数组
int bucount=1;//子弹数量
int cnt;//得分
int enSleep;//控制敌人的移动速度
int ChangeSleep;//控制换弹时间
int clip;//弹夹中剩余的子弹
bool fclip;//标记弹夹是否为空(1为空,0为不空)
bool fc;//判断弹夹是否填充
struct en {//敌人结构体
int x,y;//敌人的坐标
}fen[40];//一共20*20,设置了30个敌人
char Map[200][200];//地图
bool f=false;
void out(string a) {//延时输出(暂时没有用到,以后写介绍会有
for (int i=0;i<a.size();i++) {
cout<<a[i];
Sleep(50);
}
}
void color(int a) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void SetPos(COORD a)
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)
{
COORD pos={i, j};
SetPos(pos);
}
void init() {//地图初始化函数
memset(Map,' ',sizeof(Map));//将地图初始化为空格更容易看见玩家和敌人
}
void in_con() {
color(7);
system("cls");
out("本游戏控制主要分为两块\n");
cout<<" ";
out("1、玩家人物控制\n");
cout<<" ";
out("玩家在游戏中字符表示为1,通过w(上)s(下)a(左)d(右)控制1上下左右移动\n");
cout<<" ";
out("2、发射子弹控制\n");
cout<<" ";
out("本游戏接近于射击游戏,所以你可以在游戏中发射子弹,通过i(上)k(下)l(右)j(左)控制子弹发射方向\n");
out("按s召唤商店来购买东西");
out("如果中途你想要暂停游戏,您可以按下x键,此时不可以召唤商店\n");
out("如果你没有看介绍或者对介绍不熟悉,请按下Esc退出到主界面\n");
out("一发弹夹为100发子弹,子弹耗尽时会自动换弹,如果中途想要换弹请按r\n");
out("按下k跳出本轮介绍");
while (!KEY_DOWN('K'));
system("cls");
}
void in_cont() {
color(7);
system("cls");
out("本游戏为射击游戏,所以游戏主要分为3个部分\n");
out("开始后你可能会看见:\n");
init();
Map[9][9]='1';
for (int i=1;i<=8;i++) Map[i][9]='0';
for (int i=1;i<=9;i++) Map[rand()%19][rand()%19]='U';
cout<<"╭═══════════════════╮\n";//输出游戏边界
for (int i=1;i<=20;i++) {
cout<<"║";//输出边界
for (int j=1;j<20;j++) {
if (Map[i][j]=='U') color(64);//将敌人设成红色
if (Map[i][j]=='1') color(2);//将本人设置绿色
if (Map[i][j]=='0') color(14);//将子弹设置成**
cout<<Map[i][j];
color(7);//恢复
}//输出地图(由于子弹遇到边界目前会卡在边界上,所以少输出头尾
cout<<"║";//输出边界
if (i==1) printf("剩余生命:%-2d ║\n",soldier.life);
else if (i==2) cout<<"得分 :"<<setw(8)<<cnt<<"分 ║"<<endl;
else if (i==3) cout<<setw(3)<<clip<<setw(6)<<"/"<<setw(5)<<soldier.rem<<" ║"<<endl;
else if (i==4&&fclip&&soldier.rem!=0) cout<<" 换弹中... ║"<<endl;
else if (i==6&&soldier.rem==0) cout<<" 子弹耗尽! ║"<<endl;
else if (i==7&&soldier.rem==0) cout<<"请尽快到商城购买!║"<<endl;
else cout<<" ║"<<endl;
}
cout<<"╰═══════════════════╯\n";//输出游戏边界
out("左边单独框出来的是游戏地图,地图上有3种符号,1,u,0\n");
out("其中1代表玩家,0代表子弹,u代表敌人,具体如何操作,请看操作介绍\n");
out("你的目标就是控制1打u获得得分\n");
out("游戏中会有子弹限制,初始会给出1000发子弹,游戏中会有商城设置,目前里面可以购买生命和子弹,以积分作为货币,避免子弹不够的情况\n");
out("按下k跳出本轮介绍");
while (!KEY_DOWN('K'));
system("cls");
}
void update() {
system("cls");
cout<<"1.0~1.1 更新了游戏介绍,但是非常简洁,比较普通\n";
cout<<"1.1~1.2 更新游戏介绍内容和界面(当前版本未发布)\n";
cout<<"1.2~1.3 更新了游戏界面太卡顿以至于看不清的情况,和弹夹内子弹为负数的情况bug\n";
cout<<"1.3~1.4 作者发布以后立即发现了几个bug,不稳定程序问题解决,修复部分bug\n";
color(14);cout<<"优化部分闪屏问题(存在少量bug,后续继续修复)(本次更新)\n";color(7);
cout<<"按下k继续";
while (!KEY_DOWN('K'));
system("cls");
}
void careful() {
system("cls");
out("游戏中现在存在少量bug,发现请与作者联系\n");
out("祝您玩的愉快\n");
out("按下k继续");
while (!KEY_DOWN('K'));
system("cls");
}
void introduce() {
color(7);
Sleep(500);
bool f=0;
int i=1;
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
cout<<"╭══════╮\n";
cout<<"║";
if (i==1) {
color(14);
if (KEY_DOWN('Z')) in_con();
}cout<<" 控制介绍 ";color(7);
cout<<"║\n";
cout<<"║";
if (i==2) {
color(14);
if (KEY_DOWN('Z')) in_cont();
}cout<<" 内容介绍 ";color(7);
cout<<"║\n║";
if (i==3) {
color(14);
if (KEY_DOWN('Z')) return ;
}cout<<" 跳出介绍 ";color(7);
cout<<"║\n";
cout<<"╰══════╯\n";
if (KEY_DOWN('W')&&i-1!=0) i--;
if (KEY_DOWN('S')&&i+1<=3) i++;
Sleep(100);
// out("您对游戏的那些部分需要查看介绍:\n");
// out("1、控制介绍(按下u)\n");
// out("2、内容介绍(按下i)\n");
// out("按下Z开始游戏");
}
system("cls");
}
void Opening() {
int i=1;
system("cls");
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
printf("╭══════╮\n");
printf("║");
if (i==1) {
color(14);
if (KEY_DOWN('Z')&&!f) {
if (KEY_DOWN('Z')) {
for (int i=3;i>=1;i--) {
system("cls");
color(rand()%14);
cout<<i;
Sleep(1000);
}
color(rand()%14);
system("cls");
cout<<"开始!";
Sleep(1000);
return ;
}
}
if (KEY_DOWN('Z')&&f) {
color(7);
int j=0;
SetPos(0,0);
Sleep(500);
system("cls");
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
printf("╭═══════╮\n");
printf("║");
if (!j) {
color(14);
if (KEY_DOWN('Z')) {
for (int i=3;i>=1;i--) {
system("cls");
color(rand()%14);
cout<<i;
Sleep(1000);
}
color(rand()%14);
system("cls");
cout<<"开始!";
Sleep(1000);
return ;
}
}printf(" 继续上次游戏 ");color(7);
printf("║\n║");
if (j==1) {
color(14);
if (KEY_DOWN('Z')) {
soldier.x=9,soldier.y=9,soldier.life=9,soldier.rem=1000;//玩家初始坐标,生命,子弹数量
clip=100;
ChangeSleep=10;
for (int i=1;i<=bucount;i++)
fbullet[i].x=0,fbullet[i].y=0,fbullet[i].di=0;
bucount=1;
for (int i=1;i<=29;i++) {//生成第一波敌人(目前只是会从上面生成,以后会从四面生成
fen[i].x=0;
fen[i].y=rand()%19;
}
cnt=0;
init();
for (int i=3;i>=1;i--) {
system("cls");
color(rand()%14);
cout<<i;
Sleep(1000);
}
color(rand()%14);
system("cls");
cout<<"开始!";
Sleep(1000);
return ;
}
}printf(" 新游戏 ");color(7);
printf("║\n║");
if (j==2){
color(14);
if (KEY_DOWN('Z')) break;
}
printf(" 退出 ");color(7);
printf("║\n");
printf("╰═══════╯\n");
if (KEY_DOWN('W')&&j-1>=0) j--;
if (KEY_DOWN('S')&&j+1<=2) j++;
Sleep(100);
}
}
}printf(" 开始游戏 ");color(7);
printf("║\n");
printf("║");
if (i==2) {
color(14);
if (KEY_DOWN('Z')) introduce();
}printf(" 查看介绍 ");color(7);
printf("║\n");
printf("║");
if (i==3) {
if (KEY_DOWN('Z')) update();
color(14);
}printf(" 更新内容 ");color(7);
printf("║\n║");
if (i==4) {
if (KEY_DOWN('Z')) careful();
color(14);
}printf(" 注意事项 ");color(7);
printf("║\n");
printf("╰══════╯");
if (KEY_DOWN('W')&&i-1!=0) i--;
if (KEY_DOWN('S')&&i+1<=4) i++;
Sleep(100);
}
}
void control() {//控制函数
if (KEY_DOWN('W')&&soldier.x-1>=1) soldier.x--;
if (KEY_DOWN('S')&&soldier.x+1<=20) soldier.x++;
if (KEY_DOWN('A')&&soldier.y-1>=1) soldier.y--;
if (KEY_DOWN('D')&&soldier.y+1<20) soldier.y++;
}
void fire() {//发射子弹函数
int buco=0;
if (KEY_DOWN('K')) {
while (fbullet[++buco].di!=0);//重复利用数组,以下同理
if (buco>=bucount) bucount++;
fbullet[buco].di=1;
clip--;
}
if (KEY_DOWN('J')) {
while (fbullet[++buco].di!=0);
if (buco>=bucount) bucount++;
fbullet[bucount].di=2;
clip--;
}
if (KEY_DOWN('L')) {
while (fbullet[++buco].di!=0);
if (buco>=bucount) bucount++;
fbullet[bucount].di=3;
clip--;
}
if (KEY_DOWN('I')) {
while (fbullet[++buco].di!=0);
if (buco>=bucount) bucount++;
fbullet[buco].di=4;
clip--;
}
fbullet[buco].x=soldier.x;
fbullet[buco].y=soldier.y;
}
void en_move() {//敌人移动函数
if (enSleep==2) {//控制敌人移动速度
for (int i=1;i<=29;i++) {
if (fen[i].x+1<=21)//如果下一步未出界,那么移动
fen[i].x++;
if (Map[fen[i].x][fen[i].y]=='1') {//如果敌人碰到玩家
soldier.life--;
if (soldier.life==0) {
system("cls");
out("Game Over!");
Sleep(1000);
system("cls");
out("你目前的得分为:");
cout<<cnt;
out("分");Sleep(1000);
system("cls");
out("是否重新开始游戏?\nYes(y)No(n)");
while (true) {
if (KEY_DOWN('N')) exit(0);
if (KEY_DOWN('Y')) {
cnt=0;
soldier.x=9,soldier.y=9;//玩家初始坐标
soldier.life=9;soldier.rem=1000;
for (int i=1;i<=9;i++) {//生成第一波敌人(目前只是会从上面生成,以后会从四面生成
fen[i].x=0;
fen[i].y=rand()%19;
}
bucount=0;
break;
}
}
}
}
if (fen[i].x==21) {//如果到界限,那么重新生成
fen[i].x=0;
fen[i].y=rand()%19;
}
}
enSleep=0;
}
}
void hit(int x,int y,int k) {
if (Map[x][y]=='U') {//如果当前子弹击中敌人
cnt++;//得分累加
for (int j=1;j<=29;j++) {//查出是哪一个敌人被击中
if (fen[j].x==x&&fen[j].y==y) {//找到当前敌人并重新生成
fen[j].x=0;
fen[j].y=rand()%19;
break;
}
}
fbullet[k].x=0;//将子弹放在0,0处(此处不会输出)
fbullet[k].y=0;
fbullet[k].di=0;//以后方便重复利用数组
}
}
void bullet_move() {//子弹移动函数
for (int i=1;i<=bucount;i++) {//遍历每一个子弹
hit(fbullet[i].x,fbullet[i].y,i);
if (fbullet[i].di==1&&fbullet[i].x+1<=21) fbullet[i].x++;
if (fbullet[i].di==2&&fbullet[i].y-1>=0) fbullet[i].y--;
if (fbullet[i].di==3&&fbullet[i].y+1<=21) fbullet[i].y++;
if (fbullet[i].di==4&&fbullet[i].x-1>=0) fbullet[i].x--;
if (fbullet[i].x==21||fbullet[i].y==0||fbullet[i].y==21||fbullet[i].x==0)
fbullet[i].di=0;
hit(fbullet[i].x,fbullet[i].y,i);
}
}
void shop() {
int i=1;
system("cls");
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
color(14);
cout<<"================================================\n";
color(7);
cout<<"欢迎来到商店,您可以买如下物品:\n";
cout<<"╭════════════╮\n║";
if (i==1) {
if (KEY_DOWN('Z')) {
if (cnt<100) {
system("cls");
cout<<"积分不够!\n";
}
if (cnt>=100) {
system("cls");
cnt-=100;
soldier.life++;
soldier.life%=10;
cout<<"购买成功!\n";
cout<<"您现在有"<<soldier.life<<"条生命\n";
cout<<"您还有"<<cnt<<"分\n";
}
out("按下k继续");
while (!KEY_DOWN('K'));
system("cls");
}
color(14);
}cout<<" 一条命(售价100分) ";color(7);
cout<<"║\n║";
if (i==2) {
if (KEY_DOWN('Z')) {
if (cnt<10) {
system("cls");
cout<<"积分不够!\n";
}
if (cnt>=10) {
system("cls");
cnt-=10;
soldier.rem+=700;
cout<<"购买成功!\n";
cout<<"您现在有"<<soldier.rem<<"发子弹\n";
cout<<"您还有"<<cnt<<"分\n";
}
out("按下k继续");
while (!KEY_DOWN('K'));
system("cls");
}
color(14);
}cout<<" 700发子弹(售价10分) ";color(7);
cout<<"║\n║";
if (i==3) {
if (KEY_DOWN('Z')) return ;
color(14);
}cout<<" 退出商店 ";color(7);
cout<<"║\n";
cout<<"╰════════════╯\n";
if (KEY_DOWN('W')&&i-1!=0) i--;
if (KEY_DOWN('S')&&i+1<=3) i++;
Sleep(100);
}
}
int main () {
soldier.x=9,soldier.y=9,soldier.life=9,soldier.rem=1000;//玩家初始坐标,生命,子弹数量
clip=100;
ChangeSleep=10;
for (int i=1;i<=9;i++) {//生成第一波敌人(目前只是会从上面生成,以后会从四面生成
fen[i].x=0;
fen[i].y=rand()%19;
}
Opening();
color(7);
while (true) {
f=true;
if (KEY_DOWN(VK_ESCAPE))
Opening();
enSleep++;//控制时间
if (KEY_DOWN('X')) {
SetPos(26,6);
cout<<"暂停中!";
Sleep(1000);
while (!KEY_DOWN('X'));
Sleep(100);
}
//system("cls");//清屏使其动态
if (KEY_DOWN('P')) shop();
init();
control();
if (KEY_DOWN('R')) {
if (soldier.rem>=100-clip) {
soldier.rem-=(100-clip);
clip=100;
}
else {
clip+=soldier.rem;
soldier.rem=0;
}
fclip=1;
ChangeSleep=0;
}
if (ChangeSleep==10) {
if (fc==0) {
clip=100;
if (soldier.rem>=100) soldier.rem-=100;
else clip=soldier.rem,soldier.rem=0;
fc=1;
}
fclip=0;
if (clip!=0) fire();
}
if (clip==0&&fclip==0) ChangeSleep=0,fclip=1,fc=0;
if (fclip) ChangeSleep++;
Map[soldier.x][soldier.y]='1';//将玩家生成在屏幕上
en_move();
for (int i=1;i<=29;i++)//将敌人生成在屏幕上(后面子弹判断需要)
Map[fen[i].x][fen[i].y]='U';
bullet_move();
for (int i=1;i<=bucount;i++)//将子弹生成在屏幕上
Map[fbullet[i].x][fbullet[i].y]='0';
Map[soldier.x][soldier.y]='1';//将玩家生成在屏幕上
SetPos(0,0);
cout<<"╭═══════════════════╮\n";//输出游戏边界
for (int i=1;i<=20;i++) {
cout<<"║";//输出边界
for (int j=1;j<20;j++) {
if (Map[i][j]=='U') color(64);//将敌人设成红色
if (Map[i][j]=='1') color(2);//将本人设置绿色
if (Map[i][j]=='0') color(14);//将子弹设置成**
cout<<Map[i][j];
color(7);//恢复
}//输出地图(由于子弹遇到边界目前会卡在边界上,所以少输出头尾
cout<<"║";//输出边界
if (i==1) printf("剩余生命:%-2d ║\n",soldier.life);
else if (i==2) cout<<"得分 :"<<setw(8)<<cnt<<"分 ║"<<endl;
else if (i==3) cout<<setw(3)<<clip<<setw(6)<<"/"<<setw(5)<<soldier.rem<<" ║"<<endl;
else if (i==4&&fclip&&soldier.rem!=0) cout<<" 换弹中... ║"<<endl;
else if (i==6&&soldier.rem==0) cout<<" 子弹耗尽! ║"<<endl;
else if (i==7&&soldier.rem==0) cout<<"请尽快到商城购买!║"<<endl;
else cout<<" ║"<<endl;
}
cout<<"╰═══════════════════╯\n";//输出游戏边界
Sleep(10);//防止游戏太卡顿或者高内存,延时0.1秒
}
return 0;
}
新手天翼
打篮球的
#include<cstdio>
#define hello(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#pragma GCC optimize(2)
#include<iomanip>
#include<stdio.h>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<map>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<windows.h>
using namespace std;
POINT p;
struct team{
string name;
int g=0;
int num=0;
int tl=0,jg=0,fs=0;
int sum(){
return tl*3+jg*2+fs*2;
}
}HUREN,a[10005];
void pr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
}void ppr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(70);
}
}
bool cmp(team t1,team t2){
if(t1.g!=t2.g) return t1.g>t2.g;
if(t1.num!=t2.num) return t1.num>t2.num;
if(t1.sum()!=t1.sum()) return t1.sum()>t2.sum();
if(t1.tl!=t2.tl) return t1.tl>t2.tl;
if(t1.jg!=t2.jg) return t1.jg>t2.jg;
if(t1.fs!=t2.fs) return t1.fs>t2.fs;
return t1.name<t2.name;
}
int gotoxy(int y, int x){
HANDLE handle;
COORD coord;
coord.X = x;
coord.Y = y;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, coord);
} void cls(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordScreen = { 0, 0 };
SetConsoleCursorPosition( hConsole, coordScreen );
}
void go1(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}int all;
int n;
int fs(int,int);
signed main(){
/*-------------------------基本内容设置开始-----------------------*/
go1();
srand(time(0));
system("title 小李工作室—五分钟小游戏系列之三---------NBA 1.0.0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
Sleep(1000);
pr("致敬当年我们追过的NBA球星");
Sleep(1000);
system("cls");
/*-------------------------基本内容设置结束-----------------------*/
/*---------------------------主题程序开始-----------------------*/
loop:
cout<<" 致敬当年我们追过的NBA球星 \n";
cout<<" ① 创建队伍 \n";
cout<<" ② 常规赛 \n";
cout<<" ③ 离开 \n";
int t;
cin>>t;
if(t==1){
printf(" team_name: ");
string hname;
cin>>hname;
a[++n].name=hname;
printf("\n OK");
int a1=10,b1=30;
a[n].jg=fs(a1,b1);
a[n].fs=fs(a1,b1);
a[n].tl=fs(a1,b1);
printf("\n组队中");
pr("……………………\n");
printf("完成!!\n");
pr("基本信息:\n");
Sleep(1000);
pr(" 队名:");
cout<<a[n].name;
pr("队 进攻力:");
cout<<a[n].jg;
pr(" 防守力:");
cout<<a[n].fs;
pr(" 篮板力:");
cout<<a[n].tl;
pr(" 总势力:");
cout<<a[n].sum();
Sleep(3000);
system("cls");
goto loop;
}
else if(t==2){
system("cls");
pr("第");
cout<<++all;
pr("赛季常规赛开始了!!\n\n");
int tmp=0;
for(int i=1;i<=n;i++) a[i].g=0;
pr("参战队伍:\n");
for(int i=1;i<=n;i++){
cout<<a[i].name<<"队 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i!=j){
tmp++;
cout<<"第"<<tmp<<"场:\n";
cout<<"主场"<<a[i].name<<"队VS"<<"客场"<<a[j].name<<"队"<<endl;
if(abs(a[i].sum()-a[j].sum())<=30){
pr("双方较量十分激烈,不分高下!\n");
}else{
pr("双方实力悬殊,一交手胜负已定!\n");
}
pr("得分:");
int ff1=(a[i].sum()+fs(40,70))/2+1,ff2=(a[j].sum()+fs(40,70)+4)/2+1;
cout<<a[i].name<<":"<<ff1<<" "<<a[j].name<<":"<<ff2<<endl;
if(ff1>ff2){
cout<<a[i].name<<"队胜!";
a[i].g+=2;
a[i].jg++;
a[i].fs++;
a[i].tl+=2;
a[j].tl--;
}else if(ff1==ff2){
cout<<"战平!";
a[i].g++;
a[j].g++;
a[i].fs++;
a[i].fs++;
}else{
cout<<a[j].name<<"队胜!";
a[j].g+=2;
a[j].jg++;
a[j].fs++;
a[j].tl+=2;
a[i].tl--;
}
cout<<endl;
system("pause");
system("cls");
}
}
}
sort(a+1,a+n+1,cmp);
pr("常规赛结束了\n");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
pr("决赛之钟敲响了!!\n");
team sub=a[1],ob=a[2];
Sleep(1000);
system("color 3f");
Sleep(1000);
system("color 6a");
Sleep(1000);
system("color 19");
Sleep(1000);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
pr("让我们为勇士们狂欢!\n");
Sleep(3000);
system("cls");
pr("决赛主场:");
cout<<sub.name<<"队"<<endl;
pr("决赛客场:");
cout<<ob.name<<"队"<<endl;
pr("加油!\n");
Sleep(4000);
system("pause");
system("cls");
pr("结果已出,让我们倒数5个数:\n");
team winner;
int ff1=(sub.sum()+fs(10,30))+10,ff2=(ob.sum()+fs(20,40));
if(ff1<ff2){
winner=ob;
}else if(ff1>ff2){
winner=sub;
}else{
if(sub.num>ob.num){
winner=sub;
}else{
winner=ob;
}
}
int tmp1=6;
while((tmp1--) >=1){
cout<<tmp1<<endl;
Sleep(1000);
}
ppr("第");
cout<<all;
ppr("赛季总冠军:");
cout<<winner.name<<"队!!!!!\n";
if(winner.name==a[1].name) {
a[1].num+=20;
a[2].fs++;
a[1].fs--;
}else {
a[2].num+=20;
a[2].fs--;
a[1].fs++;
}
system("pause");
system("cls");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}cout<<"历时"<<++tmp<<"场比赛,NBA第"<<all<<"赛季收官";
system("pause");
system("cls");
for(int i=1;i<=n;i++){
a[i].jg+=i;
}
goto loop;
}else if(t==3){
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
}
return false;
}
int fs(int min,int max){
return (rand()%(max-min+1))+min;
}
新手天翼
我的世界(文字版)
#include<bits/stdc++.h>
#include<time.h>
#include<conio.h>
#include<Windows.h>
using namespace std;
string name,gname,wqm="手",hjm="空";
long long gly,hjnx=-1,hjz=0,pg=0,s=20,ssx,csg=1,wq=0,gjz=csg+wq,t,z=0,l=0,x=0,y=60,u,sy=2,dy=1,fms=0,jez=20,kfl=5,wjl=1,mb=0,mt=0,mg=0,zhongzi[4]={0,0,0,0},st=0,td=0,jd=0,wqnj=0,nj,jy=0,dj,jyzy=10,gtdj=0,gtnj=0,ftnj,tks=0,jks=0,mty=0,ysy[7]={0,0,0,0,0,0,0},yq=10,hsd=0,zk=1,mm,hb=0,hjj[4]={0,0,0,0},hjnj=0,wqq;
bool fmr=0,cldt=0,bydt=0,cly=0,tp=1,gk=0,dyt=0,zlld=0;//附魔室开关
char k,a,c;
char dg;
void js();//僵尸
void xb();//小白
void klp();//苦力怕
void xh();//小黑
void py();//平原
void mx();//冒险
int kk();//挖矿
void dd();//等待
int wk();// 挖矿2
void xl();//血量判断
void myl();//末影龙
void dl();//凋零
void dgw(string names,int b,int g,int j,int jyyy);//打怪
void zy();//字幕
void sh();//钓鱼
void sd();//商店
void bb();//背包
void jh();//交换
void cl();
void cd();//菜单
void wqgj();//武器工具
void wqy();//武器
void gzt();//工作台
void qt();//其它
void sjy();//升级
void home();//回家
void gjy();//工具
void rly();//熔炉
void czy();//村庄
void ldfd();
void xsjc();
void by();
void xhy();
void xby();
void hjy();
void tf();
void tf()
{
while(1)
{
cout<<"屠夫:你好,你要购买什么?\n0.离开 1.皮革 1煤炭\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(mt>=1)
{
mt--;
pg++;
cout<<"购买成功\n";
system("pause");
}
else
{
cout<<"煤炭不够了\n";
system("pause");
}
}
}
}
void hjy()
{
while(1)
{
system("cls");
cout<<"你要合成什么护甲?(护甲需要到背包自行装备)(材料*24)\n0.离开 1.皮革套装 2.铁套装 3.金套装 4.钻石套装\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(pg>=24)
{
hjj[0]++;
pg-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
else
if(a=='2')
{
if(td>=24)
{
hjj[1]++;
td-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
else
if(a=='3')
{
if(jd>=24)
{
hjj[2]++;
jd-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
else
if(a=='4')
{
if(z>=24)
{
hjj[3]++;
z-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
}
}
void xby()
{
while(1)
{
system("cls");
cout<<"是否继续探宝?\n0.退出 1.继续(火把*1)\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(hb>0)
{
}
else
{
cout<<"你的火把不够了。\n";
}
}
}
}
void xhy()
{
yq=10;
hsd=0;
while(1)
{
system("cls");
cout<<"潜水中,请注意氧气剩余量:"<<yq<<" 潜水深度:"<<hsd<<endl<<"0.离开 1.下潜 2.上浮 3.水肺药水 加5氧气(剩余:"<<ysy[6]<<") 3.建造补给站 200木板,50铁锭,氧气2 (当深度达到这里时,氧气加满)\n";
for(int i=0;i<yq;i++)
{
cout<<".";
}
cout<<endl;
a=getch();
if(a=='0')
{
if(hsd==0)
{
break;
}
else
{
cout<<"请先浮出水面。\n";
system("pause");
}
}
else
if(a=='1')
{
hsd++;
t=rand()%20;
if(t==0)
{
cout<<"发现海底神庙,是否进入?(有丰厚的奖励!)\n";
}
}
yq--;
if(yq<=0)
{
cout<<"你呛水了,还剩"<<s<<"滴血。\n";
yq=0;
s--;
xl();
system("pause");
}
}
}
void by()
{
if(bydt==0)
{
cout<<"请先在村庄购买通往冰原的地图\n";
system("pause");
}
else
{
while(1)
{
cout<<"欢迎来到冰原!你要去干什么?\n0.离开 1.下海 ";
if(gk==0)
{
cout<<"2.搭建港口 ";
}
else
{
cout<<"2.出海 ";
}
if(dyt==0)
{
cout<<"3搭建**\n";
}
else
{
cout<<"3.钓鱼\n";
}
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
xhy();
}
else
if(a=='2')
{
}
else
if(a=='3')
{
}
}
}
}
void xsjc()
{
while(1)
{
system("cls");
cout<<"请问你要查看什么方面的教程?\n0.退出 1.工具 2.挖矿 3.砍树 4.战斗 5.交易 6.耐久 7.背包 8.作者\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
cout<<"武器:增加一定的攻击值。\n镐子:等级越高,能采集的矿物种类就越多。\n斧子:加快砍树的速度。\n";
system("pause");
}
else
if(a=='2')
{
cout<<"挖矿需要使用镐子,否则就没有掉落物。在挖矿时有几率遇见怪物。\n";
system("pause");
}
else
if(a=='3')
{
cout<<"砍树时间越长,获得木头越多。\n";
system("pause");
}
else
if(a=='4')
{
cout<<"如果遇见怪物就会进入战斗。在战斗中可以攻击,逃跑和药水。在被动遇见怪物时无法逃跑,药水需要在村庄牧师处购买。\n";
system("pause");
}
else
if(a=='5')
{
cout<<"交易可以在村庄进行。村庄偶尔会遭到劫掠,如果打败劫掠就会得到村民的丰厚回报。\n";
system("pause");
}
else
if(a=='6')
{
cout<<"在游戏中,武器、镐子、斧子和护甲都是有耐久的,当耐久为0时效果消失。\n";
system("pause");
}
else
if(a=='7')
{
cout<<"在大多数的界面都是可以打开背包界面的,按e即可开启背包界面。\n";
system("pause");
}
else
if(a=='8')
{
cout<<"作者:YYH(如有转载请告知) QQ:2054196623(欢迎**扰,在验证消息中发送070801) 微信:没有……\n";
system("pause");
}
else
if(a=='e')
{
bb();
}
}
}
void ldfd()
{
system("cls");
cout<<"**提示:在林地府邸里有很多怪物,请确认做好准备再进入!(占领即可使用)\n1.进入\n2.离开";
a=getch();
if(a=='1')
{
if(zlld==0)
{
system("cls");
cout<<"你来到了大门口,一群卫道士冲了上来。\n";
Sleep(1000);
system("cls");
dgw("卫道士",20,8,10,20);
dgw("卫道士",20,8,10,20);
dgw("卫道士",20,8,10,20);
dgw("卫道士",20,8,10,20);
system("cls");
cout<<"你进入了大厅,有一群唤魔者来了。\n";
Sleep(1000);
system("cls");
dgw("唤魔者",30,7,10,20);
dgw("唤魔者",30,7,10,20);
dgw("唤魔者",30,7,10,20);
dgw("唤魔者",30,7,10,20);
cout<<"又有一群怪物来了。\n";
Sleep(1000);
system("cls");
js();
js();
xb();
xb();
klp();
klp();
xh();
xh();
cout<<"你已经占领了林地府邸。\n";
zlld=1;
system("pause");
}
else
{
while(1)
{
system("cls");
cout<<"欢迎来到林地府邸,你要干什么?\n1.**(刷经验) 2.寻宝/n";
a=getch();
if(a=='1')
{
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在**按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / 10 << "经验" << endl;
jy+= (int)difftime(c_end, c_start) / 10;
sjy();
system("pause");
}
}
}
}
else
if(a=='e')
{
bb();
}
}
void czy()
{
int tttt=rand()%10;
if(tttt==0)
{
cout<<"这个村庄正在遭到劫掠,你是否出手相助?\n1.相助\n2.离开";
a=getch();
if(a=='1')
{
dgw("劫掠者",20,6,100,50);
dgw("劫掠者",20,6,100,50);
dgw("劫掠者",20,6,100,50);
dgw("劫掠者",20,6,100,50);
dgw("劫掠兽",100,10,100,50);
cout<<"村民们都很感谢你,给你了很多绿宝石\n";
l+=100;
system ("pause");
}
else
{
cout<<"你悄悄地回了家";
cd();
system ("pause");
}
}
while(1)
{
system("cls");
cout<<"你要去找谁?\n0.离开\n1.制图师\n2.制箭师\n3.图书**员\n4.牧师\n5.屠夫";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
while(1)
{
system("cls");
if(name!="Nouth")
cout<<"制图师:你好,请问你要买什么?\n0.离开\n1.通往从林的地图 100绿宝石\n2.通往冰原的地图 100绿宝石\n";
else
cout<<"制图师:Nouth大人,你好。\n0.离开\n1.通往从林的地图 50绿宝石\n2.通往冰原的地图 50绿宝石\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(cldt==1)
{
cout<<"你已经买过这件物品了\n";
system ("pause");
}
else
if(l<100)
{
cout<<"绿宝石不够了\n";
system ("pause");
}
else
{
cout<<"购买成功\n";
l-=100;
cldt=1;
system ("pause");
}
}
else
if(a=='2')
{
if(bydt==1)
{
cout<<"你已经买过这件物品了\n";
system ("pause");
}
else
if(l<100)
{
cout<<"绿宝石不够了\n";
system ("pause");
}
else
{
cout<<"购买成功\n";
l-=100;
bydt=1;
system ("pause");
}
}
}
}
else
if(a=='4')
{
while(1)
{
system("cls");
if(zk==1)
cout<<"牧师:你好,请问你要买什么?\n0.离开\n1.治疗药水I:血量加5 20绿宝石\n2.治疗药水II:血量加10 30绿宝石\n3.治疗药水III:血量加15 40绿宝石\n4.伤害药水I:敌人血量减5 10绿宝石\n5.伤害药水II:敌人血量减10 15绿宝石\n6.伤害药水III:敌人血量减15 20绿宝石\n";
else
cout<<"牧师:你好Nouth大人,请问你要买什么?\n0.离开\n1.治疗药水I:血量加5 10绿宝石\n2.治疗药水II:血量加10 15绿宝石\n3.治疗药水III:血量加15 20绿宝石\n4.伤害药水I:敌人血量减5 5绿宝石\n5.伤害药水II:敌人血量减10 7绿宝石\n6.伤害药水III:敌人血量减15 10绿宝石\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(l>=20)
{
cout<<"购买成功\n";
l-=20/zk;
ysy[0]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='2')
{
if(l>=30)
{
cout<<"购买成功\n";
l-=30/zk;
ysy[1]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='3')
{
if(l>=40)
{
cout<<"购买成功\n";
l-=40/zk;
ysy[2]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='4')
{
if(l>=10)
{
cout<<"购买成功\n";
l-=10/zk;
ysy[3]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='5')
{
if(l>=15)
{
cout<<"购买成功\n";
l-=15/zk;
ysy[4]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='6')
{
if(l>=20)
{
cout<<"购买成功\n";
l-=20/zk;
ysy[5]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
}
}
else
if(a=='5')
{
tf();
}
else
if(a=='e')
{
bb();
}
}
}
void rly()
{
while(1)
{
system("cls");
cout<<"煤炭:"<<mty<<endl<<"你要炼造什么?\n0.离开\n1.铁矿石(剩余"<<tks<<")\n2.金矿石(剩余"<<jks<<"个)\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
cout<<"已经为你炼造了最多\n";
if(mty<tks)
{
td+=mty;
tks-=mty;
mty=0;
}
else
{
td+=tks;
mty-=tks;
tks=0;
}
system ("pause");
}
else
if(a=='2')
{
cout<<"已经为你炼造了最多\n";
if(mty<jks)
{
jd+=mty;
jks-=mty;
mty=0;
}
else
{
jd+=jks;
mty-=jks;
jks=0;
}
system ("pause");
}
else
if(a=='e')
{
bb();
}
}
}
void gjy()
{
while(1)
{
system("cls");
cout<<"0.退出 1.木镐 2.石镐 3.铁镐 4.金镐 5.钻石镐 6.木斧 7.石斧 8.铁斧 9.金斧 a.钻石斧"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(gtdj>1)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mb>=3&&mg>=2)
{
gtdj=1;
gtnj=60;
mb-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='2')
{
if(gtdj>2)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mg>=2&&st>=3)
{
gtdj=2;
gtnj=132;
st-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='3')
{
if(gtdj>3)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mg>=2&&td>=3)
{
gtdj=3;
gtnj=251;
td-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='4')
{
if(gtdj>1)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mg>=2&&jd>=3)
{
gtdj=1;
gtnj=44;
jd-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='5')
{
if(mg>=2&&z>=3)
{
gtdj=4;
gtnj=1562;
z-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='6')
{
if(kfl<4)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&mb>=3)
{
kfl=4;
ftnj=60;
mb-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='7')
{
if(kfl<3)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&st>=3)
{
kfl=3;
ftnj=132;
st-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='8')
{
if(kfl<2)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&td>=3)
{
kfl=2;
ftnj=251;
td-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='9')
{
if(kfl<4)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&jd>=3)
{
kfl=4;
ftnj=44;
jd-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='a')
{
if(mg>=2&&z>=3)
{
kfl=1;
ftnj=1562;
z-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='e')
{
bb();
}
}
}
void home()
{
cout<<"回家了!"<<endl;
Sleep(500);
s=ssx;
cout<<"已经为你加满血了"<<endl;
system ("pause");
}
void sjy()
{
while(jy>=jyzy)
{
dj++;
jy-=jyzy;
jyzy*=2;
cout<<"你升级了,现等级为"<<dj<<endl;
Sleep(500);
}
}
void qt()
{
while(1)
{
system("cls");
cout<<"0.退出 1.木板 2.木棍"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(mt>=1)
{
mb+=4;
mt--;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='2')
{
if(mb>=2)
{
mg+=4;
mb-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='e')
{
bb();
}
}
}
void gj()
{
}
void wqy()
{
while(1)
{
system("cls");
cout<<"0.退出 1.木剑 2.石剑 3.铁剑 4.金剑 5.钻石剑"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(wq>4)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mb>=2&&mg>=1)
{
wq=4;
wqnj=60;
wqm="木剑";
mg--;
mb-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='2')
{
if(wq>5)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mg>=1&&st>=2)
{
wq=5;
wqnj=126;
mg--;
st-=2;
wqm="石剑";
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='3')
{
if(wq>6)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mg>=1&&td>=2)
{
wq=6;
wqnj=251;
mg--;
td-=2;
wqm="铁剑";
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='4')
{
if(wq>4)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mg>=1&&jd>=2)
{
wq=4;
wqnj=44;
mg--;
jd-=2;
wqm="金剑";
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='5')
{
if(mg>=1&&z>=2)
{
wq=7;
wqnj=1562;
wqm="钻石剑";
mg--;
z-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='e')
{
bb();
}
}
}
void wqgj()
{
while(1)
{
system("cls");
cout<<"请问你要合成什么?"<<endl<<"0.退出 1.武器 2.盔甲 3.工具"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
wqy();
}
else
if(a=='2')
{
hjy();
}
else
if(a=='3')
{
gjy();
}
else
if(a=='e')
{
bb();
}
}
}
void gzt()
{
while(1)
{
system("cls");
cout<<"请问你要合成什么类型的物品:"<<endl<<"0.退出 1.武器工具 2.家具 3.建筑 4.其它"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
wqgj();
}
else
if(a=='2')
{
}
else
if(a=='3')
{
}
else
if(a=='4')
{
qt();
}
else
if(a=='e')
{
bb();
}
}
}
void cl()
{
if(cldt==0)
{
cout<<"请先在村庄购买通往丛林的地图\n";
system ("pause");
cd();
}
else
{
cly=1;
while(1)
{
system("cls");
cout<<"欢迎来到丛林!(友情提示:在这里你可以得到一些平原无法得到的东西)\n0.离开 1.挖矿 2.砍树 3.寻找林地府邸\n";
a=getch();
if(a=='0')
{
cly=0;
break;
}
else
if(a=='1')
{
system("cls");
cout<<"正在搜索矿洞"<<endl;
Sleep(2000);
wk();
}
else
if(a=='2')
{
system("cls");
if(ftnj>0)
{
ftnj--;
}
else
{
kfl=5;
}
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在砍树,按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / (500*kfl) << "木头" << endl;
mt+= (int)difftime(c_end, c_start) / (500*kfl);
system("pause");
}
else
if(a=='3')
{
ldfd();
}
else
if(a=='e')
{
bb();
}
}
}
}
void py()
{
while(1)
{
tp=1;
system("cls");
cout<<"欢迎来到平原!你可以:"<<endl<<"0.离开 1.搜寻小麦种子(暂时没用) 2.砍树 3.刷怪 4.挖矿"<<endl;
char pyy=getch();
if(pyy=='0')
{
break;
}
else
if(pyy=='1')
{
while(1)
{
system("cls");
Sleep(1000);
t=rand()%10;
cout<<"获得小麦种子"<<t<<"个"<<endl;
zhongzi[0]+=t;
cout<<"你要退出吗?(按0)"<<endl;
pyy=getch();
if(pyy=='0')
{
break;
}
else
{
continue;
}
}
}
else
if(pyy=='2')
{
system("cls");
if(ftnj>0)
{
ftnj--;
}
else
{
kfl=5;
}
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在砍树,按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / (1000*kfl) << "木头" << endl;
mt+= (int)difftime(c_end, c_start) / (1000*kfl);
system("pause");
}
else
if(pyy=='3')
{
while(1)
{
system("cls");
cout<<"是否继续刷怪?\n0.退出 1.继续\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
tp=0;
int sj=rand()%4;
if(sj==0)
{
js();
}
else
if(sj==1)
{
xb();
}
else
if(sj==2)
{
klp();
}
else
{
xh();
}
}
}
}
else
if(pyy=='4')
{
system("cls");
cout<<"正在搜索矿洞"<<endl;
Sleep(1000);
wk();
}
if(pyy=='e')
{
bb();
}
}
}
void mx()
{
while(1)
{
system("cls");
cout<<"你要去哪里?"<<endl<<"0.返回 1.平原 2.丛林 3.冰原 4.村庄 5.下界 6.末地"<<endl;
char mxy=getch();
if(mxy=='0')
{
break;
}
else
if(mxy=='1')
{
py();
}
else
if(mxy=='2')
{
cl();
}
else
if(mxy=='4')
{
czy();
}
else
if(mxy=='e')
{
bb();
}
}
}
int kk()
{
k=getch();
if(k=='1')
{
x-=1;
}
else
if(k=='2')
{
x+=1;
}
else
if(k=='3')
{
y-=1;
}
else
if(k=='4')
{
return 1;
}
else
if(a=='e')
{
bb();
}
int gw=rand()%10;
if(gw==0&&k!='e')
{
js();
}
else
if(gw==1&&k!='e')
{
xb();
}
if(gtnj>0)
gtnj--;
if(gtnj==0)
{
gtdj=0;
}
if(y<=30&&y>10&>dj>=3&&cly==1)
{
int j=rand()%sy;
l+=j;
if(j!=0)
cout<<"获得绿宝石"<<j<<"颗"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y<=10&>dj>=3)
{
int j=rand()%sy;
z+=j;
if(j!=0)
cout<<"获得钻石"<<j<<"颗"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y>=10&>dj>=2)
{
int j=rand()%sy;
tks+=j;
if(j!=0)
cout<<"获得铁矿石"<<j<<"个"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y<=30&>dj>=3&&cly==1)
{
int j=rand()%sy;
jks+=j;
if(j!=0)
cout<<"获得金矿石"<<j<<"个"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(gtdj>=1)
{
int j=rand()%sy;
st+=j;
if(j!=0)
cout<<"获得石头"<<j<<"个"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y<=55&&y>10&>dj>=1)
{
int j=rand()%sy;
mty+=j;
if(j!=0)
cout<<"获得煤炭"<<j<<"颗"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
return 0;
}
int wk()
{
while(1)
{
system("cls");
cout<<"1.向左挖 2.向右挖 3.向下挖 4.离开"<<endl<<"x坐标:"<<x<<","<<"y坐标:"<<y<<"."<<endl;
if(kk()==1)
{
return 0;
}
}
}
void xl()
{
if(s<=0)
{
cout<<"你失败了"<<endl;
Sleep(1000);
s=20;
cd();
}
}
void js()
{
gname="僵尸";
dgw(gname,20,2,6,10);
}
void xb()
{
gname="小白";
dgw(gname,20,4,10,20);
}
void klp()
{
gname="苦力怕";
dgw(gname,20,0,30,30);
}
void xh()
{
gname="小黑";
dgw(gname,40,10,50,40);
}
void myl()
{
gname="末影龙";
dgw(gname,200,20,0,1000);
}
void dl()
{
gname="凋零";
dgw(gname,300,50,1000,0);
}
void dgw(string names,int b,int g,int j,int jyyy)
{
system("cls");
cout<<"一只"<<names<<"来袭"<<endl;
Sleep(1000);
while(1)
{
system("cls");
cout<<"你要干什么?"<<endl<<"1.攻击 2.逃跑 3.药水\n";
a=getch();
if(a=='3')
{
system("cls");
cout<<"你要使用什么药水?\n1.治疗药水I:血量加5*"<<ysy[0]<<"\n2.治疗药水II:血量加10*"<<ysy[1]<<"\n3.治疗药水III:血量加15*"<<ysy[2]<<"\n4.伤害药水I:敌人血量减5*"<<ysy[3]<<"\n5.伤害药水II:敌人血量减10*"<<ysy[4]<<"\n6.伤害药水III:敌人血量减15*"<<ysy[5]<<"\n";
a=getch();
if(a=='1')
{
if(ysy[0]>0)
{
s+=5;
ysy[0]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='2')
{
if(ysy[1]>0)
{
s+=10;
ysy[1]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='3')
{
if(ysy[2]>0)
{
s+=15;
ysy[2]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='4')
{
if(ysy[3]>0)
{
b-=5;
ysy[3]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='5')
{
if(ysy[4]>0)
{
b-=10;
ysy[4]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='6')
{
if(ysy[5]>0)
{
b-=15;
ysy[5]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
}
else
if(a=='2')
{
if(tp==0)
{
cout<<"逃跑成功"<<endl;
system ("pause");
break;
}
else
{
cout<<"逃跑失败"<<endl;
system ("pause");
}
}
else
if(a=='1')
{
cout<<"你对"<<names<<"造成了"<<gjz<<"点伤害\n";
b-=gjz;
if(wqnj==0)
{
wqm="手";
wq=0;
}
else
{
wqnj--;
}
}
if(s>ssx)
{
s=ssx;
}
if(b<0)
{
b=0;
}
cout<<names<<"还有"<<b<<"滴血\n";
if(b<=0)
{
cout<<"你还有"<<s<<"滴血\n";
int jl=rand()%j;
if(jl!=0)
{
cout<<"获得绿宝石"<<jl<<"颗\n";
l+=jl;
}
else
{
cout<<names<<"太穷了,什么也没掉落\n";
}
jy+=jyyy;
sjy();
system ("pause");
break;
}
if(hjnj>0)
{
hjnj--;
if(hjnj==0)
{
hjz=0;
hjj[hjnx]--;
}
}
if(g>=hjz)
{
cout<<names<<"对你"<<"造成了"<<g-hjz<<"点伤害\n";
s-=g-hjz;
}
else
{
cout<<names<<"对你"<<"造成了"<<0<<"点伤害\n";
}
cout<<"你还有"<<s<<"滴血\n";
system ("pause");
xl();
}
}
int op=0;
void zy()
{
gjz=csg+wq;
y=60;x=0;
string hh="请问你要去干什么?";
system("cls");
cout<<"欢迎回来:"<<name<<endl;
if(op==0)
{
cout<<"M";Sleep(100);cout<<"C";Sleep(100);cout<<"1";Sleep(100);cout<<".";Sleep(100);cout<<"2";Sleep(100);cout<<".";Sleep(100);cout<<"3";Sleep(100);cout<<endl;
}
else
{
cout<<"MC1.2.3";
}
if(op==0)
for(int i=0;i<hh.size();i++)
{
cout<<hh[i];
Sleep(100);
}
else
cout<<endl<<hh;
op=1;
cout<<endl<<"1.冒险 2.工具 3.回家 4.熔炉 5.提示 6.保存"<<endl<<"其它按照传统MC"<<endl;
a=0;
system("color 0");
a=getch();
op=1;
}
void bb()
{
while(1)
{
system("cls");
cout<<"请问你要看什么?\n0.离开 1.矿物 2.工具 3.药水 4.属** 5.其他 6.护甲\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
system("cls");
cout<<"石头"<<st<<"个,"<<"铁"<<td<<"个,"<<"金"<<jd<<"个,"<<"绿宝石"<<l<<"个,"<<"钻石"<<z<<"个\n"<<"铁矿石"<<tks<<"个\n金矿石"<<jks<<"个\n煤炭"<<mty<<"个\n";
system ("pause");
}
else
if(a=='2')
{
system("cls");
cout<<"武器:"<<wqm<<"\n耐久:"<<wqnj<<"\n镐子等级"<<gtdj<<"\n耐久:"<<gtnj<<"\n砍伐力"<<kfl<<endl;
system ("pause");
}
else
if(a=='3')
{
system("cls");
cout<<"治疗药水I "<<ysy[0]<<",治疗药水II "<<ysy[1]<<",治疗药水III "<<ysy[2]<<",伤害药水I "<<ysy[3]<<",伤害药水II"<<ysy[4]<<",伤害药水III "<<ysy[5]<<endl;
system ("pause");
}
if(a=='4')
{
system("cls");
cout<<"生命值"<<s<<endl;
system ("pause");
}
else
if(a=='5')
{
system("cls");
cout<<"木头"<<mt<<"个,"<<"木板"<<mb<<"个,"<<"木棍"<<mg<<"个\n";
system ("pause");
}
else
if(a=='6')
{
while(1)
{
system("cls");
cout<<"现装备护甲:"<<hjm<<endl<<"库存护甲:\n1.皮革护甲:"<<hjj[0]<<endl<<"2.铁护甲:"<<hjj[1]<<endl<<"3.金护甲:"<<hjj[2]<<endl<<"4.钻石护甲:"<<hjj[3]<<endl<<"0.退出 1.卸下当前护甲 2.装备护甲\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
cout<<"卸下成功\n";
hjm="空";
hjz=0;
hjnj=0;
system("pause");
}
else
if(a=='2')
{
if(hjm!="空")
{
cout<<"请先卸下当前护甲\n";
system("pause");
}
else
{
cout<<"请输入护甲前面的编码。\n";
a=getch();
if(a=='1')
{
if(hjj[0]>0)
{
hjm="皮革护甲";
hjnx=0;
cout<<"装备成功\n";
hjz=2;
hjnj=60;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
else
if(a=='2')
{
if(hjj[1]>0)
{
hjm="铁护甲";
hjnx=1;
cout<<"装备成功\n";
hjz=4;
hjnj=256;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
else
if(a=='3')
{
hjm="金护甲";
if(hjj[2]>0)
{
hjnx=2;
cout<<"装备成功\n";
hjz=2;
hjnj=40;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
if(a=='4')
{
if(hjj[3]>0)
{
hjm="钻石护甲";
hjnx=3;
cout<<"装备成功\n";
hjz=7;
hjnj=1562;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
}
}
}
}
}
}
void jh()
{
char jh;
long long kw;
system("cls");
cout<<"请问你要交换什么矿物?"<<endl<<"1.绿宝石->钻石" <<endl;
jh=getch();
if(jh=='1')
{
cout<<"4颗绿宝石换1颗钻石。"<<endl<<"你有绿宝石"<<l<<"颗"<<endl<<"请问你要换几颗钻石?"<<endl;
cin>>kw;
if(l>=4*kw)
{
z+=kw;
l-=4*kw;
cout<<"交换成功"<<endl;
system ("pause");
}
else
{
cout<<"交换失败"<<endl;
system ("pause");
}
}
}
void sg()
{
while(1)
{
system("cls");
char xgq;
cout<<"请问你要修改什么?"<<endl<<"0.退出 1.血量 2.绿宝石 3.钻石 4.铁 5.金 6.血量上限"<<endl;
xgq=getch();
if(xgq=='0')
{
break;
}
if(xgq=='1')
{
cout<<"请输入修改值"<<endl;;
cin>>s;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='2')
{
cout<<"请输入修改值"<<endl;;
cin>>l;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='3')
{
cout<<"请输入修改值"<<endl;;
cin>>z;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='4')
{
cout<<"请输入修改值"<<endl;;
cin>>td;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='5')
{
cout<<"请输入修改值"<<endl;;
cin>>jd;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='6')
{
cout<<"请输入修改值"<<endl;;
cin>>ssx;
cout<<"修改成功"<<endl;
system ("pause");
}
}
}
void cd()
{
while(1)
{
zy();
gjz=1+wq;
if(a=='1')
{
mx();
}
else
if(a=='2')
{
gzt();
}
else
if(a=='3')
{
home();
}
else
if(a=='4')
{
rly();
}
else
if(a=='5')
{
xsjc();
}
else
if(a=='6')
{
mm=(z+l)%1000000;
ofstream ofile;
ofile.open("mc.Minecraft");
ofile<<s<<" "<<wq<<" "<<z<<" "<<l<<" "<<z<<" "<<kfl<<" "<<mb<<" "<<mt<<" "<<mg<<" "<<st<<" "<<td<<" "<<jd<<" "<<wqnj<<" "<<jy<<" "<<jyzy<<" "<<gtdj<<" "<<gtnj<<" "<<ftnj<<" "<<tks<<" "<<jks<<" "<<mty<<" "<<ysy[0]<<" "<<ysy[1]<<" "<<ysy[2]<<" "<<ysy[3]<<" "<<ysy[4]<<" "<<ysy[5]<<" "<<cldt<<" "<<bydt<<" "<<wqm<<" "<<name<<" "<<zlld<<" "<<mm<<" "<<ssx<<" "<<hb<<" "<<hjz<<" "<<pg<<" "<<hjnj<<" "<<hjj[0]<<" "<<hjj[1]<<" "<<hjj[2]<<" "<<hjj[3]<<" "<<hjnx<<" "<<gly<<" "<<hjm;
ofile.close();
cout<<"存档成功"<<endl;
system ("pause");
}
else
if(a=='y'&&gly==801)
{
sg();
}
if(a=='e')
{
bb();
}
}
}
int main()
{
int hhh;
cout<<"欢迎来到我的世界文字版1.2.3。(增加护甲值,游戏帮助提升)"<<endl;
cout<<"请问你要打开什么模式?"<<endl<<"1.新建世界"<<endl<<"2.加载存档"<<endl;
c=getch();
ssx=20;
if(c=='1')
{
cout<<"请输入你的名字"<<endl;
cin>>name;
if(name=="Nouth")
{
zk=2;
l=10000;
z=10000;
wq=100;
wqm="创始者之剑";
wqnj=100000000;
s=1000;
ssx=1000;
}
else
if(name=="Herobrine")
{
wq=10000;
wqm="黑曜石";
wqnj=-1;
s=100;
ssx=100;
}
else
if(name=="YYH")
{
cout<<"测试版,请普通玩家不要进入。\n1.开启 2. 不开启\n";
a=getch();
if(a=='2')
{
cd();
}
cin>>gly;
}
cd();
}
else
if(c=='2')
{
ifstream ifile;
ifile.open("mc.Minecraft");
ifile>>s>>wq>>z>>l>>z>>kfl>>mb>>mt>>mg>>st>>td>>jd>>wqnj>>jy>>jyzy>>gtdj>>gtnj>>ftnj>>tks>>bydt>>mty>>ysy[0]>>ysy[1]>>ysy[2]>>ysy[3]>>ysy[4]>>ysy[5]>>cldt>>bydt>>wqm>>name>>zlld>>mm>>ssx>>hb>>hjz>>pg>>hjnj>>hjj[0]>>hjj[1]>>hjj[2]>>hjj[3]>>hjnx>>gly>>hjm;
if(mm!=(z+l)%1000000)
{
cout<<"作者很反感作弊,帮你把存档删了。(诚信为本)\n";
ofstream ofile;
ofile.open("mc.Minecraft");
ofile.close();
return 0;
}
cd();
}
return 0;
}