当前位置: 首页 > news >正文

[C++] 小游戏 斗破苍穹 2.2.1至2.11.5所有版本(中) zty出品

目录

2.8.2

2.9.1

2.10.1

2.10.2

2.10.3

2.10.4

2.10.5


2.8.2

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
using namespace std;
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",50,40,100,100,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[20];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
} strongman= {"森林巨人","传说圣甲",40,50,350,200,100,1,5,1,0},
witch= {"森林兽人","重甲",25,15,100,50,50,2,4,1,1},
xiyi= {"森林蜥蜴","铁甲",18,10,50,30,35,3,8,2,2},
big_strongman= {"熔岩巨龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},
lion= {"皇家士兵","尚方宝剑",60,30,280,200,100,5,5,1,0},
horse= {"草原独眼巨人","碧血战锤",28,12,90,50,50,6,5,1,1},
bee= {"草原剑客","西洋剑",17,11,60,30,35,7,5,2,2},
shitu= {"*凋零风暴*","\0",2000,700,20000,10000,5000,0,1,1,0},
pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},
dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},
cl= {"中华长龙","\0",450,50*10,2000,3500,2500,0,0,1,0},
jl= {"东方金龙","万龙甲",500,40*20,5000,10000,5000,9,6,6,1},
guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=200,fang5n=0;
int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0,gong5=100,gong5n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
char gongname[20]="无",fangname[20]="无";
char proof;void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);int main()
{
MessageBox (NULL, "欢迎来到斗破苍穹 2.8.2 正式版 !", "斗破苍穹 2.8.2 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("               _.+=*^--{|欢迎来到 [苍穹世界] 2.8.2 正式版|}--^*=+._              ");system("color 89");
printf("                        ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                       \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(1000);
printf("这里是苍穹世界! 契晋赫苟国的漓嘉茜公主被神秘老人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0)
{
printf("\n\n\n封印多年的郑族血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");
player.attack=999;
player.defense=999;
player.health=9999;
player.max_health=9999;
}
getchar();OrdinaryAct();
return 0;
}int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨龙晶石%d个 12,免死金牌%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi);system("color 8A");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200)
{printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60; 
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1)
{
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200)
{
if(player.level>197&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100; 
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200)
{
if(player.level>192&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200; 
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<200)
{
if(player.level>182&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400; 
player.attack+=60;
player.defense+=40;
player.health+=999999;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
printf("使用免死金牌,HP满\n\n\n");system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");system("color 8C");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"*凋零风暴*")==0)
{
printf("你把公主救了出来\n\n你可以在主页面退出\n\n");system("color 8C");}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
default:
printf("AddWupin error\n\n\n");
}}
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,打开后台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
printf("1,小郑子酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");system("color 89");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");system("color 89");
printf("铁甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,碧血战锤:%d个 4,尚方宝剑:%d个 5,皮卡大剑:%d个\n",gong1n,gong2n,gong3n,gong4n,gong5n);system("color 89");
printf("防御装备: 6,布衣:%d个 7,铁甲:%d个 8,重甲:%d个 9,传说圣甲:%d个 10,万龙甲:%d个\n11,巨龙晶石:%d个 0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("万龙甲:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★\n\n 5,炽热炎洞 危险程度:★★★★\n\n 6,皮卡超人游乐场 危险程度★★★★★\n\n 7,花朵宫殿 危险程度:★★★★★\n\n 8,五千龙穴 危险程度:★★★★★★\n\n 0,离开\n");system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<10)
{
battle=1;
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 6:
s=SuiJi();
if(s<7)
{
battle=1; 
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1; 
guai=cl;
printf("一条长龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1; 
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的长龙盘旋空中,你定睛一看,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
if(strongman_arm>=1)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
printf("这里安全\n\n\n");
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,碧血战锤:%d个 4,尚方宝剑:%d个 5,雷霆之刃:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n,gong5n);system("color 89");
printf("防御装备: 6,布衣:%d个 7,铁甲:%d个 8,重甲:%d个 9,传说圣甲:%d个 10万龙甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,fang5n);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 4:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 5:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 6:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 7:
if(fang2>=1){
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 8:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 9:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 10:
if(fang5n>=1){
printf("穿上了万龙甲\n\n\n");
fang=fang5;
strcpy(fangname,"万龙甲");
}
else printf("你没有万龙甲可以装备\n\n\n");
break; 
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界。为了给您更好的游戏体验,zty时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“zty ”(不包括双引号)。由于2.8.1版本的buy,我们在2.8.1的基础上进行修改,已修复该bug.希望大家喜欢。在这里要感谢吴昊同学,他给了我们许多宝贵的建议,谢谢。\n");system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("数据存储中...");system("color 89");
//向文件中更新数据;
getchar();
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
break;
case 7:int mi;cout<<"=====*【后台管理 简称开挂 测试Bug】*=================================\n请输入管理者密码      想退出就在管理密码那输入211\n=====*【想要后台密码就问郑桐羽,只能输数字,别问为什么,否则死循环】*=========\n管理密码:";cin>>mi;if(mi%20120913==0){cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加9999\n2.血量加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n211.退出\n=======================\n输入>>> "<<endl;cin>>htsr;if(htsr==1){cout<<"成功获得效果 *金币加9999\n";money+=9999;}if(htsr==2){cout<<"成功获得效果 *血量加9999\n";player.health+=9999;}if(htsr==3){cout<<"成功获得效果 *血量上限加9999\n";player.max_health+=9999;}if(htsr==4){cout<<"成功获得效果 *攻击加9999\n";player.attack+=9999;}if(htsr==5){cout<<"成功获得效果 *防御加9999\n";player.defense+=9999;}if(htsr%211==0){cout<<"成功退出\n";continue;}}else{cout<<"输入错误!请检查!"<<endl;continue;}break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
} 

2.9.1

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
using namespace std;
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",50,40,100,100,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[20];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
} strongman= {"森林巨人","传说圣甲",40,50,350,200,100,1,5,1,0},
witch= {"森林兽人","重甲",25,15,100,50,50,2,4,1,1},
xiyi= {"森林蜥蜴","铁甲",18,10,50,30,35,3,8,2,2},
big_strongman= {"熔岩巨龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},
lion= {"皇家士兵","尚方宝剑",60,30,280,200,100,5,5,1,0},
horse= {"草原独眼巨人","碧血战锤",28,12,90,50,50,6,5,1,1},
bee= {"草原剑客","西洋剑",17,11,60,30,35,7,5,2,2},
shitu= {"凋零女巫","凋零之心",2000,700,20000,10000,5000,10,10,1,0},
dljs= {"凋零巨兽","凋零之心",2000,700,20000,10000,5000,10,10,1,0},
pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},
dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},
cl= {"中华长龙","\0",450,50*10,2000,3500,2500,0,0,1,0},
jl= {"东方金龙","万龙甲",500,40*20,5000,10000,5000,9,6,6,1},
gst={"凋零共生体","\0",1800,65*10,15000,0,4500,0,0,1,0},
dlkl= {"凋零骷髅","\0",3000,30*10,12000,0,5000,0,0,1,0},
dlfb= {".+*凋零风暴*+.","\0",18000,200*10,98000,0,500000,0,0,1,0},
guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=200,fang5n=0;
int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0,gong5=100,gong5n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
int diaolingxin=0; 
char gongname[20]="无",fangname[20]="无";
char proof;void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);int main()
{
MessageBox (NULL, "欢迎来到斗破苍穹 2.9.0 正式版 !", "斗破苍穹 2.9.0 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("               _.+=*^--{|欢迎来到 [苍穹世界] 2.9.0 正式版|}--^*=+._              ");system("color 89");
printf("                        ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                       \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(1000);
printf("这里是苍穹世界! 契晋赫苟国的漓嘉茜公主被神秘老人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0)
{
printf("\n\n\n封印多年的郑族血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");
player.attack=999;
player.defense=999;
player.health=9999;
player.max_health=9999;
}
getchar();OrdinaryAct();
return 0;
}int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨龙晶石%d个 12,免死金牌%d个 13,凋零之心%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi,diaolingxin);system("color 8A");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200)
{printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60; 
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1)
{
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200)
{
if(player.level>197&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100; 
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200)
{
if(player.level>192&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200; 
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<200)
{
if(player.level>182&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400; 
player.attack+=60;
player.defense+=40;
player.health+=999999;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
printf("使用免死金牌,HP满\n\n\n");system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
break;
case 13:
if(diaolingxin>0)
{
printf("使用凋零之心\nHP+100  攻击+100\n\n\n");system("color 8b");
diaolingxin--;
player.health+=100;
player.attack+=100; 
}else printf("没有凋零之心了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");system("color 8C");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"*凋零巨兽*")==0)
{
printf("你把公主救了出来\n\n你从公主口中得知了一个更大的阴谋,你可以进入凋零世界\n\n");system("color 8C");}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
case 10:
diaolingxin++;
break;
default:
printf("AddWupin error\n\n\n");
}}
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,打开后台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
printf("1,小郑子酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");system("color 89");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");system("color 89");
printf("铁甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,碧血战锤:%d个 4,尚方宝剑:%d个 5,皮卡大剑:%d个\n",gong1n,gong2n,gong3n,gong4n,gong5n);system("color 89");
printf("防御装备: 6,布衣:%d个 7,铁甲:%d个 8,重甲:%d个 9,传说圣甲:%d个 10,万龙甲:%d个\n11,巨龙晶石:%d个 0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("万龙甲:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★\n\n 5,炽热炎洞 危险程度:★★★★\n\n 6,皮卡超人游乐场 危险程度★★★★★\n\n 7,花朵宫殿 危险程度:★★★★★\n\n 8,五千龙穴 危险程度:★★★★★★\n\n 9,凋零宇宙 危险程度:★★★★★★★★\n\n0,离开\n");system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<10)
{
battle=1;
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 6:
s=SuiJi();
if(s<7)
{
battle=1; 
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1; 
guai=cl;
printf("一条长龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1; 
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的长龙盘旋空中,你定睛一看,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
if(strongman_arm>=1)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
printf("这里安全\n\n\n");
}
break;
case 9:
s=SuiJi();
if(diaolingxin!=0){
if(s==1)
{
battle=1; 
guai=dlfb;
printf("一个巨大的黑暗物体,周围环绕着大量的由破碎方块组成的黑色颗粒云环的%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else if(s<=2 && s<=4)
{
battle=1; 
guai=dlkl;
printf("手持凋零剑的黑色凶恶%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=5&&s>=7){
battle=1;
guai=gst;
printf("一个巨大的触手向你打来,你挡了下来%s扑了过来!\n\n\n",guai.name);
BattleAct();
} else{
battle=1;
guai=dljs;
printf("一只巨大的猛兽%s冲了过来!\n\n\n",guai.name);
BattleAct();
}
}if(diaolingxin==0){
cout<<"你没有凋零之心,需要击败凋零女巫或凋零巨兽" <<endl;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,碧血战锤:%d个 4,尚方宝剑:%d个 5,雷霆之刃:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n,gong5n);system("color 89");
printf("防御装备: 6,布衣:%d个 7,铁甲:%d个 8,重甲:%d个 9,传说圣甲:%d个 10万龙甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,fang5n);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 4:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 5:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 6:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 7:
if(fang2>=1){
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 8:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 9:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 10:
if(fang5n>=1){
printf("穿上了万龙甲\n\n\n");
fang=fang5;
strcpy(fangname,"万龙甲");
}
else printf("你没有万龙甲可以装备\n\n\n");
break; 
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界。为了给您更好的游戏体验,zty时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“zty ”(不包括双引号)。我们在2.8版本内容的基础上进行修改,已修复该bug。并且新增了新副本、怪物、boss、道具等,希望大家喜欢。在这里要感谢吴昊同学,他给了我们许多宝贵的建议,谢谢。\n");system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("数据存储中...");system("color 89");
//向文件中更新数据;
getchar();
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
break;
case 7:int mi;cout<<"=====*【后台管理 简称开挂 测试Bug】*=================================\n请输入管理者密码      想退出就在管理密码那输入211\n=====*【想要后台密码就问郑桐羽,只能输数字,别问为什么,否则死循环】*=========\n管理密码:";cin>>mi;if(mi%20120913==0){cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加9999\n2.血量加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n211.退出\n=======================\n输入>>> "<<endl;cin>>htsr;if(htsr==1){cout<<"成功获得效果 *金币加9999\n";money+=9999;}if(htsr==2){cout<<"成功获得效果 *血量加9999\n";player.health+=9999;}if(htsr==3){cout<<"成功获得效果 *血量上限加9999\n";player.max_health+=9999;}if(htsr==4){cout<<"成功获得效果 *攻击加9999\n";player.attack+=9999;}if(htsr==5){cout<<"成功获得效果 *防御加9999\n";player.defense+=9999;}if(htsr%211==0){cout<<"成功退出\n";continue;}}else{cout<<"输入错误!请检查!"<<endl;continue;}break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
} 

2.10.1

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
using namespace std;
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",50,40,100,100,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[20];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
} 
gl= {"格伦石人","石铠甲",30,150,1000,500,250,11,7,1,0},
zhizhu= {"洞穴蜘蛛","蜘蛛毒剑",140,20,250,400,200,12,5,1,0},
ymr= {"野蛮人","粗制石剑",20,20,150,100,50,13,5,1,0},
nz= {"牛仔","战斗马甲",100,20,350,500,250,14,10,1,0},
strongman= {"森林巨人","传说圣甲",40,50,350,200,100,1,5,1,0},
witch= {"兽人","重甲",25,15,100,50,50,2,4,1,1},
xiyi= {"森林蜥蜴","铁甲",18,10,50,30,35,3,8,2,2},
big_strongman= {"熔岩巨龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},
lion= {"皇家士兵","尚方宝剑",60,30,280,200,100,5,5,1,0},
horse= {"独眼巨人","碧血战锤",28,12,90,50,50,6,5,1,1},
bee= {"草原剑客","西洋剑",17,11,60,30,35,7,5,2,2},
shitu= {"凋零女巫","凋零之心",2000,700,20000,10000,5000,10,10,1,0},
dljs= {"凋零巨兽","凋零之心",2000,700,20000,10000,5000,10,10,1,0},
pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},
dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},
cl= {"中华长龙","\0",450,50*10,2000,3500,2500,0,0,1,0},
jl= {"东方金龙","万龙甲",500,40*20,5000,10000,5000,9,6,6,1},
gst={"凋零共生体","\0",1800,65*10,15000,0,4500,0,0,1,0},
dlkl= {"凋零骷髅","\0",3000,30*10,12000,0,5000,0,0,1,0},
dlfb= {".+*凋零风暴*+.","\0",18000,200*10,98000,0,500000,0,0,1,0},
guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=200,fang5n=0,fang6=150,fang6n=0,fang7=60,fang7n=0;
int gong=0,gong1=10,gong1n=0,gong2=10,gong2n=0,gong3=45,gong3n=0,gong4=100,gong4n=0,gong5=500,gong5n=0,gong6=150,gong6n=0,gong7=35,gong7n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
int diaolingxin=0; 
char gongname[20]="无",fangname[20]="无";
char proof;void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);int main()
{
MessageBox (NULL, "欢迎来到斗破苍穹 2.10.1 正式版 !", "斗破苍穹 2.10.1 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("                _.+=*^--{|欢迎来到 [苍穹世界] 2.10.1 正式版|}--^*=+.              ");system("color 89");
printf("                         ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                       \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(1000);
printf("这里是苍穹世界! 契晋赫苟国的漓嘉茜公主被神秘老人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0)
{
printf("\n\n\n封印多年的郑族血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");
player.attack=99999;
player.defense=99999;
player.health=999999;
player.max_health=999999;
}
getchar();OrdinaryAct();
return 0;
}int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨龙晶石%d个 12,免死金牌%d个 13,凋零之心%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi,diaolingxin);system("color 8A");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200)
{printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60; 
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1)
{
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200)
{
if(player.level>197&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100; 
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200)
{
if(player.level>192&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200; 
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<200)
{
if(player.level>182&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400; 
player.attack+=60;
player.defense+=40;
player.health+=999999;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
printf("使用免死金牌,HP满\n\n\n");system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
break;
case 13:
if(diaolingxin>0)
{
printf("使用凋零之心\nHP+100  攻击+100\n\n\n");system("color 8b");
diaolingxin--;
player.health+=100;
player.attack+=100; 
}else printf("没有凋零之心了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");system("color 8C");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"*凋零巨兽*")==0)
{
printf("你把公主救了出来\n\n你从公主口中得知了一个更大的阴谋,你可以进入凋零世界\n\n");system("color 8C");}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
case 10:
diaolingxin++;
break;
case 11:
fang6n++;
break;
case 12:
gong6n++;
break;
case 13:
gong7n++;
break;
case 14:
fang7n++;
break;
default:
printf("AddWupin error\n\n\n");
}}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/200;
int l2=player.range_exp/500;
int l3=player.range_exp/1000;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,打开后台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
printf("1,小郑子酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");system("color 89");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");system("color 89");
printf("铁甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑%n 4,碧血战锤:%d个 5,蜘蛛毒剑:%n个 6,尚方宝剑:%d个 7,皮卡大剑:%d个\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个 15,巨龙晶石:%d个\n 0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong7n>=shu)
{
gong7n=gong7n-shu;
money=money+shu*800;
printf("粗制石剑:%d\n",gong7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong6n>=shu)
{
gong6n=gong6n-shu;
money=money+shu*1000;
printf("蜘蛛毒剑:%d\n",gong6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang7n>=shu)
{
fang7n=fang7n-shu;
money=money+shu*1000;
printf("战斗马甲:%d\n",fang7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 12:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang6n>=shu)
{
fang6n=fang6n-shu;
money=money+shu*2000;
printf("石凯甲:%d\n",fang6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 13:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}case 14:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("万龙甲:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 15:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★★★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★★\n\n 5,炽热炎洞 危险程度:★★★★★\n\n 6,皮卡超人游乐场 危险程度★★★★★★★\n\n 7,花朵宫殿 危险程度:★★★★★★\n\n 8,五千龙穴 危险程度:★★★★★★★\n\n 9,凋零宇宙 危险程度:★★★★★★★★\n\n0,离开\n");system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<4)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
battle=1;
guai=zhizhu;
printf("可怕的%s爬了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<=3){
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
} else if(s<8){
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=zhizhu;
printf("可怕的%s扑爬了过来!\n\n\n",guai.name);
BattleAct();
} 
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<=3){
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else if(s<8){
battle=1;
guai=ymr;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7){
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();}
else{
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 6:
s=SuiJi();
if(s<7){
battle=1; 
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9){
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1; 
guai=cl;
printf("一条长龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1; 
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的长龙盘旋空中,你定睛一看,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<5)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
if(strongman_arm>=1)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 9:
s=SuiJi();
if(diaolingxin!=0){
if(s==1)
{
battle=1; 
guai=dlfb;
printf("一个巨大的黑暗物体,周围环绕着大量的由破碎方块组成的黑色颗粒云环的%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else if(s<=2 && s<=4)
{
battle=1; 
guai=dlkl;
printf("手持凋零剑的黑色凶恶%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=5&&s>=7){
battle=1;
guai=gst;
printf("一个巨大的触手向你打来,你挡了下来%s扑了过来!\n\n\n",guai.name);
BattleAct();
} else{
battle=1;
guai=dljs;
printf("一只巨大的猛兽%s冲了过来!\n\n\n",guai.name);
BattleAct();
}
}if(diaolingxin==0){
cout<<"你没有凋零之心,需要击败凋零巨兽" <<endl;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%d个 4,碧血战锤:%d个 5,蜘蛛毒剑:%d个 6,尚方宝剑:%d个 7,雷霆之刃:%d个\n\n\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong7n>=1){
printf("拿起了粗制石剑\n\n\n");
gong=gong7;
strcpy(gongname,"粗制石剑");
}
else printf("你没有粗制石剑可以装备\n\n\n");
break;
case 4:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 5:
if(gong6n>=1){
printf("拿起了蜘蛛毒剑\n\n\n");
gong=gong6;
strcpy(gongname,"蜘蛛毒剑");
}
else printf("你没有蜘蛛毒剑可以装备\n\n\n");
break;
case 6:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 7:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 8:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 9:
if(fang2n>=1){
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 10:
if(fang7n>=1){
printf("穿上了战斗马甲\n\n\n");
fang=fang7;
strcpy(fangname,"战斗马甲");
}
else printf("你没有战斗马甲可以装备\n\n\n");
break;
case 11:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 12:
if(fang6n>=1){
printf("穿上了石铠甲\n\n\n");
fang=fang6;
strcpy(fangname,"石凯甲");
}
else printf("你没有石凯甲可以装备\n\n\n");
break;
case 13:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 14:
if(fang5n>=1){
printf("穿上了万龙甲\n\n\n");
fang=fang5;
strcpy(fangname,"万龙甲");
}
else printf("你没有万龙甲可以装备\n\n\n");
break; 
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界(斗破苍穹)。为了给您更好的游戏体验,zty时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“zty ”(不包括双引号)。我们在2.9版本内容的基础上进行修改,新增了四个新怪物和武器装备,希望大家喜欢。在这里要感谢吴昊同学,他给了我们许多宝贵的建议,谢谢。\n");system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
break;
case 7:int mi;cout<<"=====*【后台管理 简称开挂 测试Bug】*=================================\n请输入管理者密码      想退出就在管理密码那输入211\n=====*【想要后台密码就问郑桐羽,只能输数字,否则死循环】*===============\n管理密码:";cin>>mi;if(mi%20120913==0){cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加999999\n2.血量加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n211.退出\n=======================\n输入>>> "<<endl;cin>>htsr;if(htsr==1){cout<<"成功获得效果 *金币加9999\n";money+=999999;}if(htsr==2){cout<<"成功获得效果 *血量加9999\n";player.health+=9999;}if(htsr==3){cout<<"成功获得效果 *血量上限加9999\n";player.max_health+=9999;}if(htsr==4){cout<<"成功获得效果 *攻击加9999\n";player.attack+=9999;}if(htsr==5){cout<<"成功获得效果 *防御加9999\n";player.defense+=9999;}if(htsr%211==0){cout<<"成功退出\n";continue;}}else{cout<<"输入错误!请检查!"<<endl;continue;}break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
} 

2.10.2

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
using namespace std;
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",100,80,200,200,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[20];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
} 
gl= {"格伦石人","石铠甲",30,150,1000,500,250,11,7,1,0},
zhizhu= {"洞穴蜘蛛","蜘蛛毒剑",140,20,250,400,200,12,5,1,0},
ymr= {"野蛮人","粗制石剑",20,20,150,100,50,13,5,1,0},
nz= {"牛仔","战斗马甲",80,20,250,500,250,14,10,1,0},
strongman= {"森林巨人","传说圣甲",50,50,580,200,100,1,5,1,0},
witch= {"兽人","重甲",35,55,250,50,50,2,4,1,1},
xiyi= {"森林蜥蜴","铁甲",20,25,80,30,35,3,8,2,2},
big_strongman= {"熔岩巨龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},
lion= {"皇家士兵","尚方宝剑",100,30,380,200,100,5,5,1,0},
horse= {"独眼巨人","碧血战锤",50,22,360,50,50,6,5,1,1},
bee= {"草原剑客","西洋剑",27,11,60,30,35,7,5,2,2},
shitu= {"凋零女巫","凋零之心",1400,500,15000,10000,5000,10,10,1,0},
dljs= {"凋零巨兽","凋零之心",1200,700,20000,10000,5000,10,7,1,0},
pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},
dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},
cl= {"中华长龙","\0",450,50*10,2000,3500,2500,0,0,1,0},
jl= {"东方金龙","万龙甲",500,40*20,5000,8000,4500,9,6,6,1},
gst={"凋零共生体","\0",1800,65*10,15000,0,10000,0,0,1,0},
dlkl= {"凋零骷髅","\0",3000,30*10,12000,0,10000,0,0,1,0},
dlfb= {".+*凋零风暴*+.","\0",9000,1500,49000,0,500000,0,0,1,0},
guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=400,fang5n=0,fang6=150,fang6n=0,fang7=60,fang7n=0;
int gong=0,gong1=10,gong1n=0,gong2=20,gong2n=0,gong3=45,gong3n=0,gong4=100,gong4n=0,gong5=300,gong5n=0,gong6=150,gong6n=0,gong7=35,gong7n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
int diaolingxin=0; 
char gongname[20]="无",fangname[20]="无";
char proof;void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);int main()
{
MessageBox (NULL, "欢迎来到斗破苍穹 2.10.2 正式版 !", "斗破苍穹 2.10.2 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("                _.+=*^--{|欢迎来到 [斗破苍穹] 2.10.2 正式版|}--^*=+.              ");system("color 89");
printf("                         ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                       \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(1000);
printf("这里是斗破苍穹(苍穹世界)! 契晋赫苟国的漓嘉茜公主被神秘人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0)
{
printf("\n\n\n封印多年的zty族血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");
player.attack=99999;
player.defense=99999;
player.health=999999;
player.max_health=999999;
}
getchar();OrdinaryAct();
return 0;
}int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨龙晶石%d个 12,免死金牌%d个 13,凋零之心%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi,diaolingxin);system("color 8A");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200)
{printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60; 
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1)
{
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200)
{
if(player.level>197&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100; 
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200)
{
if(player.level>192&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200; 
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<200)
{
if(player.level>182&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400; 
player.attack+=60;
player.defense+=40;
player.health+=999999;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
printf("使用免死金牌,HP满\n\n\n");system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
break;
case 13:
if(diaolingxin>0)
{
printf("使用凋零之心\nHP+100  攻击+100\n\n\n");system("color 8b");
diaolingxin--;
player.health+=100;
player.attack+=100; 
}else printf("没有凋零之心了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");system("color 8C");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"*凋零巨兽*")==0)
{
printf("你把公主救了出来\n\n你从公主口中得知了一个更大的阴谋,你可以进入凋零世界\n\n");system("color 8C");}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
case 10:
diaolingxin++;
break;
case 11:
fang6n++;
break;
case 12:
gong6n++;
break;
case 13:
gong7n++;
break;
case 14:
fang7n++;
break;
default:
printf("AddWupin error\n\n\n");
}}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/150;
int l2=player.range_exp/375;
int l3=player.range_exp/750;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,打开后台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
printf("1,小郑子酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");system("color 89");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");system("color 89");
printf("铁甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%n 4,碧血战锤:%d个 5,蜘蛛毒剑:%n个 6,尚方宝剑:%d个 7,皮卡大剑:%d个\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个 15,巨龙晶石:%d个\n 0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong7n>=shu)
{
gong7n=gong7n-shu;
money=money+shu*800;
printf("粗制石剑:%d\n",gong7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong6n>=shu)
{
gong6n=gong6n-shu;
money=money+shu*1000;
printf("蜘蛛毒剑:%d\n",gong6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang7n>=shu)
{
fang7n=fang7n-shu;
money=money+shu*1000;
printf("战斗马甲:%d\n",fang7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 12:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang6n>=shu)
{
fang6n=fang6n-shu;
money=money+shu*2000;
printf("石凯甲:%d\n",fang6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 13:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}case 14:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("万龙甲:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 15:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★★★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★★\n\n 5,炽热炎洞 危险程度:★★★★★\n\n 6,皮卡营地 危险程度★★★★★★\n\n 7,花朵宫殿 危险程度:★★★★★★\n\n 8,五千龙穴 危险程度:★★★★★★★\n\n 9,凋零宇宙 危险程度:★★★★★★★★\n\n0,离开\n");system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<4)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
battle=1;
guai=zhizhu;
printf("可怕的%s爬了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<=3){
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
} else if(s<8){
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=zhizhu;
printf("可怕的%s扑爬了过来!\n\n\n",guai.name);
BattleAct();
} 
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<=3){
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else if(s<8){
battle=1;
guai=ymr;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7){
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();}
else{
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 6:
s=SuiJi();
if(s<7){
battle=1; 
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9){
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1; 
guai=cl;
printf("一条长龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1; 
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的长龙盘旋空中,你定睛一看,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<5)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
if(strongman_arm>=1)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 9:
s=SuiJi();
if(diaolingxin!=0){
if(s==1)
{
battle=1; 
guai=dlfb;
printf("一个巨大的黑暗物体,周围环绕着大量的由破碎方块组成的黑色颗粒云环的%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else if(s<=2 && s<=4)
{
battle=1; 
guai=dlkl;
printf("手持凋零剑的黑色凶恶%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=5&&s>=7){
battle=1;
guai=gst;
printf("一个巨大的触手向你打来,你挡了下来%s扑了过来!\n\n\n",guai.name);
BattleAct();
} else{
battle=1;
guai=dljs;
printf("一只巨大的猛兽%s冲了过来!\n\n\n",guai.name);
BattleAct();
}
}if(diaolingxin==0){
cout<<"你没有凋零之心,需要击败凋零巨兽" <<endl;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%d个 4,碧血战锤:%d个 5,蜘蛛毒剑:%d个 6,尚方宝剑:%d个 7,雷霆之刃:%d个\n\n\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong7n>=1){
printf("拿起了粗制石剑\n\n\n");
gong=gong7;
strcpy(gongname,"粗制石剑");
}
else printf("你没有粗制石剑可以装备\n\n\n");
break;
case 4:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 5:
if(gong6n>=1){
printf("拿起了蜘蛛毒剑\n\n\n");
gong=gong6;
strcpy(gongname,"蜘蛛毒剑");
}
else printf("你没有蜘蛛毒剑可以装备\n\n\n");
break;
case 6:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 7:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 8:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 9:
if(fang2n>=1){
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 10:
if(fang7n>=1){
printf("穿上了战斗马甲\n\n\n");
fang=fang7;
strcpy(fangname,"战斗马甲");
}
else printf("你没有战斗马甲可以装备\n\n\n");
break;
case 11:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 12:
if(fang6n>=1){
printf("穿上了石铠甲\n\n\n");
fang=fang6;
strcpy(fangname,"石凯甲");
}
else printf("你没有石凯甲可以装备\n\n\n");
break;
case 13:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 14:
if(fang5n>=1){
printf("穿上了万龙甲\n\n\n");
fang=fang5;
strcpy(fangname,"万龙甲");
}
else printf("你没有万龙甲可以装备\n\n\n");
break; 
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界(斗破苍穹)。为了给您更好的游戏体验,zty时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“zty ”(不包括双引号)。由于2.10.1版本的buy,我们在2.10.1的基础上进行修改,已修复该buy。并且修改了怪物的各项数值,做了一些平衡性调整,希望大家喜欢。在这里要感谢吴昊同学,他给了我们许多宝贵的建议,谢谢。\n");system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
break;
case 7:int mi;cout<<"=====*【后台管理 简称开挂 测试Bug】*=================================\n请输入管理者密码      想退出就在管理密码那输入211\n=====*【想要后台密码就问郑桐羽,只能输数字,否则死循环】*===============\n管理密码:";cin>>mi;if(mi%20120913==0){cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加999999\n2.血量加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n211.退出\n=======================\n输入>>> "<<endl;cin>>htsr;if(htsr==1){cout<<"成功获得效果 *金币加9999\n";money+=999999;}if(htsr==2){cout<<"成功获得效果 *血量加9999\n";player.health+=9999;}if(htsr==3){cout<<"成功获得效果 *血量上限加9999\n";player.max_health+=9999;}if(htsr==4){cout<<"成功获得效果 *攻击加9999\n";player.attack+=9999;}if(htsr==5){cout<<"成功获得效果 *防御加9999\n";player.defense+=9999;}if(htsr%211==0){cout<<"成功退出\n";continue;}}else{cout<<"输入错误!请检查!"<<endl;continue;}break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
} 

2.10.3

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
using namespace std;
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",100,80,200,200,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[20];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
}
//怪,拿格伦石人举例 
// 怪变量  怪名     掉落的装备 攻   防  血  金币 经验 掉落装备编号 掉落概率 后面这俩不能改 
//  gl= {"格伦石人","石铠甲",  30, 150,1000,500, 250,      11,       7,           1,0},gl= {"格伦石人","石铠甲",30,150,1000,500,250,11,7,1,0},zhizhu= {"洞穴蜘蛛","蜘蛛毒剑",140,20,250,400,200,12,5,1,0},ymr= {"野蛮人","粗制石剑",20,20,150,100,50,13,5,1,0},nz= {"牛仔","战斗马甲",80,20,250,500,250,14,10,1,0},strongman= {"森林巨人","传说圣甲",50,50,580,200,100,1,5,1,0},witch= {"兽人","重甲",35,55,250,50,50,2,4,1,1},xiyi= {"森林蜥蜴","铁甲",20,25,80,30,35,3,8,2,2},big_strongman= {"熔岩巨龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},lion= {"皇家士兵","尚方宝剑",100,30,380,200,100,5,5,1,0},horse= {"独眼巨人","碧血战锤",50,22,360,50,50,6,5,1,1},bee= {"草原剑客","西洋剑",27,11,60,30,35,7,5,2,2},shitu= {"凋零女巫","凋零之心",1400,500,15000,10000,5000,10,10,1,0},dljs= {"凋零巨兽","凋零之心",1200,700,20000,10000,5000,10,7,1,0},pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},cl= {"中华长龙","\0",450,50*10,2000,3500,2500,0,0,1,0},jl= {"东方金龙","万龙甲",500,40*20,5000,8000,4500,9,6,6,1},gst={"凋零共生体","\0",1800,65*10,15000,0,10000,0,0,1,0},dlkl= {"凋零骷髅","\0",3000,30*10,12000,0,10000,0,0,1,0},dlfb= {".+*凋零风暴*+.","\0",9000,1500,49000,0,500000,0,0,1,0},guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=400,fang5n=0,fang6=150,fang6n=0,fang7=60,fang7n=0;
int gong=0,gong1=10,gong1n=0,gong2=20,gong2n=0,gong3=45,gong3n=0,gong4=100,gong4n=0,gong5=300,gong5n=0,gong6=150,gong6n=0,gong7=35,gong7n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
int diaolingxin=0; 
char gongname[20]="无",fangname[20]="无";
char proof;void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);int main()
{
MessageBox (NULL, "欢迎来到斗破苍穹 2.10.3 正式版 !", "斗破苍穹 2.10.3 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("                _.+=*^--{|欢迎来到 [斗破苍穹] 2.10.3 正式版|}--^*=+.              ");system("color 89");
printf("                          ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                      \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(1000);
printf("这里是斗破苍穹(苍穹世界)! 契晋赫苟国的漓嘉茜公主被神秘人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0){printf("\n\n\n封印多年的zty族血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");player.attack=99999;player.defense=99999;player.health=999999;player.max_health=999999;
}
getchar();OrdinaryAct();
return 0;
}int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨龙晶石%d个 12,免死金牌%d个 13,凋零之心%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi,diaolingxin);system("color 8A");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200)
{printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60; 
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1)
{
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200)
{
if(player.level>197&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100; 
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200)
{
if(player.level>192&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200; 
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<200)
{
if(player.level>482&&player.level<500)
{
int sheng;
sheng=500-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400; 
player.attack+=60;
player.defense+=40;
player.health+=999999;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过500级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
printf("使用免死金牌,HP满\n\n\n");system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
break;
case 13:
if(diaolingxin>0)
{
printf("使用凋零之心\nHP+100  攻击+100\n\n\n");system("color 8b");
diaolingxin--;
player.health+=100;
player.attack+=100; 
}else printf("没有凋零之心了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");system("color 8C");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"*凋零巨兽*")==0)
{
printf("你把公主救了出来\n\n你从公主口中得知了一个更大的阴谋,你可以进入凋零世界\n\n");system("color 8C");}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
case 10:
diaolingxin++;
break;
case 11:
fang6n++;
break;
case 12:
gong6n++;
break;
case 13:
gong7n++;
break;
case 14:
fang7n++;
break;
default:
printf("AddWupin error\n\n\n");
}}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/150;
int l2=player.range_exp/375;
int l3=player.range_exp/750;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,打开后台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
printf("1,小郑子酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");system("color 89");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");system("color 89");
printf("铁甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%n 4,碧血战锤:%d个 5,蜘蛛毒剑:%n个 6,尚方宝剑:%d个 7,皮卡大剑:%d个\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个 15,巨龙晶石:%d个\n 0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong7n>=shu)
{
gong7n=gong7n-shu;
money=money+shu*800;
printf("粗制石剑:%d\n",gong7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong6n>=shu)
{
gong6n=gong6n-shu;
money=money+shu*1000;
printf("蜘蛛毒剑:%d\n",gong6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang7n>=shu)
{
fang7n=fang7n-shu;
money=money+shu*1000;
printf("战斗马甲:%d\n",fang7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 12:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang6n>=shu)
{
fang6n=fang6n-shu;
money=money+shu*2000;
printf("石凯甲:%d\n",fang6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 13:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}case 14:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("万龙甲:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 15:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★★★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★★\n\n 5,炽热炎洞 危险程度:★★★★★\n\n 6,皮卡营地 危险程度★★★★★★\n\n 7,花朵宫殿 危险程度:★★★★★★\n\n 8,五千龙穴 危险程度:★★★★★★★\n\n 9,凋零宇宙 危险程度:★★★★★★★★\n\n0,离开\n");system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<4)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
battle=1;
guai=zhizhu;
printf("可怕的%s爬了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<=3){
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
} else if(s<8){
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=zhizhu;
printf("可怕的%s扑爬了过来!\n\n\n",guai.name);
BattleAct();
} 
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<=3){
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else if(s<8){
battle=1;
guai=ymr;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7){
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();}
else{
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 6:
s=SuiJi();
if(s<7){
battle=1; 
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9){
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1; 
guai=cl;
printf("一条长龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1; 
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的长龙盘旋空中,你定睛一看,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<5)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
if(strongman_arm>=1)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 9:
s=SuiJi();
if(diaolingxin!=0){
if(s==1)
{
battle=1; 
guai=dlfb;
printf("一个巨大的黑暗物体,周围环绕着大量的由破碎方块组成的黑色颗粒云环的%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else if(s<=2 && s<=4)
{
battle=1; 
guai=dlkl;
printf("手持凋零剑的黑色凶恶%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=5&&s>=7){
battle=1;
guai=gst;
printf("一个巨大的触手向你打来,你挡了下来%s扑了过来!\n\n\n",guai.name);
BattleAct();
} else{
battle=1;
guai=dljs;
printf("一只巨大的猛兽%s冲了过来!\n\n\n",guai.name);
BattleAct();
}
}if(diaolingxin==0){
cout<<"你没有凋零之心,需要击败凋零巨兽" <<endl;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%d个 4,碧血战锤:%d个 5,蜘蛛毒剑:%d个 6,尚方宝剑:%d个 7,雷霆之刃:%d个\n\n\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong7n>=1){
printf("拿起了粗制石剑\n\n\n");
gong=gong7;
strcpy(gongname,"粗制石剑");
}
else printf("你没有粗制石剑可以装备\n\n\n");
break;
case 4:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 5:
if(gong6n>=1){
printf("拿起了蜘蛛毒剑\n\n\n");
gong=gong6;
strcpy(gongname,"蜘蛛毒剑");
}
else printf("你没有蜘蛛毒剑可以装备\n\n\n");
break;
case 6:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 7:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 8:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 9:
if(fang2n>=1){
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 10:
if(fang7n>=1){
printf("穿上了战斗马甲\n\n\n");
fang=fang7;
strcpy(fangname,"战斗马甲");
}
else printf("你没有战斗马甲可以装备\n\n\n");
break;
case 11:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 12:
if(fang6n>=1){
printf("穿上了石铠甲\n\n\n");
fang=fang6;
strcpy(fangname,"石凯甲");
}
else printf("你没有石凯甲可以装备\n\n\n");
break;
case 13:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 14:
if(fang5n>=1){
printf("穿上了万龙甲\n\n\n");
fang=fang5;
strcpy(fangname,"万龙甲");
}
else printf("你没有万龙甲可以装备\n\n\n");
break; 
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界(斗破苍穹)。为了给您更好的游戏体验,zty时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“zty ”(不包括双引号)。由于2.10.2版本巨龙晶石的buy,我们在2.10.2的基础上进行修改,已修复该buy。并且修改了巨龙晶石的升级上限,希望大家喜欢。在这里要感谢吴昊同学,他给了我们许多宝贵的建议,谢谢。\n");system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
break;
case 7:int mi;cout<<"=====*【后台管理 简称开挂 测试Bug】*=================================\n请输入管理者密码===================================*【想要后台密码就问郑桐羽,只能输数字,否则死循环】*===============\n管理密码:";cin>>mi;if(mi%20120913==0){cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加999999\n2.血量上限加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n211.退出\n=======================\n输入>>> "<<endl;cin>>htsr;if(htsr==1){cout<<"成功获得效果 *金币加9999\n";money+=999999;}if(htsr==2){cout<<"成功获得效果 *血量加9999\n";player.health+=9999;}if(htsr==3){cout<<"成功获得效果 *血量上限加9999\n";player.max_health+=9999;}if(htsr==4){cout<<"成功获得效果 *攻击加9999\n";player.attack+=9999;}if(htsr==5){cout<<"成功获得效果 *防御加9999\n";player.defense+=9999;}if(htsr%211==0){cout<<"成功退出\n";continue;}}else{cout<<"输入错误!请检查!"<<endl;continue;}break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
} 

2.10.4

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
using namespace std;
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",100,80,200,200,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[20];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
}
//怪,拿格伦石人举例 
// 怪变量  怪名     掉落的装备 攻   防  血  金币 经验 掉落装备编号 掉落概率 后面这俩不能改 
//  gl= {"格伦石人","石铠甲",  30, 150,1000,500, 250,      11,       7,           1,0},gl= {"格伦石人","石铠甲",30,150,1000,500,250,11,7,1,0},zhizhu= {"洞穴蜘蛛","蜘蛛毒剑",140,20,250,400,200,12,5,1,0},ymr= {"野蛮人","粗制石剑",20,20,150,100,50,13,5,1,0},nz= {"牛仔","战斗马甲",80,20,250,500,250,14,10,1,0},strongman= {"森林巨人","传说圣甲",50,50,580,200,100,1,5,1,0},witch= {"兽人","重甲",35,55,250,50,50,2,4,1,1},xiyi= {"森林蜥蜴","铁甲",20,25,80,30,35,3,8,2,2},big_strongman= {"熔岩巨龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},lion= {"皇家士兵","尚方宝剑",100,30,380,200,100,5,5,1,0},horse= {"独眼巨人","碧血战锤",50,22,360,50,50,6,5,1,1},bee= {"草原剑客","西洋剑",27,11,60,30,35,7,5,2,2},shitu= {"凋零女巫","凋零之心",1400,500,15000,10000,5000,10,10,1,0},dljs= {"凋零巨兽","凋零之心",1200,700,20000,10000,5000,10,7,1,0},pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},cl= {"中华长龙","\0",450,50*10,2000,3500,2500,0,0,1,0},jl= {"东方金龙","万龙甲",500,40*20,5000,8000,4500,9,6,6,1},gst={"凋零共生体","\0",1800,65*10,15000,0,10000,0,0,1,0},dlkl= {"凋零骷髅","\0",3000,30*10,12000,0,10000,0,0,1,0},dlfb= {".+*凋零风暴*+.","\0",9000,1500,49000,0,500000,0,0,1,0},guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=400,fang5n=0,fang6=150,fang6n=0,fang7=60,fang7n=0;
int gong=0,gong1=10,gong1n=0,gong2=20,gong2n=0,gong3=45,gong3n=0,gong4=100,gong4n=0,gong5=300,gong5n=0,gong6=150,gong6n=0,gong7=35,gong7n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
int diaolingxin=0; 
char gongname[20]="无",fangname[20]="无";
char proof;void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);int main()
{
MessageBox (NULL, "欢迎来到斗破苍穹 2.10.3 正式版 !", "斗破苍穹 2.10.3 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("                _.+=*^--{|欢迎来到 [斗破苍穹] 2.10.3 正式版|}--^*=+.              ");system("color 89");
printf("                          ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                      \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(1000);
printf("这里是斗破苍穹(苍穹世界)! 契晋赫苟国的漓嘉茜公主被神秘人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0){printf("\n\n\n封印多年的zty族血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");player.attack=99999;player.defense=99999;player.health=999999;player.max_health=999999;
}
getchar();OrdinaryAct();
return 0;
}int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨龙晶石%d个 12,免死金牌%d个 13,凋零之心%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi,diaolingxin);system("color 8A");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200)
{printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60; 
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1)
{
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200)
{
if(player.level>197&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100; 
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200)
{
if(player.level>192&&player.level<200)
{
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200; 
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<200)
{
if(player.level>482&&player.level<500)
{
int sheng;
sheng=500-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400; 
player.attack+=60;
player.defense+=40;
player.health+=999999;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过500级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
printf("使用免死金牌,HP满\n\n\n");system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
break;
case 13:
if(diaolingxin>0)
{
printf("使用凋零之心\nHP+100  攻击+100\n\n\n");system("color 8b");
diaolingxin--;
player.health+=100;
player.attack+=100; 
}else printf("没有凋零之心了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");system("color 8C");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"*凋零巨兽*")==0)
{
printf("你把公主救了出来\n\n你从公主口中得知了一个更大的阴谋,你可以进入凋零世界\n\n");system("color 8C");}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
case 10:
diaolingxin++;
break;
case 11:
fang6n++;
break;
case 12:
gong6n++;
break;
case 13:
gong7n++;
break;
case 14:
fang7n++;
break;
default:
printf("AddWupin error\n\n\n");
}}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/150;
int l2=player.range_exp/375;
int l3=player.range_exp/750;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,打开后台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
printf("1,小郑子酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");system("color 89");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");system("color 89");
printf("铁甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%n 4,碧血战锤:%d个 5,蜘蛛毒剑:%n个 6,尚方宝剑:%d个 7,皮卡大剑:%d个\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个 15,巨龙晶石:%d个\n 0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong7n>=shu)
{
gong7n=gong7n-shu;
money=money+shu*800;
printf("粗制石剑:%d\n",gong7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong6n>=shu)
{
gong6n=gong6n-shu;
money=money+shu*1000;
printf("蜘蛛毒剑:%d\n",gong6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang7n>=shu)
{
fang7n=fang7n-shu;
money=money+shu*1000;
printf("战斗马甲:%d\n",fang7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 12:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang6n>=shu)
{
fang6n=fang6n-shu;
money=money+shu*2000;
printf("石凯甲:%d\n",fang6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 13:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}case 14:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("万龙甲:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 15:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★★★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★★\n\n 5,炽热炎洞 危险程度:★★★★★\n\n 6,皮卡营地 危险程度★★★★★★\n\n 7,花朵宫殿 危险程度:★★★★★★\n\n 8,五千龙穴 危险程度:★★★★★★★\n\n 9,凋零宇宙 危险程度:★★★★★★★★\n\n0,离开\n");system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<4)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
battle=1;
guai=zhizhu;
printf("可怕的%s爬了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<=3){
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
} else if(s<8){
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=zhizhu;
printf("可怕的%s扑爬了过来!\n\n\n",guai.name);
BattleAct();
} 
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<=3){
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else if(s<8){
battle=1;
guai=ymr;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7){
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();}
else{
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 6:
s=SuiJi();
if(s<7){
battle=1; 
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9){
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1; 
guai=cl;
printf("一条长龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1; 
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的长龙盘旋空中,你定睛一看,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<5)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
if(strongman_arm>=1)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 9:
s=SuiJi();
if(diaolingxin!=0){
if(s==1)
{
battle=1; 
guai=dlfb;
printf("一个巨大的黑暗物体,周围环绕着大量的由破碎方块组成的黑色颗粒云环的%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else if(s<=2 && s<=4)
{
battle=1; 
guai=dlkl;
printf("手持凋零剑的黑色凶恶%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=5&&s>=7){
battle=1;
guai=gst;
printf("一个巨大的触手向你打来,你挡了下来%s扑了过来!\n\n\n",guai.name);
BattleAct();
} else{
battle=1;
guai=dljs;
printf("一只巨大的猛兽%s冲了过来!\n\n\n",guai.name);
BattleAct();
}
}if(diaolingxin==0){
cout<<"你没有凋零之心,需要击败凋零巨兽" <<endl;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%d个 4,碧血战锤:%d个 5,蜘蛛毒剑:%d个 6,尚方宝剑:%d个 7,雷霆之刃:%d个\n\n\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,万龙甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong7n>=1){
printf("拿起了粗制石剑\n\n\n");
gong=gong7;
strcpy(gongname,"粗制石剑");
}
else printf("你没有粗制石剑可以装备\n\n\n");
break;
case 4:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 5:
if(gong6n>=1){
printf("拿起了蜘蛛毒剑\n\n\n");
gong=gong6;
strcpy(gongname,"蜘蛛毒剑");
}
else printf("你没有蜘蛛毒剑可以装备\n\n\n");
break;
case 6:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 7:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 8:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 9:
if(fang2n>=1){
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 10:
if(fang7n>=1){
printf("穿上了战斗马甲\n\n\n");
fang=fang7;
strcpy(fangname,"战斗马甲");
}
else printf("你没有战斗马甲可以装备\n\n\n");
break;
case 11:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 12:
if(fang6n>=1){
printf("穿上了石铠甲\n\n\n");
fang=fang6;
strcpy(fangname,"石凯甲");
}
else printf("你没有石凯甲可以装备\n\n\n");
break;
case 13:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 14:
if(fang5n>=1){
printf("穿上了万龙甲\n\n\n");
fang=fang5;
strcpy(fangname,"万龙甲");
}
else printf("你没有万龙甲可以装备\n\n\n");
break; 
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界(斗破苍穹)。为了给您更好的游戏体验,zty时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“zty ”(不包括双引号)。由于2.10.2版本巨龙晶石的buy,我们在2.10.2的基础上进行修改,已修复该buy。并且修改了巨龙晶石的升级上限,希望大家喜欢。在这里要感谢吴昊同学,他给了我们许多宝贵的建议,谢谢。\n");system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
break;
case 7:int mi;cout<<"=====*【后台管理 简称开挂 测试Bug】*=================================\n请输入管理者密码===================================*【想要后台密码就问郑桐羽,只能输数字,否则死循环】*===============\n管理密码:";cin>>mi;if(mi%20120913==0){cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加999999\n2.血量上限加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n211.退出\n=======================\n输入>>> "<<endl;cin>>htsr;if(htsr==1){cout<<"成功获得效果 *金币加9999\n";money+=999999;}if(htsr==2){cout<<"成功获得效果 *血量加9999\n";player.health+=9999;}if(htsr==3){cout<<"成功获得效果 *血量上限加9999\n";player.max_health+=9999;}if(htsr==4){cout<<"成功获得效果 *攻击加9999\n";player.attack+=9999;}if(htsr==5){cout<<"成功获得效果 *防御加9999\n";player.defense+=9999;}if(htsr%211==0){cout<<"成功退出\n";continue;}}else{cout<<"输入错误!请检查!"<<endl;continue;}break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
} 

2.10.5

#include<stdio.h>
#include<iostream>
#include<ctime>
#include<bits/stdc++.h>
#include<time.h> 
#include<windows.h> //SLEEP函数
using namespace std;
struct Player {//玩家结构体,并初始化player
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",100,80,200,200,1,0,0,100};
struct Enemy {//怪的结构体,并初始化各种怪
char name[20];
char wupin[20];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
}
//怪,拿格伦石人举例 
// 怪变量  怪名     掉落的装备 攻   防  血  金币 经验 掉落装备编号 掉落概率 真伤(被防御后的破甲伤害)   不能改 
//  gl= {"格伦石人","石铠甲",  30, 150,1000,500, 250,      11,       7,        1,                         0},gl= {"格伦石人","石铠甲",30,150,1000,500,250,11,7,1,0},zhizhu= {"洞穴蜘蛛","蜘蛛毒剑",140,20,250,400,200,12,5,1,0},ymr= {"野蛮人","粗制石剑",20,20,150,100,50,13,5,1,0},nz= {"牛仔","战斗马甲",80,20,250,500,250,14,10,1,0},strongman= {"森林巨人","传说圣甲",50,50,580,200,100,1,5,1,0},witch= {"兽人","重甲",35,55,250,50,50,2,4,1,1},xiyi= {"毒蜴","鳞甲",20,25,80,30,35,3,8,2,2},big_strongman= {"喷火龙","巨龙晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},lion= {"皇家士兵","尚方宝剑",100,30,380,200,100,5,5,1,0},horse= {"独眼巨人","碧血战锤",50,22,360,50,50,6,5,1,1},bee= {"剑客","西洋剑",27,11,60,30,35,7,5,2,2},shitu= {"凋零女巫","凋零通行证",1400,500,15000,10000,5000,15,10,1,0},dljs= {"凋零巨兽","凋零之心",1200,700,20000,10000,5000,10,7,1,0},pika= {"皮卡超人","\0",300,40*8,1000,2000,1000,0,0,1,0},dapika= {"雷霆皮卡","雷霆之刃",350,40*10,1500,3000,2000,8,6,6,0},cl= {"熔岩飞龙","\0",450,50*10,2000,3500,2500,0,0,1,0},jl= {"裂凯金龙","金龙铠",500,40*20,5000,8000,4500,9,6,6,1},gst={"凋零共生体","\0",1800,65*10,15000,0,10000,0,0,1,0},dlkl= {"凋零骷髅","\0",3000,30*10,12000,0,10000,0,0,1,0},dlfb= {".+*凋零风暴*+.","\0",9000,1500,49000,0,500000,0,0,1,0},guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,te1,te2,te3,te4;
} place= {1,2,3,4,5,6,7,8,9,10,11,12};
int max_exp=0;
int htsr;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=10;
int cao=3,jijiubao=3,baiyao=3,superbaiyao=3,miansi=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=400,fang5n=0,fang6=150,fang6n=0,fang7=60,fang7n=0;
int gong=0,gong1=10,gong1n=0,gong2=20,gong2n=0,gong3=45,gong3n=0,gong4=100,gong4n=0,gong5=300,gong5n=0,gong6=150,gong6n=0,gong7=45,gong7n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0,htmmcs=5;
int diaolingxinhave=0,diaolingxin=0; 
char gongname[20]="无",fangname[20]="无";
char proof;
void AddWupin(int);
int AttackResult();
void BattleAct();  //      ____
void ChooseWupin();  //   /___/|
void DisplayState();  //  |   |/
void OrdinaryAct();     //▔▔
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);
int main(){
MessageBox (NULL, "欢迎来到斗破苍穹 2.10.5 正式版 !", "斗破苍穹 2.10.5 游戏开始提示", MB_OK);
int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("                            _________________________________                    ");system("color 89");
printf("                          /________________________________/|                    ");system("color 89");
printf("                _.+=*^--{|欢迎来到 [斗破苍穹] 2.10.5 正式版|}--^*=+.              ");system("color 89");
printf("                          ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔                      \n");system("color 89");
//如果想使用外挂,名字请输入:“zty ”。
Sleep(1000);
printf("这里是斗破苍穹(苍穹世界)! 契晋赫苟国的漓嘉茜公主被神秘人绑架了!\n\n\n 伟大的勇者啊~拿起你的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");system("color 89");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"zty")==0){printf("\n\n\n封印多年的zty族血统啊!你终于觉醒了!\n\n\nzty,你成为了天选之人,请你救出公主吧!\n\n\n");player.attack=99999;player.defense=99999;player.health=999999;player.max_health=999999;
}
getchar();
OrdinaryAct();
return 0;
}
int SuiJi(){
srand((unsigned)time(NULL));
return rand()%10;
}
int SuiJi100(){
srand((unsigned)time(NULL));
return rand()%100;
}
void ChooseWupin(){//选择物品 并使用
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨龙晶石%d个 12,免死金牌%d个 13,凋零之心%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm,miansi,diaolingxin);system("color 8A");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(cao>0){
printf("使用止血草,HP增加120\n\n\n");system("color 8A");
cao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有止血草了\n\n\n");system("color 8A");
break;
case 2:
if(jijiubao>0){
printf("使用急救包,HP增加180\n\n\n");system("color 8A");
jijiubao--;
if(player.health+180>player.max_health)player.health=player.max_health;
else player.health+=180;
}
else printf("没有急救包了\n\n\n");system("color 8A");
break;
case 3:
if(baiyao>0){
printf("使用云南白药,HP增加240\nz\n\n");system("color 8A");
baiyao--;
if(player.health+240>player.max_health)player.health=player.max_health;
else player.health+=240;
}
else printf("没有云南白药了\n\n\n");system("color 8A");
break;
case 4:
if(superbaiyao>0){
printf("使用超级云南白药,HP增加400\n\n\n");system("color 8A");
superbaiyao--;
if(player.health+400>player.max_health)player.health=player.max_health;
else player.health+=400;
}
else printf("没有超级云南白药了\n\n\n");system("color 8A");
break;
case 5:
if(battle){//在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
if(boom>0){
printf("使用手雷,敌人HP减少100\n\n\n");system("color 84");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");system("color 84");
break;
case 6:
if(battle){ //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
if(dubiao>0){
printf("使用毒标,敌人HP减少200\n\n\n");system("color 84");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");system("color 84");
break;
case 7:
if(battle){ //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
if(atom_boom>0){
printf("使用手抛式原子弹,敌人HP减少1500\n\n\n");system("color 84");
atom_boom--;
guai.health-=1500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");system("color 84");
break;
case 8:
if(jingyancao>0 && player.level<200){
printf("使用经验草,等级增加3级\n\n\n");system("color 8E");
jingyancao--;
player.max_health=player.max_health+60; 
player.attack+=9;
player.defense+=6;
player.level+=3;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
else    if(jingyancao<1){
printf("没有经验草了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 9:
if(jingyanbao>0 && player.level<200){
if(player.level>197&&player.level<200){
int sheng;
sheng=100-player.level;
player.level+=sheng;
jingyanbao--;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验包,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else{
printf("使用经验包,等级增加5级\n\n\n");system("color 8E");
jingyanbao--;
player.max_health=player.max_health+100; 
player.attack+=15;
player.defense+=10;
player.level+=5;
player.health=player.max_health;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(jingyanbao<1){
printf("没有经验包了");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 10:
if(jingyanshi>0 && player.level<200){
if(player.level>192&&player.level<200){
int sheng;
sheng=100-player.level;
player.level+=sheng;
player.max_health+=sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用经验石,等级增加%d级\n",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else{
printf("使用经验石,等级增加10级\n");system("color 8E");
jingyanshi--;
player.max_health=player.max_health+200; 
player.attack+=30;
player.defense+=20;
player.level+=10;
player.health=player.max_health;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");system("color 8E");
}
else printf("等级超过200级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 11:
if(strongman_arm>0 && player.level<200)
{
if(player.level>482&&player.level<500)
{
int sheng;
sheng=500-player.level;
player.level+=sheng;
player.max_health=player.max_health+sheng*20; 
player.attack+=sheng*3;
player.defense+=sheng*2;
player.health=player.max_health;
printf("使用巨龙晶石,等级增加%d级",sheng);system("color 8E");
printf("等级:%d\n",player.level);system("color 8E");
}
else
{
printf("使用巨龙晶石,等级增加20级\n\n\n");system("color 8E");
strongman_arm--;
player.max_health=player.max_health+400; 
player.attack+=60;
player.defense+=40;
player.health=player.max_health;
player.level+=20;
printf("等级:%d\n",player.level);system("color 8E");
}
}
else if(strongman_arm<1)
{
printf("没有巨龙晶石了。\n\n\n");system("color 8E");
}
else printf("等级超过500级,修为太高,无法使用。\n\n\n");system("color 8E");
break;
case 12:
if(miansi>0)
{
printf("使用免死金牌,HP满\n\n\n");system("color 8b");
miansi--;
if(player.health+999999>player.max_health)player.health=player.max_health;
else player.health+=999999;
}else printf("没有免死金牌了\n\n\n"); system("color 8b");break;
break;
case 13:
if(diaolingxin>0)
{
printf("使用凋零之心\nHP上限+100  攻击+100\n\n\n");system("color 8b");
diaolingxin--;
player.max_health+=100;
player.attack+=100; 
}else printf("没有凋零之心了\n\n\n"); system("color 8b");break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);system("color 8C");
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");system("color 8C");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"*凋零巨兽*")==0)
{
printf("你把公主救了出来\n\n你从公主口中得知了一个更大的阴谋,你可以进入凋零世界\n\n");system("color 8C");}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);system("color 8C");
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);system("color 8C");
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);system("color CC");
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm++;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
fang5n++;
break;
case 10:
diaolingxin++;
break;
case 11:
fang6n++;
break;
case 12:
gong6n++;
break;
case 13:
gong7n++;
break;
case 14:
fang7n++;
break;
case 15:
diaolingxinhave++;
break;
default:
printf("AddWupin error\n\n\n");
}}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/150;
int l2=player.range_exp/375;
int l3=player.range_exp/750;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);system("color 8E");
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);system("color 8E");
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
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);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);system("color 8E");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");system("color 89");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 7,打开后台 0,退出游戏\n\n\n");system("color 89");
puts("=============================================================================");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");system("color 89");
printf("1,小郑子酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);system("color 89");
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");system("color 89");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<=0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");system("color 89");
break;
default:
printf("hotel talk error!\n\n\n");system("color 89");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");system("color 89");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,西洋剑¥500 3,碧血战锤¥1000\n\n\n");system("color 89");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");system("color 89");
printf("匕首:%d个\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("西洋剑+1\n");system("color 89");
printf("西洋剑:%d个\n",gong2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血战锤+1\n");system("color 89");
printf("碧血战锤:%d个\n",gong3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
default:
printf("对不起,我们只会打造以上武器。");system("color 89");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,重甲¥1000\n\n\n");system("color 89");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");system("color 89");
printf("布衣:%d个\n",fang1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");system("color 89");
printf("铁甲:%d个\n",fang2n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("重甲+1\n");system("color 89");
printf("重甲:%d个\n",fang3n);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
default:
printf("对不起,我们只会打造以上防具。");system("color 89");
break;}
printf("金币:%d\n",money);system("color 89");
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");system("color 89");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");system("color 89");
printf("手雷:%d\n",boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d",money);system("color 89");
}
break;
case 2:
if(money>=600 && dubiao<9999999)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");system("color 89");
printf("毒镖:%d\n",dubiao);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}
break;
case 3:
if(money>=1000 && atom_boom<5)
{
atom_boom=atom_boom+1;
money=money-1000;
printf("手抛式原子弹+1\n");system("color 89");
printf("手抛式原子弹:%d\n",atom_boom);system("color 89");
printf("金币:%d\n",money);system("color 89");
}
else
{
printf("钱不够!\n\n\n");system("color 89");
printf("金币:%d\n",money);system("color 89");
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");system("color 89");
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%n 4,碧血战锤:%d个 5,蜘蛛毒剑:%n个 6,尚方宝剑:%d个 7,皮卡大剑:%d个\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,金龙铠:%d个 15,巨龙晶石:%d个\n 0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n,strongman_arm);system("color 89");
int pai,shu,i;
scanf("%d",&pai);system("color 89");
switch(pai)
{
case 1:
printf("请问您要出售几件?");system("color 89");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);system("color 89");
printf("金币:%d\n",money);system("color 89");
break;
}
else
{
printf("装备数不够,无法出售!\n");system("color 89");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("西洋剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 3:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong7n>=shu)
{
gong7n=gong7n-shu;
money=money+shu*800;
printf("粗制石剑:%d\n",gong7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 4:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血战锤:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 5:
printf("请问您要出售几件?\n");system("color 89");
scanf("%d",&shu);
if(gong6n>=shu)
{
gong6n=gong6n-shu;
money=money+shu*1000;
printf("蜘蛛毒剑:%d\n",gong6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("尚方宝剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 7:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*3000;
printf("皮卡大剑:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 10:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang7n>=shu)
{
fang7n=fang7n-shu;
money=money+shu*1000;
printf("战斗马甲:%d\n",fang7n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 11:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("重甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 12:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang6n>=shu)
{
fang6n=fang6n-shu;
money=money+shu*2000;
printf("石凯甲:%d\n",fang6n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 13:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang4n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("传说圣甲:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}case 14:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang5n>=shu)
{
fang5n=fang5n-shu;
money=money+shu*3000;
printf("金龙铠:%d\n",fang5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 15:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*4000;
printf("巨龙晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
case 0:
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★★★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★★\n\n 5,炽热炎洞 危险程度:★★★★★\n\n 6,皮卡营地 危险程度★★★★★★\n\n 7,花朵宫殿 危险程度:★★★★★★\n\n 8,熔岩龙穴 危险程度:★★★★★★★\n\n 9,凋零宇宙 危险程度:★★★★★★★★\n\n0,离开\n");system("color 8c");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<4)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
battle=1;
guai=zhizhu;
printf("可怕的%s爬了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<=3){
battle=1;
guai=strongman;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
} else if(s<8){
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=zhizhu;
printf("可怕的%s扑爬了过来!\n\n\n",guai.name);
BattleAct();
} 
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<=3){
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else if(s<8){
battle=1;
guai=ymr;
printf("横冲直撞的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}else{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<5){
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<7){
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();}
else{
battle=1;
guai=gl;
printf("全身长满矿石的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 6:
s=SuiJi();
if(s<7){
battle=1; 
guai=pika;
printf("你感到了强烈的电流涌入全身,%s走了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9){
battle=1;
guai=dapika;
printf("天空一声巨响,三道闪电劈到%s的身上,%s手持雷霆之刃冲了过来!\n\n\n",guai.name,guai.name);
BattleAct();
}
else{
printf("这里安全\n\n\n");
}
break;
case 8:
s=SuiJi();
if(s<=3)
{
battle=1; 
guai=cl;
printf("一条飞龙横卧洞内,你定睛一看,是%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<=8 && s>=4)
{
battle=1; 
guai=big_strongman;
printf("炽热的%s拍打着翅膀扑了过来!\n\n\n",guai.name);
BattleAct();
}
else {
battle=1;
guai=jl;
printf("一条金光闪闪的飞龙盘旋空中,,是传说中的%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
break;
case 7:
place_sign=place.grass3;
s=SuiJi();
if(s<5)
{
battle=1;
guai=lion;
printf("%s举着尚方宝剑拦住了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<7)
{
battle=1;
if(strongman_arm>=1)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨龙晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("瞬间,你被一团黑雾笼罩,你被拉入了凋零幻境,%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨龙晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
battle=1;
guai=nz;
printf("帅气但令人讨厌的%s向你开枪!\n\n\n",guai.name);
BattleAct();
}
break;
case 9:
s=SuiJi();
if(diaolingxinhave!=0){
if(s==1)
{
battle=1; 
guai=dlfb;
printf("一个巨大的黑暗物体,周围环绕着大量的由破碎方块组成的黑色颗粒云环的%s向你发起攻击!\n\n\n",guai.name);
BattleAct();
}
else if(s>=2 && s<=4)
{
battle=1; 
guai=dlkl;
printf("手持凋零剑的黑色凶恶%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s>=5&&s<=7){
battle=1;
guai=gst;
printf("一个巨大的触手向你打来,你挡了下来%s扑了过来!\n\n\n",guai.name);
BattleAct();
} else{
battle=1;
guai=dljs;
printf("一只巨大的猛兽%s冲了过来!\n\n\n",guai.name);
BattleAct();
}
}if(diaolingxin==0){
cout<<"你没有击败过凋零女巫,请去花朵宫殿击败凋零女巫。" <<endl;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");system("color 89");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");system("color 89");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); system("color 89");//显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");system("color 89");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");system("color 89");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");system("color 89");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,伏特加80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");system("color 89");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(money<25){
printf("钱不够!");system("color 89");
}
else
{
if(player.health+20<=player.max_health){
printf("HP+20.");system("color 89");
money-=25;
player.health+=20;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80){
printf("钱不够!");system("color 89");
}
else{
if(player.health+50<=player.max_health){
printf("HP+50.");system("color 89");
money-=80;
player.health+=50;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150){
printf("钱不够!");system("color 89");
}
else{
if(player.health+100<=player.max_health){
printf("HP+100.");system("color 89");
money-=150;
player.health+=100;
}
else{
printf("HP满了");system("color 89");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");system("color 89");
break;
default:
printf("输入错误\n\n\n");system("color 89");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");system("color 89");
int mai;
scanf("%d",&mai);
if(mai==1){
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");system("color 89");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi){
case 1:
if(money>=100&&cao<6){
cao++;
money=money-100;
printf ("止血草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 2:
if(money>=150&&jijiubao<10){
jijiubao++;
money=money-150;
printf ("急救包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 3:
if(money>=250&&baiyao<10){
baiyao++;
money=money-250;
printf ("云南白药+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 4:
if(money>=400&&superbaiyao<10){
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");system("color 89");}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 5:
if(money>=150){
jingyancao++;
money=money-150;
printf ("经验草+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 6:
if(money>=300){
jingyanbao++;
money=money-300;
printf ("经验包+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
case 7:
if(money>=500){
jingyanshi++;
money=money-500;
printf ("经验石+1\n");system("color 89");
}
else{
printf("钱不够!\n");system("color 89");
}
break;
}
case 0:
printf("金币:%d\n",money);system("color 89");
printf("再见,欢迎下次再来!\n");system("color 89");
break;}
if(mai==2){
printf("药品商人:去去去,老子没时间陪你聊。\n");system("color 89");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");system("color 89");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,西洋剑:%d个 3,粗制石剑:%d个 4,碧血战锤:%d个 5,蜘蛛毒剑:%d个 6,尚方宝剑:%d个 7,雷霆之刃:%d个\n\n\n",gong1n,gong2n,gong7n,gong3n,gong6n,gong4n,gong5n);system("color 89");
printf("防御装备: 8,布衣:%d个 9,铁甲:%d个 10,战斗马甲:%d个 11,重甲:%d个 12,石铠甲:%d个 13,传说圣甲:%d个 14,金龙铠:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang7n,fang3n,fang6n,fang4n,fang5n);system("color 89");
printf("选择要装备的武器或防具:\n\n\n");system("color 89");
switch(scanf("%d",&choose_number),choose_number){
case 1:
if(gong1n>=1){
printf("拿起了匕首\n\n\n");system("color 89");
gong=gong1;
strcpy(gongname,"匕首");system("color 89");
}
else printf("你没有匕首可以装备\n\n\n");system("color 89");
break;
case 2:
if(gong2n>=1){
printf("拿起了西洋剑\n\n\n");system("color 89");
gong=gong2;
strcpy(gongname,"西洋剑");system("color 89");
}
else printf("你没有西洋剑可以装备\n\n\n");system("color 89");
break;
case 3:
if(gong7n>=1){
printf("拿起了粗制石剑\n\n\n");
gong=gong7;
strcpy(gongname,"粗制石剑");
}
else printf("你没有粗制石剑可以装备\n\n\n");
break;
case 4:
if(gong3n>=1){
printf("拿起了碧血战锤\n\n\n");
gong=gong3;
strcpy(gongname,"碧血战锤");
}
else printf("你没有碧血战锤可以装备\n\n\n");
break;
case 5:
if(gong6n>=1){
printf("拿起了蜘蛛毒剑\n\n\n");
gong=gong6;
strcpy(gongname,"蜘蛛毒剑");
}
else printf("你没有蜘蛛毒剑可以装备\n\n\n");
break;
case 6:
if(gong4n>=1){
printf("拿起了尚方宝剑\n\n\n");
gong=gong4;
strcpy(gongname,"尚方宝剑");
}
else printf("你没有尚方宝剑可以装备\n\n\n");
break;
case 7:
if(gong5n>=1){
printf("拿起了雷霆之刃\n\n\n");
gong=gong5;
strcpy(gongname,"雷霆之刃");
}
else printf("你没有雷霆之刃可以装备\n\n\n");
break;
case 8:
if(fang1n>=1){
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 9:
if(fang2n>=1){
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 10:
if(fang7n>=1){
printf("穿上了战斗马甲\n\n\n");
fang=fang7;
strcpy(fangname,"战斗马甲");
}
else printf("你没有战斗马甲可以装备\n\n\n");
break;
case 11:
if(fang3n>=1){
printf("穿上了重甲\n\n\n");
fang=fang3;
strcpy(fangname,"重甲");
}
else printf("你没有重甲可以装备\n\n\n");
break;
case 12:
if(fang6n>=1){
printf("穿上了石铠甲\n\n\n");
fang=fang6;
strcpy(fangname,"石凯甲");
}
else printf("你没有石凯甲可以装备\n\n\n");
break;
case 13:
if(fang4n>=1){
printf("穿上了传说圣甲\n\n\n");
fang=fang4;
strcpy(fangname,"传说圣甲");
}
else printf("你没有传说圣甲可以装备\n\n\n");
break;
case 14:
if(fang5n>=1){
printf("穿上了金龙铠\n\n\n");
fang=fang5;
strcpy(fangname,"金龙铠");
}
else printf("你没有金龙铠可以装备\n\n\n");
break; 
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩斗破苍穹(苍穹世界)。为了给您更好的游戏体验,zty时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“zty ”(不包括双引号)。由于2.10.4版本凋零之心和巨龙晶石剩余的buy和凋零宇宙无法刷出凋零共生体的bug,我们在2.10.4的基础上进行修改,已修复该bug。并且修改了部分怪和场景的名称,希望大家喜欢。在这里要感谢吴昊同学,他给了我许多宝贵的建议,谢谢。\n");system("color 89");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");system("color 89");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y'){
printf("按回车退出");system("color 89");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
break;
case 7:int mi;cout<<"=====*【后台 开挂 测试Bug】*=================================\n请输入密码===================================*【想要后台密码问郑桐羽,只能输数字,否则死循环】*===============\n密码:";cin>>mi;if(mi%20120913==0){cout<<"输入正确!\n欢迎进入后台!\n后台服务:\n=======================\n1.金币加999999\n2.血量上限加9999\n3.现有血量加9999\n4.攻击加9999\n5.防御加9999\n0.退出\n=======================\n输入>>> "<<endl;cin>>htsr;if(htsr==1){cout<<"成功获得效果 *金币加9999\n";money+=999999;}if(htsr==2){cout<<"成功获得效果 *血量加9999\n";player.health+=9999;}if(htsr==3){cout<<"成功获得效果 *血量上限加9999\n";player.max_health+=9999;}if(htsr==4){cout<<"成功获得效果 *攻击加9999\n";player.attack+=9999;}if(htsr==5){cout<<"成功获得效果 *防御加9999\n";player.defense+=9999;}if(htsr==0){cout<<"成功退出\n";continue;}}else{cout<<"输入错误!请检查!"<<endl;continue;}break;
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
} 

相关文章:

[C++] 小游戏 斗破苍穹 2.2.1至2.11.5所有版本(中) zty出品

目录 2.8.2 2.9.1 2.10.1 2.10.2 2.10.3 2.10.4 2.10.5 2.8.2 #include<stdio.h> #include<iostream> #include<ctime> #include<bits/stdc.h> #include<time.h> //suiji #include<windows.h> //SLEEP函数 using namespace std; st…...

Javaweb---HTTPS

题记 为了保护数据的隐私性我们引入了HTTPS 加密的方式都有那些呢? 1.对称加密: 加密和解密使用的密钥是同一个密钥 2.非对称加密:有两个密钥(一对),分为公钥和私钥(公钥是公开的,私钥是要藏好的) HTTPS的工作过程(旨在对body和header进行加密) 1.对称加密 上述引出的…...

[已解决]ESP32-C3上传程序成功但没有反应的问题

ESP32-C3上传程序成功但没有反应的问题 ESP32-C3是一款功能强大的微控制器&#xff0c;常用于物联网&#xff08;IoT&#xff09;应用的开发和原型设计。然而&#xff0c;有时候在上传程序成功后&#xff0c;设备却没有任何反应&#xff0c;十分让人费解。通过各种尝试已解决这…...

使用 OCLint进行静态代码分析:一个完整的配置示例

文章目录 0. 概述1. 安装 oclint2. oclint配置文件3. 脚本详解3.1 禁用的规则列表3.2 需要启用的规则代码风格代码复杂性命名规范性能安全性其他 4. 检测执行1. 使用 CMake 生成 compile_commands.json2. 运行 Oclint 0. 概述 OCLint是一个静态代码分析工具&#xff0c;通过词…...

【Linux】线程的互斥

一、进程线程间的互斥相关的背景概念 临界资源&#xff1a;多线程执行流共享的资源就叫做临界资源临界区&#xff1a;每一个线程内部&#xff0c;访问临界资源的代码&#xff0c;就叫做临界区互斥&#xff1a;任何时刻&#xff0c;互斥保证有且只有一个执行流进入临界区&#…...

electron如何让你窗口总是显示在最前面【mac解决全屏窗口alwaysOnTop参数不起作用】

你创建了一个使用Electron框架的应用程序,并希望它在以下情况下始终保持可见: 在切换工作区(桌面)时可见在其他应用程序之上显示当其他应用程序全屏显示时,它也显示在顶部当Keynote处于演示模式时,它也能显示在顶部 特别是当Keynote处于演示模式时,要实现这一点比较困难…...

XR和Steam VR项目合并问题

最近有一个项目是用Steam VR开发的&#xff0c;里面部分场景是用VRTK框架做的&#xff0c;还有一部分是用SteamVR SDK自带的Player预制直接开发的。 这样本身没有问题&#xff0c;因为最终都是通过SteamVR SDK处理的&#xff0c;VRTK也管理好了SteamVR的逻辑&#xff0c;并且支…...

uni-app:利用Vue的原型对象Vue.prototype设置全局方法及其引用

一、在main.js中设置方法checkPermission绑定到Vue.prototype 核心代码 Vue.prototype.$checkPermission function(username) {console.log(Checking permission for:, username); }; 完整代码 import App from ./App// 添加 checkPermission 方法到 Vue.prototype 上,检查…...

django接入djangorestframework-simplejwt步骤

版本&#xff1a;django 4.2 python: 3.8 安装 pip install djangorestframework-simplejwtuser子应用models.py文件 from django.db import models from django.contrib.auth.models import AbstractUserclass User(AbstractUser):mobile models.CharField(max_length11, u…...

前端工程化工具系列(十)—— Browserslist:浏览器兼容性配置工具

Browserslist 是一个能够在不同的前端工具间共享目标浏览器的配置&#xff0c;各工具根据该配置进行代码转译等操作。 具体的这些前端工具为&#xff1a;Autoprefixer、Babel、postcss-preset-env、eslint-plugin-compat、stylelint-no-unsupported-browser-features、postcss-…...

双列集合底层源码

tips: 竖着的箭头&#xff1a;重写 横着的箭头&#xff1a;继承...

【Ardiuno】实验使用ESP32连接Wifi(图文)

ESP32最为精华和有特色的地方当然是wifi连接&#xff0c;这里我们就写程序实验一下适使用ESP32主板连接wifi&#xff0c;为了简化实验我们这里只做了连接部分&#xff0c;其他实验在后续再继续。 由于本实验只要在串口监视器中查看结果状态即可&#xff0c;因此电路板上无需连…...

优化家庭网络,路由器无线中继配置全攻略(中兴E1600无线中继设置/如何解决没有预埋有线网络接口的问题/使用闲置路由实现WIFI扩展)

文章目录 📖 介绍 📖🏡 演示环境 🏡📒 网络优化 📒📒 操作步骤 📒💡适用场景🚨 常见问题及解决方案⚓️ 相关链接 ⚓️📖 介绍 📖 在现代家庭生活中,WiFi已经渗透到我们生活的每一个角落,成为了日常生活中不可或缺的一部分。然而,不少用户常常遇到W…...

【ArcGIS微课1000例】0114:基于DEM地形数据整体抬升或下降高程

相关阅读:【GlobalMapper精品教程】083:基于DEM整体抬升或下降地形高程的两种方式 文章目录 一、任务分析二、栅格计算器简介三、地形整体修改四、注意事项一、任务分析 打开软件,加载配套实验数据中的0112.rar中的dem数据,如下所示,dem的高程范围为256.75~342.37米,现在…...

AGP4+ 打包运行闪退,AGP7+ 正常(has code but is marked native or abstract)

问题 安装应用&#xff0c;点击图标启动立马闪退&#xff01; 诡异的闪退&#xff1a;AGP4 打包运行闪退&#xff0c;AGP7 正常 unity 导出的 Android 日志两个主要点&#xff1a; com.android.boot.App 是 Android 的 application 子类&#xff0c;程序入口 java.lang.Class…...

ChatGPT3.5和ChatGPT4.0、ChatGPT4o对比

一、ChatGPT3.5、ChatGPT4.0、ChatGPT4o对比 目前ChatGPT有三个主要版本&#xff0c;分别是ChatGPT3.5、ChatGPT4.0、ChatGPT4o&#xff0c;这三个版本之间有什么差异呢&#xff1f; 对比项ChatGPT3.5ChatGPT4.0ChatGPT4o参数数量1750亿约1万亿未公开输入文本文本、图片文本、…...

【知识拓展】HTTP、WebSocket 和 RPC:区别与使用场景详解

在工作中&#xff0c;HTTP、WebSocket 和 RPC 是三种常见的协议或通信方式&#xff0c;根据资料查阅&#xff0c;本文主要记录它们的区别及其适用的使用场景 HTTP&#xff08;超文本传输协议&#xff09; 概述 HTTP&#xff08;Hypertext Transfer Protocol&#xff09;是一…...

C语言printf( ) 函数和 scanf( ) 函数格式符的修饰符 “*”有什么作⽤?

一、问题 在 printf( ) 函数和 scanf( ) 函数的格式修饰符有很多&#xff0c;以浮点型数据为例&#xff0c;有%f、%lf、 %3.0f、%.4f等。不同的修饰符表示不同的含义&#xff0c;那么修饰符“*”有什么含义呢&#xff1f; 二、解答 下⾯通过例⼦来证明⼀下这个格式符在 printf…...

java 使用WebClient发送https请求

核心逻辑 绕过ssl证书检查 具体操作 话不多说上代码 // 构建WebClient public static WebClient createWebClient() throws SSLException {SslContext context SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();HttpClient htt…...

Python 中的内存管理机制

Python 的内存管理机制主要由两个部分组成&#xff1a;垃圾回收机制和引用计数。 垃圾回收机制主要负责检测和回收不再被使用的内存。Python 使用的是自动垃圾回收机制&#xff0c;也就是说程序员不需要手动释放内存。Python 的垃圾回收机制采用了引用计数的方法来追踪和回收不…...

Mac电脑重置网络命令

在Mac电脑上重置网络设置可以通过终端命令来实现。以下是几种方法&#xff0c;包括刷新DNS缓存、重置网络接口&#xff0c;以及重置Wi-Fi设置。 刷新DNS缓存 要刷新DNS缓存&#xff0c;可以使用以下命令&#xff1a; sudo dscacheutil -flushcache; sudo killall -HUP mDNSR…...

C++期末复习总结(2)

目录 1.运算符重载 2.四种运算符重载 &#xff08;1&#xff09;关系运算符的重载 &#xff08;2&#xff09; 左移运算符的重载 &#xff08;3&#xff09;下标运算符的重载 &#xff08;4&#xff09;赋值运算符的重载 3.继承的方式 4.继承的对象模型 5.基类的构造 6…...

[word] word大括号怎么打两行 #其他#其他#微信

word大括号怎么打两行 Word给用户提供了用于创建专业而优雅的文档工具&#xff0c;帮助用户节省时间&#xff0c;并得到优雅美观的结果。 一直以来&#xff0c;Microsoft Office Word 都是最流行的文字处理程序。 作为 Office 套件的核心程序&#xff0c; Word 提供了许多易…...

【python】python指南(二):命令行参数解析器ArgumentParser

一、引言 对于算法工程师来说&#xff0c;语言从来都不是关键&#xff0c;关键是快速学习以及解决问题的能力。大学的时候参加ACM/ICPC一直使用的是C语言&#xff0c;实习的时候做一个算法策略后台用的是php&#xff0c;毕业后做策略算法开发&#xff0c;因为要用spark&#x…...

香橙派 Orange AIpro 测评记录视频硬件解码

香橙派 Orange AIpro 测评记录视频硬件解码 香橙派官网&#xff1a;http://www.orangepi.cn/ 收到了一块Orange Pi AIpro开发板&#xff0c;记录一下我的测评~测评简介如下&#xff1a;1.连接网络2.安装流媒体进行硬件解码测试3.安装IO测试 简介 Orange Pi AI Pro 是香橙派联合…...

四天工作制,比你想象的更近了一点

原文&#xff1a;Andrew Keshner - 2024.05.30 软件公司、大型企业甚至警察部门都在试验这一看似遥不可及的概念。 教育软件公司 Kuali 的会议精简&#xff0c;除非绝对必要&#xff0c;员工尽量避免安排会议。即使有会议&#xff0c;也鼓励员工跳过与自己工作无关的部分。在…...

(UE4.26)UE4的FArchive序列化入门

前言 序列化(Serialize)和反序列化(UnSerialize)是程序领域常见的概念。对于这两个词汇我理解的是 序列化(Serialize): 变量值(int, float, string等基本类型, 或者Array&#xff0c;Map&#xff0c;或者更复杂的复合体)存储为一个文件(二进制流, 二进制文件, json, xml等格式…...

Inpaint9.1软件下载附加详细安装教程

软件简介: Inpaint 是个人开发者Max开发的图片处理软件&#xff0c;可以高效去除水印&#xff0c;修复照片等。使用方法和操作都很简单&#xff0c;非常适合不会PS等软件的小白用户。 安 装 包 获 取 地 址&#xff1a; Iinpaint win版&#xff1a;​​https://souurl.cn/b…...

Unity 集成 FMOD 音频管理插件 2.02

Unity 集成 FMOD 音频管理插件 2.02 3. 集成教程&#xff1a;3.1 设置Unity项目3.2 设置FMOD项目3.3 设置 FMOD for Unity3.4 添加声音&#xff1a;卡丁车引擎3.5 添加声音&#xff1a;氛围3.6 添加声音&#xff1a;音乐3.7 删除现有音频3.8 下一步 10. 脚本 API 参考10.1 基础…...

Linux下线程的互斥与同步详解

&#x1f916;个人主页&#xff1a;晚风相伴-CSDN博客 &#x1f496;如果觉得内容对你有帮助的话&#xff0c;还请给博主一键三连&#xff08;点赞&#x1f49c;、收藏&#x1f9e1;、关注&#x1f49a;&#xff09;吧 &#x1f64f;如果内容有误或者有写的不好的地方的话&…...

做早餐的网站/直销怎么做才最快成功

1.启动cmd命令窗口&#xff0c;进入本机MySQL安装bin目录&#xff1a; 2.关闭本机的MySQL进程&#xff08;可以直接在任务管理器中找到并关闭进程&#xff09;也可以命令关闭&#xff1a; # 关闭MySQL服务D:\MySQL\bin>sc stop mysql3. 以安全模式启动MySQLD:\MySQL\bin>…...

网站多语言包/网站运营主要做什么

拦截器(Interceptor) 拦截器可以监听程序的一个或所有方法。拦截器对方法调用流提供了细粒度控制。可以在无状态会话bean、有状态会话bean 和消息驱动bean 上使用它们。拦截器可以是同一bean 类中的方法或是一个外部类。下面介绍如何在Session Bean 类中使用外部拦截器类。Hell…...

网站建设创作思路怎么写/长春网站优化团队

背景 上一篇我们详细介绍了使用monaco-editor来实现一个hello-world的示例,并详细介绍了其中涉及的资源加载,相关参数。本篇文章让我们一起学习如何设置编辑器的内容,获取编辑器的内容,和监听编辑器的内容改动。 设置值 书接上文,我们在上篇初始化了一个编辑器,并设置…...

网页设计毕业设计开题报告/北京seo不到首页不扣费

整数类型数据的运算函数一、bitshift 函数bitshift函数实现数据位移操作。bitshift(A,B)函数第二个参数为正&#xff0c;则对A的二进制数左移。第二个参数为负&#xff0c;则右移。bitshift(A,n,N),N表示移位后的数据最多只有N为&#xff0c;若超过N位&#xff0c;多余的位将被…...

网站备案 多ip/免费创建个人博客网站

学习目的及目标 掌握UDP原理和工作过程 掌握乐鑫ESP32的UDP的程序设计 主要掌握UDP源码过程UDP科普(来自百度百科)UDP 是User Datagram Protocol的简称&#xff0c; 中文名是用户数据报协议&#xff0c;是OSI(Open System Interconnection&#xff0c;开放式系统互联) 参考模型…...

电子商务网站建设选择/seo网站优化价格

在现实世界中&#xff0c;经常有属于同一类的对象。例如&#xff0c;你的自行车 只是世界上很多自行车中的一辆。在面向对象软件中&#xff0c;也有很 多共享相同特征的不同的对象&#xff1a;矩形、雇用记录、视频剪辑 等。可以利用这些对象的相同特征为它们建立一个蓝图。对象…...