结构体大更,新增物品结构体(改了好久)
商店--买东西体验优化,若钻石不足颜色会变暗
给LCR点一个赞吧~~
===上代码===
#include<time.h>
#include<windows.h>
#include<bits/stdc++.h>/*目前为1.25版(被jzp制裁后的第一版)
伤害s改变
新增道具结构体(商店显示还没改)*/
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 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={"史莱姆",3,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 zhuangtai(){
color(0);
cout<<"\n\n=========================================================================================";
color(5);
cout<<'\n'<<"钻石:"<<player.diamond<<"个-------"<<"等级:"<<player.grade<<'\n';
cout<<"护甲值:"<<player.Armor+fangyu<<"/"<<player.Armor_max<<"-------血量:"<<player.blood_volume<<"/"<<player.blood_volume_max<<"-------伤害:"<<player.harm+gongji<<"/"<<player.harm_max<<'\n';
cout<<"武器:"<<player.right_hand<<" 防具:"<<player.body<<" 左手:"<<player.left_hand<<'\n';
color(1);
cout<<"击败怪的数量:";
for(int i=1;i<=ko;i++){
cout<<"█ ";
}
if(battle==1){
attack();
}
}
void daoju(){
color(0);
cout<<"\n=========================================================================================";
color(15);
if(first_aid_kit.number>=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,生命+5,伤害+2"<<'\n';
player.harm+=2;
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+=5;
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';
Sleep(1000);
color(5);
cout<<"-----1:前往商店----2:前往恶龙谷----3:查看状态/物品数量----4:在地面探索----5:关于游戏及开发者-----"<<'\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;
}
}
}
void shangdian(){
color(0);
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'<<player.name<<",欢迎来到恶龙谷!"<<'\n';
Sleep(1000);
cout<<"你在这里想:"<<'\n';
Sleep(1000);
cout<<"-----1:屠龙----2:前往地狱传送门----3:查看状态/物品----4:自由探索----5:离开"<<'\n';
cin>>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<<i<<' ';
Sleep(970);
}
color(7);
SlowDisplay("\n你进入了一片古老的森林,阳光斜洒,在地上斑驳\n");
SlowDisplay("你的面前有三条道路,一条路电闪雷鸣,另一条路火焰滚滚,最后一条冰天雪地");
cout<<player.name<<",你想走哪条路?"<<'\n';
Sleep(1000);
color(1);
cout<<"-----1:电闪雷鸣路----2:火焰滚滚路----3:冰天雪地路----4:逃走"<<'\n';
color(0);
int lu;
cin>>lu;
if(lu==1){
guai=thunder_dragon;
if(guai.kill!=0){
battle=1;
cout<<"\n欢迎来到雷电峡谷,"<<player.name<<"\n";
Sleep(1000);
cout<<"(只见空中阴云密布,峡谷一副破败景象,雷龙栖息在盘龙柱上)\n";
Sleep(2000);
cout<<player.name<<"想到:好强大的气场!\n";
Sleep(1500);
cout<<"(雷龙逐渐睁开了眼睛):小不点,就你也想打败我?\n";
Sleep(1500);
cout<<player.name<<":我不是小不点!\n";
Sleep(1000);
cout<<"雷龙:那你就靠自己的实力证明吧!\n";
Sleep(1000);
attack();
}
else{
cout<<"\n安全了!\n";
Sleep(1000);
xiangganshenm();
}
}
if(lu==2){
guai=fire_dragon;
if(guai.kill!=0){
battle=1;
cout<<"\n欢迎来到熔岩洞窟,"<<player.name<<"\n";
Sleep(1000);
cout<<"(这里处处都是岩浆,炎热的空气顿时让你汗流浃背,可是盘龙柱上的火龙像是没有事一般)\n";
Sleep(2000);
cout<<player.name<<":天哪,这就是传说中浴火重生的火龙吗!\n";
Sleep(1500);
cout<<"(火龙的眼睛看向了你):小不点,你是来干什么的?\n";
Sleep(1500);
cout<<player.name<<":我要来打败你!\n";
Sleep(1000);
cout<<"火龙:呵呵,不自量力的小鬼,不值一提!\n";
Sleep(1000);
attack();
}
else{
cout<<"\n这里安全了!\n";
Sleep(1000);
xiangganshenm();
}
}
if(lu==3){
guai=ice_dragon;
if(guai.kill!=0){
battle=1;
cout<<"\n欢迎来到镜之冰界,"<<player.name<<"\n";
Sleep(1000);
cout<<"(这里寒冷至极,镜子反射的寒光让你感到敌人仿佛就在这里)\n";
Sleep(2000);
cout<<player.name<<"(你徒劳地敲打着结界,想离开这是非之地)\n";
Sleep(1500);
cout<<"(你惊动了睡觉的冰龙):是谁吵醒我睡觉啊?\n";
Sleep(1500);
cout<<player.name<<":就是我!\n";
Sleep(1000);
cout<<"冰龙:过分!觉都没睡好啊啊啊,接招吧!\n";
Sleep(1000);
attack();
}
else{
cout<<"\n这里安全了!\n";
Sleep(1000);
xiangganshenm();
}
}
if(lu==4){
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<<i<<' ';
Sleep(970);
}
cout<<"逃走成功!"<<'\n';
}
}
void dimiantansuo(){
color(5);
panduan=3;
cout<<"你想去哪里探索?\n";
Sleep(1000);
cout<<"1:繁茂洞穴----2:深邃矿区----3:僵尸村庄----4:冰湖表面----5:离开\n";
int tansuo;
cin>>tansuo;
color(0);
switch(tansuo){
case 1:{
cout<<player.name<<",欢迎来到繁茂洞穴\n\n";
s=suiji();
if(s<4){
guai=corpse;
battle=1;
cout<<"僵尸向你扑了过来!\n";
attack();
}
if(s>=4&&s<=7){
guai=slime;
battle=1;
cout<<"史莱姆向你撞了过来!\n";
attack();
}
if(s>7){
cout<<"这里似乎暂时没有怪物。\n";
dimiantansuo();
}
break;
}
case 2:{
cout<<player.name<<",欢迎来到深邃矿区\n\n";
s=suiji();
if(s<4){
guai=skeleton;
battle=1;
cout<<"骷髅在暗处向你射箭!\n";
attack();
}
if(s>=4&&s<=7){
guai=wither_skeleton;
battle=1;
cout<<"凋零骷髅射出凋零之箭!\n";
attack();
}
if(s>7){
cout<<"这里似乎暂时没有怪物。\n";
dimiantansuo();
}
break;
}
case 3:{
cout<<player.name<<",欢迎来到僵尸村庄\n\n";
s=suiji();
if(s<2){
guai=skeleton;
battle=1;
cout<<"骷髅在暗处向你射箭!\n";
attack();
}
if(s>=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<<player.name<<",欢迎来到冰湖表面\n\n";
s=suiji();
if(s<5){
guai=wanderers;
battle=1;
cout<<"流浪者在向你射箭!\n";
attack();
}
if(s>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<<player.name<<",你似乎到了废弃矿洞\n\n";
s=suiji();
if(s<3){
guai=corpse;
battle=1;
cout<<"僵尸向你扑了过来!\n";
attack();
}
if(s>3&&s<=7){
guai=wither_skeleton;
battle=1;
cout<<"凋零骷髅开始攻击!\n";
attack();
}
if(s>7){
cout<<"这里暂时安全!\n";
ziyoutansuo();
}
break;
}
case 2:{
panduan=5;
cout<<player.name<<",你似乎独自面对着末界传送门\n\n";
int mojie;
cout<<"请问你的选择是:\n 1:进入传送门----2:离开这里\n";
cin>>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<<i<<' ';
Sleep(970);
}
color(0);
SlowDisplay("欢迎来到末界!\n");
SlowDisplay("末影龙在空中飞翔着...\n");
color(1);
cout<<"勇士,现在你想要\n 1:打最后boss---末影龙 2:在末界闯荡\n";
int chuangdang;
cin>>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<<player.name<<",你进入了紫水晶洞\n\n";
s=suiji();
if(s<3){
guai=creeper;
battle=1;
cout<<"苦力怕要爆炸了!\n";
attack();
}
if(s>3&&s<=6){
guai=slime;
battle=1;
cout<<"史莱姆向你撞了过来!\n";
attack();
}
if(s>6){
cout<<"这里暂时安全!\n";
ziyoutansuo();
}
break;
}
case 4:{
cout<<player.name<<",欢迎进入岩浆方洞\n\n";
s=suiji();
if(s<3){
guai=creeper;
battle=1;
cout<<"苦力怕要爆炸了!\n";
attack();
}
if(s>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+=30;
cout<<"使用成功!"<<'\n';
attack();
}
}
else jijiu();
}
}
void direnzhuangtai(){
color(0);
cout<<guai.name<<"的血量:"<<guai.blood_volume;
cout<<" "<<guai.name<<"的护甲:"<<guai.Armor<<'\n';
printf("%s的技能:%s\n",guai.name,guai.skill);
attack();
}
int attack(){
color(9);
if(player.blood_volume<=0&&Immortal_Totem.number>0){
cout<<"\n不死图腾触发成功!血量恢复至10!"<<'\n';
player.blood_volume=10;
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你攻击"<<guai.name<<",造成了"<<(player.harm+gongji*2)/guai.Armor*2.0+s<<"点伤害\n";
if(guai.blood_volume<=0){
cout<<'\n'<<"战斗胜利!你打败了"<<guai.name<<"获得"<<guai.diamond<<"钻石"<<'\n';
ko++;
guai.kill=0;
battle=0;
player.diamond+=guai.diamond;
switch(guai.id){
case 7:{
thunder_dragon=guai;
break;
}
case 8:{
fire_dragon=guai;
break;
}
case 9:{
ice_dragon=guai;
break;
}
case 13:{
ender_dragon=guai;
break;
}
}
if(ender_dragon.kill==0){
color(9);
cout<<"游戏结束,你打败了末影龙,获得胜利!\n";
color(8);
exit(0);
}
Sleep(1000);
cout<<"\n正在敌人尸体中寻找掉落物...\n";
Sleep(2000);
color(9);
switch(guai.id){
case 1:{ //僵尸掉落物
s=suiji();
if(s<=3){
cout<<"发现木棍8根!\n";
Stick.number+=8;
}
if(s>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<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s);
attack();
break;
}
case 2:{ //骷髅技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*3.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*3.0+s);
attack();
break;
}
case 3:{ //凋零骷髅技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s);
attack();
break;
}
case 4:{ //苦力怕技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s);
attack();
break;
}
case 5:{ //史莱姆技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0);
Sleep(300);
cout<<"史莱姆护甲增强!\n";
guai.Armor+=1;
attack();
break;
}
case 6:{ //末影人技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/((player.Armor+fangyu/2)/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/((player.Armor+fangyu/2)/2)*2.0+s);
attack();
break;
}
case 7:{ //雷龙技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
Sleep(500);
cout<<guai.name<<"对你造成"<<s<<"点伤害";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s+s);
attack();
break;
}
case 8:{ //火龙技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<(guai.harm/(player.Armor+fangyu/2)*2.0+s)*3<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s)*3;
attack();
break;
}
case 9:{ //冰龙技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/player.Armor*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor*2.0+s));
attack();
break;
}
case 10:{ //烈焰人技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s+1<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s+1);
attack();
break;
}
case 11:{ //僵尸村民技能
color(0);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s);
attack();
break;
}
case 12:{ //流浪者技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"1对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s);
Sleep(500);
cout<<guai.name<<"2对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s);
attack();
break;
}
case 13:{ //末影龙技能
color(0);
s=suiji();
if(s<3){
cout<<"末影龙使用影之扇翼,你的防具在此时失效了!\n";
Sleep(1000);
cout<<"末影龙对你造成5点真实伤害!\n";
player.blood_volume-=5;
}
if(s>=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<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<(guai.harm+4)/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm+4/(player.Armor+fangyu/2)*2.0+s);
attack();
break;
}
case 15:{ //僵尸猪灵技能
color(0);
cout<<guai.skill<<'\n';
Sleep(500);
cout<<guai.name<<"对你造成"<<guai.harm/(player.Armor+fangyu/2)*2.0+s<<"点伤害\n";
player.blood_volume-=(guai.harm/(player.Armor+fangyu/2)*2.0+s);
guai.harm+=4;
attack();
break;
}
}
}
int main(){
MessageBox(NULL,"切勿关闭运行页面!!!","提示",MB_OK);
SlowDisplay("LCR ♂创作游戏者 请勿盗版权\n\n\n");
Sleep(1000);
mingzi();
while(player.kill!=1){
xiangganshenm();
}
MessageBox(NULL,"游戏结束","提示",MB_OK);
return 0;
}