求bug的修复方法
还是本人的那个小游戏,我那个本来说和我一块搞游戏的朋友在8月初消失了很长时间,前几天突然冒出来要我把他的版本和我的合并,结果弄出来一堆bug。由于本人新手(才学一个半月)实在搞不懂,恳请各位高手大神帮忙。另外有兴趣持续更新的欢迎加入勇者游戏工作室:qq326432436
程序代码:
#include <stdlib.h>//初次做游戏可能做的不好 #include <stdio.h> #include <time.h> //suiji #include <string.h> #include <conio.h> #include <string> #include <algorithm> #include "stdlib.h" #include <iomanip> #include <ctime> #include <cmath> #include <windows.h> //SLEEP函数 SYSTEMTIME Time; struct Player { char type[101]; char name[101]; int attack; int defense; int health; int mp; long int max_health; long int max_mp; int level; int exp; int range_exp; long int max_exp; int air; int max_air; int player_number; }tank={"开坦克的","\0",25,75,250,75,250,75,1,0,0,100,10,10,1}, army={"战士","\0",60,50,150,100,150,100,1,0,0,100,10,10,2}, ack={"刺客","\0",100,30,100,100,100,100,1,0,0,100,10,10,3}, mag={"法师","\0",75,40,120,250,120,250,1,0,0,100,10,10,4}, gun={"射手","\0",80,35,110,150,110,150,1,0,0,100,10,10,5}, player={"\0","\0",0,0,0,0,0,0,0,0,0,0}; struct Enemy //怪的结构体,并初始化各种怪 { char name[200]; char wupin[100]; int attack; int defense; int health; int money; long int exp; int wupin_sign; int wupinpro; int double_attack; int miss; char a[5]; int guai_number; }strongman={"森林巨人","黄金圣衣",50,60,350,200,100,2,2,5,2,"扑",1}, witch={"森林巫师","银甲",40,30,100,50,50,2,2,0,1,"飘",2}, xiyi={"森林蜥蜴","铁甲",30,25,50,30,35,3,3,0,0,"扑",3}, big_strongman={"森林巨人王","程序猿令牌上半部分",150,180,1200,800,400,4,10,10,3,"\0",4}, lions={"草原狮群","程序猿令牌下半部分",120,150,1400,800,400,24,24,10,3,"\0",5}, lion={"草原雄狮","绝世好剑",70,40,280,200,100,5,2,5,2,"扑",6}, horse={"草原野马","碧血剑",50,30,90,50,50,6,2,0,1,"冲",7}, bee={"草原黄蜂","长剑",30,20,60,30,35,7,3,0,0,"飞",8}, stone={"山脉岩石","布衣",10,40,100,50,20,0,4,0,0,"滚",9}, asshole={"山脉菊花","匕首",30,10,60,50,20,8,4,0,0,"挪",10}, cxy={"程序猿","程序猿吊坠",100,200,1200,500,300,17,5,1,0,"跳",18}, shitu={"程序廖","草泥马令牌",350,170,1600,600,500,12,9,15,3,"冲",22}, fish={"食人鱼","进入下一关的钥匙",35,25,70,40,40,22,8,0,0,"游",14}, pangxie={"螃蟹","进入下一关的钥匙",30,35,70,40,40,22,8,0,0,"爬",15}, smallshark={"小鲨","进入下一关的钥匙",45,35,100,50,50,23,7,0,1,"游",16}, lanjing={"小蓝鲸","进入下一关的钥匙",30,50,200,50,50,23,7,0,1,"\0",17}, wugui={"巨龟","神龟之盾和圣地的钥匙",100,500,500,400,300,11,5,10,2,"\0",12}, shark={"巨兽鲨","狂鲨利齿和圣地的钥匙",350,50,500,400,300,10,5,10,3,"\0",13}, Bman={"B-boom投手","B-boom",6666,60,300,200,100,12,5,0,1,"\0",21}, fashu={"法师","魔法卷轴",150,20,250,300,200,13,8,1,1,"瞅",23}, hongshi={"猩红之石","猩红精华",100,100,500,100,100,20,8,1,1,"滚",24}, gushi={"远古之石","远古精华",100,100,500,100,100,21,8,1,1,"滚",25}, ccm={"草泥马","草泥马吊坠",200,30,300,300,200,18,5,1,0,"冲",19}, cnx={"草泥曦","法克鱿令牌",500,200,1500,700,600,14,10,1,0,"冲",26}, ffk={"法克鱿","法克鱿吊坠",70,300,500,300,300,19,5,1,0,"游",20}, fky={"法克逸","黄学长令牌",550,300,1800,800,700,15,10,1,0,"冲",27}, zk={"Hzwer","\0",700,500,2100,1000,1000,16,-1,1,0,"\0",11}, guai={"\0","\0",0,0,0,0,0,0,0,0,0,"\0",0}, guai1={"\0","\0",0,0,0,0,0,0,0,0,0,"\0",0}, guai2={"\0","\0",0,0,0,0,0,0,0,0,0,"\0",0}; struct Place { int sign; char name[50]; } school={0,"学校"} ,bar={1,"酒吧"},hotel={2,"旅店"}, forest={14,"森林边上"},forest1={3,"森林一层"},forest2={4,"森林二层"},forest3={5,"森林三层"}, grass={15,"草原边上"},grass1={6,"草原一层"},grass2={7,"草原二层"},grass3={8,"草原三层"}, mountain={9,"圣地"},mountain1={17,"山上"},mlgb={10,"马勒戈壁"}, sea={16,"海边"},sea1={11,"海洋一层"},sea2={12,"海洋二层"},sea3={13,"海洋三层"}, mesh={18,"机械之城"},fsyg={19,"法术幽谷"},cnm={20,"草泥马平原"},fkk={21,"法克鱿大海"},jd={22,"基地"},zysd={23,"职业神殿"}, place={0,"\0"}; int max_exp=0; int choose_number=0,s=0,battle=0,money=1000,bi=0,yun=0,yaoshi1=0,yaoshi2=0,yaoshi3=0,s1=0,s2=0,res; int cao=4,jijiubao=3,baiyao=3,superbaiyao=1,boom=4,dubiao=3,atom_boom=1,B=0,juan1=0,my=3,aircase=1,diangun=1,yulei=1,zidan=1; int dbjs=0,yinxie=0,tjsww=0,lingpaia=0,lingpaib=0,lingpai0=0,lingpai1=0,lingpai2=0,lingpai3=0; int honghua=0,guhua=0,juan2=0,juan3=0,fenshu=0,n=0,nn=0,nnn=0,nnnn=0,nnnnn=0,wrbsp=0,dhwj=0,dysls=0,fnhl=0,kfzx=0; int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=130,fang5n=0; int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0,gong5=80,gong5n=0; int diaozhui1nn=0,diaozhui2nn=0,diaozhui3nn=0,diaozhui1n=0,diaozhui1=200,diaozhui2n=0,diaozhui2=70,diaozhui3n=0,diaozhui3=70; char gongname[20]="无",fangname[20]="无",fujin1[10]="无",fujin2[10]="无",fujin3[10]="无",fujin4[10]="无",diaozhui1name[20]="无",diaozhui2name[20]="无",diaozhui3name[20]="无",zyname[20]="无",xiaohua_name[101]; char proof; void AddWupin(int); int AttackResult(); void BattleAct(); void ChooseWupin(); void DisplayState(); void OrdinaryAct(); int SuiJi(); int SuiJi100(); void WhetherLevelUp(); void Battle(); void Map(char[50],char[50],char[50],char[50]); void Map2(); void Menu(); void Yidong1(); void Yidong2(); void Yidong3(); void Yidong4(); void Yidong5(); void Boom(); void Setjindutiao(int); void SlowDisplay(char *); void gotoxy(int,int); int main() { system("mode con cols=150 lines=150"); system("color 0F"); int i=0,j=0,k=0; char player_name[21]; res=MessageBox(NULL,"准备好开始游戏了吗?","提示",MB_YESNO); if(res==IDNO) { MessageBox(NULL,"太慢了吧!","提示",MB_OK); return 0; } Setjindutiao(25); SlowDisplay("这是一个令人蛋疼的学生世界! 师大附小时代师大附中师大联盟的校花,被一群好人(才怪)绑架了!\n\n 伟大的学生党啊~拿起你们的节操,不,铁锹,不,武器,营救校花!\n\n\n"); printf("选择你的职业:\n\n\n 1 坦克 肉到绝望\n\n\n 2 战士 削弱特性\n\n\n 3 刺客 输出爆表\n\n\n 4 法师 无限恢复\n\n\n 5 射手 爆发极强\n\n\n"); do { switch(scanf("%d",&choose_number),choose_number) { case 1:player=tank;n++;break; case 2:player=army;nn++;break; case 3:player=ack;nnn++;break; case 4:player=mag;nnnn++;break; case 5:player=gun;nnnnn++;break; } } while(choose_number!=1&&choose_number!=2&&choose_number!=3&&choose_number!=4&&choose_number!=5); SlowDisplay("输入你的名字与校花的名字(输一个按一下回车)(25个字符以内)\n\n\n"); // sndPlaySound("res\\F005.wav",SND_LOOP); scanf("%s",player.name); strncpy(player.name,player.name,25); if(strcmp(player.name,"Hzwer")==0) { SlowDisplay("隐居多年的Hzwer啊!你终于回来了!快去杀掉那个冒牌货吧!\n\n\n Hzwer重新出山... 随即... 暴走!!!\n\n\n");//开挂程序 player.attack=999; player.defense=999; player.health=9999; player.max_health=9999; atom_boom++; } if(strcmp(player.name,"吴桐学长")==0) { SlowDisplay("隐居多年的吴桐学长啊!你终于可以重见天日了!\n\n\n 吴桐学长重新出山... 随即... 暴走!!!\n\n\n");//开挂程序 player.attack=100; player.defense=100; player.health=1000; player.max_health=1000; atom_boom++; bi+=10; } strcat(player.type,player.name); strcpy(player.name,player.type); place=school; scanf("%s",xiaohua_name); getchar(); OrdinaryAct(); return 0; } int SuiJi() { srand((unsigned)time(NULL)); return rand()%10; } int SuiJi100() { srand((unsigned)time(NULL)); return rand()%100; } void AddWupin(int wupin_sign) { switch(wupin_sign) { case 0:fang1n++; break; case 1:fang4n++; break; case 2:fang3n++; break; case 3:fang2n++; break; case 4:lingpaia++;break; case 5:gong4n++; break; case 6:gong3n++; break; case 7:gong2n++; break; case 8:gong1n++; break; case 9:lingpai1++; break; case 10:gong5n++;yaoshi3++; break; case 11:fang5n++;yaoshi3++; break; case 12:B++; break; case 13:juan1++; break; case 14:lingpai2++;break; case 15:lingpai3++;break; case 17:diaozhui1n++;break; case 18:diaozhui2n++;break; case 19:diaozhui3n++;break; case 20:honghua++;break; case 21:guhua++;break; case 22:yaoshi1++;break; case 23:yaoshi2++;break; case 24:lingpaib++;break; } if(lingpaia>0&&lingpaib>0){lingpai1++;lingpaia--;lingpaib--;} } void ChooseWupin() //选择物品 并使用 { printf("物品: 1,止血草%d个\n2,急救包%d个\n3,云南白药%d个\n4,超级云南白药%d个\n5,手雷%d个\n6,毒标%d个\n7,手抛式原子弹%d个\n8,B-boom%d个\n9,逼能激光炮\n10,氧气袋%d个\n11,电棍%d个\n12,鱼雷%d个\n13,狙击枪\n14,魔法卷轴%d个\n15,猩红精华%d个\n16,猩红卷轴%d个\n17,远古精华%d个\n18,远古卷轴%d个\n19,秘药%d个0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,B,aircase,diangun,yulei,juan1,honghua,juan2,guhua,juan3,my); switch(scanf("%d",&choose_number),choose_number) { case 1: if(cao>0) { SlowDisplay("使用止血草,HP增加80\n\n\n"); cao--; if(player.health+80>player.max_health)player.health=player.max_health; else player.health+=80; } else MessageBox(NULL,"没有止血草了","注意",MB_OK); break; case 2: if(jijiubao>0) { SlowDisplay("使用急救包,HP增加100\n\n\n"); jijiubao--; if(player.health+100>player.max_health)player.health=player.max_health; else player.health+=100; } else MessageBox(NULL,"没有急救包了","注意",MB_OK); break; case 3: if(baiyao>0) { SlowDisplay("使用云南白药,HP增加150\n\n\n"); baiyao--; if(player.health+150>player.max_health)player.health=player.max_health; else player.health+=150; } else MessageBox(NULL,"没有云南白药了","注意",MB_OK); break; case 4: if(superbaiyao>0) { SlowDisplay("使用超级云南白药,HP增加200\n\n\n"); superbaiyao--; if(player.health+200>player.max_health)player.health=player.max_health; else player.health+=200; } else MessageBox(NULL,"没有超级云南白药了","注意",MB_OK); break; case 5: if(battle&&place.sign!=sea1.sign&&place.sign!=sea2.sign&&place.sign!=sea3.sign) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(boom>0) { SlowDisplay("使用手雷,敌人HP减少150\n\n\n"); boom--; guai.health-=150; AttackResult(); } else MessageBox(NULL,"没有手雷了","注意",MB_OK); } else MessageBox(NULL,"非战斗状态或在海中,不能使用手雷!","警告",MB_OK); break; case 6: if(battle&&place.sign!=sea1.sign&&place.sign!=sea2.sign&&place.sign!=sea3.sign) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(dubiao>0) { SlowDisplay("使用毒标,敌人HP减少300\n\n\n"); dubiao--; guai.health-=300; AttackResult(); } else MessageBox(NULL,"没有毒标了","注意",MB_OK); } else MessageBox(NULL,"非战斗状态或在海中,不能使用毒标!","警告",MB_OK); break; case 7: if(battle&&place.sign!=sea1.sign&&place.sign!=sea2.sign&&place.sign!=sea3.sign) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(atom_boom>0) { SlowDisplay("使用手抛式原子弹,敌人HP减少600\n\n\n"); atom_boom--; guai.health-=600; AttackResult(); } else MessageBox(NULL,"没有手抛式原子弹了","注意",MB_OK); } else MessageBox(NULL,"非战斗状态或在海中,不能使用手抛式原子弹!","警告",MB_OK); break; case 8: if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(B>0) { Boom(); B--; AttackResult(); } else MessageBox(NULL,"没有B-boom了","注意",MB_OK); } else SlowDisplay("非战斗状态,不能使用B-boom!\n\n\n"); break; case 9: if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(bi>20) { SlowDisplay("使用逼能激光炮,敌人HP减少1500\n\n\n"); bi-=20; guai.health-=1500; AttackResult(); } else MessageBox(NULL,"没有逼能了","注意",MB_OK); } else MessageBox(NULL,"非战斗状态,不能使用逼能激光炮!","警告",MB_OK); break; case 10: if(aircase>0) { SlowDisplay("使用氧气袋,氧气增加5\n\n\n"); player.air--; if(player.air+5>player.max_air)player.air=player.max_air; else player.air+=5; } else MessageBox(NULL,"没有氧气袋了","注意",MB_OK); break; case 11: if(battle&&place.sign!=sea1.sign&&place.sign!=sea2.sign&&place.sign!=sea3.sign) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(diangun>0) { SlowDisplay("使用电棍,敌人HP减少200,并暂停3回合反击\n\n\n"); diangun--; guai.health-=200; yun=3; AttackResult(); } else MessageBox(NULL,"没有电棍了","注意",MB_OK); } else MessageBox(NULL,"非战斗状态或在海中,不能使用电棍!","警告",MB_OK); break; case 12: if(battle&&place.sign==sea1.sign||place.sign==sea2.sign||place.sign==sea3.sign)//在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(yulei>0) { SlowDisplay("使用鱼雷,敌人HP减少500\n\n\n"); yulei--; guai.health-=500; AttackResult(); } else MessageBox(NULL,"没有鱼雷了","注意",MB_OK); } else MessageBox(NULL,"非战斗状态或不在海中,不能使用鱼雷!","警告",MB_OK); break; case 13: if(battle)//在战斗中(battle=1),否则(battle=0)不能使用攻击性物品 { if(zidan>0) { SlowDisplay("使用狙击枪,敌人HP减少300\n\n\n"); zidan--; guai.health-=300; AttackResult(); } else MessageBox(NULL,"没有子弹了","注意",MB_OK); } else MessageBox(NULL,"非战斗状态,不能使用狙击枪!","警告",MB_OK); break; case 14: SlowDisplay("这货总会有用的\n\n\n"); break; case 15: SlowDisplay("这货总会有用的\n\n\n"); break; case 16: SlowDisplay("这货总会有用的\n\n\n"); break;