玩这个游戏要用C++14
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
#define int long long
int zhengcha=0;
int Exp=0;
int lv=1;
int tao;
int ls[3][4]={{15,8,2,0},{20,8,3,0},{25,8,3,0}};
map<int,string> pass;
map<string,int> word;
string password="20230128";
int geshu[30];
map<char,int> temppp;
struct jineng
{
string name;
int sud;
pair<int,int> shan,gong,fang,huif;
int mp;
vector<int> z;
void init1(int x,pair<int,int> y,pair<int,int> z,pair<int,int> a,pair<int,int> b,int c,string s)
{
name=s;
sud=x;
shan=a;
gong=y;
fang=z;
huif=b;
mp=c;
}
void init2(vector<int> c)
{
for(unsigned int i=0;i<c.size();i++)
{
z.push_back(c[i]);
}
}
};
jineng j[30];
struct zuangtai
{
string name;
int shan,gong,fang,fhp;
void init(int a,int b,int c,int d,string s)
{
name=s;
shan=a;
gong=b;
fang=c;
}
}buff[3];
struct wuping
{
string mingzi;
int huixei;
int huimp;
int flag;
void init(int a,int b,string c,int f)
{
mingzi=c;
huixei=a;
huimp=b;
flag=f;
}
}w[3];
class People
{
private:
int ls[3];
int gls[3];
int hp;
int mp;
int hps;
int mps;
int stx;
public:
vector<int> a;
int shenmi;
string name;
void let_go()
{
hp=hps;
mp=mps;
}
void init(int hpsx,int mpsx,int stsx,int shenmix)
{
hps=hpsx;
hp=hps;
mps=mpsx;
mp=mps;
stx=stsx;
shenmi=shenmix;
gls[0]=0;
gls[1]=0;
gls[2]=0;
}
void get_name(string x)
{
name=x;
}
void insert_jineng(int x)
{
a.push_back(x);
}
bool Is_over()
{
return hp>0;
}
void havemp()
{
if(mp<mps)
{
mp++;
}
if(gls[2]>0)
{
cout<<"你收到了流血效果"<<endl;
cout<<"HP减"<<gls[2]<<endl;
hp-=gls[2];
gls[2]--;
}
}
void have(int x,int g)
{
gls[x]+=g;
}
void havehp(int x)
{
if(hp+x>hps)
{
hp=hps;
}
else
{
hp+=x;
}
}
void havehurt(int x)
{
cout<<name<<"受到了"<<x<<"点伤害"<<endl;
hp-=x;
}
void eat(int x)
{
cout<<"你吃了"<<w[x].mingzi<<endl;
if(w[x].huixei!=0)
{
cout<<"你回复了"<<w[x].huixei<<"点血量"<<endl;
havehp(w[x].huixei);
}
if(w[x].huimp!=0)
{
cout<<"你回复了"<<w[x].huimp<<"点MP"<<endl;
if(mp+w[x].huimp>mps)
{
mp=mps;
}
else
{
mp+=w[x].huimp;
}
}
}
void a_say()
{
for(unsigned int i=0;i<a.size();i++)
{
cout<<i+1<<"."<<j[a[i]].name<<"("<<j[a[i]].mp<<")"<<":攻击点数:"<<j[a[i]].gong.first<<"~"<<j[a[i]].gong.second<<"防御点数:"<<j[a[i]].fang.first<<"~"<<j[a[i]].fang.second<<"闪避点数:"<<j[a[i]].shan.first<<"~"<<j[a[i]].shan.second<<"回血点数:"<<j[a[i]].huif.first<<"~"<<j[a[i]].huif.second<<endl;
}
}
void say()
{
cout<<name<<": "<<" Hp: "<<hp<<"/"<<hps<<" Mp: "<<mp<<"/"<<mps;
if(gls[2])
{
cout<<"流血*"<<gls[2];
}
cout<<endl;
}
void diaocha_say(People x)
{
cout<<x.name<<":"<<endl;
x.a_say();
}
void diaocha(People x)
{
if(x.shenmi<=zhengcha)
{
diaocha_say(x);
}
else
{
cout<<"滴~滴~"<<endl;
cout<<"侦查点数不足"<<endl;
}
}
vector<int> fight(People &x)
{
int flag=0;
int flag1=0;
// int flag2=0;
char temp=' ';
vector<int> gj;
cout<<"孩子你不清楚技能就看一下吧"<<endl;
cout<<"0.查看\n1.调查\n2.攻击\n3.物品"<<endl;
if(x.shenmi-1>lv&&hp<=5)
{
cout<<"4.逃跑"<<endl;
}
cin>>temp;
while(temp!='2')
{
if(temp!='0'&&temp!='1'&&temp!='2'&&temp!='3')
{
if(temp=='4'&&x.shenmi-1>lv&&hp<=5)
{
if(x.shenmi-2==lv)
{
tao=1;
cout<<"逃跑成功!"<<endl;
return gj;
}
}
cout<<"这可是有关生命安全的事!\n孩子别胡来"<<endl;
say();
x.say();
cout<<"0.查看\n1.调查\n2.攻击\n3.物品"<<endl;
if(x.shenmi-1>lv&&hp<=5)
{
cout<<"4.逃跑"<<endl;
}
}
if(temp=='0')
{
if(flag==0)
{
a_say();
flag=1;
system("pause");
system("cls");
say();
x.say();
cout<<"0.查看\n1.调查\n2.攻击\n3.物品"<<endl;
if(x.shenmi-1>lv&&hp<=5)
{
cout<<"4.逃跑"<<endl;
}
}
else
{
cout<<"你已经看过了!"<<endl;
}
}
if(temp=='1')
{
if(flag1==0)
{
diaocha(x);
flag=1;
system("pause");
system("cls");
say();
x.say();
cout<<"0.查看\n1.调查\n2.攻击\n3.物品"<<endl;
if(x.shenmi-1>lv&&hp<=5)
{
cout<<"4.逃跑"<<endl;
}
}
else
{
cout<<"你已经看过了!"<<endl;
}
}
if(temp=='3')
{
temppp.clear();
int tep=-1;
int tempp=1;
char tepp='0';
char ch=' ';
for(int i=0;i<=2;i++)
{
if(geshu[i]!=0)
{
if(w[i].flag==1)
{
tep=i;
tempp=0;
}
}
}
if(tempp)
{
cout<<"空"<<endl;
cout<<"你什么都没有,算了吧"<<endl;
system("pause");
system("cls");
say();
x.say();
cout<<"0.查看\n1.调查\n2.攻击\n3.物品"<<endl;
if(x.shenmi-1>lv&&hp<=5)
{
cout<<"4.逃跑"<<endl;
}
cin>>temp;
continue;
}
else
{
for(int i=0;i<=2;i++)
{
if(geshu[i]!=0&&w[i].flag==1)
{
cout<<w[i].mingzi<<geshu[i]<<"个";
tempp=0;
if(i!=tep)
{
cout<<',';
}
}
}
}
cout<<endl;
cout<<"你要吃啥?"<<endl;
cout<<"0.退出"<<endl;
for(int i=0;i<=2;i++)
{
if(geshu[i]!=0&&w[i].flag==1)
{
tepp++;
cout<<tepp<<"."<<w[i].mingzi<<endl;
temppp[tepp]=i;
}
}
cin>>ch;
while(ch<'0'||ch>tepp)
{
cout<<"好好选"<<endl;
cin>>ch;
}
if(ch!='0')
{
eat(temppp[ch]);
geshu[temppp[ch]]--;
}
system("pause");
system("cls");
say();
x.say();
cout<<"0.查看\n1.调查\n2.攻击\n3.物品"<<endl;
if(x.shenmi-1>lv&&hp<=5)
{
cout<<"4.逃跑"<<endl;
}
}
cin>>temp;
}
for(unsigned int i=0;i<a.size();i++)
{
cout<<i+1<<"."<<j[a[i]].name<<endl;
}
for(int i=1;i<=stx;i++)
{
cout<<"你的第"<<i<<"招是什么?(输入0即放弃"<<endl;
temp=' ';
cin>>temp;
while(1)
{
if((unsigned int)(temp-'0')<=a.size())
{
if(temp=='0')
{
break;
}
if(j[a[temp-'1']].mp>mp)
{
cout<<"你蓝不够!"<<endl;
}
else
{
break;
}
}
else
{
cout<<"请重新输入!"<<endl;
}
cin>>temp;
}
if(temp=='0')
{
break;
}
mp-=j[a[temp-'1']].mp;
gj.push_back(a[temp-'1']);
}
cout<<"好,你的招数是:"<<endl;
for(unsigned int i=0;i<gj.size();i++)
{
cout<<j[gj[i]].name<<endl;
}
Sleep(1000);
return gj;
}
vector<int> aifight(People &x)
{
vector<int> gj;
int temp;
if(mp==1)
{
temp=rand()%5;
if(temp==0)
{
cout<<name<<"跳过了这个回合!"<<endl;
return gj;
}
}
cout<<name<<"的招数是:"<<endl;
for(int i=1;i<=stx;i++)
{
if(mp==0)
{
break;
}
temp=rand()%a.size();
while(j[a[temp]].mp>mp)
{
temp=rand()%a.size();
}
cout<<j[a[temp]].name<<" ";
gj.push_back(a[temp]);
mp-=j[a[temp]].mp;
}
cout<<endl;
return gj;
}
};
People you;
People muou;
People mouse;
int Read(string s)
{
string a;
int id;
int l;
int temp;
ifstream in(s+".in");
in>>a>>lv>>zhengcha>>Exp>>id>>l;
for(int i=2;i<l;i++)
{
in>>temp;
you.insert_jineng(temp);
}
// in>>mzhg>>zd>>swhm>>qxs>>swx>>sn>>mp>>tongguan>>sw1>>zd1>>sn1>>mz1>>mp1>>zbbj>>ccg>>mzzd>>mz>>tongguan1>>sw>>x>>s>>cdd>>jg>>qiang>>gun>>by>>vv;
// for(int i=0;i<=99;i++) in>>gjj[i];
// for(int i=0;i<=99;i++) in>>hjj[i];
// for(int i=0;i<=99;i++) in>>zjj[i];
in.close();
return id;
}
void Save(string s,int id)
{
ofstream out(s+".in");
out<<"1.0.0\n";
out<<lv<<' '<<zhengcha<<' '<<Exp<<' '<<id<<' '<<you.a.size()<<'\n';
for(unsigned int i=2;i<you.a.size();i++)
{
out<<you.a[i]<<' ';
}
out<<'\n';
// for(int i=0;i<=99;i++) out<<' '<<gjj[i];out<<'\n';
// for(int i=0;i<=99;i++) out<<' '<<hjj[i];out<<'\n';
// for(int i=0;i<=99;i++) out<<' '<<zjj[i];out<<'\n';
out.close();
}
void Init()
{
password=password+"8495162";
buff[0].init(-1,0,0,0,"虚弱");
buff[1].init(0,-1,-1,0,"破绽");
buff[2].init(0,0,0,1,"流血");
j[0].init1(1,{3,5},{0,1},{0,0},{0,0},1,"劈砍");
j[0].init2({0,0,0});
j[1].init1(1,{0,0},{3,4},{0,0},{0,0},1,"格挡");
j[1].init2({0,0,0});
j[2].init1(1,{2,5},{1,2},{0,1},{0,0},1,"出拳");
j[2].init2({0,0,0});
j[3].init1(1,{0,1},{3,3},{0,0},{0,0},1,"防御");
j[3].init2({0,0,0});
j[4].init1(1,{4,4},{0,0},{1,2},{0,0},1,"撕咬");
j[4].init2({0,0,0});
j[5].init1(1,{0,0},{0,0},{2,3},{0,0},1,"躲闪");
j[5].init2({0,0,0});
j[6].init1(1,{0,0},{0,0},{0,0},{4,5},1,"吃奶酪");
j[6].init2({0,0,0});
j[7].init1(1,{0,1},{0,0},{3,5},{0,0},-1,"鬼影");
j[7].init2({0,0,0});
j[8].init1(1,{2,5},{0,0},{0,0},{3,5},2,"灵魂吸引");
j[8].init2({0,0,0});
j[9].init1(1,{0,0},{3,3},{5,7},{0,0},2,"抱头鼠窜");
j[9].init2({0,0,0});
j[10].init1(1,{0,0},{0,0},{0,0},{3,4},3,"木偶自修复");
j[10].init2({0,0,0});
j[11].init1(1,{0,0},{0,0},{2,4},{0,0},0,"悬浮");
j[11].init2({0,0,0});
j[12].init1(1,{4,7},{2,3},{0,1},{0,0},2,"重击");
j[12].init2({0,0,1});
j[13].init1(1,{1,3},{3,6},{0,0},{0,0},1,"织网");
j[13].init2({0,0,0});
j[14].init1(1,{3,4},{0,0},{5,7},{0,0},2,"跳蛛出击");
j[14].init2({0,0,2});
j[15].init1(1,{0,0},{0,0},{0,0},{0,0},-1,"不动");
j[15].init2({0,0,0});
w[0].init(10,0,"奶酪饼干",1);
w[1].init(0,2,"巧克力豆",1);
w[2].init(0,0,"火把",2);
}
void wait()
{
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<"."<<endl;
}
void Fight(People &a,vector<int> x,vector<int> y)
{
int agong,yougong;
int afang,youfang;
int ashan,youshan;
int ahuif,youhuif;
vector<int> abuff,youbuff;
for(unsigned int i=0;i<min(x.size(),y.size());i++)
{
cout<<j[x[i]].name<<"对"<<j[y[i]].name<<endl;
Sleep(1000);
agong=rand()%(j[y[i]].gong.second-j[y[i]].gong.first+1)+j[y[i]].gong.first;
afang=rand()%(j[y[i]].fang.second-j[y[i]].fang.first+1)+j[y[i]].fang.first;
ashan=rand()%(j[y[i]].shan.second-j[y[i]].shan.first+1)+j[y[i]].shan.first;
ahuif=rand()%(j[y[i]].huif.second-j[y[i]].huif.first+1)+j[y[i]].huif.first;
abuff=j[x[i]].z;
youbuff=j[y[i]].z;
yougong=rand()%(j[x[i]].gong.second-j[x[i]].gong.first+1)+j[x[i]].gong.first;
youfang=rand()%(j[x[i]].fang.second-j[x[i]].fang.first+1)+j[x[i]].fang.first;
youshan=rand()%(j[x[i]].shan.second-j[x[i]].shan.first+1)+j[x[i]].shan.first;
youhuif=rand()%(j[x[i]].huif.second-j[x[i]].huif.first+1)+j[x[i]].huif.first;
if(youshan>=agong)
{
cout<<"你躲掉了伤害"<<endl;
}
else if(youfang>=agong)
{
cout<<"你挡下了伤害"<<endl;
for(int j=0;j<youbuff.size();j++)
{
if(youbuff[j]!=0)
{
you.have(j,youbuff[j]);
cout<<"但你受到了"<<youbuff[j]<<"层"<<buff[j].name<<endl;
}
}
}
else
{
you.havehurt(agong-youfang);
for(int j=0;j<youbuff.size();j++)
{
if(youbuff[j]!=0)
{
you.have(j,youbuff[j]);
cout<<"但你受到了"<<youbuff[j]<<"层"<<buff[j].name<<endl;
}
}
}
if(ashan>=yougong)
{
cout<<a.name<<"躲掉了伤害"<<endl;
}
else if(afang>=yougong)
{
cout<<a.name<<"挡下了伤害"<<endl;
}
else
{
a.havehurt(yougong-afang);
}
if(youhuif>0)
{
cout<<"你回复了"<<youhuif<<"点血"<<endl;
you.havehp(youhuif);
}
if(ahuif>0)
{
cout<<a.name<<"回复了"<<ahuif<<"点血"<<endl;
a.havehp(ahuif);
}
}
if(x.size()>y.size())
{
for(unsigned int i=y.size();i<x.size();i++)
{
cout<<j[x[i]].name<<"轮空"<<endl;
yougong=rand()%(j[x[i]].gong.second-j[x[i]].gong.first+1)+j[x[i]].gong.first;
youhuif=rand()%(j[x[i]].huif.second-j[x[i]].huif.first+1)+j[x[i]].huif.first;
a.havehurt(yougong);
if(youhuif>0)
{
cout<<"你回复了"<<youhuif<<"点血"<<endl;
you.havehp(youhuif);
}
}
}
else
{
for(unsigned int i=x.size();i<y.size();i++)
{
cout<<j[y[i]].name<<"轮空"<<endl;
agong=rand()%(j[y[i]].gong.second-j[y[i]].gong.first+1)+j[y[i]].gong.first;
ahuif=rand()%(j[y[i]].huif.second-j[y[i]].huif.first+1)+j[y[i]].huif.first;
youbuff=j[y[i]].z;
you.havehurt(agong);
for(int j=0;j<youbuff.size();j++)
{
if(youbuff[j]!=0)
{
you.have(j,youbuff[j]);
cout<<"但你受到了"<<youbuff[j]<<"层"<<buff[j].name<<endl;
}
}
if(ahuif>0)
{
cout<<a.name<<"回复了"<<ahuif<<"点血"<<endl;
a.havehp(ahuif);
}
}
}
}
void fight(People a,int h)
{
tao=0;
vector<int> x;
vector<int> y;
if(h==3)
{
h=rand()%2;
}
while(a.Is_over()&&you.Is_over())
{
you.say();
a.say();
if(h==1)
{
x=you.fight(a);
if(tao==1)
{
cout<<"你仓皇逃窜"<<endl;
system("pause");
system("cls");
return;
}
// cout<<"ok"<<endl;
// Sleep(1000);
y=a.aifight(you);
Fight(a,x,y);
you.havemp();
a.havemp();
system("pause");
system("cls");
}
else
{
// cout<<"ok"<<endl;
// Sleep(1000);
y=a.aifight(you);
x=you.fight(a);
if(tao==1)
{
cout<<"你仓皇逃窜"<<endl;
system("pause");
system("cls");
return;
}
Fight(a,x,y);
you.havemp();
a.havemp();
system("pause");
system("cls");
}
}
if(!you.Is_over())
{
cout<<"你被一个"<<a.name<<"杀死了"<<endl;
exit(0);
}
cout<<"你成功了!"<<endl;
Sleep(500);
int temp=rand()%5+1;
cout<<"你获得了"<<temp<<"点EXP"<<endl;
Exp+=temp;
if(Exp>=10&&lv==1)
{
lv++;
cout<<"你的Lv增加了!"<<endl;
you.init(20,8,3,0);
}
if(Exp>=25&&lv==2)
{
lv++;
cout<<"你的Lv增加了!"<<endl;
you.init(25,8,3,0);
}
system("pause");
system("cls");
return;
}
int erchalukou(int x,string s)
{
int flag=0;
char temp=' ';
cout<<"你发现了一个二岔路口"<<endl;
Sleep(500);
cout<<"1.左转\n2.右转\n3.侦查"<<endl;
while(temp!='1'&&temp!='2')
{
cin>>temp;
if(temp!='1'&&temp!='2'&&temp!='3')
{
cout<<"孩子好好走(请在1,2,3中做选择!)"<<endl;
}
else if(temp=='3')
{
if(zhengcha>=x)
{
flag++;
cout<<s<<endl;
if(flag==5&&zhengcha==1)
{
cout<<"你侦察了很多次后,对侦察的领悟到了更多"<<endl;
cout<<"彩蛋:侦察点数++"<<endl;
Sleep(1000);
zhengcha++;
}
cout<<"所以你是左转还是右转?"<<endl;
}
else
{
cout<<"滴~滴~"<<endl;
cout<<"侦查点数不足"<<endl;
}
}
}
return temp-'0';
}
void Play1()
{
char temp=' ';
cout<<"Sorry 让我想想该怎么给你这个孩子一些指导。"<<endl;
Sleep(1000);
cout<<"来,看到眼前的十字路口了吗?\n1.是\n2.不是"<<endl;
while(temp!='1')
{
cin>>temp;
if(temp!='1'&&temp!='2')
{
cout<<"孩子好好说话(请在1,2中做选择!)"<<endl;
}
else if(temp!='1')
{
cout<<"孩子你眼睛还没瞎!"<<endl;
}
}
temp=' ';
cout<<"看见了是不是";
wait();
cout<<"看在这个路口,你可以左转和右转!,那接下来你该怎么走呢?"<<endl;
Sleep(1000);
cout<<"你解锁了新地形:二岔路口!"<<endl;
cout<<"1.左转\n2.右转"<<endl;
while(temp!='1'&&temp!='2')
{
cin>>temp;
if(temp!='1'&&temp!='2'&&temp!='3')
{
cout<<"孩子好好走(请在1,2中做选择!)"<<endl;
}
else if(temp=='3')
{
if(zhengcha==0)
{
cout<<"你领悟到了侦查的秘密!"<<endl;
Sleep(700);
cout<<"彩蛋:侦查点数++"<<endl;
zhengcha++;
cout<<"可惜你没法从这个路口看出来点什么"<<endl;
cout<<"所以你是左转还是右转?"<<endl;
}
else
{
cout<<"孩子好好走(请在1,2中做选择!)"<<endl;
}
}
}
if(temp=='2')
{
cout<<"你觉得你多绕了一点路"<<endl;
}
else
{
cout<<"你走过了这个路口"<<endl;
}
temp=' ';
Sleep(1000);
cout<<"好,让你来看看我们这个世界的战斗。"<<endl;
Sleep(500);
cout<<"你面前出现了一个木偶"<<endl;
muou.get_name("木偶");
muou.init(5,3,2,1);
muou.insert_jineng(0);
muou.insert_jineng(1);
system("pause");
system("cls");
cout<<"在这个世界里每次出手都使用的是技能\n每个技能都有攻击点数,防御点数,闪避点数,回血点数,骰子点数,以及特殊效果"<<endl;
Sleep(1500);
cout<<"大家都有技能,包括我(一个简简单单的旁白!~"<<endl<<endl;
Sleep(700);
cout<<"每个技能被分为攻击牌,防御牌,准备牌。"<<endl<<endl;
Sleep(1000);
cout<<"攻击点数:攻击他人 伤害:攻击点数-他人装备防护-他人防御点数\n"<<endl;
Sleep(1500);
cout<<"防御点数;防守 作用:抵消攻击,如果防御点数不小于攻击点数,那就是防御成功,不收伤害,如果失败那减少伤害\n"<<endl;
Sleep(1500);
cout<<"闪避点数:Miss! 躲开攻击 如果闪避点数不小于攻击点数,那闪避成功,不收伤害,但一旦失败,那伤害全收\n"<<endl;
Sleep(1500);
cout<<"每个技能要消耗一定的速度骰子,就像你,现在有2个骰子。"<<endl;
cout<<"每个攻击牌有趟数(既一张牌打多少下),防御牌没有趟数,闪避牌是如果成功继续使用,一次失败那后面伤害全吃"<<endl;
wait();
cout<<"开始啰"<<endl;
system("pause");
system("cls");
fight(muou,1);
cout<<"孩子,你赢了!"<<endl;
Sleep(700);
cout<<"我还有事先走了!"<<endl;
cout<<" --旁白离开了"<<endl;
cout<<"你漫无目的的走着";
wait();
if(erchalukou(1,"左边的小路上有小老鼠的脚印,右边小路上的阴影有些不对劲的浓重")==1)
{
cout<<"你发现小路上有一只小老鼠!"<<endl;
cout<<"开始战斗!"<<endl;
system("pause");
system("cls");
mouse.get_name("小老鼠");
mouse.init(8,4,2,2);
mouse.insert_jineng(4);
mouse.insert_jineng(5);
mouse.insert_jineng(6);
fight(mouse,1);
cout<<"耗子一只接着一只..."<<endl;
cout<<"战斗继续!"<<endl;
system("pause");
system("cls");
mouse.get_name("小耗子");
mouse.init(10,4,2,2);
fight(mouse,1);
cout<<"你在攻击耗子的途中学会了新技能--抱头鼠窜!"<<endl;
you.insert_jineng(9);
}
else
{
cout<<"Danger!~Danger!~"<<endl;
Sleep(300);
cout<<"前方出现了一个鬼!"<<endl;
cout<<"开始战斗!"<<endl;
system("pause");
system("cls");
mouse.get_name("鬼");
mouse.init(50,5,3,3);
mouse.insert_jineng(0);
mouse.insert_jineng(1);
mouse.insert_jineng(7);
mouse.insert_jineng(8);
fight(mouse,0);
while(tao==0)
{
cout<<"鬼:呵呵呵,我免疫物理伤害,掉HP只是出于礼貌,你认为我还能死吗?"<<endl;
system("pause");
system("cls");
fight(mouse,0);
}
}
cout<<"前面出现了一个闪闪发光的东西~"<<endl;
cout<<"1.过去看看\n2.不管不顾"<<endl;
temp=' ';
cin>>temp;
while(temp!='1')
{
if(temp=='2')
{
cout<<"过去看看吧!"<<endl;
cout<<"(请选1"<<endl;
}
else
{
cout<<"好好走路!(请在1,2中做选择!)"<<endl;
}
cin>>temp;
}
temp=' ';
cout<<"这是一个存档点!"<<endl;
Sleep(700);
cout<<"你解锁了新地形:存档点!"<<endl;
Sleep(1000);
cout<<"所以,你要保存你的当前进度吗?"<<endl;
cout<<"1.要\n2.不要"<<endl;
cin>>temp;
while(temp!='1'&&temp!='2')
{
cout<<"好好选!(重做选择)"<<endl;
cin>>temp;
}
if(temp=='1')
{
cout<<"请输入你的存档名"<<endl;
string s;
cin>>s;
cout<<"保存中";
wait();
Save(s,1);
cout<<"保存好了"<<endl;
cout<<"你的Hp和Mp都回复满了!"<<endl;
you.let_go();
}
}
void Play2()
{
People muou2,mouse2,muou3,zhizhu;
muou2.get_name("木偶");
muou2.init(5,3,2,1);
muou2.insert_jineng(0);
muou2.insert_jineng(1);
mouse2.get_name("小耗子");
mouse2.init(10,4,2,2);
mouse2.insert_jineng(4);
mouse2.insert_jineng(5);
mouse2.insert_jineng(6);
muou3.get_name("装甲木偶-lv0");
muou3.init(17,5,3,3);
muou3.insert_jineng(1);
muou3.insert_jineng(12);
zhizhu.get_name("跳蛛");
zhizhu.init(20,4,2,4);
zhizhu.insert_jineng(13);
zhizhu.insert_jineng(14);
zhizhu.insert_jineng(15);
char temp=' ';
cout<<"你继续往前走去"<<endl;
Sleep(700);
cout<<"你来到了一片平地"<<endl;
Sleep(700);
cout<<"你解锁了新地形:平地"<<endl;
vector<People> g;
g.push_back(muou2);
g.push_back(mouse2);
g.push_back(muou2);
while(temp!='2'&&g.size()>0)
{
cout<<"你现在要干啥?"<<endl;
cout<<"1.原地不动\n2.离开"<<endl;
cin>>temp;
if(temp!='1'&&temp!='2')
{
cout<<"好好走路"<<endl;
}
else if(temp=='1')
{
cout<<"你面前出现了一个"<<g[g.size()-1].name<<endl;
cout<<"战斗开始"<<endl;
system("pause");
system("cls");
fight(g[g.size()-1],0);
if(g[g.size()-1].name=="小耗子")
{
cout<<"你捡到了一块奶酪饼干"<<endl;
geshu[0]++;
}
g.pop_back();
}
}
if(g.size()==0)
{
cout<<"你杀光了一切,正准备离开"<<endl;
cout<<"遇到了一个提线木偶!"<<endl;
cout<<"Danger! Danger!"<<endl;
cout<<"开始战斗!"<<endl;
system("pause");
system("cls");
muou2.get_name("提线木偶");
muou2.init(15,4,2,2);
muou2.insert_jineng(11);
fight(muou2,0);
}
else
{
cout<<"你离开了"<<endl;
}
if(erchalukou(2,"左边的路上传来巧克力的香味但有混杂着铁锈味,右边的路好像没有危险")==1)
{
cout<<"你顺着巧克力的香味向前走去,香味越来越浓烈";
wait();
cout<<"但前面突然出现一个——"<<endl;
Sleep(700);
cout<<"装甲木偶--lv0"<<endl;
Sleep(700);
cout<<"Be~careful"<<endl;
Sleep(1000);
cout<<"战斗开始"<<endl;
system("pause");
system("cls");
fight(muou3,3);
cout<<"你在他身上找到了一块奶酪饼干"<<endl;
geshu[0]++;
Sleep(700);
cout<<"巧克力的香味越来越浓烈,直到你来到一个山洞"<<endl;
cout<<"解锁新地形--山洞!"<<endl;
wait();
cout<<"你要进去吗?"<<endl;
cout<<"1.进去\n2.不,算了"<<endl;
temp=' ';
cin>>temp;
while(temp!='1'&&temp!='2')
{
cout<<"好好选"<<endl;
cin>>temp;
}
if(temp=='1')
{
cout<<"你走的越来越深,直到你两眼什么都看不见才草草了事"<<endl;
Sleep(700);
cout<<"提示:没有火把走进山洞干啥?"<<endl;
wait();
cout<<"突然前面出现了一个蜘蛛!"<<endl;
Sleep(1000);
cout<<"战斗开始"<<endl;
system("pause");
system("cls");
fight(zhizhu,1);
}
}
}
signed main()
{
srand(time(0));
char temp=' ';
int id=1;
Init();
cout<<"欢迎来到这个世界";
wait();
cout<<"你有名字吗"<<endl;
Sleep(1000);
cout<<"哦~,对了现在你还不该有名字"<<endl;
you.get_name("你");
you.insert_jineng(2);
you.insert_jineng(3);
Sleep(1000);
cout<<"你可能才刚刚来,对这个世界还不熟悉,对吧";
wait();
cout<<"是否加载存档?"<<endl;
cout<<"1.我有存档,我要加载\n2.存档是什么,不用加载~"<<endl;
cin>>temp;
while(temp!='1'&&temp!='2')
{
cout<<"好好来!"<<endl;
cin>>temp;
}
if(temp=='1')
{
string s;
cout<<"请输入你的存档名!"<<endl;
cin>>s;
if(s=="_________0")
{
cout<<"Password:"<<endl;
cin>>s;
if(s==password)
{
system("cls");
cout<<"Debug:无限奶酪饼干?"<<endl;
cin>>temp;
if(temp=='0')
{
geshu[0]=INT_MAX;
}
cout<<"Debug:无限巧克力豆?"<<endl;
cin>>temp;
if(temp=='0')
{
geshu[1]=INT_MAX;
}
cout<<"Debug:无限火把?"<<endl;
cin>>temp;
if(temp=='0')
{
geshu[2]=INT_MAX;
}
cout<<"你要去哪儿?"<<endl;
cin>>id;
cout<<"LV:"<<endl;
cin>>lv;
you.get_name("你");
you.init(ls[lv-1][0],ls[lv-1][1],ls[lv-1][2],ls[lv-1][3]);
system("pause");
system("cls");
}
else
{
cout<<"密码错误!"<<endl;
exit(0);
}
}
else
{
cout<<"加载中";
wait();
id=Read(s)+1;
cout<<"加载成功!"<<endl;
you.get_name("你");
you.init(ls[lv-1][0],ls[lv-1][1],ls[lv-1][2],ls[lv-1][3]);
system("pause");
system("cls");
}
}
else
{
you.init(15,8,2,0);
}
if(id==1)
{
Play1();
id++;
system("pause");
system("cls");
}
if(id==2)
{
Play2();
id++;
}
return 0;
}更新日志:
1.0.0 : 基本框架(一切的初始化
1.0.1 : 旁白出现了+新的地形—二岔路口
1.0.2 : 游戏攻击函数基本模块诞生
1.0.3 : 第一个敌人:小木偶
1.0.4 : 第二个路口+小老鼠
1.0.5 : 鬼上线
1.0.6 : 优化AI攻击方式
1.0.7 : 存档+新的地形—存档点
1.0.8 : 新的地形—平地
1.0.9 : 增加背包和新物品—奶酪饼干,和提线木偶(一个有点菜但还好的怪物
1.0.10 : 增加了Debug模式从根源上解决了开发组成员没法通关的问题(滑稽
1.0.11 : 更新了下一个路口,装甲木偶(但lv0),新的地形—山洞,跳珠(值得小心的敌人)
版本预告:
1.0.12 : 增加金钱机制和新的地形—商店
1.0.13 : 增加新物品—巧克力豆
1.0.14 : 完善前俩段的剧情
1.0.14 : 更新存档点
1.0.15 : 新的剧情。
1.0.16 : 没想好。