- 问答
- 2018-01-31 13:34:34 @
题解
10 条评论
-
______________ LV 6 @ 2018-06-02 15:50:17
#include<stdio.h>
#include<ctime>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
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[12];
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,2,1,0},
witch= {"森林女巫","银甲",25,15,100,50,50,2,2,1,1},
xiyi= {"森林蜥蜴","铁甲",18,10,50,30,35,3,3,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,2,1,0},
horse= {"草原野马","碧血剑",28,12,90,50,50,6,2,1,1},
bee= {"草原黄蜂","长剑",17,11,60,30,35,7,3,2,2},
shitu= {"使徒","\0",60*8,30*8,280*8,200*8,100*8,9,1,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;
} place= {1,2,3,4,5,6,7,8};int max_exp=0;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=9;
int cao=3,jijiubao=2,baiyao=2,superbaiyao=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;
int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0;
int jingyancao=0,jingyanbao=0,jingyanshi=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()
{int i=0,j=0,k=0;
char player_name[21];
printf("---------------------------------[末日团队]出品--------------------------------\n\n\n");
printf("无论你是会做游戏,还是想玩游戏,请加我QQ:1392042949");
Sleep(1000);
printf("--------------------------欢迎来到 [苍穹世界] 2.2 测试版-----------------------\n\n\n");
//如果想使用外挂,名字请输入:“圣战斗士 ”。
Sleep(1000);
printf("这里是苍穹世界! 雅莉萨斯国的罗茜公主被陌生人绑架了!\n\n\n 伟大的勇者啊~拿起你们的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"圣战斗士")==0)
{
printf("\n\n\n封印多年的圣剑血统啊!你终于觉醒了!\n\n\n圣战斗士,你成为了天选之人,请你救出公主吧!\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个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm);
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加60\n\n\n");
cao--;
if(player.health+60>player.max_health)player.health=player.max_health;
else player.health+=60;
}
else printf("没有止血草了\n\n\n");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加80\n\n\n");
jijiubao--;
if(player.health+80>player.max_health)player.health=player.max_health;
else player.health+=80;
}
else printf("没有急救包了\n\n\n");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加120\n\n\n");
baiyao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有云南白药了\n\n\n");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加200\n\n\n");
superbaiyao--;
if(player.health+200>player.max_health)player.health=player.max_health;
else player.health+=200;
}
else printf("没有超级云南白药了\n\n\n");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少500\n\n\n");
atom_boom--;
guai.health-=500;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");
break;
case 8:
if(jingyancao>0 && player.level<46)
{printf("使用经验草,等级增加1级\n\n\n");
jingyancao--;
player.level+=1;
printf("等级:%d\n",player.level);
}
else if(jingyancao<1)
{
printf("没有经验草了\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 9:
if(jingyanbao>0 && player.level<46)
{
if(player.level>44&&player.level<46)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用经验包,等级增加%d级",sheng);
printf("等级:%d\n",player.level);
}
else
{printf("使用经验包,等级增加2级\n\n\n");
jingyanbao--;
player.level+=2;
printf("等级:%d\n",player.level);
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 10:
if(jingyanshi>0 && player.level<45)
{
if(player.level>42&&player.level<46)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用经验石,等级增加%d级\n",sheng);
printf("等级:%d\n",player.level);
}
else
{
printf("使用经验石,等级增加4级\n");
jingyanshi--;
player.level+=4;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 11:
if(strongman_arm>0 && player.level<46)
{
if(player.level>29&&player.level<46)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用巨人晶石,等级增加%d级",sheng);
printf("等级:%d\n",player.level);
}
else
{
printf("使用巨人晶石,等级增加16级\n\n\n");
strongman_arm--;
player.level+=16;
printf("等级:%d\n",player.level);
}
}
else if(strongman_arm<1)
{
printf("没有巨人晶石了。\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
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);
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"使徒")==0)
{
printf("战斗胜利,救出公主!!!");
getchar();
getchar();
exit(0);
}
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);
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);
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=1;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
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");
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);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);
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");
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);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);
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");
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);
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("=============================================================================");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 0,退出游戏\n\n\n");
puts("=============================================================================");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");
printf("1,happy酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");
printf("金币:%d",money);
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");
printf("金币:%d\n",money);
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");
break;
default:
printf("hotel talk error!\n\n\n");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,长剑¥500 3,碧血剑¥1000\n\n\n");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");
printf("匕首:%d个\n",gong1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("长剑+1\n");
printf("长剑:%d个\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血剑+1\n");
printf("碧血剑:%d个\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
default:
printf("对不起,我们只会打造以上武器。");
break;}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,银甲¥1000\n\n\n");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");
printf("布衣:%d个\n",fang1n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");
printf("铁甲:%d个\n",fang2n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d",money);
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("银甲+1\n");
printf("银甲:%d个\n",fang3n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}
default:
printf("对不起,我们只会打造以上防具。");
break;}
printf("金币:%d\n",money);
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");
printf("手雷:%d\n",boom);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d",money);
}
break;
case 2:
if(money>=600 && dubiao<4)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");
printf("毒镖:%d\n",dubiao);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}
break;
case 3:
if(money>=1500 && atom_boom<3)
{
atom_boom++;
money=money-1500;
printf("手抛式原子弹+1\n");
printf("手抛式原子弹:%d\n",atom_boom);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n\n\n");
printf("金币:%d\n",money);
}break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");
printf("攻击装备: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个\n",gong1n,gong2n,gong3n,gong4n);
printf("防御装备: 5,布衣:%d个 6,铁甲:%d个 7,银甲:%d个 8,黄金圣衣:%d个\n9,巨人晶石:%d个 0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,strongman_arm);
int pai,shu,i;
scanf("%d",&pai);
switch(pai)
{
case 1:
printf("请问您要出售几件?");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
case 2:
printf("请问您要出售几件?\n");
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(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 6:
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 7:
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 8:
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("黄金圣衣:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
case 9:
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*2000;
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 0,离开\n");
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<9)
{
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:
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)
{
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");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");
}
}}
break;case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人\n\n\n"); //显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,XO酒80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money<25)
{
printf("钱不够!");
}
else
{
if(player.health+20<=player.max_health)
{
printf("HP+20.");
money-=25;
player.health+=20;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80)
{
printf("钱不够!");
}
else
{
if(player.health+50<=player.max_health)
{
printf("HP+50.");
money-=80;
player.health+=50;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150)
{
printf("钱不够!");
}
else
{
if(player.health+100<=player.max_health)
{
printf("HP+100.");
money-=150;
player.health+=100;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");
break;
default:
printf("输入错误\n\n\n");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");
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");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi)
{
case 1:
if(money>=100&&cao<6)
{
cao++;
money=money-100;
printf ("止血草+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 2:
if(money>=150&&jijiubao<5)
{
jijiubao++;
money=money-150;
printf ("急救包+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 3:
if(money>=250&&baiyao<4)
{
baiyao++;
money=money-250;
printf ("云南白药+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 4:
if(money>=400&&superbaiyao<3)
{
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");}
else
{
printf("钱不够!\n");
}
break;
case 5:
if(money>=150)
{
jingyancao++;
money=money-150;
printf ("经验草+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 6:
if(money>=300)
{
jingyanbao++;
money=money-300;
printf ("经验包+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 7:
if(money>=500)
{
jingyanshi++;
money=money-500;
printf ("经验石+1\n");
}
else
{
printf("钱不够!\n");
}
break;
}
case 0:
printf("金币:%d\n",money);
printf("再见,欢迎下次再来!\n");
break;}
if(mai==2)
{
printf("药品商人:去去去,老子没时间陪你聊。\n");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n);
printf("防御装备: 5,布衣:%d个 6,铁甲:%d个 7,银甲:%d个 8,黄金圣衣:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n);
printf("选择要装备的武器或防具:\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(gong1n>=1)
{
printf("拿起了匕首\n\n\n");
gong=gong1;
strcpy(gongname,"匕首");
}
else printf("你没有匕首可以装备\n\n\n");
break;
case 2:
if(gong2n>=1)
{
printf("拿起了长剑\n\n\n");
gong=gong2;
strcpy(gongname,"长剑");
}
else printf("你没有长剑可以装备\n\n\n");
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(fang1n>=1)
{
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 6:
if(fang2>=1)
{
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 7:
if(fang3n>=1)
{
printf("穿上了银甲\n\n\n");
fang=fang3;
strcpy(fangname,"银甲");
}
else printf("你没有银甲可以装备\n\n\n");
break;
case 8:
if(fang4n>=1)
{
printf("穿上了黄金圣衣\n\n\n");
fang=fang4;
strcpy(fangname,"黄金圣衣");
}
else printf("你没有黄金圣衣可以装备\n\n\n");
break;
case 0:
printf("未更换装备\n\n\n");
break;
default:
printf("change error!");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界。为了给您更好的游戏体验,本团队时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“圣战斗士 ”(不包括双引号)。由于2.0版本的buy,我们在2.0的基础上进行修改,已修复该buy。并且新增了经验草等有助于升级的道具,希望大家喜欢。在这里要感谢周佳诚同学,他给了我们许多宝贵的建议,谢谢。\n");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y')
{
printf("数据存储中...");
//向文件中更新数据;
getchar();
printf("按回车退出");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
}
}
}
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);
}
} -
2018-02-26 16:37:54@
#include<bits/stdc++.h>
using namespace std;
char a1[1000],b1[1000],n[1000];
int a[1000],b[1000],c[1000];
int lena,lenb,lenc,i,x;
void in();
void change();
void out();
int main(){
in();
change();
out();
return 0;
}
void in(){
scanf("%s",a1);
scanf("%s",b1);
if(strlen(a1)<strlen(b1)||(strlen(a1)==strlen(b1)&&strcmp(a1,b1)<0)){
swap(a1,b1);
printf("-");
}
lena=strlen(a1);
lenb=strlen(b1);
for(i=1;i<=lena;i++)
a[i]=a1[lena-i]-'0';
for(i=1;i<=lenb;i++)
b[i]=b1[lenb-i]-'0';
}
void change(){
i=1;
while(i<=lena||i<=lenb){
if(a[i]<b[i]){
a[i]+=10;
a[i+1]--;
}
c[i]=a[i]-b[i];
i++;
}
lenc=i;
while(!c[lenc])
lenc--;}
void out(){
for(i=lenc;i>=1;i--)
cout<<c[i];
} -
2018-02-26 16:37:45@
#include<bits/stdc++.h>
using namespace std;
char a1[1000];
int b,a[1000],c[1000],lena,lenc,x=0,i;
int main(){
gets(a1);
cin>>b;
lena=strlen(a1);
for(i=1;i<=lena;i++)
a[i]=a1[i-1]-'0';
for(i=1;i<=lena;i++){
c[i]=(a[i]+x*10)/b;
x=(a[i]+x*10)%b;
}
lenc=1;
while(c[lenc]==0&&lenc<lena)
lenc++;
for(i=lenc;i<=lena;i++)
cout<<c[i];
return 0;
} -
2018-02-26 16:37:37@
#include<bits/stdc++.h>
using namespace std;
char a1[5000],b1[5000];
int a[5000],b[5000],c[5000];
int i,x,lena,lenb,lenc,j;
void in();
void change();
void out();
int main(){
in();
change();
out();
return 0;
}
void in(){
gets(a1);gets(b1);
lena=strlen(a1);lenb=strlen(b1);
for(i=0;i<lena;i++)
a[lena-i]=a1[i]-'0';
for(i=0;i<lenb;i++)
b[lenb-i]=b1[i]-'0' ;
}
void change(){
for(i=1;i<=lena;i++){
x=0;
for(j=1;j<=lenb;j++){
c[i+j-1]=a[i]*b[j]+x+c[i+j-1];
x=c[i+j-1]/10;
c[i+j-1]%=10;
}
c[i+lenb]=x;
}
lenc=lena+lenb;
while((
c[lenc]==0)&&(lenc>1))
lenc--;
}
void out(){
for(i=lenc;i>=1;i--)
cout<<c[i];
} -
2018-02-26 16:37:29@
#include<bits/stdc++.h>
using namespace std;
char a1[500],b1[500];
int a[500],b[500],c[500];
int lena,lenb,lenc,i,x;
void in();
void change();
void out();
int main(){
in();
change();
out();
return 0;
}
void in(){
scanf("%s",a1);
scanf("%s",b1);
lena=strlen(a1);lenb=strlen(b1);
for(i=1;i<=lena;i++)
a[i]=a1[lena-i]-'0';
for(i=1;i<=lenb;i++)
b[i]=b1[lenb-i]-'0';
}
void change(){
lenc=1;
x=0;
while(lenc<=lena||lenc<=lenb){
c[lenc]=a[lenc]+b[lenc]+x;
x=c[lenc]/10;
c[lenc]%=10;
lenc++;
}
c[lenc]=x;
while(c[lenc]==0&&lenc>1)
lenc--;
}
void out(){
for(i=lenc;i>=1;i--)
cout<<c[i];}
-
2018-02-26 16:37:17@
#include<bits/stdc++.h>
using namespace std;
void chu();
void cheng();
void jian();
void jia();
int main(){
char plan;
printf("What kind of [+ - * /] do you want to choose?\n");
scanf("%c",&plan);
switch(plan){
case '+': jia();break;
case '-': jian();break;
case '*': cheng();break;
case '/': chu();break;
}
return 0;
}
void chu(){
char a1[1000];
int b,a[1000]={0},c[1000]={0},lena,lenc,x=0,i;
scanf("%s",a1);
cin>>b;
lena=strlen(a1);
for(i=1;i<=lena;i++)
a[i]=a1[i-1]-'0';
for(i=1;i<=lena;i++){
c[i]=(a[i]+x*10)/b;
x=(a[i]+x*10)%b;
}
lenc=1;
while(c[lenc]==0&&lenc<lena)
lenc++;
for(i=lenc;i<=lena;i++)
cout<<c[i];
}
void cheng(){
char a1[5000],b1[5000];
int a[5000],b[5000],c[5000];
int i,x,lena,lenb,lenc,j;
scanf("%s",a1);scanf("%s",b1);
lena=strlen(a1);lenb=strlen(b1);
for(i=0;i<lena;i++)
a[lena-i]=a1[i]-'0';
for(i=0;i<lenb;i++)
b[lenb-i]=b1[i]-'0' ;
for(i=1;i<=lena;i++){
x=0;
for(j=1;j<=lenb;j++){
c[i+j-1]=a[i]*b[j]+x+c[i+j-1];
x=c[i+j-1]/10;
c[i+j-1]%=10;
}
c[i+lenb]=x;
}
lenc=lena+lenb;
while((c[lenc]==0)&&(lenc>1))
lenc--;
for(i=lenc;i>=1;i--)
cout<<c[i];
}
void jian(){
char a1[1000],b1[1000],n[1000];
int a[1000],b[1000],c[1000];
int lena,lenb,lenc,i,x;
scanf("%s",a1);
scanf("%s",b1);
if(strlen(a1)<strlen(b1)||(strlen(a1)==strlen(b1)&&strcmp(a1,b1)<0)){
swap(a1,b1);
printf("-");
}
lena=strlen(a1);
lenb=strlen(b1);
for(i=1;i<=lena;i++)
a[i]=a1[lena-i]-'0';
for(i=1;i<=lenb;i++)
b[i]=b1[lenb-i]-'0';
i=1;
while(i<=lena||i<=lenb){
if(a[i]<b[i]){
a[i]+=10;
a[i+1]--;
}
c[i]=a[i]-b[i];
i++;
}
lenc=i;
while(!c[lenc])
lenc--;
for(i=lenc;i>=1;i--)
cout<<c[i];}
void jia(){
char a1[500],b1[500];
int a[500],b[500],c[500];
int lena,lenb,lenc,i,x;
scanf("%s",a1);
scanf("%s",b1);
lena=strlen(a1);lenb=strlen(b1);
for(i=1;i<=lena;i++)
a[i]=a1[lena-i]-'0';
for(i=1;i<=lenb;i++)
b[i]=b1[lenb-i]-'0';
lenc=1;
x=0;
while(lenc<=lena||lenc<=lenb){
c[lenc]=a[lenc]+b[lenc]+x;
x=c[lenc]/10;
c[lenc]%=10;
lenc++;
}
c[lenc]=x;
while(c[lenc]==0&&lenc>1)
lenc--;
for(i=lenc;i>=1;i--)
cout<<c[i];}
-
2018-02-04 13:14:00@
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<string.h>
#include<windows.h>
#include <iostream>
#include <fstream>
using namespace std;
struct 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};
bool key=false;
int du;
int hold=0,wear=0;
struct Enemy
{
char name[20];
char wupin[12];
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,20,1,0},
witch={"萌新","二级防弹衣",25,15,100,50,50,2,20,1,1},
xiyi={"新手","一级防弹衣",18,10,50,30,35,3,3,20,2},
big_strongman={"RPG发射台","USB",40*5,50*5,350*5,200*5,100*5,4,40,2,0},
lion={"冲锋高手","M4A1",60,30,280,200,100,5,20,1,0},
horse={"点射神","AK47",28,12,90,50,50,6,20,1,1},
bee={"逆天手炮","M1911",17,11,60,30,35,7,30,2,2},
shitu={"记忆高手","电脑密码",60*8,30*8,280*8,200*8,100*8,9,10,1,0},
mouse={"特种部队狙击手","AWM",100,30,250,200,150,11,20,1,0},
protecter={"开发组","密钥",800,300,2800,2000,1100,12,10,1,0},
prinses={"密钥","\0",1000,500,10000,5000,3000,0,0,0},
guai={"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3,dilao1,dilao2,shop,tjp;
}place={1,2,3,4,5,6,7,8,9,10,11,12};int max_exp=0;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=9;
int cao=3,jijiubao=2,baiyao=2,superbaiyao=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;
int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0,gong5=100,gong5n=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 *);
ifstream fin;
ofstream fout;int main()
{
int ifnew;
SlowDisplay("使用进度(1)还是重新开始?(2) 重新开始你的进度将消失,并不可逆转!");
cin>>ifnew;
cout<<"加载材质包";
system("color E9");
cout<<"材质包加载成功,版本:1.2.1 正式版"<<endl;
switch(ifnew)
{
case 1:fin.open("battle.dat",ios::in);
fin>>player.attack>>player.defense>>player.exp>>player.health>>player.level>>player.max_exp>>player.max_health>>player.name>>player.range_exp;
fin>>fang>>gong>>hold>>wear>>gongname>>fangname;
fin>>fang1n;
fin>>fang1;
fin>>fang2n;
fin>>fang2;
fin>>fang3n;
fin>>fang3;
fin>>fang4n;
fin>>fang4;
fin>>gong1n;
fin>>gong1;
fin>>gong2n;
fin>>gong2;
fin>>gong3n;
fin>>gong3;
fin>>gong4n;
fin>>gong4;
fin>>gong5n;
fin>>gong5;
fin>>strongman_arm>>key;
fin>>atom_boom>>baiyao>>boom>>cao>>dubiao>>jijiubao>>superbaiyao;
fin>>money;
break;
case 2:
system("del battle.dat /q /f");
system("del chapter2 /q /f");
system("del chapter3 /q /f");
break;
}
int i=0,j=0,k=0;
char player_name[21];
if(ifnew==2){ SlowDisplay("【注意1】不可使用×关闭,否则你的数据将会消失!\n这是一次勇敢者的战斗!\n\n\n由于外国恐怖分子在境外岛屿肆虐\n\n\n中央军委决定空出一座空岛作为演习地\n\n\n在这里时刻要小心!\n\n\n输入你的名字: (20个字符)\n\n\n");
// sndPlaySound("res\F005.wav",SND_LOOP);
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"老司机")==0)
{
SlowDisplay("吊销驾照多年的 老司机 啊!你终于可以重新开车了!\n\n\n 老司机 重新上路... 随即... 翻车!!!\n\n\n");
player.attack-=9999;
player.defense-=9999;
player.health-=99999;
player.max_health-=99999;
}}
else SlowDisplay("继续!\n");
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个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom);
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
SlowDisplay("使用绷带,HP增加60\n\n\n");
if(player.health+60>player.max_health)player.health=player.max_health;
else player.health+=60;
cao--;
}
else SlowDisplay("没有绷带\n\n\n");
break;
case 2:
if(jijiubao>0)
{
SlowDisplay("使用急救包,HP增加80\n\n\n");
if(player.health+80>player.max_health)player.health=player.max_health;
else player.health+=80;
jijiubao--;
}
else SlowDisplay("没有急救包了\n\n\n");
break;
case 3:
if(baiyao>0)
{
SlowDisplay("使用纳米修复绷带,HP增加120\n\n\n");
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
baiyao--;
}
else SlowDisplay("没有纳米修复绷带\n\n\n");
break;
case 4:
if(superbaiyao>0)
{
SlowDisplay("使用超导高频绷带,HP增加200\n\n\n");
if(player.health+200>player.max_health)player.health=player.max_health;
else player.health+=200;
superbaiyao--;
}
else SlowDisplay("没有超导高频绷带了\n\n\n");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
SlowDisplay("使用手雷,敌人HP减少100\n\n\n");
guai.health-=100;
boom--;
AttackResult();
}
}
else SlowDisplay("非战斗状态,不能使用手雷!\n\n\n");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
SlowDisplay("使用毒子弹,敌人HP减少200 敌人中毒! 每回合HP减少150\n\n\n");
guai.health-=200;
dubiao--;
du+=150;
AttackResult();
}
}
else SlowDisplay("非战斗状态,不能使用毒子弹!\n\n\n");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
SlowDisplay("使用阿姆斯特朗回旋穿甲拽光爆破弹,敌人HP减少500 滑稽性!敌人每回合HP减少200\n\n\n");
guai.health-=500;
atom_boom--;
du+=200;
AttackResult();
}
}
else SlowDisplay("非战斗状态,不能使用阿姆斯特朗回旋穿甲拽光爆破弹!\n\n\n");
break;
case 0:break;
default:printf("ChooseWupin error!\n\n\n");
}
}
int AttackResult()
{
if(guai.health<=0)
{
du=0;
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=-10;
if(s<guai.wupinpro)
{
if(strcmp(guai.name,"制作组")==0) SlowDisplay("游戏更新啦,去开发组办公室找密钥吧!");
if(strcmp(guai.name,"密钥")==0) {SlowDisplay("嘿嘿,成功解开荒野行动2!");
SlowDisplay("第一版 《荒野求生》结束 第二版《荒野求生2》推出!");
fout.open("chapter2",ios::out);
fout<<" "<<1;
fout.close();
fout.open("battle.dat",ios::out);
fout<<" "<<player.attack<<" "<<player.defense<<" "<<player.exp<<" "<<player.health<<" "<<player.level<<" "<<player.max_exp<<" "<<player.max_health<<" "<<player.name<<" "<<player.range_exp;
fout<<" "<<fang<<" "<<gong<<" "<<hold<<" "<<wear<<" "<<gongname<<" "<<fangname;
fout<<" "<<fang1n;
fout<<" "<<fang1;
fout<<" "<<fang2n;
fout<<" "<<fang2;
fout<<" "<<fang3n;
fout<<" "<<fang3;
fout<<" "<<fang4n;
fout<<" "<<fang4;
fout<<" "<<gong1n;
fout<<" "<<gong1;
fout<<" "<<gong2n;
fout<<" "<<gong2;
fout<<" "<<gong3n;
fout<<" "<<gong3;
fout<<" "<<gong4n;
fout<<" "<<gong4;
fout<<" "<<gong5n;
fout<<" "<<gong5;
fout<<" "<<strongman_arm<<" "<<key;
fout<<" "<<atom_boom<<" "<<baiyao<<" "<<boom<<" "<<cao<<" "<<dubiao<<" "<<jijiubao<<" "<<superbaiyao;
fout<<" "<<money;
getchar();
getchar();exit(0);
}
SlowDisplay("从敌人背包中发现");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"超级开发组")==0)
{
puts("战斗胜利,找到密钥!!!");
}
return 1;
}
else
{
int s=SuiJi();if((guai.attack+s-(player.defense+fang)/3)<0)
{
player.health-=1;
printf("%s向你射击,你的HP减少了 1\n\n",guai.name);
}
else
{
player.health-=guai.attack+s-(player.defense+fang)/3;
printf("%s向你射击,你的HP减少了%d\n\n",guai.name,guai.attack+s-(player.defense+fang)/3);
}
if(player.health>=player.max_health/2) system("color 07");
if(player.health<player.max_health/2) system("color 0e");
if(player.health<player.max_health/3) system("color 06");
if(player.health<player.max_health/4) system("color 0c");
if(player.health<player.max_health/6) system("color 04");
if(player.health<0)
{
du=0;
battle=0;
printf("%s战死!",player.name);
if(money>=player.level*100) printf("使用%d金币贿赂开发组,复活!\n\n\n",player.level*100);
else
{
printf("你穷到死都死不起了!开发组看你没钱,嫌你可怜,就把你的少的可怜的钱全收了");
money=0;
}
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=1;break;
case 5:gong4n++; break;
case 6:gong3n++; break;
case 7:gong2n++; break;
case 9:key=true;break;
case 11:gong5n++;break;
case 12:
guai=prinses;
battle=1;
SlowDisplay("密钥:勇士,想解开我?没门!");
printf("密钥变形了!扑了过来!");
printf("%s",player.name);
SlowDisplay(":???");
BattleAct();
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);
SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
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;
system("color 07");
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);
player.exp=player.exp+guai.exp-(player.exp+guai.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;
system("color 07");
}
}
else if(player.level<=40&&l2>0)
{
if(l2==1)
{
printf("%s",player.name);
SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
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;
system("color 07");
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);
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;
system("color 07");
}
}
else if(l3>0)
{
if(l3==1)
{
printf("%s",player.name);
SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
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;
system("color 07");
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);
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;
system("color 07");
}
}
}
void OrdinaryAct()
{while(1)
{
// (1000);
// system("cls");puts("=============================================================================");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 0,退出游戏\n\n\n");
puts("=============================================================================");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
SlowDisplay("要去哪里?\n\n\n");
printf("1,等待大厅 2,休息室 3,新手线 4,一号线 5,二号线 6,三号线 7,高级线 8,极限生存线 9,系统机房 10,开发组办公室 11,商店 12,武器改装铺\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 12:
SlowDisplay("1,锻造 2,售卖");
int choise;
scanf("%d",&choise);
switch(choise)
{
case 1:
SlowDisplay("选择锻造装备:");
printf("攻装: 1,小刀:%d个 2,M1911:%d个 3,AK47:%d个 4,M4A1:%d个 5,AWM\n\n\n",gong1n,gong2n,gong3n,gong4n,gong5n);
printf("防装: 6,低级防弹衣:%d个 7,一级防弹衣:%d个 8,二级防弹衣:%d个 9,机械防弹甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n);
printf("选择要锻造的武器或防具以及锻造次数:(30个金币/次) 你有%d个\n\n\n",money);
int cishu;
scanf("%d%d",&choose_number,&cishu);
if(money<30*cishu) {printf("你没钱瞎嘚瑟啥!");break;}
money-=30*cishu;
switch(choose_number)
{
case 1:if(gong1n>=1)
{
SlowDisplay("锻造了小刀\n\n\n");
gong1+=1*cishu;
if(hold==1) gong+=1*cishu;
strcpy(gongname,"匕首");
}
else SlowDisplay("你没有小刀可以制造\n\n\n");
break;
case 2:if(gong2n>=1)
{
SlowDisplay("制造了M1911\n\n\n");
gong2+=3*cishu;
if(hold==2) gong+=3*cishu;
strcpy(gongname,"M1911");
}
else SlowDisplay("你没有M1911可以制造\n\n\n");
break;
case 3:if(gong3n>=1)
{
SlowDisplay("制造了AK47\n\n\n");
gong3+=5*cishu;
if(hold==3) gong+=5*cishu;
strcpy(gongname,"AK47");
}
else SlowDisplay("你没有AK47可以制造\n\n\n");
break;
case 4:if(gong4n>=1)
{
SlowDisplay("制造了M4A1\n\n\n");
gong4+=10*cishu;
if(hold==4) gong+=10*cishu;
strcpy(gongname,"M4A1");
}
else SlowDisplay("你没有M4A1可以制造\n\n\n");
break;
case 6:if(fang1n>=1)
{
SlowDisplay("制造了低级防弹衣\n\n\n");
fang1+=2*cishu;
if(wear==1) fang+=2*cishu;
strcpy(fangname,"低级防弹衣");
}
else SlowDisplay("你没有低级防弹衣可以制造\n\n\n");
break;
case 7:if(fang2>=1)
{
SlowDisplay("制造了一级防弹衣\n\n\n");
fang2+=4*cishu;
if(wear==2) fang+=4*cishu;strcpy(fangname,"一级防弹衣");
}
else SlowDisplay("你没有一级防弹衣可以制造\n\n\n");
break;
case 8:if(fang3n>=1)
{
SlowDisplay("制造了二级防弹衣\n\n\n");
fang3+=8*cishu;
if(wear==3) fang+=8*cishu;strcpy(fangname,"二级防弹衣");
}
else SlowDisplay("你没有二级防弹衣可以制造\n\n\n");
break;
case 9:if(fang4n>=1)
{
SlowDisplay("制造了机械防弹甲\n\n\n");
fang4+=15*cishu;
if(wear==4) fang+=15*cishu;strcpy(fangname,"机械防弹甲");
}
else SlowDisplay("你没有机械防弹甲可以制造\n\n\n");
break;
case 0:{SlowDisplay("未制造\n\n\n");money+=30*cishu;break;}
case 5:if(gong5n>=1)
{
SlowDisplay("制造了AWN\n\n\n");
gong5+=15*cishu;
if(hold==5) gong+=15*cishu;
strcpy(gongname,"AWN");
}
default:{printf("change error!");money+=30;}
}
break;
case 2:
SlowDisplay("1:小刀 10\( 2:M1911 30\) 3:AK47 50\( 4:M4A1 80\) 5:AWM 120\( 6:低级防弹衣 5\) 7:一级防弹衣 15\( 8:二级防弹衣 35\) 9:机械防弹甲 60$");
scanf("%d",&choose_number);
switch(choose_number)
{
case 1:if(gong1n>=1)
{
SlowDisplay("出售了小刀\n\n\n");
gong1n--;
money+=10;
}
else SlowDisplay("你没有小刀可以出售\n\n\n");
break;
case 2:if(gong2n>=1)
{
SlowDisplay("出售了M1911\n\n\n");
gong2n--;
money+=30;}
else SlowDisplay("你没有M1911可以出售\n\n\n");
break;
case 3:if(gong3n>=1)
{
SlowDisplay("出售了AK47\n\n\n");
gong3n--;
money+=50;}
else SlowDisplay("你没有AK47可以出售\n\n\n");
break;
case 4:if(gong4n>=1)
{
SlowDisplay("出售了M4A1\n\n\n");
gong4n--;
money+=80;}
else SlowDisplay("你没有M4A1可以出售\n\n\n");
break;
case 6:if(fang1n>=1)
{
SlowDisplay("出售了低级防弹衣\n\n\n");
fang1n--;
money+=5;}
else SlowDisplay("你没有低级防弹衣可以出售\n\n\n");
break;
case 7:if(fang2>=1)
{
SlowDisplay("出售了一级防弹衣\n\n\n");
fang2n--;
money+=15;}
else SlowDisplay("你没有一级防弹衣可以出售\n\n\n");
break;
case 8:if(fang3n>=1)
{
SlowDisplay("出售了二级防弹衣\n\n\n");
fang3n--;
money+=35;}
else SlowDisplay("你没有二级防弹衣可以出售\n\n\n");
break;
case 9:if(fang4n>=1)
{
SlowDisplay("出售了机械防弹甲\n\n\n");
fang4n--;
money+=60;}
else SlowDisplay("你没有机械防弹甲可以出售\n\n\n");
break;
case 0:{SlowDisplay("未出售\n\n\n");money+=30*cishu;break;}
case 5:if(gong5n>=1)
{
SlowDisplay("出售了AWM\n\n\n");
gong5n--;
money+=120;
}}
}
break;case 11:
{
printf("1、绷带:80\n2、急救包:115\n3、纳米修复绷带:135\n4、超导高频绷带:200\n5、手雷:100\n6、毒子弹:190\n7、阿姆斯特朗回旋穿甲拽光爆破弹:450\n0、退出 你有%d$",money);
int buy;
scanf("%d",&buy);
switch(buy)
{
case 0:break;
case 1:
if(money>=80)
{
money-=80;
cao++;
SlowDisplay("交易成功!");
}
else {SlowDisplay("由于你买不起,你穷到肌肉萎缩!攻击力清零");
player.attack=0;}
break;
case 2:
if(money>=115)
{
money-=115;
jijiubao++;
SlowDisplay("交易成功!");
}
else {SlowDisplay("由于你买不起,你穷到肌肉萎缩!攻击力清零");
player.attack=0;}
break;
case 3:
if(money>=135)
{
money-=135;
baiyao++;
SlowDisplay("交易成功!");
}
else {SlowDisplay("由于你买不起,你穷到肌肉萎缩!攻击力清零");
player.attack=0;}
break;
case 4:
if(money>=200)
{
money-=200;
superbaiyao++;
SlowDisplay("交易成功!");
}
else {SlowDisplay("由于你买不起,你穷到肌肉萎缩!攻击力清零");
player.attack=0;}
break;
case 5:
if(money>=100)
{
money-=100;
boom++;
SlowDisplay("交易成功!");
}
else {SlowDisplay("由于你买不起,你穷到肌肉萎缩!攻击力清零");
player.attack=0;}
break;
case 6:
if(money>=190)
{
money-=190;
dubiao++;
SlowDisplay("交易成功!");
}
else {SlowDisplay("由于你买不起,你穷到肌肉萎缩!攻击力清零");
player.attack=0;}
break;
case 7:
if(money>=450)
{
money-=450;
atom_boom++;
SlowDisplay("交易成功!");
}
else {SlowDisplay("由于你买不起,你穷到肌肉萎缩!攻击力清零");
player.attack=0;}
break;
}
}
case 1:place_sign=place.bar;
// OrdinaryAct();
break;
case 2:place_sign=place.hotel;
SlowDisplay("要休息吗? 200个金币 1,是 0,否\n\n\n");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:if(money-200<0)
{
SlowDisplay("Sorry,你的钱不够~\n\n\n");
}
else
{
SlowDisplay("好好休息\n\tHP满\n\t\t第二天了\n\n");
money-=200;
player.health=player.max_health; //体力满
}
break;
case 0:SlowDisplay("下次再来!\n\n\n");break;
default:printf("hotel talk error!\n\n\n");
}
place_sign=0;
break;
case 3:
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
{
SlowDisplay("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 4:
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
{
SlowDisplay("这里安全\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<9)
{
battle=1;
guai=big_strongman;
printf("%s朝你开枪!\n\n\n",guai.name);
BattleAct();
}
else
{
SlowDisplay("这里安全\n\n\n");
}
break;
case 6:
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
{
SlowDisplay("这里安全\n\n\n");
}
break;
case 7:
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
{
SlowDisplay("这里安全\n\n\n");
}
break;
case 8:
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)
{
SlowDisplay("开发组:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!USB我要了,密钥你也别想带走!\n\n\n");
guai=shitu;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else SlowDisplay("开发组:\n\n\n 年轻人,你好啊.如果你有USB,我可以告诉你密钥的下落哦~ USB由 【二号线】 的 【RPG发射台】 掉落\n\n\n");
}
else
{
SlowDisplay("这里安全\n\n\n");
}
break;
case 9:
if(!key) {printf("电脑锁了,打不开");break;}
if(SuiJi()<8) {battle=1;
guai=mouse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();}
else cout<<"这里安全";
break;case 10:
if(!key) {printf("门被锁了,打不开");break;}
battle=1;
SlowDisplay("开发组:你怎能擅自闯入这里?");
guai=protecter;
printf("%s架起了阿姆斯特朗回旋爆破穿甲拽光炮!\n\n\n",guai.name);
BattleAct();
break;default:printf("choose map error!\n\n\n");
}
break;
case 2: ChooseWupin();break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
SlowDisplay("要和谁说话?\n\n\n1,游戏编写组 2,福利领取 3,酒吧老板 4,你自己\n\n\n"); //显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
SlowDisplay("开发组:\n\n\n 有什么事吗,年轻人!你是新来的的吧,去福利领取吧\n\n\n");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
SlowDisplay("福利领取机器人:\n\n\n 哔哔哔......这是你的新手礼包,请收好!(新手礼包为小刀与低级防弹衣)\n\n\n");
printf("%s心想:(哇,这机器真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else SlowDisplay("福利领取机器人:\n\n\n 加油吧,年轻人!\n\n\n");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,XO酒80金币 HP+50 3,五粮液150金币 HP+100 0,返回\n\n\n");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number)
{
case 1:if(money<25)
{
SlowDisplay("钱不够!");
}
else
{
if(player.health+20<=player.max_health)
{
SlowDisplay("HP+20.");
money-=25;
player.health+=20;
}
else
{
SlowDisplay("HP满了");
player.health=player.max_health;
}
}
break;
case 2:if(money<80)
{
SlowDisplay("钱不够!");
}
else
{
if(player.health+50<=player.max_health)
{
SlowDisplay("HP+50.");
money-=80;
player.health+=50;
}
else
{
SlowDisplay("HP满了");
player.health=player.max_health;
}
}
break;
case 3:if(money<150)
{
SlowDisplay("钱不够!");
}
else
{
if(player.health+100<=player.max_health)
{
SlowDisplay("HP+100.");
money-=150;
player.health+=100;
}
else
{
SlowDisplay("HP满了");
player.health=player.max_health;
}
}
break;
case 0:SlowDisplay("下次在来!\n");break;
default:SlowDisplay("输入错误\n\n\n");
}
}
break;
case 4:
char word[200];
cin>>word;
if(word[0]=='$'&&word[1]=='+') {int add;cin>>add;money+=add;}
}
}
else if(place_sign==place.hotel)
SlowDisplay("“老板娘!我...”\n\n\n“呃啊......啊......舒服!......(只见老板娘......)”\n\n\n");
else SlowDisplay("这里好像没人可以聊天\n\n\n");
break;
case 4: DisplayState(); break; //显示状态
case 5: //装备
printf("攻装: 1,小刀:%d个 2,M1911:%d个 3,AK47:%d个 4,M4A1:%d个 5,AWM\n\n\n",gong1n,gong2n,gong3n,gong4n,gong5n);
printf("防装: 6,低级防弹衣:%d个 7,一级防弹衣:%d个 8,二级防弹衣:%d个 9,机械防弹甲:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n);
SlowDisplay("选择要装备的武器或防具:\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:if(gong1n>=1)
{
SlowDisplay("拿起了小刀\n\n\n");
gong=gong1;
hold=1;
strcpy(gongname,"小刀");
}
else SlowDisplay("你没有小刀可以装备\n\n\n");
break;
case 2:if(gong2n>=1)
{
SlowDisplay("拿起了M1911\n\n\n");
gong=gong2;
hold=2;
strcpy(gongname,"M1911");
}
else SlowDisplay("你没有M1911可以装备\n\n\n");
break;
case 3:if(gong3n>=1)
{
SlowDisplay("拿起了AK47\n\n\n");
gong=gong3;
hold=3;
strcpy(gongname,"AK47");
}
else SlowDisplay("你没有AK47可以装备\n\n\n");
break;
case 4:if(gong4n>=1)
{
SlowDisplay("拿起了M4A1\n\n\n");
gong=gong4;
hold=4;
strcpy(gongname,"M4A1");
}
else SlowDisplay("你没有M4A1可以装备\n\n\n");
break;
case 6:if(fang1n>=1)
{
SlowDisplay("穿上了低级防弹衣\n\n\n");
fang=fang1;
wear=1;
strcpy(fangname,"低级防弹衣");
}
else SlowDisplay("你没有低级防弹衣可以装备\n\n\n");
break;
case 7:if(fang2>=1)
{
SlowDisplay("穿上了一级防弹衣\n\n\n");
fang=fang2;
wear=2;
strcpy(fangname,"一级防弹衣");
}
else SlowDisplay("你没有一级防弹衣可以装备\n\n\n");
break;
case 8:if(fang3n>=1)
{
SlowDisplay("穿上了二级防弹衣\n\n\n");
fang=fang3;
wear=3;
strcpy(fangname,"二级防弹衣");
}
else SlowDisplay("你没有二级防弹衣可以装备\n\n\n");
break;
case 9:if(fang4n>=1)
{
SlowDisplay("穿上了机械防弹甲\n\n\n");
fang=fang4;
wear=4;
strcpy(fangname,"机械防弹甲");
}
else SlowDisplay("你没有机械防弹甲可以装备\n\n\n");
break;
case 0:SlowDisplay("未更换装备\n\n\n");break;
case 5:if(gong5n>=1)
{
SlowDisplay("拿起了AWM\n\n\n");
gong=gong5;
hold=5;
strcpy(gongname,"AWM");
}
default:printf("change error!");
}
break;
case 0:
SlowDisplay("确定退出游戏?(Y/N)\n\n\n");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y')
{
SlowDisplay("数据存储中...");
fout.open("battle.dat",ios::out);
fout.open("battle.dat",ios::out);
fout<<" "<<player.attack<<" "<<player.defense<<" "<<player.exp<<" "<<player.health<<" "<<player.level<<" "<<player.max_exp<<" "<<player.max_health<<" "<<player.name<<" "<<player.range_exp;
fout<<" "<<fang<<" "<<gong<<" "<<hold<<" "<<wear<<" "<<gongname<<" "<<fangname;
fout<<" "<<fang1n;
fout<<" "<<fang1;
fout<<" "<<fang2n;
fout<<" "<<fang2;
fout<<" "<<fang3n;
fout<<" "<<fang3;
fout<<" "<<fang4n;
fout<<" "<<fang4;
fout<<" "<<gong1n;
fout<<" "<<gong1;
fout<<" "<<gong2n;
fout<<" "<<gong2;
fout<<" "<<gong3n;
fout<<" "<<gong3;
fout<<" "<<gong4n;
fout<<" "<<gong4;
fout<<" "<<gong5n;
fout<<" "<<gong5;
fout<<" "<<strongman_arm<<" "<<key;
fout<<" "<<atom_boom<<" "<<baiyao<<" "<<boom<<" "<<cao<<" "<<dubiao<<" "<<jijiubao<<" "<<superbaiyao;
fout<<" "<<money;//向文件中更新数据;
getchar();
SlowDisplay("按回车退出");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else SlowDisplay("继续!\n\n\n");
break;
default:SlowDisplay("输入错误!\n\n\n");
}
}
}
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("=============================================================================");
if(du>0) printf("敌人中毒!HP-%d 剩余%d",du,guai.health);
guai.health-=du;
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 %s剩余血量:%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3,guai.name,guai.health-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:SlowDisplay("输入错误,重新输入!\n\n\n");
}
}
}
void SlowDisplay(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(50);
}
} -
2018-02-04 13:08:30@
5843
-
2018-02-04 12:57:22@
#include <bits/stdc++.h>//万能头文件
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
system("color f0");//先用黑底白字,顺眼
printf("\刺客信条---启示录\n\
\n\
著作者:古麒麟\n\n");
Sleep (1000);
printf("很久以前,有两个繁荣昌盛的国家--阿泰尔所统治的国家和圣殿骑士团所占领的国家。他们一直为人类创造物品。\n\n");
Sleep (1000);
printf("但圣殿骑士团非常贪婪,阿泰尔的国家资源又很丰富,圣殿骑士团想进攻阿泰尔的国家。\n\n");
Sleep (1000);
printf("不久,一场大战便引发了。\n\n");
Sleep (1000);
printf("大战了九天九夜,300个回合。终于,圣殿骑士团被刺客们关进大牢了。\n\n");
Sleep (1000);
printf("一天,阿泰尔用最后一点力气,从梦中告诉你:\n\
“和平只是短暂的,终有一日圣殿骑士们会逃出监狱。”\n\n\
说罢,便将他的袖剑交给了你。\n\n");
Sleep(1000);
printf("一场新的故事拉开了序幕...\n\n");
Sleep(1000);
char mz[11];//十个字符
char jiaochen ,mxp,mx,ms,shop,pl,gl1,gl2,gl3,gl4,gd;
int sj,xue1,xue2,xue3,xue4,xue5,xue6,xue7,xue8,xue9,xue10,gj=15,xue=200,s2,db,bd1,dbm,gl,dj=0;
float s1,money=100;
printf(" 你的名字(在埃齐奥的后面加):埃齐奥");
cin>>mz;
printf("是否需要教程?(Y or N)\n");
cin>>jiaochen;
if( (jiaochen != 'Y'&&jiaochen!='y') && (jiaochen != 'N'&&jiaochen!='n') )//输入错误
{
cout<<"乱输!"<<endl;
}
if((jiaochen=='Y')||(jiaochen=='y'))//教程
{
printf("亲爱的%s:\n若输1,则进入冒险模式。\n若输2,则进入商店模式。\n若输3,则进入状态显示模式。\n刚进入时有100元,好好利用他吧!\n没钱就进入冒险模式打怪赚钱吧!更多玩法等待你发现...\n", mz);
}//教程完
while(1)//主程序
{
loop:
printf("\n\n1--冒险模式 2--商店模式 3--状态显示模式 4--赌博模式 5--管理模式");
cin>>ms;
if(ms=='1')//冒险模式
{
printf(" E--退出\n 1--第一次战斗(☆)\n 2--危险之城(☆☆)\n 3--击退雇佣兵(☆☆☆☆)\n 4--再战雇佣兵(☆☆)\n 5--被敌人埋伏(☆)\n 6--险战圣殿骑士(☆☆☆)\n 7--暗中监视(****)\n 8--正式成为刺客大师\n 9--获得某某大官的日记(☆☆☆★)\n 9.5--迎接大战(☆☆☆☆☆☆☆☆),\nA--最终之战---歼灭圣殿骑士团---找齐五把钥匙----打开刺客宗师阿泰尔的图书馆的大门----获得刺客的所有智慧(☆☆☆☆☆☆☆☆☆☆★★★★★★☆☆★★★☆☆★☆★☆☆★☆★★☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆)\n");
cin>>mx;
if(mx=='E'||mx=='e'){goto loop;}
if(mx == '1')
{//1
xue1=50;
while(xue1>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=10;printf("逃跑失败!你被扣了10滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue1-=gj;xue-=10;
printf("你被扣了10滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue1);
}
if(xue <= 0){printf("你死了!");Sleep(10000000);return 0;}
}
if(xue1 <= 0){money+=30;dj+=25;printf("你赢了!加30元,25经验,现有%.2f元,%d经验", money,dj);}
}//1完
if(mx == '2')
{//2
xue2=100;
while(xue2>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=20;printf("逃跑失败!你被扣了20滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue2-=gj;xue-=20;
printf("你被扣了20滴血,剩%d滴血你在最后一刻用袖剑刺穿了敌人的胸膛。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue2);
}
if(xue <= 0){printf("你死了!");Sleep(10000000); return 0;}
}
if(xue2 <= 0){money+=60;dj+=50;printf("你赢了!加60元,50经验,现有%.2f元,%d经验", money,dj);}
}//2完
if(mx == '3')
{//3
xue3=200;
while(xue3>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=40;printf("逃跑失败!你被扣了40滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue3-=gj;xue-=40;
printf("你被扣了40滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue3);
}
if(xue <= 0){printf("你死了!"); Sleep(10000000);return 0;}
}
if(xue3 <= 0){money+=120;dj+=100;printf("你赢了!加120元,100经验现有%.2f元,%d经验", money,dj);}
}//3完
if(mx == '4')
{//4
xue4=400;
while(xue4>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=80;printf("逃跑失败!你被扣了80滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue4-=gj;xue-=80;
printf("你被扣了40滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue4);
}
if(xue <= 0){printf("你死了!");Sleep(10000000); return 0;}
}
if(xue4 <= 0){money+=240;dj+=200;printf("你赢了!加240元,200经验,现有%.2f元,%d经验", money,dj);}
}//4完
if(mx == '5')
{//5
xue5=800;
while(xue5>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=160;printf("逃跑失败!你被扣了160滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue5-=gj;xue-=160;
printf("你被扣了160滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue5);
}
if(xue <= 0){printf("你死了!"); Sleep(10000000);return 0;}
}
if(xue5 <= 0){money+=480;dj+=400;printf("你赢了!加480元,400经验,现有%.2f元,%d经验", money,dj);}
}//5完
if(mx == '6')
{//6
xue6=800;
while(xue6>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=320;printf("逃跑失败!你被扣了320滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue6-=gj;xue-=320;
printf("你被扣了320滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue6);
}
if(xue <= 0){printf("你死了!");Sleep(10000000); return 0;}
}
if(xue6 <= 0){money+=860;dj+=800;printf("你赢了!加860元,800经验,现有%.2f元,%d经验", money,dj);}
}//6完
if(mx == '7')
{//7
xue7=1600;
while(xue7>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=640;printf("逃跑失败!你被扣了640滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue7-=gj;xue-=640;
printf("你被扣了640滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue7);
}
if(xue <= 0){printf("你死了!");Sleep(10000000); return 0;}
}
if(xue7 <= 0){money+=980;dj+=1600;printf("你赢了!加980元,1600经验,现有%.2f元,%d经验", money,dj);}
}//7完
if(mx == '8')
{//8
xue8=3200;
while(xue8>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=1280;printf("逃跑失败!你被扣了1280滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue8-=gj;xue-=2280;
printf("你被扣了2280滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue8);
}
if(xue <= 0){printf("你死了!");Sleep(10000000); return 0;}
}
if(xue8 <= 0){money+=1960;dj+=3200;printf("你赢了!加3960元,3200经验,现有%.2f元,%d经验", money,dj);}
}//8完
if(mx == '9')
{//9
xue9=6400;
while(xue9>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"逃跑成功!"<<endl;break;}else{xue-=2560;printf("逃跑失败!你被扣了2560滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue9-=gj;xue-=6560;
printf("你被扣了6560滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue9);
}
if(xue <= 0){printf("你死了!");Sleep(10000000); return 0;}
}
if(xue9 <= 0){money+=12980;dj+=6400;printf("你赢了!加12980金币,6400经验,现有%.2f元%d经验", money,dj);}
}//9完
if(mx == 'a'||mx=='A' )
{//10
xue10=12800;
while(xue10>0)
{
printf("敌人冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y')
{
if(sj%2==0){cout<<"恭喜您逃跑成功!"<<endl;break;}else{xue-=5120;printf("逃跑失败!皮卡丘被扣了5120滴血,剩%d滴血。\n", xue);}
}
if(mxp == 'N'||mxp=='n')
{
xue10-=gj;xue-=72120;
printf("你被被扣了72120滴血,剩%d滴血。\n对方被扣了%d滴血,剩%d滴血。\n",xue,gj,xue10);
}
if(xue <= 0){printf("你死了!");Sleep(10000000); return 0;}
}
if(xue10 <= 0){money+=19960;dj+=12800;printf("你赢了!加19960元,12800经验,现有%.2f元,%d经验", money,dj);}
}//10完}//冒险模式完
if(ms=='2')//商店模式
{
printf("\n E--退出\n 1--熔岩长剑(加250战斗力)--40元\n 2--熔岩钩剑(加400战斗力)--80元\n 3熔岩袖剑--(加7200战斗值)--1000元\n 4--血量加成剂I(加1600滴血)--40元\n 5--血量加成剂2(加3200滴血)--80元\n 6--血量加成剂III(加500000滴血)--1500元\n 7--批量购买\n若金钱不足自动跳出");
cin>>shop;
if( (shop == '1') && (money >= 40) ){ gj += 250; money-=40; printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money); }//1
if( (shop == '2') && (money >= 80) ){ gj += 400; money-=80; printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money); }//2
if( (shop == '3') && (money >= 160) ){ gj += 7200; money-=1000; printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money); }//3
if( (shop == '4') && (money >= 40) ){ xue += 1600; money-=40; printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money); }//4
if( (shop == '5') && (money >= 80) ){ xue += 3200; money-=80; printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money); }//5
if( (shop == '6') && (money >= 160) ){ xue += 500000; money-=1500; printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money); }//6
if(shop=='e'||shop=='E')goto loop;
if( shop == '7')
{//7
printf("\n E--退出\n 1--袖剑升级\n 2--血量加成剂");
cin>>pl;
if(pl=='e'||pl=='E')goto loop;
if(pl == '1')
{
printf("请输入要加的战斗力:");cin>>s2;
s1 = s2/20.00*40;if(money >= s1){gj+=s2;money-=s1;printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money);}
}
if(pl == '2')
{
printf("请输入要加的HP:");cin>>s2;
s1 = s2/160.00*40;if(money >= s1){xue+=s2;money-=s1;printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money);}
}
}//7完
}//商店模式完
if(ms=='3')//状态显示模式
{
printf("\n你有%d滴血,%d点攻击,%.2f元。\n" ,xue,gj,money);
}//状态显示模式
if( (ms!='1') && (ms!='2') && (ms!='3') &&(ms!='4')&&(ms!='5'))
{
cout<<"\n乱输的^小猪猪^不是豪猪。";
}
if(ms=='4')
{
printf("\n惊心动魂的时刻来了,请输入你的幸运数字:");cin>>db;
printf("\n请输入你的赌注:");cin>>dbm;
srand((unsigned)time(NULL));bd1 = rand();
if( bd1 % 2 == dbm % 2 && money >= dbm){printf("\n你赢了!金币的20倍!");money = money+0.5*dbm;}
if( bd1 % 2 != dbm % 2 && money >= dbm){printf("\n你输了!失去赌注!");money-=dbm;}
}
if(ms=='5')
{
gly:
printf("\n (EEEE--退出) 请输入变态的修改密码(四位):");cin>>gl1>>gl2>>gl3>>gl4;
if((gl1=='E'&&gl2=='E'&&gl3=='E'&&gl4=='E')||(gl1=='e'&&gl2=='e'&&gl3=='e'&&gl4=='e'))goto loop;
if(gl1=='5'&&gl2=='8'&&gl3=='4'&&gl4=='3')
{
system("cls");g1:
printf("\n 成功!\n (E--退出)你有%d滴血,%d点攻击,%.2f元。\n 1--改血量\n 2--改攻击\n 3--改金钱\n",xue,gj,money);cin>>gd;
if(gd=='1')goto gd1;
if(gd=='2')goto gd2;
if(gd=='3')goto gd3;
}
else{system("cls");printf("\n错误!\n");goto gly;}
}
}//主程序完 1221
gd1:
printf("请输入HP:");cin>>gl;xue=gl;goto g1;
gd2:
printf("请输入战斗力:");cin>>gl;gj=gl;goto g1;
gd3:
printf("请输入金币:");cin>>gl;money=gl;goto g1;
return 0;
} -
2018-01-31 13:45:41@
nfukt
- 1