求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;
case 17: SlowDisplay("这货总会有用的\n\n\n"); break; case 18: SlowDisplay("这货总会有用的\n\n\n"); break; case 19: if(my>0) { SlowDisplay("使用秘药,MP增加30\n\n\n"); my--; if(player.mp+30>player.max_mp)player.mp=player.max_mp; else player.mp+=30; } else SlowDisplay("没有秘药了\n\n\n"); break; case 0:break; default:MessageBox(NULL,"错误!","警告",MB_OK); } } int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级 { if(guai.health<=0) { battle=0; printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp); player.exp+=guai.exp; player.range_exp+=guai.exp; fenshu++; money+=guai.money; s=SuiJi(); system("pause"); if(s<guai.wupinpro) { printf("%s爆出了%s\n\n\n",guai.name,guai.wupin); AddWupin(guai.wupin_sign); } WhetherLevelUp(); if(strcmp(guai.name,"Hzwer")==0) { SlowDisplay("杀怪数量:"); printf("%d\t\t",fenshu); SlowDisplay("最终等级:"); printf("%d\t\t",player.level); SlowDisplay("最终余额:"); printf("%d\n\n\n",money); printf("战斗胜利,救出你的校花女友%s!!!\n\n\n",xiaohua_name); getchar(); getchar(); exit(0); } return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为 } else { int s=SuiJi(); if(yun==0) { gotoxy(4,5); printf("\t\t\t"); gotoxy(4,5); if(SuiJi100()>=guai.double_attack) { if((guai.attack+s-(player.defense+fang)/3)<0) { player.health-=1; printf("-1\n"); } else { player.health-=guai.attack+s-(player.defense+fang)/3; printf("-%d\n",guai.attack+s-(player.defense+fang)/3); } } else { if((2*guai.attack+s-(player.defense+fang)/3)<0) { player.health-=2; printf("-2!!!\n"); } else { player.health-=2*guai.attack+s-(player.defense+fang)/3; printf("-%d!!!\n",2*guai.attack+s-(player.defense+fang)/3); } } } else { gotoxy(4,40); printf("%s晕了,无法反击!\n\n",guai.name); yun--; } if(player.health<0) { battle=0; gotoxy(3,5); if(player.air!=0) printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*100); else printf("%s窒息!金币掉落%d\n\n\n",player.name,player.level*100); money-=player.level*100; player.health=player.max_health/5; system("pause"); OrdinaryAct(); return 1; } } return 0; } void WhetherLevelUp() { int i=0,j=0; int l1=player.range_exp/100; int l2=player.range_exp/300; int l3=player.range_exp/600; if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级 { if(l1==1) { printf("%s",player.name); SlowDisplay(" 升级!\n\n\n攻击力+5,防御力+5,HP上限+20,MP上限+10,氧气上限+1\n\n\n"); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5; player.defense+=5; player.max_health+=20; player.health=player.max_health; player.max_mp+=10; player.level++; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=100; } else { printf("好厉害!连升%d级!",l1); printf("攻击力+%d,防御力+%d,HP上限+%d,MP上限+%d,氧气上限+%d\n\n\n",5*l1,5*l1,20*l1,10*l1,1*l1); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5*l1; player.defense+=5*l1; player.max_health+=20*l1; player.health=player.max_health; player.max_mp+=10*l1; player.level+=l1; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=100*l1; } } else if(player.level<=40&&l2>0) { if(l2==1) { printf("%s",player.name); SlowDisplay(" 升级!\n\n\n攻击力+5,防御力+5,HP上限+20,MP上限+10,氧气上限+1\n\n\n"); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5; player.defense+=5; player.max_health+=20; player.health=player.max_health; player.max_mp+=10; player.level++; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=300; } else { printf("好厉害!连升%d级!",l2); printf("攻击力+%d,防御力+%d,HP上限+%d,MP上限+%d,氧气上限+%d\n\n\n",5*l2,5*l2,20*l2,10*l2,1*l2); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5*l2; player.defense+=5*l2; player.max_health+=20*l2; player.health=player.max_health; player.max_mp+=10*l2; player.level+=l2; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=300*l2; } } else if(l3>0) { if(l3==1) { printf("%s",player.name); SlowDisplay("升级!\n\n\n攻击力+5,防御力+5,HP上限+20,MP上限+10,氧气上限+1\n\n\n"); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5; player.defense+=5; player.max_health+=20; player.health=player.max_health; player.max_mp+=10; player.level++; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=600; } else { printf("好厉害!连升%d级!",l3); printf("攻击力+%d,防御力+%d,HP上限+%d,MP上限%d,氧气上限+%d\n\n\n",5*l3,5*l3,20*l3,10*l3,1*l3); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5*l3; player.defense+=5*l3; player.max_health+=20*l3; player.health=player.max_health; player.max_mp+=10; player.level+=l3; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=600*l3; } } } void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏) { 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!=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!=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 { 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"); 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; 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"); OrdinaryAct() ; 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; } } } }
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() { Setjindutiao(20); battle=1; s=SuiJi(); s2=1; 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; 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=1)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=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); } } 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 { 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(15,74);puts("o");system("cls"); gotoxy(13,74);puts("*");gotoxy(15,70);puts("* *");gotoxy(17,74);puts("*");system("cls"); gotoxy(11,74);puts("*");gotoxy(13,68);puts("* *");gotoxy(15,66);puts("* *");gotoxy(17,68);puts("* *");gotoxy(19,74);puts("*");system("cls"); gotoxy(9,74);puts("*");gotoxy(11,66);puts("* *");gotoxy(15,62);puts("* *");gotoxy(19,66);puts("* *");gotoxy(21,74);puts("*");system("cls"); gotoxy(11,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); }
#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=1,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++; lingpai3=10; } 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; case 17: SlowDisplay("这货总会有用的\n\n\n"); break; case 18: SlowDisplay("这货总会有用的\n\n\n"); break; case 19: if(my>0) { SlowDisplay("使用秘药,MP增加30\n\n\n"); my--; if(player.mp+30>player.max_mp)player.mp=player.max_mp; else player.mp+=30; } else SlowDisplay("没有秘药了\n\n\n"); break; case 0:break; default:MessageBox(NULL,"错误!","警告",MB_OK); } }
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级 { if(guai.health<=0) { battle=0; printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp); player.exp+=guai.exp; player.range_exp+=guai.exp; fenshu++; money+=guai.money; s=SuiJi(); system("pause"); if(s<guai.wupinpro) { printf("%s爆出了%s\n\n\n",guai.name,guai.wupin); AddWupin(guai.wupin_sign); } WhetherLevelUp(); if(strcmp(guai.name,"Hzwer")==0) { SlowDisplay("杀怪数量:"); printf("%d\t\t",fenshu); SlowDisplay("最终等级:"); printf("%d\t\t",player.level); SlowDisplay("最终余额:"); printf("%d\n\n\n",money); printf("战斗胜利,救出你的校花女友%s!!!\n\n\n",xiaohua_name); getchar(); getchar(); exit(0); } return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为 } else { int s=SuiJi(); if(yun==0) { gotoxy(4,5); printf("\t\t\t"); gotoxy(4,5); if(SuiJi100()>=guai.double_attack) { if((guai.attack+s-(player.defense+fang)/3)<0) { player.health-=1; printf("-1\n"); } else { player.health-=guai.attack+s-(player.defense+fang)/3; printf("-%d\n",guai.attack+s-(player.defense+fang)/3); } } else { if((2*guai.attack+s-(player.defense+fang)/3)<0) { player.health-=2; printf("-2!!!\n"); } else { player.health-=2*guai.attack+s-(player.defense+fang)/3; printf("-%d!!!\n",2*guai.attack+s-(player.defense+fang)/3); } } } else { gotoxy(4,40); printf("%s晕了,无法反击!\n\n",guai.name); yun--; } if(player.health<0) { battle=0; gotoxy(3,5); if(player.air!=0) printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*100); else printf("%s窒息!金币掉落%d\n\n\n",player.name,player.level*100); money-=player.level*100; player.health=player.max_health/5; system("pause"); OrdinaryAct(); return 1; } } return 0; } void WhetherLevelUp() { int i=0,j=0; int l1=player.range_exp/100; int l2=player.range_exp/300; int l3=player.range_exp/600; if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级 { if(l1==1) { printf("%s",player.name); SlowDisplay(" 升级!\n\n\n攻击力+5,防御力+5,HP上限+20,MP上限+10,氧气上限+1\n\n\n"); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5; player.defense+=5; player.max_health+=20; player.health=player.max_health; player.max_mp+=10; player.level++; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=100; } else { printf("好厉害!连升%d级!",l1); printf("攻击力+%d,防御力+%d,HP上限+%d,MP上限+%d,氧气上限+%d\n\n\n",5*l1,5*l1,20*l1,10*l1,1*l1); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5*l1; player.defense+=5*l1; player.max_health+=20*l1; player.health=player.max_health; player.max_mp+=10*l1; player.level+=l1; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=100*l1; } } else if(player.level<=40&&l2>0) { if(l2==1) { printf("%s",player.name); SlowDisplay(" 升级!\n\n\n攻击力+5,防御力+5,HP上限+20,MP上限+10,氧气上限+1\n\n\n"); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5; player.defense+=5; player.max_health+=20; player.health=player.max_health; player.max_mp+=10; player.level++; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=300; } else { printf("好厉害!连升%d级!",l2); printf("攻击力+%d,防御力+%d,HP上限+%d,MP上限+%d,氧气上限+%d\n\n\n",5*l2,5*l2,20*l2,10*l2,1*l2); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5*l2; player.defense+=5*l2; player.max_health+=20*l2; player.health=player.max_health; player.max_mp+=10*l2; player.level+=l2; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=300*l2; } } else if(l3>0) { if(l3==1) { printf("%s",player.name); SlowDisplay("升级!\n\n\n攻击力+5,防御力+5,HP上限+20,MP上限+10,氧气上限+1\n\n\n"); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5; player.defense+=5; player.max_health+=20; player.health=player.max_health; player.max_mp+=10; player.level++; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=600; } else { printf("好厉害!连升%d级!",l3); printf("攻击力+%d,防御力+%d,HP上限+%d,MP上限%d,氧气上限+%d\n\n\n",5*l3,5*l3,20*l3,10*l3,1*l3); player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100; player.attack+=5*l3; player.defense+=5*l3; player.max_health+=20*l3; player.health=player.max_health; player.max_mp+=10; player.level+=l3; player.range_exp=0; player.exp=player.max_exp; player.max_exp+=600*l3; } } }
[此贴子已经被作者于2017-8-26 17:03编辑过]