一个经典RPG游戏(2)

2008-02-23 05:27:19来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折


void shiyong();
string c;
int b;
hp[5]=hp[6];
cout<<"boss出现 hp="<<hp[5]<<'\n';
do
{
cout<<"攻击=a 逃跑=b 使用道具=c"<<'\n';
cin>>c;
if (c=="a")
{
b=str[1]*2-def[3]*3/2 str[1]*4/def[3];
if (b<=0) b=1;
cout<<"攻击! boss减少"<<b<<"滴血"<<'\n';
hp[5]=hp[5]-b;
if (hp[5]<=0) hp[5]=0;
cout<<"boss更有"<<hp[5]<<"滴血"<<'\n';
if (hp[5]>0)
{
b=str[3]*2-def[1]*3/2 str[3]*4/def[1];
if (b<=0) b=1;
cout<<"boss攻击! 减少"<<b<<"滴血"<<'\n';
hp[1]=hp[1]-b;
cout<<"人物更有"<<hp[1]<<"滴血"<<'\n'<<'\n';
}
}
if (c=="c")
{
shiyong();
b=str[3]*2-def[1]*3/2 str[3]*4/def[1];
if (b<=0) b=1;
cout<<"boss攻击! 减少"<<b<<"滴血"<<'\n';
hp[1]=hp[1]-b;
cout<<"人物更有"<<hp[1]<<"滴血"<<'\n'<<'\n';
}
if (c=="b")
{ cout<<"逃跑成功 hp 3"<<'\n';
hp[1]=hp[1] 3;
if (hp[1]>hp[2]) hp[1]=hp[2];
break;
}
if (hp[1]<=0) break;
} while (hp[5]>0);
if (hp[5]<=0) prt2();
}
void prt2()
{
int tempmoney;
cout<<"太帅了!打赢总boss,游戏结束"<<'\n';
boss=0;
if (mj==1)
{ tempmoney=hp[6];
str[1]=str[1] 10;
def[1]=def[1] 10;
hp[1]=hp[1] 10;
cout<<"胜利!升级 str="<<str[1]<<" def="<<def[1]<<" hp="<<hp[2]<<'\n';
cout<<"得到"<<tempmoney<<"金"<<'\n'<<'\n';
str[3]=str[3] 10;
def[3]=def[3] 10;
hp[6]=hp[5]=hp[6] 10;
money=money 200;
}
}
void miji()
{
cout<<"秘籍模式开启!";
mj=1;
}
void boss3()
{
void prt3();
void shiyong();
string c;
int b;
hp[7]=hp[8]=1000000;
cout<<"Zn出现 hp="<<hp[7]<<'\n';
do
{
cout<<"攻击=a 逃跑=b 使用道具=c"<<'\n';
cin>>c;
if (c=="a")
{
b=str[1]*2-def[4]*3/2 str[1]*4/def[4];
if (b<=0) b=1;
cout<<"攻击! Zn减少"<<b<<"滴血"<<'\n';
hp[7]=hp[7]-b;
if (hp[7]<=0) hp[7]=0;
cout<<"Zn更有"<<hp[7]<<"滴血"<<'\n';
if (hp[7]>0)
{
b=str[4]*2-def[1]*3/2 str[4]*4/def[1];
if (b<=0) b=1;
cout<<"Zn攻击! 减少"<<b<<"滴血"<<'\n';
hp[1]=hp[1]-b;
cout<<"人物更有"<<hp[1]<<"滴血"<<'\n'<<'\n';
}
}
if (c=="c")
{
shiyong();
b=str[4]*2-def[1]*3/2 str[4]*4/def[1];
if (b<=0) b=1;
cout<<"Zn攻击! 减少"<<b<<"滴血"<<'\n';
hp[1]=hp[1]-b;
cout<<"人物更有"<<hp[1]<<"滴血"<<'\n'<<'\n';
}
if (c=="b")
{ cout<<"逃跑成功 hp 3"<<'\n';
hp[1]=hp[1] 3;
if (hp[1]>hp[2]) hp[1]=hp[2];
break;
}
if (hp[1]<=0) break;
} while (hp[7]>0);
if (hp[7]<=0) prt3();
}
void daoju()
{
void yaopind();
void wuqid();
void fangjud();
string b;
cout<<"药品=1"<<'\n'<<"武器=2"<<'\n'<<"防具=3"<<'\n';
cin>>b;
if (b=="1") yaopind();
if (b=="2") wuqid();
if (b=="3") fangjud();
if (b!="1" && b!="2" && b!="3") cout<<"错误!"<<'\n'<<'\n';
}
void yaopind()
{
string b;
int c,e=0,f;
cout<<"小补药=1 40$ hp 30"<<'\n';
cout<<"大补药=2 200$ hp 100"<<'\n';
cout<<"全恢复药=3 500$ hp 100%"<<'\n';
cout<<"神奇水=4 2000$ ???"<<'\n';
cout<<"退出=q"<<'\n';
cin>>b;
if (b=="q") e=1;
if (b!="1" && b!="2" && b!="3" && b!="4" && b!="q") e=2;
if (e==2) cout<<"输入错误!"<<'\n'<<'\n';
else {
if (e!=1)
{
cout<<"要多少个"<<'\n';
cin>>c;
if (c<=0)

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇: 验C 中接口和实现分离的技术

下一篇: 内存陷阱 驯服C 中的野指针