勇士冒险游戏

news/2024/11/28 19:33:30/
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<fstream>
using namespace std;//角色信息 
struct person
{char name[255];int health;int maxhealth;int attack;int defence;int speed;int attention;int magic;int maxmagic; int level;int money;int exp;int maxexp;
}player={"\0",100,100,10,5,5,0,100,100,1,1000,0,100};//怪物信息
struct mobs
{char name[255];int blood;int attack;int defence;int speed;int attention;int getm;int gete;int zt;
}enemy[105]={{"\0",0,0,0,0,0,0,0,0},{"蓝色史莱姆",50,5,10,0,0,20,10,0},{"绿色史莱姆",50,5,10,0,0,20,10,0},{"大型史莱姆",150,10,15,0,0,250,50,0},{"黄色史莱姆",150,15,15,2,2,50,20,0},{"红色史莱姆",150,15,15,2,2,50,20,0},{"僵尸",100,25,15,5,5,50,20,0},{"嗜血兽人",400,40,30,10,10,300,100,0},{"巨型史莱姆",300,25,25,5,7,100,30,0},{"僵尸巨人",500,50,35,10,15,200,50,0},{"宝箱怪",400,20,40,20,5,300,20,0},{"骷髅守卫",750,75,40,15,20,350,150,0},{"骷髅弓箭手",400,40,20,20,30,100,100,0},{"骷髅武士",400,40,20,20,30,100,100,0},{"骷髅祭司",400,40,20,20,30,100,100,0},{"骨龙",1000,100,50,30,30,1000,5000,0},{"骷髅王",500,999999,999999,30,30,100,100,0} };//变量声明区 
bool Exit=1,Boss1=0,Boss2=0,Boss3=0,Boss4=0,Dragon=0,shop1=0,shop2=0,shop3=0,fightboss4=0,Sandy[6];
int a,_round,b,c,d;
int sxie=5,xie=3,lxie=2,mxie=1,tw=3,dj=0,md=0,dbj=0,dp=0,key=0,page=1,zhi=0,huo=0,du=0,bing=0,shun=0,ask=1;
char s[255],g;
string x;//函数声明区 
void move();
void First();
void Second();
void Home();
void Author();
void Shop();
void Show();
void Bag();
void Third();
void Fight(int);
int random(int); 
void slowplay();
void fastplay();
void Ask(int);
void Dormitory116();
void Dormitory114(){return;};
void Crab_Dave(){return;};
void color(int);
void Fourth();
void Save();
void Read();
void Book();
void IAttack();
void EAttack();
int Lock(int);
int Unlock(int);int main()
{srand(unsigned(time(NULL)));system("color 0F");//  player.exp+=100000;
//  player.money+=100000;
//  Boss1=Boss2=Boss3=Boss4=1,shop1=shop2=shop3=1;x="欢迎来到 冒险世界~( ̄︶ ̄)↗\n伟大的作者大大:";slowplay();color(4); x="zjy";slowplay();color(1);x="  ∠(⌒▽ ⌒ ∠)_\n版本号 2.1啦~:\n";slowplay();printf("1.调整了部分怪物信息\n2.");color(7);printf("你家里的书桌开放啦~(^O ^ ~)\n");color(1); printf("3.作者之家即将开放...\n4.修复了部分bug(我当年怎么写这么多bug...)\n5.小伙子们,耐心些(咕咕咕)...\n\n");system("pause");yy:system("cls");x="要读档吗?\n";slowplay();printf("1.Yes\n2.No\n");gets(s);if(strcmp(s,"1")==0){system("cls");Read();printf("Reading......");Sleep(1000);printf("Complete!\n");Sleep(700);}else if(strcmp(s,"2")==0){system("cls");x="Please Enter Your Name Here:\n-------+++++++=======+++++++-------\n";fastplay();gets(player.name);x="-------+++++++=======+++++++-------\n";fastplay();x="好的,";slowplay();x=player.name;slowplay();x=",启程吧!迎接挑战!";slowplay();Sleep(500);system("cls");x="Loading......";slowplay();Sleep(500);}else{printf("输入错误!\n");goto yy;}while(Exit){move();}system("cls");x="好吧,再见QAQ...\n";slowplay();x="退出中...";slowplay();Sleep(1000); return 0;
}//移动(已完成)
void move()
{system("cls");printf("请问你要干什么( ̄_ ̄)\n");printf("1.地牢一层\n2.回家\n3.作者之家(装修ing~)\n4.商店\n5.查看信息\n6.查看背包\n7.Exit\n");gets(s);if(strcmp(s,"1")==0) First();else if(strcmp(s,"2")==0) Home();else if(strcmp(s,"3")==0) Author();else if(strcmp(s,"4")==0) Shop();else if(strcmp(s,"5")==0) Show();else if(strcmp(s,"6")==0) Bag();else if(strcmp(s,"7")==0) Exit=0;else{printf("输入错误!!!\n\n");Sleep(700);}
}//地牢一层(已完成) 
void First()
{xx:system("cls");x="这里是地牢一层——费斯特草原...\n";fastplay();x="请问你要干什么( ̄_ ̄)\n";fastplay();printf("1.探索\n2.挑战Boss\n3.前往下一层\n4.查看信息\n5.查看背包\n6.返回\n");gets(s);if(strcmp(s,"1")==0){system("cls");if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xx;}a=random(5);if(a==0){if(shop1==0){x="小贩:?...\n";fastplay();Sleep(300);x="小贩:你是谁?\n";fastplay();Sleep(300);x="小贩:你可以救我出去吗?\n";fastplay();Sleep(700);x="小贩:太好了!谢谢~ (≧ω≦)/\n";fastplay();Sleep(300);x="小贩:哦对了,我在商店工作,没事你可以来找我哦~\n\n";fastplay();Sleep(300);x="商店角色:    小贩  已解锁...\n\n";slowplay();Sleep(300);shop1=1;printf("按任意键返回~");gets(s);}else{x="呼...这里安全...";slowplay();Sleep(500);}}if(a==1||a==2){Fight(1);}if(a==3||a==4){Fight(2);}goto xx;}else if(strcmp(s,"2")==0){if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xx;}Fight(3);goto xx;}else if(strcmp(s,"3")==0){if(Boss1){Second();goto xx;}else{system("cls");x="抱歉,您还没战胜这一层的Boss呢...";fastplay();Sleep(500);goto xx;}}else if(strcmp(s,"4")==0){Show();goto xx;}else if(strcmp(s,"5")==0){Bag();goto xx;}else if(strcmp(s,"6")==0) return;else{printf("输入错误!!!\n\n");Sleep(700);goto xx;}
} //地牢二层(已完成)
void Second()
{xxxxxx:system("cls");x="这里是地牢二层——赛肯德森林...\n";fastplay();x="请问你要干什么( ̄_ ̄)\n";fastplay();printf("1.探索\n2.挑战Boss\n3.前往下一层\n4.查看信息\n5.查看背包\n6.返回\n");gets(s);if(strcmp(s,"1")==0){system("cls");if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xxxxxx;}a=random(10);if(a==0){if(shop1&&shop2==0){x="商人:?...\n";fastplay();Sleep(300);x="商人:你是谁?\n";fastplay();Sleep(300);x="商人:你可以救我出去吗?\n";fastplay();Sleep(700);x="商人:太好了!谢谢~ (≧ω≦)/\n";fastplay();Sleep(300);x="商人:哦对了,我和小贩是好朋友,没事你可以来找我们哦~\n\n";fastplay();Sleep(300);x="商店角色:    商人  已解锁...\n\n";slowplay();Sleep(300);shop2=1;printf("按任意键返回~");gets(s);}else{x="呼...这里安全...";slowplay();Sleep(500);}}if(a==1||a==2||a==3){Fight(4);}if(a==4||a==5||a==6){Fight(5);}if(a==7||a==8||a==9){Fight(6);}goto xxxxxx;}else if(strcmp(s,"2")==0){if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xxxxxx;}Fight(7);goto xxxxxx;}else if(strcmp(s,"3")==0){if(Boss2){Third();goto xxxxxx;}else{system("cls");x="抱歉,您还没战胜这一层的Boss呢...";fastplay();Sleep(500);goto xxxxxx;}}else if(strcmp(s,"4")==0){Show();goto xxxxxx;}else if(strcmp(s,"5")==0){Bag();goto xxxxxx;}else if(strcmp(s,"6")==0) return;else{printf("输入错误!!!\n\n");Sleep(700);goto xxxxxx;}
} //地牢三层(已完成)
void Third()
{xxxxxxxx:system("cls");x="这里是地牢三层——幽异遗迹...\n";fastplay();x="请问你要干什么( ̄_ ̄)\n";fastplay();printf("1.探索\n2.挑战Boss\n3.前往下一层\n4.查看信息\n5.查看背包\n6.返回\n");gets(s);if(strcmp(s,"1")==0){system("cls");if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xxxxxxxx;}a=random(10);if(a==0){if(shop1&&shop2&&shop3==0){x="奸商:?...\n";fastplay();Sleep(300);x="奸商:你是谁?\n";fastplay();Sleep(300);x="奸商:你可以救我出去吗?\n";fastplay();Sleep(700);x="奸商:嗯,你真是个好人~ (≧ω≦)/\n";fastplay();Sleep(300);x="奸商:嘿嘿嘿,还有,我有比另外两个好得多的东西哦~\n\n";fastplay();Sleep(300);x="商店角色:    奸商  已解锁...\n\n";slowplay();Sleep(300);shop3=1;printf("按任意键返回~");gets(s);}else{x="呼...这里安全...";slowplay();Sleep(500);}}if(a==1||a==2||a==3){Fight(8);}if(a==4||a==5||a==6){Fight(9);}if(a==7||a==8||a==9){Fight(10);}goto xxxxxxxx;}else if(strcmp(s,"2")==0){if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xxxxxxxx;}Fight(11);goto xxxxxxxx;}else if(strcmp(s,"3")==0){if(Boss3){Fourth();goto xxxxxxxx;}else{system("cls");x="抱歉,您还没战胜这一层的Boss呢...";fastplay();Sleep(500);goto xxxxxxxx;}}else if(strcmp(s,"4")==0){Show();goto xxxxxxxx;}else if(strcmp(s,"5")==0){Bag();goto xxxxxxxx;}else if(strcmp(s,"6")==0) return;else{printf("输入错误!!!\n\n");Sleep(700);goto xxxxxxxx;}
}//地牢四层(已完成)
void Fourth()
{xxxxxxxxx:system("cls");x="这里是地牢四层——骷髅神殿...\n";fastplay();x="请问你要干什么( ̄_ ̄)\n";fastplay();printf("1.探索\n2.挑战Boss\n3.查看信息\n4.查看背包\n5.返回\n");gets(s);if(strcmp(s,"1")==0){system("cls");if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xxxxxxxxx;}a=random(100);if(a==0){if(!Dragon){system("cls");x="骨龙:......";slowplay();Sleep(1000);Fight(15);}else{x="呼...这里安全...";slowplay();Sleep(500);}}if(a>0&&a<=33){Fight(12);}if(a>33&&a<=66){Fight(13);}if(a>66&&a<=99){Fight(14);}goto xxxxxxxxx;}else if(strcmp(s,"2")==0){if(player.health<=0){x="好累...休息一下再出发吧...";slowplay();Sleep(700);goto xxxxxxxxx;}Fight(16);goto xxxxxxxxx;}else if(strcmp(s,"3")==0){Show();goto xxxxxxxxx;}else if(strcmp(s,"4")==0){Bag();goto xxxxxxxxx;}else if(strcmp(s,"5")==0) return;else{printf("输入错误!!!\n\n");Sleep(700);goto xxxxxxxxx;}
}//作者之家(MMP)
void Author()
{y:system("cls");x="都说了在装修啦...";slowplay();Sleep(500);return;if(!Boss1){ x="打败了大型史莱姆再来吧...\n";slowplay();Sleep(500);return;}else{x="欢迎来到作者之家~\n";slowplay();x="这里是zjy的小屋~\n\n";slowplay();printf("请问你要干什么(^_^)\n");printf("1.有奖问答\n");if(Boss2) printf("2.挑战作者隔壁的寝室\n");if(Boss3) printf("3.挑战作者所在的寝室\n");if(Boss4) printf("4.挑战作者的十大人格\n");printf("\n按n返回~\n");gets(s);if(strcmp(s,"1")==0&&Boss1){Ask(ask);goto y;}else if(strcmp(s,"2")==0&&Boss2){Dormitory116();goto y;}else if(strcmp(s,"3")==0&&Boss3){Dormitory114();goto y;}else if(strcmp(s,"4")==0&&Boss4){Crab_Dave();goto y;}else if(strcmp(s,"n")==0) return;else{printf("输入错误!\n");Sleep(500);goto y;}}
}//有奖问答 
void Ask(int a)
{system("cls");if(a==1){x="这里是第1个问题~\n";slowplay();x="\n问题1:请输入π的小数点后第100位~\n";fastplay();x="Question 1:Please enter the 100th digit after the decimal point of π~\n";fastplay();gets(s);if(strcmp(s,"9")==0){x="\n仔细读题的好孩子(′-v- `)\n";slowplay(); x="\n恭喜你,答对了~\n";slowplay();x="下一关载入中...\n";fastplay();Sleep(500);ask++;Ask(ask);}else{x="\n唉,你还是太菜了啊......";slowplay();x="\n下次加油!";slowplay();Sleep(500);}}if(a==2){x="这里是第2个问题~\n";slowplay();x="\n问题2:谁是这个世界上最帅的人?\n";fastplay();x="Question 2:Who is the most handsome person in the world ?\n";fastplay();gets(s);if(strcmp(s,"Crab_Dave")==0){x="\n谢谢夸奖(*/ω\*)\n";slowplay();x="\n恭喜你,答对了~\n";slowplay();x="下一关载入中...\n";fastplay();Sleep(500);ask++;Ask(ask);}else{x="\n唉,你还是太菜了啊......";slowplay();x="\n下次加油!";slowplay();Sleep(500);}}if(a==3){x="这里是第3个问题~\n";slowplay();x="\n问题3:世界上最帅的人的QQ是多少?\n";fastplay();x="Question 3:What is the QQ number of the most handsome person in the world ?\n";fastplay();gets(s);if(strcmp(s,"1351591429")==0){x="\n想不到你这么关心我呀(*/ω\*)\n";slowplay();x="\n恭喜你,答对了~\n";slowplay();x="下一关载入中...\n";fastplay();Sleep(500);ask++;Ask(ask);}else{x="\n唉,你还是太菜了啊......";slowplay();x="\n下次加油!";slowplay();Sleep(500);}}if(a==4){x="这里是第4个问题~\n";slowplay();x="\n问题4:作者的第五个点子是什么?\n";fastplay();x="Question 4:What is zjy's fifth idea ?\n";fastplay();gets(s);if(strcmp(s,"多彩逗比")==0){x="\n既然都知道了,还不快去试试(~ ̄▽ ̄)~\n";slowplay();x="\n恭喜你,答对了~\n";slowplay();x="下一关载入中...\n";fastplay();Sleep(500);ask++;Ask(ask);}else{x="\n唉,你还是太菜了啊......";slowplay();x="\n下次加油!";slowplay();Sleep(500);}}if(a==5){x="这里是第5个问题~\n";slowplay();x="\n问题5:NOIP2018普及组第4题输出1能拿几分?\n";fastplay();x="Question 5:How many scores can you get by printing 1 to the fourth quesqion in NOIP2018 ?\n";fastplay();gets(s);if(strcmp(s,"4")==0){x="\n真是魂淡啊!!!(▼皿▼ #)\n";slowplay();x="\n恭喜你,答对了~\n";slowplay();x="下一关载入中...\n";fastplay();Sleep(500);ask++;Ask(ask);}else{x="\n唉,你还是太菜了啊......";slowplay();x="\n下次加油!";slowplay();Sleep(500);}}
}//作者隔壁的寝室(开更~) 
void Dormitory116()
{}//查看信息(已完成) 
void Show()
{system("cls");printf("名称:%s\n等级:%d\n血量:%d/%d\n法力:%d/%d\n攻击:%d\n防御:%d\n金币:%d\n经验:%d/%d\n\n按任意键返回~\n",player.name,player.level,player.health,player.maxhealth,player.magic,player.maxmagic,player.attack,player.defence,player.money,player.exp,player.maxexp);gets(s);return;
}//查看背包(差不多完成了吧...)
void Bag()
{xxxx:system("cls");x="背包里有...\n";fastplay();Sleep(300);if(sxie>0){printf("小伤药×%d(使用请输入c)\n",sxie);}if(xie>0){printf("伤药×%d(使用请输入r)\n",xie);}if(lxie>0){printf("大伤药×%d(使用请输入a)\n",lxie);}if(mxie>0){printf("绝好伤药×%d(使用请输入b)\n",mxie);}if(tw>0){printf("藤蔓×%d(使用请输入d)\n",tw);}if(key>0){printf("骷髅秘钥×%d(使用请输入A)\n",key);}if(!sxie&&!xie&&!lxie&&!mxie&&!tw&&!key){x="什么也没有QAQ...";fastplay();Sleep(700);return;}printf("\n若不使用,请输入n\n\n");gets(s);if(strcmp(s,"c")==0&&sxie>0){x="使用了小伤药,恢复血量30点~^_ ^~\n\n";fastplay();Sleep(500);sxie--;player.health=player.health+30;if(player.health>player.maxhealth) player.health=player.maxhealth;goto xxxx;}else if(strcmp(s,"r")==0&&xie>0){x="使用了伤药,恢复血量70点~^. ^~\n\n";fastplay();Sleep(500);xie--;player.health=player.health+70;if(player.health>player.maxhealth) player.health=player.maxhealth;goto xxxx;}else if(strcmp(s,"a")==0&&lxie>0){x="使用了大伤药,恢复血量150点~^。^~\n\n";fastplay();Sleep(500);lxie--;player.health=player.health+150;if(player.health>player.maxhealth) player.health=player.maxhealth;goto xxxx;}else if(strcmp(s,"b")==0&&mxie>0){x="使用了绝好伤药,血量回满~^o ^~\n\n";fastplay();Sleep(500);mxie--;player.health=player.maxhealth;goto xxxx;}else if(strcmp(s,"d")==0&&tw>0){a=random(10);if(a<=4){x="糟糕!误食了毒藤蔓,血量减半QAQ...\n\n";slowplay();player.health/=2;if(player.health<=0) player.health=1;tw--;}else{x="哇,使用了上等药藤,血量翻倍~^O ^~...\n\n";slowplay();player.health=player.health*2;if(player.health>player.maxhealth) player.health=player.maxhealth;tw--;}goto xxxx;}else if(strcmp(s,"A")==0&&key>0){if(fightboss4){x="使用了骷髅秘钥,骷髅王向你臣服...\n\n";slowplay();Sleep(500);player.attack+=9999999;player.defence+=9999999;key--;}else{x="这个不是这么用的!!!\n\n";slowplay();Sleep(500);}goto xxxx;}else if(strcmp(s,"n")==0){return;}else{printf("输入错误!!!\n\n");Sleep(700);goto xxxx;}
}//商店(已完成)
void Shop()
{if(!shop1){system("cls"); x="商店里空空荡荡的...好冷清...\n\n";fastplay();printf("按任意键返回~");gets(s);return;}else if(!shop2){xxxxx:system("cls");x="小贩:啊,";fastplay();x=player.name;fastplay();x=",你要买点什么吗?\n";fastplay();printf("1.小伤药 $20\n");printf("2.伤药     $50\n");printf("3.大伤药 $100\n");printf("4.藤蔓   $75\n\n");printf("n.什么也不买\n");gets(s);if(strcmp(s,"1")==0){if(player.money>=20){x="购买了1个小伤药,花费20金币...";fastplay();Sleep(700);sxie++;player.money-=20;}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"2")==0){if(player.money>=50){x="购买了1个伤药,花费50金币...";fastplay();Sleep(700);xie++;player.money-=50;}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"3")==0){if(player.money>=100){x="购买了1个大伤药,花费100金币...";fastplay();Sleep(700);lxie++;player.money-=100;}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"4")==0){if(player.money>=75){x="购买了1个藤蔓,花费75金币...";fastplay();Sleep(700);tw++;player.money-=75;}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"n")==0) return;else{printf("输入错误!!!\n\n");Sleep(700);}goto xxxxx;}else if(!shop3){x="你要和谁对话?\n1.小贩\n2.商人\n";fastplay();gets(s);if(strcmp(s,"1")==0) goto xxxxx;else if(strcmp(s,"2")==0){xxxxxxx:system("cls");x="商人:啊,";fastplay();x=player.name;fastplay();x=",你要买点什么吗?\n";fastplay();printf("1.绝好伤药 $300\n");printf("2.短剑     $1000\n");printf("3.木盾     $1000\n");printf("n.什么也不买\n");gets(s);if(strcmp(s,"1")==0){if(player.money>=300){x="购买了1个绝好伤药,花费300金币...";fastplay();Sleep(700);mxie++;player.money-=300;}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"2")==0){if(player.money>=1000){if(!dj){x="购买了短剑并装备,攻击+10,花费1000金币...";fastplay();Sleep(700);dj++;if(dbj) player.attack-=30,dbj=0;player.attack+=10;player.money-=1000;}else{x="你已经拥有一把短剑了,不能贪心!!!";slowplay();Sleep(700);}}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"3")==0){if(player.money>=1000){if(!md){x="购买了木盾并装备,防御+10,花费1000金币...";fastplay();Sleep(700);md++;if(dp) player.defence-=20,dp=0;player.defence+=10;player.money-=1000;}else{x="你已经拥有一个木盾了,不能贪心!!!";slowplay();Sleep(700);}}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"n")==0) return;else{printf("输入错误!!!\n\n");Sleep(700);}goto xxxxxxx;}}else{x="你要和谁对话?\n1.小贩\n2.商人\n3.奸商\n";fastplay();gets(s);if(strcmp(s,"1")==0) goto xxxxx;else if(strcmp(s,"2")==0) goto xxxxxxx;else if(strcmp(s,"3")==0){xxxxxxxxx:system("cls");x="奸商:嘿嘿,";fastplay();x=player.name;fastplay();x=",你要买点什么吗?\n";fastplay();printf("1.骷髅秘钥 $5000\n");printf("2.大宝剑   $3000\n");printf("3.银盾     $3000\n");printf("n.什么也不买\n");gets(s);if(strcmp(s,"1")==0){if(player.money>=5000){x="购买了1个骷髅秘钥,花费5000金币...";fastplay();Sleep(700);key++;player.money-=5000;}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"2")==0){if(player.money>=3000){if(!dbj){x="购买了大宝剑并装备,攻击+30,花费3000金币...";fastplay();Sleep(700);dbj++;if(dj) player.attack-=10,dj=0;player.attack+=30;player.money-=3000;}else{x="你已经拥有一把大宝剑了,不能贪心!!!";slowplay();Sleep(700);}}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"3")==0){if(player.money>=3000){if(!dp){x="购买了银盾并装备,防御+20,花费3000金币...";fastplay();Sleep(700);dp++;if(md) player.defence-=10,md=0;player.defence+=20;player.money-=3000;}else{x="你已经拥有一个银盾了,不能贪心!!!";slowplay();Sleep(700);}}else{x="买不起QAQ...";slowplay();Sleep(700);}}else if(strcmp(s,"n")==0) return;else{printf("输入错误!!!\n\n");Sleep(700);}goto xxxxxxxxx;}}
}//家(临时)
void Home()
{xxx:system("cls");x="啊,温暖的";fastplay();x=player.name;fastplay();x="的小屋~\n\n";fastplay();x="请问你要干什么( ̄_ ̄)\n";fastplay();printf("1.吃大餐(200金币一顿,回满血量和法力)\n2.床(存档系统)(目前只支持一个存档位呢...)\n3.书桌(学习技能)\n4.返回\n");gets(s);if(strcmp(s,"1")==0){if(player.money>=200){x=player.name;fastplay();x="享用了一顿美味的大餐(嗝~),血量回满,花费金币200个~\n"; fastplay();player.money-=200;player.health=player.maxhealth;player.magic=player.maxmagic;}else{x="这年头,连饭都吃不起了QAQ...\n";slowplay();}Sleep(700);goto xxx;}else if(strcmp(s,"2")==0){Save();printf("Saveing......");Sleep(1000);printf("Complete!\n");Sleep(700);goto xxx;}else if(strcmp(s,"3")==0){Book();goto xxx;}else if(strcmp(s,"4")==0){return;}else{printf("输入错误!!!\n\n");Sleep(700);goto xxx;}
}//书桌(已完成) 
void Book()
{yy:system("cls");x=player.name;fastplay();x="的小书桌前充满了学习(TuíFeì)的气息~\n";fastplay();x="请问你要看什么( ̄_ ̄)\n";fastplay();printf("1.作者的笔记本(为什么会把这种东西放在这儿啊喂...)\n2.如何学习魔法\n3.一张小纸条\n4.返回\n");gets(s);if(strcmp(s,"1")==0){while(1){system("cls");printf("第%d页\n",page);printf("===================zjy的小笔记本~======================\n");if(page==1){printf("\n\n");printf("这是个密码本~\n\n");printf("请输入密码:");gets(s);if(strcmp(s,"zjy666")==0){printf("\n锁开了!");g=_getch();page++;}else{printf("\n不知道密码就不要来窥探别人的隐私!!!");g=_getch();goto yy;}}else if(page==2){printf("\n魂淡,NOIP2018的普及组第四题好无耻啊QAQ...\n");printf("如果老夫输出3就好了,\n");printf("毕竟前三道题攒了190分了,\n");printf("输出3就可以稳上195,\n");printf("怎么可能得194?!!!!\n");printf("啊啊啊啊啊啊啊啊啊啊!!!!!\n\n");printf("===================zjy的小笔记本~======================\n");printf("←→键翻页,n键退出\n");g=_getch();if(g==77) page++;else if(g=='n') goto yy;}else if(page==3){printf("\nzjy是一个圆周率能背200位的好孩子~\n");printf("π=3.14159265358979323846----------20位\n");printf("     26433832795028841971----------40位\n");printf("     69399375105820974944----------60位\n");printf("     59230781640628620899----------80位\n");printf("     86280348253421170679----------100位\n");printf("     82148086513282306647----------120位\n");printf("     09384460955058223172----------140位\n");printf("     53594081284811174502----------160位\n");printf("     84102701938521105559----------180位\n");printf("     64462294895493038196----------200位\n");printf("不得不说一句我TQL~\n\n");printf("===================zjy的小笔记本~======================\n");printf("←→键翻页,n键退出\n");g=_getch();if(g==75) page--;else if(g==77) page++;else if(g=='n') goto yy;}else if(page==4){printf("\nCrab_Dave的QQ:1351591429\n");printf("Crab_Dave的洛谷账号:Crab_Dave\n");printf("Crab_Dave的博客:https://www.luogu.org/blog/Crab-Dave233/");printf("快去骚扰他吧~\n\n");printf("===================zjy的小笔记本~======================\n");printf("←→键翻页,n键退出\n");g=_getch();if(g==75) page--;else if(g==77) page++;else if(g=='n') goto yy;}else if(page==5){printf("\n好像是最后一页了呢......\n\n\n");printf("===================zjy的小笔记本~======================\n");printf("←→键翻页,n键退出\n");g=_getch();if(g==75) page--;else if(g=='n') goto yy;}}}else if(strcmp(s,"2")==0){yyy:system("cls");printf("学习什么魔法?\n\n");printf("1.治疗术:%d级-->%d级\n",zhi,zhi+1);printf("2.火球术:%d级-->%d级\n",huo,huo+1);printf("3.毒蛊术:%d级-->%d级\n",du,du+1);if(bing<=4) printf("4.冰冻术:%d级-->%d级\n",bing,bing+1);else printf("4.冰冻术:5级-->/\n");printf("5.瞬身术:%d级-->%d级\n",shun,shun+1);printf("n.返回\n\n");gets(s);if(strcmp(s,"1")==0){printf("将花费%d金币学习治疗术,是否确认Y/ANYKEY?\n",(zhi+1)*1000);gets(s);if(strcmp(s,"Y")==0||strcmp(s,"y")==0){if(player.money>=(zhi+1)*1000){player.money-=(zhi+1)*1000;zhi++;printf("学习成功!\n");g=_getch();goto yyy;}else{printf("没钱读什么书!!!\n");g=_getch();goto yyy;}}else{goto yyy;}}else if(strcmp(s,"2")==0){printf("将花费%d金币学习火球术,是否确认Y/ANYKEY?\n",(huo+1)*1000);gets(s);if(strcmp(s,"Y")==0||strcmp(s,"y")==0){if(player.money>=(huo+1)*1000){player.money-=(huo+1)*1000;huo++;printf("学习成功!\n");g=_getch();goto yyy;}else{printf("没钱读什么书!!!\n");g=_getch();goto yyy;}}else{goto yyy;}}else if(strcmp(s,"3")==0){printf("将花费%d金币学习毒蛊术,是否确认Y/ANYKEY?\n",(du+1)*1000);gets(s);if(strcmp(s,"Y")==0||strcmp(s,"y")==0){if(player.money>=(du+1)*1000){player.money-=(du+1)*1000;du++;printf("学习成功!\n");g=_getch();goto yyy;}else{printf("没钱读什么书!!!\n");g=_getch();goto yyy;}}else{goto yyy;}}else if(strcmp(s,"4")==0){if(bing<=4){printf("将花费%d金币学习冰冻术,是否确认Y/ANYKEY?\n",(bing+1)*1000);gets(s);if(strcmp(s,"Y")==0||strcmp(s,"y")==0){if(player.money>=(bing+1)*1000){player.money-=(bing+1)*1000;bing++;printf("学习成功!\n");g=_getch();goto yyy;}else{printf("没钱读什么书!!!\n");g=_getch();goto yyy;}}else{goto yyy;}}else{printf("此技能无法再升级了!!!\n");g=_getch();goto yyy;}}else if(strcmp(s,"5")==0){printf("将花费%d金币学习瞬身术,是否确认Y/ANYKEY?\n",(shun+1)*1000);gets(s);if(strcmp(s,"Y")==0||strcmp(s,"y")==0){if(player.money>=(shun+1)*1000){player.money-=(shun+1)*1000;shun++;printf("学习成功!\n");g=_getch();goto yyy;}else{printf("没钱读什么书!!!\n");g=_getch();goto yyy;}}else{goto yyy;}}else if(strcmp(s,"n")==0) goto yy;else{printf("输入错误!\n");g=_getch();goto yyy;}}else if(strcmp(s,"3")==0){system("cls");printf("小纸条上写着:zjy666\n\n");x="是说作者DL吗???\n";fastplay();g=_getch();goto yy;}else if(strcmp(s,"4")==0) return;else{printf("输入错误!\n");g=_getch();goto yy;}
}//加密 
int Lock(int x)
{return (x+3141)*592-6535897+9323846;
}//解密 
int Unlock(int x)
{return (x-9323846+6535897)/592-3141;
}//存档(已完成) 
void Save()
{ofstream out("Save.txt");//presonal informationout<<player.name<<'\n';out<<Lock(player.health)<<' '<<Lock(player.maxhealth)<<' '<<Lock(player.attack)<<' '<<Lock(player.defence)<<' '<<Lock(player.speed)<<' '<<Lock(player.attention)<<' ';out<<Lock(player.magic)<<' '<<Lock(player.maxmagic)<<' '<<Lock(player.level)<<' '<<Lock(player.money)<<' '<<Lock(player.exp)<<' '<<Lock(player.maxexp)<<'\n';//Boss状压 if(Boss4) out<<Lock(4);else if(Boss3) out<<Lock(3);else if(Boss2) out<<Lock(2);else if(Boss1) out<<Lock(1);else out<<Lock(0);out<<' ';//Dragonif(Dragon) out<<"1 ";else out<<"0 ";//shop状压if(shop3) out<<"3 ";else if(shop2) out<<"2 ";else if(shop1) out<<"1 ";else out<<"0 ";//Sandy状压int San=0;for(int i=0;i<6;i++) San+=(Sandy[i]==true)?1:0,San<<1;San>>1;out<<San<<" "; out<<Lock(514)<<"\n";//bagout<<sxie<<' '<<xie<<' '<<lxie<<' ';out<<random(10)<<" ";out<<mxie<<' '<<tw<<' '<<dj<<' ';out<<random(10)<<" ";out<<md<<' '<<dbj<<' '<<dp<<' '<<key<<' ';out<<random(10)<<" ";//书&询问out<<page<<' '<<zhi<<' '<<huo<<' '<<du<<' '<<bing<<' '<<shun<<' '<<ask<<'\n';out.close();
}//读档(已完成) 
void Read()
{ifstream in("Save.txt");int lalala;//presonal informationin>>player.name;in>>(player.health)>>(player.maxhealth)>>(player.attack)>>(player.defence)>>(player.speed)>>(player.attention);in>>(player.magic)>>(player.maxmagic)>>(player.level)>>(player.money)>>(player.exp)>>(player.maxexp);player.health=Unlock(player.health);player.maxhealth=Unlock(player.maxhealth);player.attack=Unlock(player.attack);player.defence=Unlock(player.defence);player.speed=Unlock(player.speed);player.attention=Unlock(player.attention);player.magic=Unlock(player.magic);player.maxmagic=Unlock(player.maxmagic);player.level=Unlock(player.level);player.money=Unlock(player.money);player.exp=Unlock(player.exp);player.maxexp=Unlock(player.maxexp);//Boss状压 Boss1=Boss2=Boss3=Boss4=false; in>>lalala;if(Unlock(lalala)==4) Boss1=Boss2=Boss3=Boss4=true;else if(Unlock(lalala)==3) Boss1=Boss2=Boss3=true;else if(Unlock(lalala)==2) Boss1=Boss2=true;else if(Unlock(lalala)==1) Boss1=true;//Dragonin>>lalala;Dragon=(lalala==1)?true:false;//shop状压shop1=shop2=shop3=false;in>>lalala;if(lalala==3) shop1=shop2=shop3=true;else if(lalala==2) shop1=shop2=true;else if(lalala==1) shop1=true;//Sandy状压in>>lalala;for(int i=5;i>=0;i--) if(lalala&1) Sandy[i]=true;else Sandy[i]=false; in>>lalala;//bagin>>sxie>>xie>>lxie;in>>lalala;in>>mxie>>tw>>dj;in>>lalala;in>>md>>dbj>>dp>>key;in>>lalala;//书&询问in>>page>>zhi>>huo>>du>>bing>>shun>>ask;in.close(); 
}//我方攻击(已完成) 
void IAttack(bool shuai)
{if(shuai){b=random(100);if(b>=enemy[0].speed){b=random(10);c=random(3)-1;d=player.attack*2-enemy[0].defence+b*c;if(d<1) d=1;b=random(100);if(b>=player.attention){printf("%s率先发起了攻击,造成了%d点伤害!\n\n",player.name,d);}else{printf("%s率先发动了攻击,并且...暴击!造成了%d点伤害!\n\n",player.name,d*=2);}enemy[0].blood-=d;}else printf("%s率先发起了攻击,但是...Miss...\n\n",player.name);}else{b=random(100);if(b>=enemy[0].speed){b=random(10);c=random(3)-1;d=player.attack*2-enemy[0].defence+b*c;if(d<1) d=1;b=random(100);if(b>=player.attention){printf("%s发起了攻击,造成了%d点伤害!\n\n",player.name,d);}else{printf("%s发动了攻击,并且...暴击!造成了%d点伤害!\n\n",player.name,d*=2);}enemy[0].blood-=d;}else printf("%s发起了攻击,但是...Miss...\n\n",player.name);}
}//敌方攻击(已完成) 
void EAttack(bool shuai)
{if(enemy[0].zt!=2){if(shuai){b=random(100);if(b>=player.speed){b=random(10);c=random(3)-1;d=enemy[0].attack*2-player.defence+b*c;if(d<1) d=1;b=random(100);if(b>=enemy[0].attention){printf("%s率先发起了攻击,造成了%d点伤害!\n\n",enemy[0].name,d);}else{printf("%s率先发动了攻击,并且...暴击!造成了%d点伤害!\n\n",enemy[0].name,d*=2);}player.health-=d;}else printf("%s率先发起了攻击,但是...Miss...\n\n",enemy[0].name);}else{b=random(100);if(b>=player.speed){b=random(10);c=random(3)-1;d=enemy[0].attack*2-player.defence+b*c;if(d<1) d=1;b=random(100);if(b>=enemy[0].attention){printf("%s发起了攻击,造成了%d点伤害!\n\n",enemy[0].name,d);}else{printf("%s发动了攻击,并且...暴击!造成了%d点伤害!\n\n",enemy[0].name,d*=2);}player.health-=d;}else printf("%s发起了攻击,但是...Miss...\n\n",enemy[0].name);}}else{b=random(6)+1;if(b<=bing){printf("%s尝试攻击,但寒气困扰着%s,令%s动弹不得!\n",enemy[0].name,enemy[0].name,enemy[0].name);}else{printf("%s挣脱了寒气的束缚!\n",enemy[0].name);enemy[0].zt=0;EAttack(0);}}
}//对战(可能完成了吧...) 
void Fight(int num)
{strcpy(enemy[0].name,enemy[num].name);enemy[0].blood=enemy[num].blood;enemy[0].attack=enemy[num].attack;enemy[0].defence=enemy[num].defence;enemy[0].speed=enemy[num].speed;enemy[0].attention=enemy[num].attention;enemy[0].zt=enemy[num].zt;if(num==16) fightboss4=1;system("cls");x=enemy[0].name;fastplay();x="与你展开了战斗!!!\n\n";fastplay();g=_getch();_round=0;while(player.health>0&&enemy[0].blood>0){system("cls");printf("================第%d回合================\n\n",++_round);printf("你的血量:%d/%d\n你的法力:%d/%d\n对方血量:%d\n\n",player.health,player.maxhealth,player.magic,player.maxmagic,enemy[0].blood);printf("请问你要干什么( ̄_ ̄)\n");printf("1.攻击\n2.使用技能\n3.查看背包\n4.查看信息\n5.逃跑\n\n");gets(s);if(strcmp(s,"1")==0){if(player.speed>=enemy[0].speed){IAttack(1);if(player.health<=0||enemy[0].blood<=0) break;EAttack(0); if(player.health<=0||enemy[0].blood<=0) break;if(enemy[0].zt==1){printf("%s喷出一口毒血,受到了%d点伤害!\n",enemy[0].name,du*20);enemy[0].blood-=du*20;if(player.health<=0||enemy[0].blood<=0) break;}}else{EAttack(1);if(player.health<=0||enemy[0].blood<=0) break;IAttack(0);if(player.health<=0||enemy[0].blood<=0) break;if(enemy[0].zt==1){printf("%s喷出一口毒血,受到了%d点伤害!\n",enemy[0].name,du*20);enemy[0].blood-=du*20;if(player.health<=0||enemy[0].blood<=0) break;}}g=_getch();}else if(strcmp(s,"2")==0){printf("使用什么技能( ̄_ ̄)\n");if(zhi)printf("1.治疗术:回复%d点血量,消耗%d点法力\n",zhi*75,zhi*100);if(huo)printf("2.火球术:对敌人造成%d点伤害,消耗%d点法力\n",huo*75,huo*100);if(du)printf("3.毒蛊术:使敌人中毒,消耗%d点法力\n",du*75);if(bing)printf("4.冰冻术:冰冻敌人,消耗%d点法力\n",bing*75);if(shun)printf("5.瞬身术:当回合攻击,敌人不能反击,消耗%d点法力\n",shun*75);printf("n.不使用技能\n\n");gets(s);if(strcmp(s,"1")==0&&zhi){if(player.magic>=zhi*100){printf("%s吟唱起了咒语...温和的白光撒在%s身上,",player.name,player.name);Sleep(100);printf("%s的血量回复了%d点!\n",player.name,zhi*75);Sleep(750);player.health+=zhi*75;player.magic-=zhi*100;if(player.health>player.maxhealth) player.health=player.maxhealth;EAttack(0);if(player.health<=0||enemy[0].blood<=0) break;if(enemy[0].zt==1){printf("%s喷出一口毒血,受到了%d点伤害!\n",enemy[0].name,du*20);enemy[0].blood-=du*20;if(player.health<=0||enemy[0].blood<=0) break;}}else{printf("呀,没蓝了呢...");_round--;}}else if(strcmp(s,"2")==0&&huo){if(player.magic>=huo*100){printf("%s吟唱起了咒语...熊熊烈焰呼啸着砸到%s身上,",player.name,enemy[0].name);Sleep(100);printf("造成了%d点伤害!\n",huo*75);Sleep(750);player.magic-=huo*100;enemy[0].blood-=huo*75;if(player.health<=0||enemy[0].blood<=0) break;EAttack(0);if(player.health<=0||enemy[0].blood<=0) break;if(enemy[0].zt==1){printf("%s喷出一口毒血,受到了%d点伤害!\n",enemy[0].name,du*20);enemy[0].blood-=du*20;if(player.health<=0||enemy[0].blood<=0) break;}}else{printf("呀,没蓝了呢...");_round--;}}else if(strcmp(s,"3")==0&&du){if(player.magic>=du*75){printf("%s吟唱起了咒语...%s的周围腾起了层层毒雾,",player.name,enemy[0].name);Sleep(100);printf("%s已身中剧毒!\n",enemy[0].name);Sleep(750);player.magic-=du*75;enemy[0].zt=1;EAttack(0);if(player.health<=0||enemy[0].blood<=0) break;if(enemy[0].zt==1){printf("%s喷出一口毒血,受到了%d点伤害!\n",enemy[0].name,du*20);enemy[0].blood-=du*20;if(player.health<=0||enemy[0].blood<=0) break;}}else{printf("呀,没蓝了呢...");_round--;}}else if(strcmp(s,"4")==0&&bing){if(player.magic>=bing*75){printf("%s吟唱起了咒语...%s身周冰霜凝结,",player.name,enemy[0].name);Sleep(100);printf("%s被霜寒之力冰封!\n",enemy[0].name);Sleep(750);player.magic-=bing*75;enemy[0].zt=2;EAttack(0);if(player.health<=0||enemy[0].blood<=0) break;}else{printf("呀,没蓝了呢...");_round--;}}else if(strcmp(s,"5")==0&&shun){if(player.magic>=shun*75){printf("%s吟唱起了咒语...%s毫无防备,",player.name,enemy[0].name);Sleep(100);printf("受到了%d点伤害!\n",shun*player.attack*(rand()%5+1));Sleep(750);player.magic-=shun*75;enemy[0].blood-=shun*player.attack*8;if(player.health<=0||enemy[0].blood<=0) break;printf("%s尝试反击,但晕头转向的他找不到目标!\n",enemy[0].name);if(enemy[0].zt==1){printf("%s喷出一口毒血,受到了%d点伤害!\n",enemy[0].name,du*20);enemy[0].blood-=du*20;if(player.health<=0||enemy[0].blood<=0) break;}}else{printf("呀,没蓝了呢...");_round--;}}else printf("输入错误!\n"),_round--;g=_getch();}else if(strcmp(s,"3")==0){Bag();_round--;}else if(strcmp(s,"4")==0){Show();_round--;}else if(strcmp(s,"5")==0){if(num==3||num==7||num==11){printf("勇士在魔王面前不应该逃跑!\n");Sleep(700);_round--;}else{b=random(10);if(b<4){printf("%s逃跑了...",player.name);Sleep(700);return;}else{printf("糟糕,逃不掉!\n");b=random(10);c=random(3)-1;d=enemy[0].attack*2-player.defence+b*c;if(d<1) d=1;printf("%s发起了攻击,造成了%d点伤害!\n",enemy[0].name,d);player.health-=d;Sleep(700);}}}else{printf("输入错误!!!\n\n");Sleep(700);_round--;}}fightboss4=0;if(player.health<=0){player.health=0;x=player.name;slowplay();x="被打败了...\n匆忙中遗失了一半的金币...\n";slowplay();player.money/=2;x="赶快找个地方回复一下...\n\n";fastplay();Sleep(700);}else if(enemy[0].blood<=0){if((player.level>=1&&player.level<=2&&num<=3)||(player.level>=3&&player.level<=4&&num>=4&&num<=7)||(player.level>=5&&player.level<=6&&num>=8&&num<=11)||(player.level>=7&&player.level<=9&&num>=12&&num<=16)){enemy[0].getm=enemy[num].getm;enemy[0].gete=enemy[num].gete;}else{enemy[0].gete=random(10)+1;enemy[0].getm=random(25)+25;}x="打败了";slowplay();x=enemy[0].name;slowplay();x=",获得金币";slowplay();printf("%d",enemy[0].getm);x="个,经验";slowplay();printf("%d",enemy[0].gete);x="点!\n\n";slowplay();player.money+=enemy[0].getm;player.exp+=enemy[0].gete;if(num==3) Boss1=1;if(num==7) Boss2=1;if(num==11) Boss3=1;if(num==15) Dragon=1;if(num==16){Boss4=1;player.attack-=9999999;player.defence-=9999999;x="咦,这是什么?!\n";slowplay();x="获得了  写着“S”的魔法碎片      ~\n";slowplay();Sandy[1]=1;}if(num==10){a=random(10);if(a==0){x="咦,宝箱怪掉落了伤药!\n";fastplay();xie++;}if(a==1){x="咦,宝箱怪掉落了藤蔓!\n";fastplay();tw++;}if(a==2){x="咦,宝箱怪掉落了200个金币!\n";fastplay();player.money+=200;}}Sleep(500);}while(player.exp>=player.maxexp){x="哇,升级了!\n血量回满,\n最大血量+50,\n法力回满,\n最大法力+50,\n攻击+5,\n防御+2,\n更敏捷了!!!\n更专注了!!!\n\n";slowplay();player.level++;player.maxhealth+=50;player.health=player.maxhealth;player.maxmagic+=50;player.magic=player.maxmagic;player.attack+=5;player.defence+=2;player.speed++;player.attention++;player.exp-=player.maxexp;player.maxexp+=200;Sleep(500);}
}//随机函数+取模 
int random(int a)
{return (rand()%a+rand()%a+rand()%a)%a;
}//慢输出
void slowplay()
{int l=x.length();for(int i=0;i<l;i++)printf("%c",x[i]),Sleep(85);
}//快输出
void fastplay()
{int l=x.length();for(int i=0;i<l;i++)printf("%c",x[i]),Sleep(2);
}//颜色函数 
void color(int a)
{switch(a){//黑底白字case 1:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);break;//黑底红字case 2:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);break;//黑底绿字case 3:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);break;//黑底黄字case 4:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);break;//黑底蓝字case 5:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);break;//黑底品红case 6:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);break;//黑底青色case 7:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);break;}
}

http://www.ppmy.cn/news/615762.html

相关文章

Redis之击穿、穿透、雪崩问题

目录 缓存问题之缓存击穿 击穿解释&#xff1a; 击穿&#xff1a;高并发量的同时key失效&#xff0c;导致请求直接到达数据库&#xff1b; 解决方法&#xff1a; 缓存问题之缓存穿透 穿透解释&#xff1a; 穿透&#xff1a; 很多请求都在访问数据库一定不存在的数据&…

【UE4】实现《黑暗之魂》背刺攻击——如何判断攻击位置?!

这次分享一个我在DynamicCombatSystem里面学来的一个功能——就是判断攻击的位置&#xff0c;例如在黑暗之魂中玩家经常要用到背刺&#xff0c;那么就得站到敌人的背后进行攻击&#xff0c;如何判断玩家是在敌人的背后呢&#xff1f; Step1 创建一个枚举&#xff0c;有四个位置…

《黑暗之魂3》的游戏设计思路

动作游戏基础概念 动作游戏的深度与宽度 宽度 简单&#xff1a;游戏可能出现情况的和 等价&#xff1a;可能空间 例如&#xff1a;黑魂中的普攻、战技、魔法、咒术、盾反、翻滚或滑步、不同武器的不同动作模组、小怪的AI和设计、玩家之间的入侵玩法、Boss的设计等等每一种可能&…

NoSQL之redis缓存雪崩、穿透、击穿概念解决办法

目录 一&#xff1a;缓存雪崩 1.1概念理解 1.2解决方案 1.2.1数据预热 1.2.2缓存层高可用 1.2.3做二级缓存&#xff0c;或双缓存策略 1.2.4缓存业务添加限流和服务降级策略 1.3举例 二&#xff1a;缓存穿透 2.1概念理解 2.2解决方案 2.2.1缓存空值 2.2.2布隆过滤器…

恶魔之魂重制版登陆服务器未响应,数毛社分析《恶魔之魂:重制版》 60帧运行,加载超快...

原标题&#xff1a;数毛社分析《恶魔之魂&#xff1a;重制版》 60帧运行&#xff0c;加载超快 魂类游戏《恶魔之魂&#xff1a;重制版》将登陆PS5平台&#xff0c;很多玩家都非常期待该作。近日&#xff0c;数毛社公布了PS5《恶魔之魂&#xff1a;重制版》的游戏演示分析。Rese…

原罪学者 无限连接服务器,黑暗之魂2原罪学者 召唤或连线失败的解决方法分享...

黑暗之魂2原罪学者 召唤或连线失败的解决方法分享 今天为大家带来的是黑暗之魂2原罪学者召唤或连线失败的解决方法分享&#xff0c;一起来看看吧&#xff01; 自从前几天更新之后无法召唤与被召唤让本人非常苦恼&#xff0c;因为我很喜欢跟别人一起逛街阿!!!!因此我在网路上爬文…

《计算之魂》读书笔记

计算之魂&#xff08;吴军&#xff09; 引子 计算的本质——从机械到电子 第 1 章 毫厘千里之差——大O概念 1.1 算法的规范化和量化度量 软件为什么从计算机科学中分离出来&#xff1f; 最初计算机是用于计算&#xff0c;而拥有了计算的基础功能&#xff0c;为了更高效计算更…

Redis中的缓存穿透,缓存击穿,缓存雪崩,分布式锁

目录 一、缓存是什么&#xff1f; 二、缓存穿透 1.缓存穿透是什么 2.解决方案 三、缓存击穿 缓存击穿是什么 2.解决方案 四、缓存雪崩 1.什么是缓存雪崩 2.解决方式 五、使用redis实现分布式锁 总结 一、缓存是什么&#xff1f; 缓存是数据交换的缓冲区&#xff0c;是…