一个经典RPG游戏

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

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

进入原贴讨论:http://www.bc-cn.net/bbs/dispbbs.asp?BoardID=56&ID=65661

#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;
int str[4],def[4],hp[8];
int boss=1,l=1,mj=0,ycboss=0;
int money=0;
int yaopin[4];
int yaopinqian[4];
int wuqi[4],wuqiqian[4],wuqiz[4];
int fangju[4],fangjuqian[4],fangjuz[4];
int temp[3];
int main(int argc, char *argv[])
{
wuqiz[1]=wuqiz[2]=wuqiz[3]=wuqiz[4]=0;
fangjuz[1]=fangjuz[2]=fangjuz[3]=fangjuz[4]=0;
str[1]=def[1]=10;
hp[1]=hp[2]=40;
str[2]=def[2]=8;
hp[3]=hp[4]=30;
str[3]=def[3]=40;
hp[5]=hp[6]=200;
str[4]=def[4]=10000;
hp[7]=hp[8]=1000000;
temp[2]=temp[3]=0;
string d;
void prt(),prt2(),yudi(),boss2(),boss3();
void miji(),shiyong(),daoju(),zhuangtai();
yaopinqian[1]=40;
yaopinqian[2]=200;
yaopinqian[3]=500;
yaopinqian[4]=2000;
wuqiqian[1]=30;
wuqiqian[2]=200;
wuqiqian[3]=500;
wuqiqian[4]=1000;
fangjuqian[1]=20;
fangjuqian[2]=100;
fangjuqian[3]=500;
fangjuqian[4]=1000;
mj=0;
for (;boss!=0 || mj==1;)
{
if (mj==0) cout<<"打小怪=1 打boss=2 道具店=3 状态=c 退出=q"<<'\n';
if (mj==1) cout<<"打小怪=1 打boss=2 道具店=3 隐藏boss=4 状态=c 退出=q"<<'\n';
cin>>d;
if (d=="c") zhuangtai();
if (d=="m") miji();
if (d=="q") break;
if (d=="1") yudi();
if (d=="2") boss2();
if (d=="3") daoju();
if (d=="4" && mj==1) boss3();
if (hp[1]<=0) { cout<<"您死啦!";break;}
}
system("PAUSE");
return EXIT_SUCCESS;
}
void zhuangtai()
{
cout<<"您的状态为:"<<'\n';
cout<<"hp="<<hp[1]<<"/"<<hp[2]<<'\n';
cout<<"str="<<str[1]<<" "<<"def="<<def[1]<<'\n';
cout<<"武器:";
if (wuqiz[1]==1) cout<<"小刀";
if (wuqiz[2]==1) cout<<"阔刀";
if (wuqiz[3]==1) cout<<"血饮";
if (wuqiz[4]==1) cout<<"机关炮";
if (wuqiz[1]==0 && wuqiz[2]==0 && wuqiz[3]==0 && wuqiz[4]==0) cout<<"无";
cout<<" "<<"防具:";
if (fangjuz[1]==1) cout<<"布衣";
if (fangjuz[2]==1) cout<<"皮衣";
if (fangjuz[3]==1) cout<<"锁甲";
if (fangjuz[4]==1) cout<<"板甲";
if (fangjuz[1]==0 && fangjuz[2]==0 && fangjuz[3]==0 && fangjuz[4]==0) cout<<"无";
cout<<'\n';
cout<<"您有"<<money<<"金"<<'\n'<<'\n';
}
void prt()
{
int tempmoney;
tempmoney=hp[4];
str[1]=str[1] 3;
def[1]=def[1] 3;
hp[1]=hp[2]=hp[2] 10;
cout<<"胜利!升级 str="<<str[1]<<" def="<<def[1]<<" hp="<<hp[2]<<'\n';
cout<<"得到"<<tempmoney<<"金"<<'\n'<<'\n';
money=money tempmoney;
str[2]=str[2] 3;
def[2]=def[2] 4;
hp[3]=hp[4]=hp[2]*4/5;
}
void yudi()
{
void shiyong();
string c;
int b;
hp[3]=hp[4];
cout<<"小怪出现 hp="<<hp[3]<<'\n';
do
{
cout<<"攻击=a 逃跑=b 使用道具=c"<<'\n';
cin>>c;
if (c=="a")
{
b=str[1]*2-def[2]*3/2 str[1]*4/def[2];
if (b<=0) b=1;
cout<<"攻击! 怪物减少"<<b<<"滴血"<<'\n';
hp[3]=hp[3]-b;
if (hp[3]<=0) hp[3]=0;
cout<<"怪物更有"<<hp[3]<<"滴血"<<'\n';
if (hp[3]>0)
{
b=str[2]*2-def[1]*3/2 str[2]*4/def[1];
if (b<=0) b=1;
cout<<"怪物攻击! 减少"<<b<<"滴血"<<'\n';
hp[1]=hp[1]-b;
cout<<"人物更有"<<hp[1]<<"滴血"<<'\n'<<'\n';
}
}
if (c=="c")
{
shiyong();
b=str[2]*2-def[1]*3/2 str[2]*4/def[1];
if (b<=0) b=1;
cout<<"怪物攻击! 减少"<<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[3]>0);
if (hp[3]<=0) prt();
}
void boss2()
{
void prt2();

标签:

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

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

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