新增标题画面,低调奢华有内涵
更改部分bug,游玩更流畅
标题画面:
给LCR一个赞吧~~
===上代码===
#include
#include
#include//目前为1.26版
using namespace std;
int a,b,c,d,ms,maidongxi,e,jiaotan,f,tulong,s,battle=0,ko=0,sum;
int gongji=0,Iron_Great_Sword_gongji=15,Nether_Sword_gongji=25,iron_sword_gongji=18,golden_sword_gongji=20;
int fangyu=0,Iron_Cuirass_fangyu=5,Nether_Cuirass_fangyu=10,golden_cuirass_fangyu=8;
int panduan=0;//判断当前你在哪里
//1:想干什么 2:商店 3:地面探索 4:恶龙谷 5:恶龙谷--自由探索 6:恶龙谷--地狱 7:末地
void mingzi();//输入玩家名
void zhuangtai();//查看状态
void daoju();//查看物品
void jinruyouxi();//封面
void skill();//怪物的技能
void jijiu();//死亡判断
void diyumen();//自由探索--末地
void direnzhuangtai();//敌人状态
int attack();//攻击
void dimiantansuo();//地面探索
void shangdian();//商店
void maimai();//商店买东西
void tulongzhe();//屠龙
void elonggu();//恶龙谷
void ziyoutansuo();//恶龙谷--自由探索
void skill();//怪怪的技能
void xiangganshenm();//主函数的次函数
void SlowDisplay(char *);//...不想说了,折磨了我半天
int suiji();//随机打败敌人获得物品
void color(int a);//0:加亮白 1:天蓝 2:亮绿 3:玫红 4:红 5:黄 6:深蓝 7:绿蓝 8:白 9:黄底红字 15:灰
struct prop{ //道具结构体
char name[40];
int number;
int price;
}Power_potion={"力量药水",0,3},
workbench={"工作台",0,1},
hand_grenade={"手榴弹",0,4},
Golden_apples={"金苹果",0,4},
Enchanted_bottle={"附魔之瓶",0,8},
Iron_Great_Sword={"铁大剑",0,4},
Healing_potion={"治疗药水",0,4},
Immortal_Totem={"不死图腾",0,6},
first_aid_kit={"急救包",0,5},
Stick={"木棍",0,1},
Iron_Cuirass={"铁胸甲",0,3},
Nether_Sword={"下界合金剑",0,0},
Nether_Cuirass={"下界合金胸甲",0,0},
iron_sword={"铁剑",0,0},
golden_sword={"金剑",0,0},
golden_cuirass={"金胸甲",0,0},
iron_ingot={"铁锭",0,0},
golden_ingot={"金锭",0,0},
nether_ingot={"下界合金锭",0,0};
struct player{
string name;//玩家名
int Armor=1; //护甲值
int Armor_max=50;
int blood_volume=100; //血量
int blood_volume_max=200;
int harm=50; //伤害
int harm_max=200;
int diamond=10; //钻石
int grade=0; //等级
string right_hand,left_hand,body; //左、右手物品,装备
string tag[100];
int kill=0; //判断玩家是否死亡
}player;
struct monster{
char name[30];//怪物名
int Armor; //护甲值
int blood_volume; //血量
int harm; //伤害
int diamond; //怪物掉落钻石
char prompt[100]; //掉落提示
char skill[100]; //技能
//掉落物 1:力量药水 2:手榴弹 3:金苹果 4:附魔之瓶 5:急救包 6:木棍 7:铁锭 8:金锭 9:工作台 10:下界合金锭
int kill; //判断怪是否死亡
int id;
}corpse={"僵尸",3,150,20,3,"掉落3个钻石!","无技能",1,1},
skeleton={"骷髅",2,150,40,4,"掉落4个钻石!","骷髅使用弓箭攻击你!",1,2},
wither_skeleton={"凋零骷髅",2,150,60,4,"掉落4个钻石!","凋零骷髅让你变得不堪一击",1,3},
creeper={"苦力怕",1,100,300,2,"掉落2个钻石!","苦力怕直接爆炸!",1,4},
slime={"史莱姆",2,150,20,5,"掉落5个钻石!","史莱姆越战越强!\n",1,5},
ender_man={"末影人",5,250,50,10,"掉落10个钻石!","可以瞬移的末影人开始攻击",1,6},
thunder_dragon={"雷龙",8,500,60,30,"掉落30个钻石!","雷龙释放雷电,对你造成二次伤害",1,7},
fire_dragon={"火龙",10,400,80,30,"掉落30个钻石!","火龙释放火焰,伤害x3",1,8},
ice_dragon={"冰龙",12,300,60,30,"掉落30个钻石!","冰龙无视你的防具",1,9},
flame_man={"烈焰人",3,150,60,6,"掉落6个钻石!","烈焰人对你喷火",1,10},
zombie_villager={"僵尸村民",2,100,20,2,"掉落2个钻石!","无技能",1,11},
wanderers={"流浪者",4,150,50,8,"掉落8个钻石!","流浪者会成群结队攻击你",1,12},
ender_dragon={"末影龙",15,500,100,50,"掉落50个钻石!","末影龙会释放各种魔法",1,13},
pig_spirit={"猪灵",4,150,60,6,"掉落6个钻石!","猪灵很萌,使你无心战斗",1,14},
corpse_pig_spirit={"僵尸猪灵",4,150,60,6,"掉落6个钻石!","僵尸猪灵的伤害变高",1,15},
guai={"0",0,0,0,0,"0",0,0};
void mingzi(){
Sleep(500);
color(0);
SlowDisplay("勇士,请输入你的名字(提示:工作台是个好东西):\n\n");
cin>>player.name;
if(player.name=="lcr"){
player.harm+=10000;
player.harm_max+=10000;
player.Armor+=10000;
player.Armor_max+=10000;
Nether_Sword.number++;
nether_ingot.number++;
}
}
void jinruyouxi(){
system("cls");
for(int i=1;i<=29;i++){
for(int j=1;j<=60;j++){
color(5);
if(i==12&&j==24){
color(0);
cout<<"1:进入游戏 2:退出游戏";
j+=10;
}
else{
if(i==5&&j==3||i==6&&j==3||i==7&&j==3||i==8&&j==3||i==9&&j==3||i==9&&j==4||i==9&&j==5) color(1);//L
if(i==5&&j==8||i==5&&j==9||i==5&&j==10||i==6&&j==7||i==7&&j==7||i==8&&j==7||i==9&&j==8||i==9&&j==9||i==9&&j==10) color(1);//C
if(i==5&&j==12||i==5&&j==13||i==5&&j==14||i==5&&j==15||i==6&&j==12||i==6&&j==15||i==7&&j==12||i==7&&j==13||i==7&&j==14||i==7&&j==15||i==8&&j==12||i==8&&j==14||i==9&&j==12||i==9&&j==15) color(1);//R
if(i==1||i==29||j==1||j==60) color(9);
cout<<"█ ";
}
}
}
color(0);
int jinru;
cin>>jinru;
if(jinru==2) exit(0);
if(jinru==1){
system("cls");
color(9);
cout<<"启动中...(约等待3秒)\n";
for(int i=3;i>=1;i--){
color(0);
Sleep(1000);
cout<=1) color(0);
printf("\n1:%s:%d ",first_aid_kit.name,first_aid_kit.number);
color(15);
if(Iron_Great_Sword.number>=1) color(0);
printf("2:%s:%d ",Iron_Great_Sword.name,Iron_Great_Sword.number);
color(15);
if(Iron_Cuirass.number>=1) color(0);
printf("3:%s:%d ",Iron_Cuirass.name,Iron_Cuirass.number);
color(15);
if(Immortal_Totem.number>=1) color(0);
printf("4:%s:%d ",Immortal_Totem.name,Immortal_Totem.number);
color(15);
if(Stick.number>=1) color(0);
printf("5:%s:%d ",Stick.name,Stick.number);
color(15);
if(Power_potion.number>=1) color(0);
printf("\n6:%s:%d ",Power_potion.name,Power_potion.number);
color(15);
if(workbench.number>=1) color(0);
printf("7:%s:%d ",workbench.name,workbench.number);
color(15);
if(Golden_apples.number>=1) color(0);
printf("8:%s:%d ",Golden_apples.name,Golden_apples.number);
color(15);
if(hand_grenade.number>=1) color(0);
printf("9:%s:%d ",hand_grenade.name,hand_grenade.number);
color(15);
if(Enchanted_bottle.number>=1) color(0);
printf("10:%s:%d \n",Enchanted_bottle.name,Enchanted_bottle.number);
color(0);
cout<<"=========================================================================================\n";
color(15);
if(Nether_Sword.number>=1) color(5);
printf("11:%s:%d ",Nether_Sword.name,Nether_Sword.number);
color(15);
if(Nether_Cuirass.number>=1) color(5);
printf("12:%s:%d ",Nether_Cuirass.name,Nether_Cuirass.number);
color(15);
if(golden_sword.number>=1) color(5);
printf("13:%s:%d ",golden_sword.name,golden_sword.number);
color(15);
if(golden_cuirass.number>=1) color(5);
printf("14:%s:%d ",golden_cuirass.name,golden_cuirass.number);
color(15);
if(iron_sword.number>=1) color(5);
printf("15:%s:%d ",iron_sword.name,iron_sword.number);
color(0);
cout<<"\n=========================================================================================\n";
color(15);
if(Healing_potion.number>=1) color(0);
printf("16:%s:%d \n",Healing_potion.name,Healing_potion.number);
color(0);
cout<<"===========================================================================================\n";
color(15);
if(iron_ingot.number>=1) color(1);
printf(" %s:%d ",iron_ingot.name,iron_ingot.number);
color(15);
if(golden_ingot.number>=1) color(1);
printf("%s:%d ",golden_ingot.name,golden_ingot.number);
color(15);
if(nether_ingot.number>=1) color(1);
printf("%s:%d ",nether_ingot.name,nether_ingot.number);
color(0);
cout<<"\n0:离开\n";
color(0);
cout<<"=========================================================================================\n";
color(0);
int shiyong;
cin>>shiyong;
color(9);
switch(shiyong){
case 1:{
if(first_aid_kit.number>=1){
cout<<"急救包不可使用!"<<'\n';
}
else cout<<"数量不足!"<<'\n';
zhuangtai();
daoju();
break;
}
case 2:{
if(Iron_Great_Sword.number>=1){
cout<<"成功装备铁大剑!"<<'\n';
player.right_hand="铁大剑";
gongji=Iron_Great_Sword_gongji;
if(player.harm>player.harm_max) player.harm=player.harm_max-gongji;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 3:{
if(Iron_Cuirass.number>=1){
cout<<"成功装备铁胸甲!"<<'\n';
player.body="铁胸甲";
fangyu=Iron_Cuirass_fangyu;
if(player.Armor+fangyu>player.Armor_max) player.Armor=player.Armor_max-fangyu;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 4:{
if(Immortal_Totem.number>=1){
cout<<"不死图腾装备成功!"<<'\n';
player.left_hand="不死图腾";
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 5:{
if(Stick.number>=1){
cout<<"木棍不可使用!"<<'\n';
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 6:{
if(Power_potion.number>=1){
cout<<"力量药水使用成功!"<<'\n';
player.harm+=5;
Power_potion.number--;
if(player.harm>player.harm_max) player.harm=player.harm_max-gongji;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 7:{
if(workbench.number>=1){
int gongzuo;
color(0);
cout<<"\n你想用工作台制造什么?\n";
Sleep(700);
printf("1:下界合金剑 2:下界合金胸甲 3:金剑 4:金胸甲 5:铁剑 6:铁胸甲\n");
cin>>gongzuo;
switch(gongzuo){
case 1:{
if(nether_ingot.number>=2&&Stick.number>=1){
cout<<"消耗了2个下界合金锭和1个木棍\n";
Sleep(500);
cout<<"制造成功!\n";
nether_ingot.number-=2;
Stick.number--;
Nether_Sword.number++;
}
else cout<<"工作台"<<'\n';
break;
}
case 2:{
if(nether_ingot.number>=8){
cout<<"消耗了8个下界合金锭\n";
Sleep(500);
cout<<"制造成功!\n";
nether_ingot.number-=8;
Nether_Cuirass.number++;
}
else cout<<"材料不足!"<<'\n';
break;
}
case 3:{
if(golden_ingot.number>=2&&Stick.number>=1){
cout<<"消耗了2个金锭和一个木棍\n";
Sleep(500);
cout<<"制造成功!\n";
golden_ingot.number-=2;
Stick.number--;
golden_sword.number++;
}
else cout<<"材料不足!"<<'\n';
break;
}
case 4:{
if(golden_ingot.number>=8){
cout<<"消耗了8个金锭\n";
Sleep(500);
cout<<"制造成功!\n";
golden_ingot.number-=8;
golden_cuirass.number++;
}
else cout<<"材料不足!"<<'\n';
break;
}
case 5:{
if(iron_ingot.number>=2&&Stick.number>=1){
cout<<"消耗了2个铁锭和一个木棍\n";
Sleep(500);
cout<<"制造成功!\n";
iron_ingot.number-=2;
Stick.number--;
iron_sword.number++;
}
else cout<<"材料不足!"<<'\n';
break;
}
case 6:{
if(iron_ingot.number>=8){
cout<<"消耗了8个铁锭\n";
Sleep(500);
cout<<"制造成功!\n";
iron_ingot.number-=8;
Iron_Cuirass.number++;
}
else cout<<"材料不足!"<<'\n';
break;
}
}
}
else cout<<"数量不足!无法使用工作台...";
zhuangtai();
daoju();
break;
}
case 8:{
if(Golden_apples.number>=1){
cout<<"金苹果吃掉了,护甲+2,生命+8,伤害+5"<<'\n';
player.harm+=5;
if(player.harm>player.harm_max) player.harm=player.harm_max-gongji;
player.Armor+=2;
if(player.Armor+fangyu>player.Armor_max) player.Armor=player.Armor_max-fangyu;
player.blood_volume+=8;
if(player.blood_volume>player.blood_volume_max) player.blood_volume=player.blood_volume_max;
Golden_apples.number--;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 9:{
if(hand_grenade.number>=1&&battle==1){
cout<<"手榴弹爆炸了!"<<'\n';
guai.blood_volume-=(100/guai.Armor)*2.0;
hand_grenade.number--;
}
if(hand_grenade.number>=1&&battle==0){
cout<<"非战斗状态不可使用!"<<'\n';
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 10:{
if(Enchanted_bottle.number>=1){
cout<<"附魔之瓶使用成功,等级+1!"<<'\n';
Enchanted_bottle.number--;
player.grade++;
player.Armor_max+=50;
player.blood_volume_max+=50;
player.harm_max+=50;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 11:{
if(Nether_Sword.number>=1){
cout<<"下界合金剑装备好了,伤害+25!"<<'\n';
player.right_hand="下界合金剑";
gongji=Nether_Sword_gongji;
if(player.harm>player.harm_max) player.harm=player.harm_max-gongji;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 12:{
if(Nether_Cuirass.number>=1){
cout<<"成功装备下界合金胸甲,护甲+10"<<'\n';
player.body="下界合金胸甲";
fangyu=Nether_Cuirass_fangyu;
if(player.Armor+fangyu>player.Armor_max) player.Armor=player.Armor_max-fangyu;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 13:{
if(golden_sword.number>=1){
cout<<"成功装备金剑!伤害+20"<<'\n';
player.right_hand="金剑";
gongji=golden_sword_gongji;
if(player.harm>player.harm_max) player.harm=player.harm_max-gongji;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 14:{
if(golden_cuirass.number>=1){
cout<<"成功装备金胸甲,护甲+8!"<<'\n';
player.body="金胸甲";
fangyu=golden_cuirass_fangyu;
if(player.Armor>player.Armor_max) player.Armor=player.harm_max-fangyu;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 15:{
if(iron_sword.number>=1){
cout<<"成功装备铁剑!伤害+18"<<'\n';
player.right_hand="铁剑";
gongji=iron_sword_gongji;
if(player.harm>player.harm_max) player.harm=player.harm_max-gongji;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 16:{
if(Healing_potion.number>=1){
cout<<"喝掉了治疗药水,血量+8!\n";
Healing_potion.number--;
player.blood_volume+=8;
if(player.blood_volume>player.blood_volume_max) player.blood_volume=player.blood_volume_max;
}
else cout<<"数量不足!";
zhuangtai();
daoju();
break;
}
case 0:{
if(battle==1){
attack();
}
else
xiangganshenm();
break;
}
}
if(shiyong<0||shiyong>12) daoju();
}
void xiangganshenm(){
color(1);
panduan=1;
cout<<'\n'<<"请选择你接下来要执行的事情:"<<'\n';
color(5);
cout<<"-----1:前往商店----2:前往恶龙谷----3:查看状态/物品数量----4:在地面探索----5:关于游戏及开发者-----6:返回标题画面"<<'\n';
cin>>f;
switch(f){
case 1:{
shangdian();
break;
}
case 2:{
elonggu();
break;
}
case 3:{
zhuangtai();
daoju();
break;
}
case 4:{
dimiantansuo();
break;
}
case 5:{
color(2);
cout<<"========================================================================================================================";
cout<<" 尊敬的玩家你好,本游戏开发者是LCR,如有任何bug可以向我反馈。LCR希望在c++里做出好玩的游戏,如有提议请留言,谢谢!\n";
cout<<" 特别致谢:luozihan2025 wangchongxu2025 lishoujun2025\n";
cout<<" 他们分别向我提供了SlowDisplay() color()和一直的鼓励\n";
cout<<"========================================================================================================================\n";
xiangganshenm();
break;
}
case 6:{
jinruyouxi();
break;
}
}
}
void shangdian(){
color(0);
panduan=2;
cout<<"\n老板:欢迎来到米奇妙妙屋!你想干什么?\n";
cout<<"-----1:买东西----2:交谈----3:休息(增加护甲)----4:离开-----"<<'\n';
Sleep(1000);
int mai;
cin>>mai;
switch(mai){
case 1:{
maimai();
break;
}
case 2:{
color(7);
cout<<"跟谁交谈?"<<'\n'<<"-----1:女仆----2:面具男----3:老板妻子----4:其余客人-----"<<'\n';
cin>>jiaotan;
switch(jiaotan){
case 1:{
SlowDisplay("女仆:听说南山那里有发现了怪物。\n");
break;
}
case 2:{
if(player.tag[1]=="发现犯人"){
cout<<"面具男:我已经改邪归正了!"<<'\n';
Sleep(1000);
}
if(player.tag[1]!="发现犯人"){
SlowDisplay("(你去叫了一下面具男)\n");
SlowDisplay("他忽然惊慌的浑身抖了一下,只见他的面具掉了下来,他竟然是被通缉的犯人!\n");
color(9);
cout<<"恭喜你发现了犯人,获得10钻石!" <<'\n';
Sleep(2000);
player.diamond+=10;
color(1);
player.tag[1]="发现犯人";
}
break;
}
case 3:{
SlowDisplay("老板妻子:听说恶龙谷的火龙最近得到了火焰附魔,更厉害了!\n");
Sleep(1000);
break;
}
case 4:{
SlowDisplay("酒鬼:你也是来这里买饭的吗?哈哈哈哈~~\n");
SlowDisplay("红衣女子(神情诡异的看了你一眼):疣方块出现在了恶龙谷...\n");
SlowDisplay("胖男人(跟着说道):说明~嗝!地狱传送门快~嗝!出现了!\n");
break;
}
}
break;
}
case 3:{
color(100);
if(player.Armor>=player.Armor_max){
cout<<"护甲值已满,无需休息!"<<'\n';
Sleep(1000);
}
if(player.Armor<10){
if(player.tag[2]=="休息完毕"){
cout<<"您已休息过!"<<'\n';
Sleep(1000);
}
if(player.tag[2]!="休息完毕"){
cout<<"休息中。。。"<<'\n';
Sleep(1000);
cout<<"休息完毕!护甲值+2。"<<'\n';
Sleep(1000);
player.Armor+=2;
player.tag[2]="休息完毕";
}
}
break;
}
case 4:{
xiangganshenm();
break;
}
}
shangdian();
}
void maimai(){
s=suiji();
color(0);
cout<<"\n\n\n";
cout<<"有以下几样东西"<<'\n';
color(15);
if(player.diamond>=first_aid_kit.price) color(1); //急救包
printf("1:%s(%d钻石) ",first_aid_kit.name,first_aid_kit.price);
color(15);
if(player.diamond>=Iron_Cuirass.price) color(1); //铁胸甲
printf("2:%s(%d钻石) ",Iron_Cuirass.name,Iron_Cuirass.price);
color(15);
if(player.diamond>=Iron_Great_Sword.price) color(1); //铁大剑
printf("3:%s(%d钻石) ",Iron_Great_Sword.name,Iron_Great_Sword.price);
color(15);
if(player.diamond>=Immortal_Totem.price) color(1); //不死图腾
printf("4:%s(%d钻石) ",Immortal_Totem.name,Immortal_Totem.price);
color(15);
if(player.diamond>=Power_potion.price) color(1); //力量药水
printf("5:%s(%d钻石)\n",Power_potion.name,Power_potion.price);
color(15);
if(player.diamond>=workbench.price) color(1); //工作台
printf("6:%s(%d钻石) ",workbench.name,workbench.price);
color(15);
if(player.diamond>=Golden_apples.price) color(1); //金苹果
printf("7:%s(%d钻石) ",Golden_apples.name,Golden_apples.price);
color(15);
if(player.diamond>=hand_grenade.price) color(1); //手榴弹
printf("8:%s(%d钻石) ",hand_grenade.name,hand_grenade.price);
color(15);
if(player.diamond>=Stick.price) color(1); //木棍
printf("9:%s(%d钻石) ",Stick.name,Stick.price);
color(15);
if(player.diamond>=Enchanted_bottle.price) color(1); //附魔之瓶
printf("10:%s(%d钻石)\n",Enchanted_bottle.name,Enchanted_bottle.price);
color(15);
if(player.diamond>=Healing_potion.price) color(1); //治疗药水
printf("11:%s(%d钻石)\n",Healing_potion.name,Healing_potion.price);
color(0);
cout<<" 0:离开\n";
cin>>maidongxi;
if(maidongxi!=0){
cout<<"要买几个啊?\n";
cin>>sum;
}
if(sum==0) cout<<"不可以买0个东西!\n";
switch(maidongxi){
case 1:{
if(player.diamond>=first_aid_kit.price*sum){
player.diamond-=first_aid_kit.price*sum;
first_aid_kit.number+=sum;
MessageBox(NULL,"急救包购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 2:{
if(player.diamond>=Iron_Cuirass.price*sum){
player.diamond-=Iron_Cuirass.price*sum;
Iron_Cuirass.number+=sum;
MessageBox(NULL,"铁胸甲购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 3:{
if(player.diamond>=Iron_Great_Sword.price*sum){
player.diamond-=Iron_Great_Sword.price*sum;
Iron_Great_Sword.number+=sum;
MessageBox(NULL,"铁大剑购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 4:{
if(player.diamond>=Immortal_Totem.price*sum){
player.diamond-=Immortal_Totem.price*sum;
Immortal_Totem.number+=sum;
MessageBox(NULL,"不死图腾购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 5:{
if(player.diamond>=Power_potion.price*sum){
player.diamond-=Power_potion.price*sum;
Power_potion.number+=sum;
MessageBox(NULL,"力量药水购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 6:{
if(player.diamond>=workbench.price*sum){
player.diamond-=workbench.price*sum;
workbench.number+=sum;
MessageBox(NULL,"工作台购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 7:{
if(player.diamond>=Golden_apples.price*sum){
player.diamond-=Golden_apples.price*sum;
Golden_apples.number+=sum;
MessageBox(NULL,"金苹果购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 8:{
if(player.diamond>=hand_grenade.price*sum){
player.diamond-=hand_grenade.price*sum;
hand_grenade.number+=sum;
MessageBox(NULL,"手榴弹购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 9:{
if(player.diamond>=Stick.price*sum){
player.diamond-=Stick.price*sum;
Stick.number+=16*sum;
MessageBox(NULL,"木棍购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 10:{
if(player.diamond>=Enchanted_bottle.price*sum){
player.diamond-=Enchanted_bottle.price*sum;
Enchanted_bottle.number+=sum;
MessageBox(NULL,"附魔之瓶购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 11:{
if(player.diamond>=Healing_potion.price*sum){
player.diamond-=Healing_potion.price*sum;
Healing_potion.number+=sum;
MessageBox(NULL,"治疗药水购买成功!","提示",MB_OK);
}
else MessageBox(NULL,"钻石不足!","提示",MB_OK);
Sleep(1000);
break;
}
case 0:{
shangdian();
break;
}
break;
}
maimai();
}
void elonggu(){
color(5);
panduan=4;
cout<<'\n'<>tulong;
switch(tulong){
case 1:{
tulongzhe();
break;
}
case 2:{
diyumen();
break;
}
case 3:{
zhuangtai();
daoju();
break;
}
case 4:{
ziyoutansuo();
break;
}
case 5:{
xiangganshenm();
break;
}
}
}
void diyumen(){
if(panduan!=6){
color(2);
Sleep(500);
cout<<" @@@@@@@@@@"<<'\n';
Sleep(300);
cout<<" @@@ 传 @@@"<<'\n';
Sleep(300);
cout<<" @@@ 送 @@@"<<'\n';
Sleep(300);
cout<<" @@@ 中 @@@"<<'\n';
Sleep(300);
cout<<" @@@@@@@@@@"<<'\n'<<'\n';
}
color(1);
panduan=6;
SlowDisplay("\n欢迎来到地狱,我的勇士\n");
cout<<"你在这里想..\n";
cout<<"1:前往猪灵堡垒----2:前往岩浆湖----3:前往灵魂土----4:离开\n";
color(0);
int zhuling;
cin>>zhuling;
if(zhuling==1){
cout<<"你来到了猪灵堡垒\n";
SlowDisplay("你抱怨着,这里怎么这么热...\n\n");
s=suiji();
if(s<5){
guai=pig_spirit;
cout<<"猪灵竟然发现了你!\n";
attack();
}
if(s>=5){
guai=corpse_pig_spirit;
cout<<"僵尸猪灵来袭!\n\n";
attack();
}
}
if(zhuling==2){
cout<<"你掉进了岩浆湖!\n烈焰人来袭!\n";
guai=flame_man;
attack();
}
if(zhuling==3){
cout<<"你进入了灵魂土领域...\n";
s=suiji();
if(s<=3){
cout<<"骷髅在暗处向你射箭!\n";
guai=skeleton;
attack();
}
if(s>3&&s<=6){
cout<<"烈焰人来袭!\n";
guai=flame_man;
attack();
}
if(s==7){
cout<<"凋零骷髅发起攻击!\n";
guai=wither_skeleton;
attack();
}
if(s>7){
cout<<"暂时安全!\n";
diyumen();
}
}
if(zhuling==4) elonggu();
}
void tulongzhe(){
color(2);
Sleep(500);
cout<<" @@@@@@@@@@"<<'\n';
Sleep(300);
cout<<" @@@ 传 @@@"<<'\n';
Sleep(300);
cout<<" @@@ 送 @@@"<<'\n';
Sleep(300);
cout<<" @@@ 中 @@@"<<'\n';
Sleep(300);
cout<<" @@@@@@@@@@"<<'\n'<<'\n';
for(int i=3;i>=1;i--){
cout<>lu;
if(lu==1){
guai=thunder_dragon;
if(guai.kill!=0){
battle=1;
cout<<"\n欢迎来到雷电峡谷,"<=1;i--){
cout<>tansuo;
color(0);
switch(tansuo){
case 1:{
cout<=4&&s<=7){
guai=slime;
battle=1;
cout<<"史莱姆向你撞了过来!\n";
attack();
}
if(s>7){
cout<<"这里似乎暂时没有怪物。\n";
dimiantansuo();
}
break;
}
case 2:{
cout<=4&&s<=7){
guai=wither_skeleton;
battle=1;
cout<<"凋零骷髅射出凋零之箭!\n";
attack();
}
if(s>7){
cout<<"这里似乎暂时没有怪物。\n";
dimiantansuo();
}
break;
}
case 3:{
cout<=2&&s<=5){
guai=wither_skeleton;
battle=1;
cout<<"凋零骷髅开始攻击!\n";
attack();
}
if(s>5&&s<=6){
guai=slime;
battle=1;
cout<<"史莱姆向你撞了过来!\n";
attack();
}
if(s==7){
cout<<"这里暂时安全!\n";
dimiantansuo();
}
if(s>7){
guai=zombie_villager;
battle=1;
cout<<"僵尸村民开始发癫~~\n";
attack();
}
break;
}
case 4:{
cout<5&&s<=7){
guai=corpse;
battle=1;
cout<<"僵尸向你扑了过来!\n";
attack();
}
if(s>7){
cout<<"这里暂时安全!\n";
dimiantansuo();
}
break;
}
case 5:{
cout<<"已离开\n";
xiangganshenm();
break;
}
}
}
void ziyoutansuo(){
color(5);
panduan=5;
cout<<"你想去哪里探索?\n";
Sleep(500);
cout<<"1:废弃矿洞----2:隔墙有眼(末地)----3:紫水晶洞----4:岩浆方洞----5:离开\n";
int ziyou;
cin>>ziyou;
color(0);
switch(ziyou){
case 1:{
cout<3&&s<=7){
guai=wither_skeleton;
battle=1;
cout<<"凋零骷髅开始攻击!\n";
attack();
}
if(s>7){
cout<<"这里暂时安全!\n";
ziyoutansuo();
}
break;
}
case 2:{
panduan=7;
cout<>mojie;
if(mojie==1){
color(2);
Sleep(500);
cout<<" @@@@@@@@@@"<<'\n';
Sleep(300);
cout<<" @@@ 传 @@@"<<'\n';
Sleep(300);
cout<<" @@@ 送 @@@"<<'\n';
Sleep(300);
cout<<" @@@ 中 @@@"<<'\n';
Sleep(300);
cout<<" @@@@@@@@@@"<<'\n'<<'\n';
for(int i=3;i>=1;i--){
cout<>chuangdang;
color(0);
if(chuangdang==1){
guai=ender_dragon;
battle=1;
cout<<"末影龙的气场瞬间将你吞没了...\n";
attack();
}
if(chuangdang==2){
for(int i=1;i<=5;i++){
guai=ender_man;
battle=1;
cout<<"末影人开始攻击你\n";
attack();
}
cout<<"恭喜你闯荡完毕,这是战利品:金苹果*5!\n";
Golden_apples.number+=5;
ziyoutansuo();
}
}
if(mojie==2) elonggu();
break;
}
case 3:{
cout<3&&s<=6){
guai=slime;
battle=1;
cout<<"史莱姆向你撞了过来!\n";
attack();
}
if(s>6){
cout<<"这里暂时安全!\n";
ziyoutansuo();
}
break;
}
case 4:{
cout<3&&s<=6){
guai=flame_man;
battle=1;
cout<<"烈焰人向你发起攻击!\n";
attack();
}
if(s>6){
cout<<"这里暂时安全!\n";
ziyoutansuo();
}
break;
}
case 5:{
elonggu();
break;
}
}
}
void jijiu(){
color(9);
if(player.kill==0){
cout<<'\n'<<"当前血量小于0,是否使用急救包?"<<'\n';
cout<<"-----1:使用急救包-----"<<'\n';
Sleep(1000);
int shiyong;
cin>>shiyong;
color(0);
if(shiyong==1){
if(first_aid_kit.number<1){
cout<<"数量不足!"<<'\n';
if(MessageBox(NULL,"你失败了!","提示",MB_OK)){
player.kill=1;
cout<<"游戏结束!";
}
exit(0);
}
if(first_aid_kit.number>=1){
first_aid_kit.number--;
player.blood_volume+=40;
cout<<"使用成功!"<<'\n';
attack();
}
}
else jijiu();
}
}
void direnzhuangtai(){
color(0);
cout<0){
cout<<"\n不死图腾触发成功!血量恢复至30!"<<'\n';
player.blood_volume=30;
Immortal_Totem.number--;
player.left_hand="";
}
if(player.blood_volume<=0&&Immortal_Totem.number<=0) jijiu();
if(player.kill==0){
color(1);
cout<<"\n-----1:攻击----2:使用道具/装备----3:查看自己状态----4:查看敌人状态/技能----5:逃走-----\n";
int gongji;
color(0);
cin>>gongji;
switch(gongji){
case 1:{
s=suiji();
color(0);
guai.blood_volume-=(player.harm+gongji)/guai.Armor*2.0+s;
cout<<"\n你攻击"<3&&s<=7){
cout<<"发现工作台!\n";
workbench.number++;
}
if(s==8){
cout<<"发现铁锭*2!\n";
iron_ingot.number+=2;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 2:{ //骷髅掉落物
s=suiji();
if(s<=3){
cout<<"发现木棍8根!\n";
Stick.number+=8;
}
if(s>3&&s<=7){
cout<<"发现铁锭*2!\n";
iron_ingot.number+=2;
}
if(s==8){
cout<<"发现金锭!\n";
golden_ingot.number++;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 3:{ //凋零骷髅掉落物
s=suiji();
if(s<=3){
cout<<"发现金锭*2\n";
golden_ingot.number+=2;
}
if(s>3&&s<=7){
cout<<"发现铁锭*2!\n";
iron_ingot.number+=2;
}
if(s==8){
cout<<"发现下界合金锭!\n";
nether_ingot.number++;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 4:{ //苦力怕掉落物
s=suiji();
if(s<=3){
cout<<"发现木棍*8\n";
Stick.number+=8;
}
if(s>3&&s<=7){
cout<<"发现力量药水!\n";
Power_potion.number+=1;
}
if(s==8){
cout<<"发现手榴弹!\n";
hand_grenade.number++;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 5:{ //史莱姆掉落物
s=suiji();
if(s<=3){
cout<<"发现铁锭*2\n";
iron_ingot.number+=2;
}
if(s>3&&s<=7){
cout<<"发现力量药水!\n";
Power_potion.number+=1;
}
if(s==8){
cout<<"发现金苹果!\n";
Golden_apples.number++;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 6:{ //末影人掉落物
s=suiji();
if(s<=3){
cout<<"发现下界合金锭*2\n";
nether_ingot.number+=2;
}
if(s>3&&s<=7){
cout<<"发现金苹果!\n";
Golden_apples.number+=1;
}
if(s==8){
cout<<"发现附魔之瓶!\n";
Enchanted_bottle.number++;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 7:{ //雷龙掉落物
s=suiji();
if(s<=3){
cout<<"发现下界合金锭*4\n";
nether_ingot.number+=4;
}
if(s>3&&s<=5){
cout<<"发现金苹果*2!\n";
Golden_apples.number+=2;
}
if(s==6){
cout<<"发现手榴弹*2!\n";
hand_grenade.number+=2;
}
if(s==7){
cout<<"发现铁锭*8!\n";
iron_ingot.number+=8;
}
if(s==8){
cout<<"发现金锭*6!\n";
golden_ingot.number+=6;
}
if(s>8){
cout<<"发现附魔之瓶!\n";
Enchanted_bottle.number++;
}
break;
}
case 8:{ //火龙掉落物
s=suiji();
if(s<=3){
cout<<"发现下界合金锭*4\n";
nether_ingot.number+=4;
}
if(s>3&&s<=5){
cout<<"发现金苹果*2!\n";
Golden_apples.number+=2;
}
if(s==6){
cout<<"发现手榴弹*2!\n";
hand_grenade.number+=2;
}
if(s==7){
cout<<"发现铁锭*8!\n";
iron_ingot.number+=8;
}
if(s==8){
cout<<"发现金锭*6!\n";
golden_ingot.number+=6;
}
if(s>8){
cout<<"发现治疗药水!\n";
Healing_potion.number++;
}
break;
}
case 9:{ //冰龙掉落物
s=suiji();
if(s<=3){
cout<<"发现下界合金锭*4\n";
nether_ingot.number+=4;
}
if(s>3&&s<=5){
cout<<"发现金苹果*2!\n";
Golden_apples.number+=2;
}
if(s==6){
cout<<"发现手榴弹*2!\n";
hand_grenade.number+=2;
}
if(s==7){
cout<<"发现铁锭*8!\n";
iron_ingot.number+=8;
}
if(s==8){
cout<<"发现金锭*6!\n";
golden_ingot.number+=6;
}
if(s>8){
cout<<"发现附魔之瓶!\n";
Enchanted_bottle.number++;
}
break;
}
case 10:{ //烈焰人掉落物
s=suiji();
if(s<=3){
cout<<"发现铁锭*2\n";
iron_ingot.number+=2;
}
if(s>3&&s<=7){
cout<<"发现治疗药水!\n";
Healing_potion.number+=1;
}
if(s==8){
cout<<"发现手榴弹!\n";
hand_grenade.number++;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 11:{ //僵尸村民掉落物
s=suiji();
if(s<=3){
cout<<"发现铁锭\n";
iron_ingot.number+=1;
}
if(s>3&&s<=7){
cout<<"发现木棍*8!\n";
Stick.number+=8;
}
if(s==8){
cout<<"发现工作台!\n";
workbench.number++;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 12:{ //流浪者掉落物
s=suiji();
if(s<=3){
cout<<"发现铁锭*4\n";
iron_ingot.number+=4;
}
if(s>3&&s<=7){
cout<<"发现治疗药水!\n";
Healing_potion.number+=3;
}
if(s==8){
cout<<"发现下界合金锭*3!\n";
nether_ingot.number+=3;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 13:{ //末影龙掉落物
s=suiji();
if(s<=3){
cout<<"发现下界合金锭*8\n";
nether_ingot.number+=8;
}
if(s>3&&s<=5){
cout<<"发现金苹果*2!\n";
Golden_apples.number+=2;
}
if(s==6){
cout<<"发现手榴弹*2!\n";
hand_grenade.number+=2;
}
if(s==7){
cout<<"发现铁锭*8!\n";
iron_ingot.number+=8;
}
if(s==8){
cout<<"发现金锭*8!\n";
golden_ingot.number+=8;
}
if(s>8){
cout<<"发现附魔之瓶!\n";
Enchanted_bottle.number++;
}
break;
}
case 14:{ //猪灵掉落物
s=suiji();
if(s<=3){
cout<<"发现金锭*4\n";
golden_ingot.number+=4;
}
if(s>3&&s<=7){
cout<<"发现金锭*3!\n";
golden_ingot.number+=3;
}
if(s==8){
cout<<"发现下界合金锭*2!\n";
nether_ingot.number+=2;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
case 15:{ //僵尸猪灵掉落物
s=suiji();
if(s<=3){
cout<<"发现金锭*4\n";
golden_ingot.number+=4;
}
if(s>3&&s<=7){
cout<<"发现治疗药水!\n";
Healing_potion.number++;
}
if(s==8){
cout<<"发现下界合金锭*2!\n";
nether_ingot.number+=2;
}
if(s>8) cout<<"什么都没有...\n";
break;
}
}
Sleep(1000); //判断获胜后跳转到哪里
if(panduan==3){
dimiantansuo();
break;
}
if(panduan==5){
ziyoutansuo();
break;
}
if(panduan==6){
diyumen();
break;
}
if(panduan!=3&&panduan!=5&&panduan!=6){
xiangganshenm();
}
break;
}
}
color(0);
if(guai.kill!=0){
skill();
}
break;
case 2:{
daoju();
break;
}
case 3:{
zhuangtai();
break;
}
case 4:{
direnzhuangtai();
break;
}
case 5:{
s=suiji();
if(s<5){
cout<<"逃走成功!\n\n";
battle=0;
xiangganshenm();
}
else{
cout<<"逃走失败!\n\n";
}
break;
}
}
}
}
void SlowDisplay(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(60);
}
}
int suiji()
{
srand((unsigned)time(NULL));
return rand()%10;
}
void color (int a) {
if (a == 0 || a == 14 || a == 20) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
} else if (a == 1 || a == 12) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
} else if (a == 2) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_GREEN);
} else if (a == 3) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
} else if (a == 4 || a == 11) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_RED);
} else if (a == 5 || a == 13) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
} else if (a == 7) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_GREEN|FOREGROUND_BLUE);
} else if (a == 15) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
} else if (a == 16) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_GREEN);
} else if (a == 17) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED);
} else if (a == 8) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
} else if (a == 6) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_BLUE);
} else if (a == 9) {
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_RED|BACKGROUND_GREEN);
}
}
void skill(){
s=suiji();
switch(guai.id){
case 1:{ //僵尸技能
color(0);
cout<=3&&s<=6){
cout<<"末影龙释放毒气,你中毒了!\n";
Sleep(500);
for(int i=1;i<=3;i++){
cout<<"毒气对你造成1点伤害!\n";
player.blood_volume--;
Sleep(500);
}
}
if(s>6){
cout<<"末影龙开始回血,++,++,++...\n";
guai.blood_volume+=5;
}
attack();
break;
}
case 14:{ //猪灵技能
color(0);
cout<