标题:求bug的修复方法
取消只看楼主
李昊逸Lion
Rank: 2
来 自:福州
等 级:论坛游民
威 望:2
帖 子:79
专家分:75
注 册:2017-8-1
得分:0 
程序代码:
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{//这里有个很大的bug:有的时候会没输入就跳出错误 
while(1)
{
Setjindutiao(25); 
if(place.sign==0||place.sign==1||place.sign==2||place.sign==18||place.sign==19){strcpy(fujin1,bar.name);strcpy(fujin2,hotel.name);strcpy(fujin3,fsyg.name);strcpy(fujin4,"秘道");}
else if(place.sign==3||place.sign==4||place.sign==5||place.sign==14){strcpy(fujin1,forest.name);strcpy(fujin2,forest1.name);strcpy(fujin3,forest2.name);strcpy(fujin4,forest3.name);}
else if(place.sign==6||place.sign==7||place.sign==8||place.sign==15){strcpy(fujin1,grass.name);strcpy(fujin2,grass1.name);strcpy(fujin3,grass2.name);strcpy(fujin4,grass3.name);}
else if(place.sign==11||place.sign==12||place.sign==13||place.sign==16){strcpy(fujin1,sea.name);strcpy(fujin2,sea1.name);strcpy(fujin3,sea2.name);strcpy(fujin4,sea3.name);}
else if(place.sign==9||place.sign==19||place.sign==20||place.sign==21||place.sign==23){strcpy(fujin1,mlgb.name);strcpy(fujin2,cnm.name);strcpy(fujin3,fky.name);strcpy(fujin4,zysd.name);}
gotoxy(1,10);
printf("这里是%s",place.name);
if(place.sign==0)Map("草原边上","森林边上","圣地","海边");
else if(place.sign==9)Map("草泥马平原","马勒戈壁","法克鱿大海","职业圣殿");
if(place.sign!=0)
{
gotoxy(12,58);
printf("5、回学校");
}
if(place.sign==19||place.sign==20||place.sign==21||place.sign==23)
{
gotoxy(12,68);
printf("6、去圣地");
}
gotoxy(21,4);
if(place.sign!=9&&place.sign!=14&&place.sign!=15&&place.sign!=16)
printf("\t附近的地点:1、%s\t2、%s\t3、%s\t4、%s\n\t菜单(m)\n",fujin1,fujin2,fujin3,fujin4);
else if(place.sign==14&&place.sign==15&&place.sign==16)
{
gotoxy(10,28);
Map2();
}
gotoxy(22,0);
puts("=============================================================================");
puts("要去哪里?");
scanf("%c",&proof);
Setjindutiao(20);
if(proof=='m'||proof=='M')Menu();
else
{
switch(place.sign)
{
case 0:
switch(proof)
{
case 'w':place=grass;system("color A0");break;
case 's':place=forest;system("color 2F");break;
case 'a':system("color 70");
if(yaoshi3>0)
{
SlowDisplay("你缓缓地向上飘去,来到了圣地\n");//bug:这里到了圣地就会掉下来 
place=mountain;
yaoshi3--;
}
else
{
SlowDisplay("圣地守门人发现你没有钥匙,把你扔到了山里\n");
place=mountain1;
Battle();
}
break;
case 'd':place=sea;system("color 9F");break;
case '1':place=bar;system("color 6F");break;
case '2':place=hotel;system("color 1F");break;
case '3':place=fsyg;system("color 4F");break;
case '4':system("color 8F");
SlowDisplay("秘道纵横交错,你误打误撞地来到了");
s=SuiJi();
if(s<6)
{
place=mesh;
printf("%s",mesh.name);
Battle();
}
else
{
place=jd;//bug:到了基地发现在机械之城 
printf("%s",jd.name);
Battle();
}
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
break;
case 1:Yidong1();break;
case 2:Yidong1();break;
case 3:Yidong2();break;
case 4:Yidong2();break;
case 5:Yidong2();break;
case 6:Yidong3();break;
case 7:Yidong3();break;
case 8:Yidong3();break;
case 9:
switch(proof)
{
case 'w':place=cnm;system("color A0");Battle();break;
case 's':place=mlgb;system("color 7F");Battle();break;
case 'a':place=fkk;system("color 9F");Battle();break;
case 'd':system("color E0");
printf("勇士,有什么事:1,领悟职业技能 2,购买职业顶级装备 0,返回\n\n\n");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
SlowDisplay("1 坦克专属 万仞崩山破\n2 战士专属 大荒芜经\n3 刺客专属 地狱之魂\n4 法师专属 佛怒火莲\n5 射手专属 狂风之息\n0 返回\n以上技能来源于游戏或小说,如有侵权请找陈曦\n\n\n"); 
choose_number=1;
while(choose_number)
{
scanf("%d",&choose_number);
Setjindutiao(20);
switch(choose_number)
{
case 1:
if(n==1)
{
SlowDisplay("领悟成功\n\n\n");
wrbsp++;
n++;
strcpy(zyname,"万仞崩山破");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 2:
if(nn==1)
{
SlowDisplay("领悟成功\n\n\n");
dhwj++;
nn++;
strcpy(zyname,"大荒芜经");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 3:
if(nnn==1)
{
SlowDisplay("领悟成功\n\n\n");
dysls++;
nnn++;
strcpy(zyname,"地狱之魂");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 4:
if(nnnn==1)
{
SlowDisplay("领悟成功\n\n\n");
fnhl++;
nnnn++;
strcpy(zyname,"佛怒火莲");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 5:
if(nnnnn==1)
{
SlowDisplay("领悟成功\n\n\n");
kfzx++;
nnnnn++;
strcpy(zyname,"狂风之息");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 0:
SlowDisplay("走你!!!\n\n\n");
OrdinaryAct() ;
break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
break;
case 2:SlowDisplay("此部分暂未完成,下次再来吧");break;
case 0:
SlowDisplay("走你!!!\n\n\n");
break;
}
}
}
case '5':place=school;system("color 0F");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
break;
case 10:Yidong5();break;
case 11:Yidong4();break;
case 12:Yidong4();break;
case 13:Yidong4();break;
case 14:Yidong2();break;
case 15:Yidong3();break;
case 16:Yidong4();break;
case 17:if(proof=='5'){place=school;system("color 0F");}else{MessageBox(NULL,"错误!","警告",MB_OK);}break;
case 18:Yidong1();break;
case 19:Yidong1();break;
case 20:Yidong5();break;
case 21:Yidong5();break;
case 22:Yidong1();break;
case 23:Yidong5();break;
}
}
}
}
2017-08-26 17:01
李昊逸Lion
Rank: 2
来 自:福州
等 级:论坛游民
威 望:2
帖 子:79
专家分:75
注 册:2017-8-1
得分:0 
程序代码:
void DisplayState()
{
gotoxy(16,2);
printf("%s 攻击力:%d+%d+%d=%d 防御力:%d+%d+%d=%d HP:%d/%d MP:%d/%d \n\n",player.name,player.attack,gong,diaozhui2nn,player.attack+gong+diaozhui2nn,player.defense,fang,diaozhui3nn,player.defense+fang+diaozhui3nn,player.health+diaozhui1nn,player.max_health+diaozhui1nn,player.mp+diaozhui1nn/4,player.max_mp+diaozhui1nn/4);
printf("武器: %s 防具: %s 逼能: %d 剩余氧气: %d/%d 子弹:%d 饰品:%s %s %s\n\n",gongname,fangname,bi,player.air,player.max_air,zidan,diaozhui1name,diaozhui2name,diaozhui3name);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money); 
printf("程序猿令牌%d 草泥马令牌%d 法克鱿令牌%d 黄学长令牌%d\n\n",lingpai0,lingpai1,lingpai2,lingpai3);
system("pause");
}
void Battle()//bug:经常出现没有怪或一直重复一个怪的情况 
{
Setjindutiao(20);
battle=1;
s=SuiJi();
s2=0;
switch(place.sign)
{
case 3:guai1=xiyi;guai2=witch;break;
case 4:guai1=witch;guai2=strongman;break;
case 5:guai1=strongman;guai2=big_strongman;break;
case 6:guai1=bee;guai2=horse;break;
case 7:guai1=horse;guai2=lion;break;
case 8:guai1=lion;guai2=lions;break;
case 17:guai1=asshole;guai2=stone;break;
case 11:guai1=fish;guai2=pangxie;break;
case 12:guai1=lanjing;guai2=smallshark;break;
case 13:guai1=wugui;guai2=shark;break;
}
if(place.sign<10||place.sign==17)
{
if(s<6)guai=guai1;
else if(s<9)guai=guai2;
else
{
battle=0;
SlowDisplay("\n\n\t\t这里安全\n\n\n");
system("pause");
}
}
else if(place.sign<11)
{
if(s<5)
{
battle=1;
guai=cxy;
}
else if(s<9)
{
battle=1; 
if(lingpai0>0)
{
SlowDisplay("程序廖:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!程序猿令牌我要了,校花你也别想带走!\n\n\n");
guai=shitu;
}
else SlowDisplay("程序廖:\n\n\n 年轻人,你好啊.如果你有程序猿令牌,我可以告诉你校花的下落哦~\n\n\n");
}
else
{
battle=0;
SlowDisplay("\n\n\t\t这里安全\n\n\n");
system("pause");
}
}
else if(place.sign<13)
{
if(yaoshi1==0&&place.sign==12)
{
battle=0;
SlowDisplay("\n\n\t\t先去海洋一层拿把钥匙吧\n\n\n");
}
if(yaoshi2==0&&place.sign==13)
{
battle=0;
SlowDisplay("\n\n\t\t先去海洋二层拿把钥匙吧\n\n\n");
}
if(s<4)guai=guai1;
else if(s<7)guai=guai2;
else if(s<9) 
{
battle=0;
printf("\n\n\t\t一群小鱼撞了过来!!!%s受了小伤。\n\n\n",player.name);
if(place.sign==12)yaoshi1++;
else if(place.sign==13)yaoshi2++;
player.health=player.health-5;
system("pause");
}
else
{
if(place.sign==12)yaoshi1++;
else if(place.sign==13)yaoshi2++;
battle=0;
SlowDisplay("\n\n\t\t这里安全\n\n\n");
system("pause");
}
}
else if(place.sign==18)
{
if(s<7)guai=Bman;
else if(s<9)
{
battle=0;
printf("\n\n\t\t齿轮轧到了%s!!!\n\n\n",player.name);
player.health=player.health-15;
if(player.health<=0)
{
printf("%s死得很难看\n\n\n",player.name);
money-=100;
player.health=player.max_health/5;
} 
}
else if(place.sign==19)
{
if(s<3)guai=fashu;
else if(s<6)guai=hongshi;
else if(s<9)guai=gushi;
else
{
battle=0;
SlowDisplay("\n\n\t\t这里安全\n\n\n");
system("pause");
}
}
else if(place.sign==20)
{
if(s<5)
{
battle=1;
guai=ccm;
}
else if(s<9)
{
battle=1; 
if(lingpai1>0)
{
SlowDisplay("\n\n\t\t草泥曦:\n\n\n\t\t\t哈哈,想救校花,先打败我!!\n\n\n");
guai=cnx;
}
else SlowDisplay("\n\n\t\t草泥曦:\n\n\n\t\t\t年轻人,你好啊.如果你有草泥马令牌,我可以告诉你校花的下落哦~\n\n\n");
}
else
{
battle=0;
SlowDisplay("\n\n\t\t这里安全\n\n\n");
system("pause");
}
}
else if(place.sign==21)
{
if(s<7)guai=ffk;
else if(s<9)
{
battle=1; 
if(lingpai2>0)
{
SlowDisplay("\n\n\t\t法克逸:\n\n\n\t\t\t想救校花?来打架呀!!\n\n\n");
guai=fky;
}
else SlowDisplay("\n\n\t\t法克逸:\n\n\n\t\t\t年轻人,你好啊.如果你有法克鱿令牌,我可以告诉你校花的下落哦~\n\n\n");
}
else
{
battle=0;
SlowDisplay("\n\n\t\t这里安全\n\n\n");
system("pause");
}
}
else if(place.sign==22)
{
if(s<4)
{
battle=0;
SlowDisplay("\n\n\t\t前方迷雾重重\n\n\n");
system("pause");
}
else
{
if(lingpai3>0)
{
guai=zk;//这个由于前面的bug导致无法使用 
SlowDisplay("\n\n\t\tHzwer:\n\n\n\t\t\t打败我就可以救出校花,来吧\n\n\n");
}
else SlowDisplay("\n\n\t\tHzwer:\n\n\n\t\t\t年轻人,你好啊.如果你有我的令牌,我可以告诉你校花的下落哦~\n\n\n");
}
}
}
if(battle==1)
{
switch(guai.guai_number)
{
case 4:
SlowDisplay("\n\n\t\t一阵巨响在森林中回响:咚!!!咚!!!咚!!!随即森林巨人王扑了过来!!!\n\n\n");
BattleAct();break;
case 5:
SlowDisplay("\n\n\t\t一大波狮子飞快的冲了过来!!!\n\n\n");
BattleAct();break;
case 12:
SlowDisplay("\n\n  巨......龟......以......一......种......慢......到......令......人......绝......望......的......速......度......游......了......过......来......\n\n\n");
BattleAct();break;
case 13:
printf("\n\n\t\t%s飞快的游了过来!\n\n\n",guai.name);
BattleAct();break;
case 17 :
SlowDisplay("\n\n\t\t小...蓝...鲸...缓...慢...的...游...了...过...来...\n\n\n");
BattleAct();break;
case 21:
SlowDisplay("\n\n\t\tB-boom投手发现你了!\n\n\n");
BattleAct();break;
case 11:
SlowDisplay("\n\n\t\t冲了过来,并扇了你一巴掌,大吼一声:你不好好做作业,来这搞什么事情!!!n\n\n");
printf("\t\t(你的HP减少了%d)\n\n\n",guai.attack+s-player.defense/3);
player.health-=guai.attack+s-player.defense/3;
SlowDisplay("一股神秘力量限制了B-boom的使用\n\n\n"); 
B=0;
if(strcmp(player.name,"Hzwer")==0)
{
SlowDisplay("Hzwer看着对面那个和自己一样的人,输入了一段代码,对方顿时灰飞烟灭");
Boom();
}
BattleAct();
break; 
default:
printf("\n\n\t\t%s%s了过来!\n\n\n",guai.name,guai.a);
BattleAct();
}
}
else OrdinaryAct();
}
void BattleAct()
{
if(place.sign==sea1.sign||place.sign==sea2.sign||place.sign==sea3.sign)
if(s2==0)Setjindutiao(20);
while(1)
{
gotoxy(2,5);
printf("%sHP:%d  ",player.name,player.health);
gotoxy(3,5);
printf("攻击力%d 防御力%d",player.attack+gong,player.defense+fang);
gotoxy(2,40);
printf("%sHP:%d  ",guai.name,guai.health);
gotoxy(3,40);
printf("攻击力%d 防御力%d",guai.attack,guai.defense);
gotoxy(21,0);
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
gotoxy(27,0);
printf("\t");
gotoxy(27,0);
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
gotoxy(4,40);
printf("\t\t\t\t");
if(s>=guai.miss||yun!=0) 
{
gotoxy(4,40);
printf("-%d\n",player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(place.sign==sea1.sign||place.sign==sea2.sign||place.sign==sea3.sign)player.air--;
else player.air=player.max_air;
if(player.air<=0)player.health=-1;
}
else
{
gotoxy(4,40);
printf("%s躲开了攻击!\n",guai.name);
}
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue; 
case 2:ChooseWupin();break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:DisplayState();break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
gotoxy(4,5);
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else if(s<7)
{
gotoxy(4,5);
printf("%s逃跑失败!还遭到了%s的反攻!!!\n\n\n",player.name,guai.name);
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue; 
}
else 
{
gotoxy(4,5);
printf("%s逃跑失败!\n\n\n",player.name);
}
break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
s2=1;
}
}
2017-08-26 17:03
李昊逸Lion
Rank: 2
来 自:福州
等 级:论坛游民
威 望:2
帖 子:79
专家分:75
注 册:2017-8-1
得分:0 
程序代码:
void Menu()
{
gotoxy(4,30);puts("1、物品");
gotoxy(6,30);puts("2、对话");
gotoxy(8,30);puts("3、状态");
gotoxy(10,30);puts("4、装备");
gotoxy(12,30);puts("0、退出");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: ChooseWupin();break; //显示道具,并可以使用.
case 2: Setjindutiao(25); //对话选项
if(place.sign==bar.sign) 
{
SlowDisplay("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板  4,道具店老板\n\n\n"); //显示对话人物
scanf("%d",&choose_number);
Setjindutiao(25);
switch(choose_number)
{
case 1:
SlowDisplay("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");
break;
case 2:
if(player.level<=30)
SlowDisplay("赏金猎人:\n\n\n 年轻人!\n\n\n 你需要从山脉里的怪兽开始,\n\n\n 打败森林最深处的巨人王!\n\n\n 最后打败4位好人才可以救回校花!\n\n\n");
if(player.level>30)
SlowDisplay("赏金猎人:\n\n\n FUCK !!!!!!!!!!!!!!!!!,你这么强了,还找我干铞\n\n\n");
break;
case 3:
choose_number=1;
while(choose_number)
{
SlowDisplay("要喝点什么?\n\n\n 1,二锅头20金币 HP+30 2,XO酒50金币 HP+100 3,人头马100金币 HP+150  4,我要卖东西 0,返回\n\n\n");
scanf("%d",&choose_number);
Setjindutiao(25);
switch(choose_number)
{
case 1:if(money<20)
{
SlowDisplay("钱不够!"); 
}
else
{
if(player.health+30<=player.max_health)
{
SlowDisplay("HP+30.");
money-=20;
player.health+=30;
}
else
{
SlowDisplay("HP满了"); 
player.health=player.max_health;
}
}
break;
case 2:if(money<50)
{
SlowDisplay("钱不够!"); 
}
else
{
if(player.health+80<=player.max_health)  
{
SlowDisplay("HP+80.");
money-=50;
player.health+=80;
}
else
{
SlowDisplay("HP满了"); 
player.health=player.max_health;
}
}
break;
case 3:if(money<100)
{
SlowDisplay("钱不够!"); 
}
else
{
if(player.health+150<=player.max_health)
{
SlowDisplay("HP+150.");
money-=100;
player.health+=150;
}
else
{
SlowDisplay("HP满了"); 
player.health=player.max_health;
}
}
break;
case 4:
while(choose_number)
{
SlowDisplay("要卖啥? 1,匕首50金币  2,长剑100金币  3,布衣50金币  4,铁甲100金币   0,返回\n\n\n");
scanf("%d",&choose_number);
Setjindutiao(25);
switch(choose_number)
{
case 1:if(gong1n>1)
{
SlowDisplay("金币加50.\n");
gong1n--;
money+=50;
}
else 
{
SlowDisplay("匕首不够\n");
}
break; 
case 2:if(gong2n>1)
{
SlowDisplay("金币加100.\n");
gong2n--;
money+=100;
}
else 
{
SlowDisplay("长剑不够\n");
}
break; 
case 3:if(fang1n>1)
{
SlowDisplay("金币加50.\n");
fang1n--;
money+=50;
}
else 
{
SlowDisplay("布衣不够\n");
}
break; 
case 4:if(fang2n>1)
{
SlowDisplay("金币加100.\n");
fang2n--;
money+=10;
}
else 
{
SlowDisplay("铁甲不够\n");
}
break; 
case 0:SlowDisplay("下次再来!\n");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
break;
case 0:SlowDisplay("下次再来!\n");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
} 
break;
case 4:
choose_number=1;
while(choose_number)
{
SlowDisplay("要买点什么?\n\n\n 1:止血草100金币 2:急救包180金币 3:云南白药200金币 4:手雷150金币  5:氧气袋100金币  6:电棍1200金币  7:鱼雷500金币  0,返回\n\n\n");
scanf("%d",&choose_number);
Setjindutiao(25);
switch(choose_number)
{
case 1:if(money<100)
{
SlowDisplay("钱不够!\n"); 
}
else
{
SlowDisplay("止血草+1\n");
money=money-100;
cao++;
}
break;
case 2:if(money<180)
{
SlowDisplay("钱不够!\n"); 
}
else
{
SlowDisplay("急救包+1\n");
money=money-180;
jijiubao++;
}
break;
case 3:if(money<200)
{
SlowDisplay("钱不够!\n"); 
}
else
{
SlowDisplay("云南白药+1\n");
money=money-200;
baiyao++;
} 
break;
case 4:if(money<150)
{
SlowDisplay("钱不够!\n"); 
}
else
{
SlowDisplay("手雷+1\n");
money=money-150;
boom++;
} 
break;
case 5:if(money<100)
{
SlowDisplay("钱不够!\n"); 
}
else
{
SlowDisplay("氧气袋+1\n");
money=money-100;
aircase++;
}
break;
case 6:if(money<1200)
{
SlowDisplay("钱不够!\n"); 
}
else
{
SlowDisplay("电棍+1\n");
money=money-1200;
diangun++;
}
break;
case 7:if(money<500)
{
SlowDisplay("钱不够!\n"); 
}
else
{
SlowDisplay("鱼雷+1\n");
money=money-500;
yulei++;
}
break;
case 0:SlowDisplay("下次在来!\n");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
case 5:
printf("这些是我最新研制的心法:\n\n\n 1,秘药 10金币,回魔30\n\n\n 2,魔法卷轴 500金币\n\n\n 3,猩红卷轴 魔法卷轴+猩红精华\n\n\n 4,远古卷轴 魔法卷轴+远古精华\n\n\n 5大爆菊术 伤害150 耗魔30 等级要求15 魔法卷轴消耗10\n\n\n 6,饮血 伤害100 耗魔25 等级要求25 猩红卷轴消耗14 偷窃一定生命\n\n\n 7,太极生万物 伤害50 耗魔150 等级要求50 远古卷轴消耗20 状态全满 消耗性法术\n\n\n 0,离开\n\n\n");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number)
{
case 1:if(money<10)
{
SlowDisplay("钱不够!\n\n\n"); 
}
else
{
if(player.mp+diaozhui1nn/4+30<=diaozhui1nn/4+player.max_mp)
{
SlowDisplay("MP+20.\n\n\n");
money-=10;
player.mp+=30;
}
else
{
SlowDisplay("MP满了\n\n\n"); 
player.mp=player.max_mp;
}
}
break;
case 2:
{
if(money<500)
{
SlowDisplay("钱不够!\n\n\n");
}
else
{
printf("这是你的了\n\n\n");
money-=500;
juan1++;
}
}
break;
case 3:
if(juan1<1||honghua<1)
{
SlowDisplay("材料不够!\n\n\n");
}
else if(juan1>=1&&honghua>=1)
{
printf("合成了猩红卷轴!\n\n\n");
juan1--;
honghua--;
juan2++;
}
break;
case 4:
if(juan1<1||guhua<1)
{
SlowDisplay("材料不够!\n\n\n");
}
else if(juan1>=1&&guhua>=1)
{
printf("合成了远古卷轴!\n\n\n");
juan1--;
guhua--;
juan3++;
}
break;
{
case 5:if(player.level<15||juan1<10)
{
SlowDisplay("你的力量还不够!\n\n\n"); 
}
else
{
if(player.level>=15&&juan1>=10)
{
SlowDisplay("爆菊心法尽收脑海\n\n\n");
juan1-=10;
dbjs++;
}
}
break;
case 6:if(player.level<25||juan2<14)
{
SlowDisplay("你的心理承受能力还不够!\n\n\n"); 
}
else
{
if(player.level>=25&&juan2>=14)
{
SlowDisplay("恐怖的声音在心中回响\n\n\n");
juan2-=14;
yinxie++;
}
}
break;
case 7:if(player.level<50||juan3<20)
{
SlowDisplay("你的力量还不够!\n\n\n"); 
}
else
{
if(player.level>=50&&juan3>=20)
{
SlowDisplay("伏羲的幻影悄悄浮现\n\n\n");
juan3-=20;
tjsww++;
}
}
break;
case 0:SlowDisplay("去吧,加油!!!\n\n\n");
break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
}
case 0:SlowDisplay("下次在来!\n");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
else SlowDisplay("这里好像没人可以聊天\n\n\n");
break;
case 3: Setjindutiao(25);DisplayState(); break; //显示状态
case 4: Setjindutiao(25);//装备
printf("攻装: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个 9,狂鲨利齿:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n,gong5n);
printf("防装: 5,布衣:%d个 6,铁甲:%d个 7,银甲:%d个 8,黄金圣衣:%d个 10,神龟之盾:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,fang5n);
printf("饰品:11,程序猿吊坠%d(生命,法术) 12,草泥马吊坠%d(攻击) 13,法克鱿吊坠%d(防御)\n\n\n",diaozhui1n,diaozhui2n,diaozhui3n);
SlowDisplay("选择要装备的武器或防具:\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:if(gong1n>=1)
{
SlowDisplay("拿起了匕首\n\n\n");
gong=gong1;
strcpy(gongname,"匕首");
}
else SlowDisplay("你没有匕首可以装备\n\n\n");
break;
case 2:if(gong2n>=1)
{
SlowDisplay("拿起了长剑\n\n\n");
gong=gong2;
strcpy(gongname,"长剑");
}
else SlowDisplay("你没有长剑可以装备\n\n\n");
break;
case 3:if(gong3n>=1)
{
SlowDisplay("拿起了碧血剑\n\n\n");
gong=gong3;
strcpy(gongname,"碧血剑");
}
else SlowDisplay("你没有碧血剑可以装备\n\n\n");
break;
case 4:if(gong4n>=1)
{
SlowDisplay("拿起了绝世好剑\n\n\n");
gong=gong4;
strcpy(gongname,"绝世好剑");
}
else SlowDisplay("你没有绝世好剑可以装备\n\n\n");
break;
case 5:if(fang1n>=1)
{
SlowDisplay("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else SlowDisplay("你没有布衣可以装备\n\n\n");
break;
case 6:if(fang2>=1) 
{
SlowDisplay("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else SlowDisplay("你没有铁甲可以装备\n\n\n");
break;
case 7:if(fang3n>=1)
{
SlowDisplay("穿上了银甲\n\n\n");
fang=fang3;
strcpy(fangname,"银甲");
}
else SlowDisplay("你没有银甲可以装备\n\n\n");
break;
case 8:if(fang4n>=1)
{
SlowDisplay("穿上了黄金圣衣\n\n\n");
fang=fang4;
strcpy(fangname,"黄金圣衣");
}
else SlowDisplay("你没有黄金圣衣可以装备\n\n\n");
break;
case 9:if(gong5n>=1)
{
SlowDisplay("拿起了狂鲨利齿\n\n\n");
gong=gong5;
strcpy(gongname,"狂鲨利齿");
}
else SlowDisplay("你没有狂鲨利齿可以装备\n\n\n");
break;
case 10:if(fang5n>=1)
{
SlowDisplay("拿起了神龟之盾\n\n\n");
fang=fang5;
strcpy(fangname,"神龟之盾");
}
else SlowDisplay("你没有神龟之盾可以装备\n\n\n");
break;
case 11:if(diaozhui1n>=1)
{
SlowDisplay("戴上了程序猿吊坠\n\n\n");
diaozhui1nn=diaozhui1;
strcpy(diaozhui1name,"程序猿吊坠");
}
else SlowDisplay("你没有程序猿吊坠可以装备\n\n\n");
break;
case 12:if(diaozhui2n>=1)
{
SlowDisplay("戴上了草泥马吊坠\n\n\n");
diaozhui2nn=diaozhui2;
strcpy(diaozhui2name,"草泥马吊坠");
}
else SlowDisplay("你没有草泥马吊坠可以装备\n\n\n");
break;
case 13:if(diaozhui3n>=1)
{
SlowDisplay("戴上了法克鱿吊坠\n\n\n");
diaozhui3nn=diaozhui3;
strcpy(diaozhui3name,"法克鱿吊坠");
}
else SlowDisplay("你没有法克鱿吊坠可以装备\n\n\n");
break;
case 0:SlowDisplay("未更换装备\n\n\n");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
break;
case 0:Setjindutiao(25);
res=MessageBox(NULL,"确定退出游戏?","提示",MB_YESNO);
if(res==IDYES)
{
MessageBox(NULL,"数据存储中","提示",MB_OK);
//向文件中更新数据;
getchar();
MessageBox(NULL,"退出","注意",MB_OK);
return;
}
else MessageBox(NULL,"继续游戏!","提示",MB_OK);
break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
} 
}
2017-08-26 17:04
李昊逸Lion
Rank: 2
来 自:福州
等 级:论坛游民
威 望:2
帖 子:79
专家分:75
注 册:2017-8-1
得分:0 
程序代码:
void Map(char n[50],char s[50],char w[50],char e[50])
{
gotoxy(8,48);printf("%c北(w): %s",24,n);gotoxy(12,48);printf("%c南(s): %s",25,s);
gotoxy(10,32);printf("西(a): %s%c",w,27);gotoxy(10,52);printf("%c东(d): %s",26,e);
}
void Map2()
{
gotoxy(8,24);printf("%c(1): %s\t%c(2): %s\t%c(3): %s\t%c(4): %s\t",26,fujin1,26,fujin2,26,fujin3,26,fujin4);
}
void Yidong1()
{
switch(proof)
{
case '1':place=bar;system("color 6F");break;
case '2':place=hotel;system("color 1F");break;
case '3':place=fsyg;system("color 1F");break;
case '4':system("color 8F");
SlowDisplay("秘道纵横交错,你误打误撞地来到了");
s=SuiJi();
if(s<6)
{
printf("%s",mesh.name);
place=mesh;
Battle();
}
else
{//bug: 到了基地发现在机械之城 
printf("%s",jd.name);
place=jd;
Battle();
}
break;
case '5':place=school;system("color 0F");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
void Yidong2()
{
switch(proof)
{
case '1':place=forest;break;
case '2':place=forest1;Battle();break;
case '3':place=forest2;Battle();break;
case '4':place=forest3;Battle();break;
case '5':place=school;system("color 0F");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
void Yidong3()
{
switch(proof)
{
case '1':place=grass;break;
case '2':place=grass1;Battle();break;
case '3':place=grass2;Battle();break;
case '4':place=grass3;Battle();break;
case '5':place=school;system("color 0F");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
void Yidong4()
{
switch(proof)
{
case '1':place=sea;break;
case '2':place=sea1;Battle();break;
case '3':place=sea2;Battle();break;
case '4':place=sea3;Battle();break;
case '5':place=school;system("color 0F");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
void Yidong5()
{
switch(proof)
{
case '1':place=mlgb;Battle();break;
case '2':place=cnm;Battle();break;
case '3':place=fkk;Battle();break;
case '4':place=zysd;
system("color E0");
printf("勇士,有什么事:1,领悟职业技能 2,购买职业顶级装备 0,返回\n\n\n");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
SlowDisplay("1 坦克专属 万仞崩山破\n2 战士专属 大荒芜经\n3 刺客专属 地狱之魂\n4 法师专属 佛怒火莲\n5 射手专属 狂风之息\n0 返回\n以上技能来源于游戏或小说,如有侵权请找陈曦\n\n\n"); 
choose_number=1;
while(choose_number)
{
scanf("%d",&choose_number);
Setjindutiao(20);
switch(choose_number)
{
case 1:
if(n==1)
{
SlowDisplay("领悟成功\n\n\n");
wrbsp++;
n++;
strcpy(zyname,"万仞崩山破");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 2:
if(nn==1)
{
SlowDisplay("领悟成功\n\n\n");
dhwj++;
nn++;
strcpy(zyname,"大荒芜经");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 3:
if(nnn==1)
{
SlowDisplay("领悟成功\n\n\n");
dysls++;
nnn++;
strcpy(zyname,"地狱之魂");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 4:
if(nnnn==1)
{
SlowDisplay("领悟成功\n\n\n");
fnhl++;
nnnn++;
strcpy(zyname,"佛怒火莲");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 5:
if(nnnnn==1)
{
SlowDisplay("领悟成功\n\n\n");
kfzx++;
nnnnn++;
strcpy(zyname,"狂风之息");
}
else
SlowDisplay("滚!\n\n\n");
break;
case 0:
SlowDisplay("走你!!!\n\n\n");
OrdinaryAct() ;
break;
}
}
break;
case 2:SlowDisplay("此部分暂未完成,下次再来吧");break;
case 0:
SlowDisplay("走你!!!\n\n\n");
OrdinaryAct() ;
break;
}
}
case '5':place=school;system("color 0F");break;
case '6':place=mountain;system("color E0");break;
default:MessageBox(NULL,"错误!","警告",MB_OK);
}
}
void Setjindutiao(int p)
{
Sleep(100);
system("cls");
HWND hConsole = FindWindow("ConsoleWindowClass", NULL);
POINT pt;
GetCursorPos(&pt);
GetLocalTime(&Time);
int s=Time.wHour;
int f=Time.wMinute;
gotoxy(0,0);
SetConsoleTitle("勇者游戏2"); //标题
COORD pos; //定义一个位置变量
puts("李昊逸制作") ; 
puts("╔═══════════════════════════════╗");
puts("║\t\t\t\t\t\t\t\t║");
puts("╚═══════════════════════════════╝");
printf("\t正在分析情况:%d:%d",s,f);
printf("\t勇者游戏\t");
if(battle==1)printf("战斗!!!");
gotoxy(2,2);
for(int i=0;i<31;i++)
{
Sleep(p);
printf("");
}
system("cls");
}
void Boom()
{
gotoxy(17,74);puts("o");system("cls");
gotoxy(15,74);puts("+");gotoxy(17,70);puts("+       +");gotoxy(19,74);puts("+");system("cls");
gotoxy(13,74);puts("+");gotoxy(15,68);puts("+           +");gotoxy(17,66);puts("+               +");gotoxy(19,68);puts("+           +");gotoxy(21,74);puts("+");system("cls");
gotoxy(11,74);puts("+");gotoxy(13,66);puts("+               +");gotoxy(17,62);puts("+                       +");gotoxy(21,66);puts("+               +");gotoxy(23,74);puts("+");system("cls");
gotoxy(2,74);puts("+");gotoxy(3,64);puts("+                    +");gotoxy(5,56);puts("+                                   +");gotoxy(8,50);puts("+                                               +");gotoxy(12,46);puts("+                                                       +");
gotoxy(17,44);puts("+                                                           +");gotoxy(22,46);puts("+                                                       +");gotoxy(25,50);puts("+                                               +");gotoxy(28,56);puts("+                                   +");
gotoxy(30,64);puts("+                    +");gotoxy(31,74);puts("+");system("cls");
gotoxy(13,0);
puts("\t\t\t\t\t■■■■■    ■■■■■    ■■■■■    ■■      ■■  ■");
puts("\t\t\t\t\t■      ■    ■      ■    ■      ■    ■ ■    ■ ■  ■");
puts("\t\t\t\t\t■      ■    ■      ■    ■      ■    ■  ■  ■  ■  ■");
puts("\t\t\t\t\t■■■■      ■      ■    ■      ■    ■   ■■   ■  ■");
puts("\t\t\t\t\t■      ■    ■      ■    ■      ■    ■    ■    ■  ■");
puts("\t\t\t\t\t■      ■    ■      ■    ■      ■    ■    ■    ■    ");
puts("\t\t\t\t\t■■■■■    ■■■■■    ■■■■■    ■    ■    ■  ■");
guai.health-=6666;
Setjindutiao(20);
}
void SlowDisplay(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else 
break;
Sleep(75);
}
}
void gotoxy(int x, int y)
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD c = { y, x };
SetConsoleCursorPosition(hOut, c);
}
2017-08-26 17:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-480288-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.733542 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved