提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
自我介绍
上代码
一、自我介绍
这是第一篇文章,若有错误,还望海涵
二、上代码
#include<stdio.h>
#include<ctime>
#include<time.h>
#include<windows.h>
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};
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];
Sleep(1000);
printf("--------------------------欢迎来到 鬼灭之刃 1.0 测试版-----------------------\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)
{
if(boom>0)
{
printf("使用爆炸丸,敌人HP减少100\n\n\n");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用爆炸丸!\n\n\n");
break;
case 6:
if(battle)
{
if(dubiao>0)
{
printf("使用紫藤花,敌人HP减少200\n\n\n");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用紫藤花!\n\n\n");
break;
case 7:
if(battle)
{
if(atom_boom>0)
{
printf("为什么杀人,为什么夺舍,你把生命当成什么了!!!--日之呼吸-乱!!!敌人HP减少9999999\n\n\n");
atom_boom--;
guai.health-=99999999;
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<4