#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<stdio.h>
using namespace std;
int fh;//返回
int zbjy=0;//争霸经验
int yy=0;//精灵赢得次数
int y2=0;//另精灵赢得次数
int sum=0;//回合
int fyy;//另精灵防御
int gj1;//另精灵攻击
string sm;//输入密码
int gm;//购买
int fyh=0;//防御力和
int gjh=0;//攻击和
int ms1;//精灵花园模式
int fy;//防御
int gj;//攻击
int dj;//dj=精灵等级
int nzjy=0;//农作经验
int kw;//矿物 石头+2 金子+5 铁+8 钻石+10
int km;//挖矿模式
int wl;//玩家现在体力
int wx;//玩家消耗体力
int tl=200;//玩家体力
int xy;//需不需要
int nzlx;//农作类型
int tx;//精灵消耗农作体力
int jx;//精灵现在体力
int jt=200;//精灵体力
int jyh=0;//经验和
int kj;//挖矿经验
int sr; //输入要不要
int ms;//模式
string jl;//精灵名字
string id;//用户ID
string mima;//用户密码
void nc() //nc=农场
{
cout<<"农场小主:欢迎来到农场 o(* ̄▽ ̄*)ブ"<<endl;
Sleep(1000);
cout<<"农场小主:请问你要返回吗? 1.要 2.不要"<<endl;
cin>>fh;
if(fh==1)
{
cout<<"农场小主:好的"<<endl;
Sleep(1000);
}
if(fh==2)
{
cout<<"农场小主:好的"<<endl;
Sleep(1000);
cout<<"农场小主:在农场,你可以做农作物从而增加经验值"<<endl;
Sleep(1000);
cout<<"农场小主:你可以用经验值提升精灵等级"<<endl;
Sleep(1000);
cout<<"农场小主:现在,你可以使用精灵来帮助你农作"<<endl;
Sleep(1000);
cout<<"农场小主:它现在有"<<jt<<"点体力"<<endl;
Sleep(1000);
cout<<"农场小主:请问你要怎么农作?"<<" "<<"农场小主:1.小精灵农作"<<"2.自己农作"<<endl;
cin>>sr;
if(sr==1)//需要 ,农作,获取经验值
{
jx=0;
if(jt<=50)
{
cout<<"小精灵:我没力气了..."<<endl;
Sleep(1000);
cout<<"农场小主:它需要去商城补给..."<<endl;
Sleep(1000);
}
else
{
nzjy=0;
cout<<"小精灵"<<jl<<"开始农作啦..."<<endl;
for(int j=1;j<=6;j++)
{
nzlx=0;
srand(time(0));
nzlx=rand()%4+1;
if(nzlx==1)//玉米+2
{
cout<<"种植了玉米"<<endl;
nzjy=nzjy+2;
Sleep(1000);
}
if(nzlx==2)//胡萝卜+5
{
cout<<"种植了胡萝卜"<<endl;
nzjy=nzjy+5;
Sleep(1000);
}
if(nzlx==3)//大豆+8
{
cout<<"种植了大豆"<<endl;
nzjy=nzjy+8;
Sleep(1000);
}
if(nzlx==4)//小麦+12
{
cout<<"种植了小麦"<<endl;
nzjy=nzjy+10;
Sleep(1000);
}
}
cout<<"农场小主:农作收获了"<<nzjy<<"点经验"<<endl;
Sleep(1000);
jyh=nzjy+jyh;
cout<<"农场小主:一共收获了"<<jyh<<"点经验"<<endl;
Sleep(1000);
srand(time(0));
tx=rand()%40+20;
cout<<jl<<":但是我消耗了"<<tx<<"点体力"<<endl;
Sleep(1000);
jx=jt-tx;
cout<<jl<<":所以我现在有"<<jx<<"点体力"<<endl;
jt=jx;
}
}
if(sr==2)//不需要
{
wl=0;
if(tl<=50)
{
cout<<"农场小主:你不行啦,要去商城补给..."<<endl;
Sleep(1000);
}
else
{
nzjy=0;
for(int j=1;j<=6;j++)
{
srand(time(0));
nzlx=rand()%4+1;
if(nzlx==1)//玉米+2
{
cout<<"种植了玉米"<<endl;
nzjy=nzjy+2;
Sleep(1000);
}
if(nzlx==2)//胡萝卜+5
{
cout<<"种植了胡萝卜"<<endl;
nzjy=nzjy+5;
Sleep(1000);
}
if(nzlx==3)//大豆+8
{
cout<<"种植了大豆"<<endl;
nzjy=nzjy+8;
Sleep(1000);
}
if(nzlx==4)//小麦+12
{
cout<<"种植了小麦"<<endl;
nzjy=nzjy+10;
Sleep(1000);
}
}
srand(time(0));
cout<<"农场小主:你一共获得了"<<nzjy<<"点经验值"<<endl;
Sleep(1000);
jyh=jyh+nzjy;
srand(time(0));
wx=rand()%30+20;
cout<<"农场小主:你一共消耗了"<<wx<<"点体力"<<endl;
Sleep(1000);
wl=tl-wx;
cout<<"农场小主:所以你现在有"<<wl<<"点体力"<<endl;
tl=wl;
}
}
}
}
void kd()// 矿洞
{
cout<<"矿洞小财:欢迎来到矿洞..."<<endl;
Sleep(1000);
cout<<"矿洞小财:你可以和你的精灵在这里挖矿发展,获取经验"<<endl;
Sleep(1000);
cout<<"矿洞小财:请问要不要返回? 1.要 2.不要"<<endl;
cin>>fh;
if(fh==1)
{
cout<<"矿洞小财:好的"<<endl;
Sleep(1000);
}
if(fh==2)
{
cout<<"矿洞小财:请问你是要自己挖矿,还是和精灵一起挖矿"<<endl;
Sleep(1000);
cout<<"1.自己挖矿"<<" "<<"2.和精灵一起挖矿"<<endl;
Sleep(1000);
cin>>km;
if(kj==1)
{
wl=0;
if(tl<=50)
{
cout<<"矿洞小财:你不行啦,你需要补给"<<endl;
Sleep(1000);
}
else
{
kj=0;
cout<<"开始挖矿啦..."<<endl;
srand(time(0));
kw=rand()%4+1;
for(int i=1;i<=10;i++)
{
if(kw==1)
{
cout<<"挖到了石头"<<endl;
kj=kj+2;
Sleep(5000);
}
if(kw==2)
{
cout<<"挖到了铁"<<endl;
kj=kj+5;
Sleep(5000);
}
if(kw==3)
{
cout<<"挖到了金子"<<endl;
kj=kj+8;
Sleep(5000);
}
if(kw==4)
{
cout<<"挖到了钻石"<<endl;
kj=kj+10;
Sleep(5000);
}
}
cout<<"矿洞小财:挖矿一共获得了"<<kj<<"点经验"<<endl;
Sleep(1000);
jyh=jyh+kj;
cout<<"矿洞小财:所以现在你有"<<jyh<<"点经验"<<endl;
srand(time(0));
wx=rand()%70+20;
cout<<"矿洞小财:你一共消耗了"<<wx<<"点体力"<<endl;
Sleep(1000);
wl=tl-wx;
cout<<"矿洞小财:所以你现在有"<<wl<<"点体力"<<endl;
tl=wl;
Sleep(1000);
}
}
else
{
jx=0;
wl=0;
if(tl<=50 or jt<=50)
{
cout<<"矿洞小财:你们不行啦,你需要补给"<<endl;
Sleep(1000);
}
else
{
kj=0;
cout<<"矿洞小财:开始挖矿啦..."<<endl;
Sleep(1000);
for(int i=1;i<=5;i++)
{
srand(time(0));
kw=rand()%4+1;
if(kw==1)
{
cout<<"矿洞小财:挖到了石头"<<endl;
kj=kj+2;
Sleep(5000);
}
if(kw==2)
{
cout<<"矿洞小财:挖到了铁"<<endl;
kj=kj+5;
Sleep(5000);
}
if(kw==3)
{
cout<<"矿洞小财:挖到了金子"<<endl;
kj=kj+8;
Sleep(5000);
}
if(kw==4)
{
cout<<"矿洞小财:挖到了钻石"<<endl;
kj=kj+10;
Sleep(5000);
}
}
cout<<"矿洞小财:挖矿一共获得了"<<kj<<"点经验"<<endl;
Sleep(1000);
jyh=jyh+kj;
cout<<"矿洞小财:所以现在有"<<jyh<<"点经验"<<endl;
Sleep(1000);
srand(time(0));
wx=rand()%50+20;
cout<<"矿洞小财:你一共消耗了"<<wx<<"点体力"<<endl;
Sleep(1000);
wl=tl-wx;
cout<<"矿洞小财:所以你现在有"<<wl<<"点体力"<<endl;
tl=wl;
srand(time(0));
tx=rand()%80+20;
cout<<"矿洞小财:但是"<<jl<<"消耗了"<<tx<<"点体力"<<endl;
Sleep(1000);
jx=jt-tx;
cout<<"矿洞小财:所以它现在有"<<jx<<"点体力"<<endl;
jt=jx;
}
}
}
}
void jh()//精灵花园
{
cout<<"花园小姐:欢迎来到精灵花园"<<endl;
Sleep(1000);
cout<<"花园小姐:请问你要返回吗? 1.要 2.不要"<<endl;
cin>>fh;
if(fh==1)
{
cout<<"花园小姐:好的"<<endl;
Sleep(1000);
}
if(fh==2)
{
cout<<"花园小姐:你可以在这里训练精灵,提升精灵等级"<<endl;
Sleep(1000);
cout<<"花园小姐:参加擂台争霸"<<endl;
Sleep(1000);
cout<<"花园小姐:获取更多经验值"<<endl;
Sleep(1000);
cout<<"花园小姐:请问你要去哪个训练区域"<<endl;
Sleep(1000);
cout<<"1.防御型 2.攻击型"<<endl;
cin>>ms1;
if(ms1==1)
{
cout<<"花园小姐:你选择了防御型"<<endl;
Sleep(1000);
cout<<"花园小姐:精灵开始训练啦"<<endl;
Sleep(1000);
for(int i=1;i<=10;i++)
{
srand(time(0));
fy=rand()%20+5;
cout<<"花园小姐:它获得了"<<fy<<"点防御力"<<endl;
fyh=fy+fyh;
Sleep(1000);
}
cout<<"花园小姐:它一共获得了"<<fyh<<"点防御力"<<endl;
Sleep(1000);
}
if(ms1==2)
{
cout<<"花园小姐:你选择了攻击型"<<endl;
Sleep(1000);
cout<<"花园小姐:精灵开始训练啦"<<endl;
Sleep(1000);
for(int i=1;i<=10;i++)
{
srand(time(0));
gj=rand()%20+5;
cout<<"花园小姐:它获得了"<<gj<<"点攻击力"<<endl;
gjh=gj+gjh;
Sleep(1000);
}
cout<<"花园小姐:它一共获得了"<<gjh<<"点攻击力"<<endl;
Sleep(1000);
}
}
}
void sd()//商店
{
cout<<"商店掌柜:欢迎来到商店"<<endl;
Sleep(1000);
cout<<"商店掌柜:请问你要返回吗? 1.要 2.不要"<<endl;
cin>>fh;
if(fh==1)
{
cout<<"商店掌柜:好的"<<endl;
Sleep(1000);
}
if(fh==2)
{
cout<<"商店掌柜:好的"<<endl;
Sleep(1000);
if(jyh<5)
{
cout<<"商店掌柜:你没经验了,去农作或者采矿吧"<<endl;
Sleep(1000);
}
else
{
cout<<"商店掌柜:请问你需要购买什么"<<endl;
Sleep(500);
cout<<"1.精灵增加10点体力(5经验)"<<endl;
Sleep(500);
cout<<"2.精灵增加15点体力(10经验)"<<endl;
Sleep(500);
cout<<"3.玩家增加20点体力(15经验)"<<endl;
Sleep(500);
cout<<"4.玩家增加25点体力(20经验)"<<endl;
Sleep(500);
cout<<"5.精灵增加30点体力(25经验)"<<endl;
Sleep(500);
cout<<"6.精灵增加35点体力(30经验)"<<endl;
Sleep(500);
cout<<"7.精灵增加40点体力(35经验)"<<endl;
Sleep(500);
cout<<"8.精灵增加45点体力(40经验)"<<endl;
Sleep(500);
cout<<"9.精灵增加50点体力(45经验)"<<endl;
Sleep(500);
cout<<"10.精灵增加60点体力(60经验)"<<endl;
Sleep(500);
cout<<"11.精灵增加70点体力(65经验)"<<endl;
Sleep(500);
cout<<"12.精灵增加80点体力(70经验)"<<endl;
Sleep(500);
cout<<"13.精灵增加90点体力(75经验)"<<endl;
Sleep(500);
cout<<"14.精灵增加100点体力(80经验)"<<endl;
cin>>gm;
if(gm==1)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
jt=jt+10;
jyh=jyh-5;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==2)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
jt=jt+20;
jyh=jyh-15;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==3)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+25;
jyh=jyh-20;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==4)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+30;
jyh=jyh-250;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==5)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+35;
jyh=jyh-30;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==6)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+40;
jyh=jyh-350;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==7)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+45;
jyh=jyh-40;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==8)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+50;
jyh=jyh-45;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==9)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+60;
jyh=jyh-50;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==10)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+70;
jyh=jyh-60;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==11)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+80;
jyh=jyh-70;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==12)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+90;
jyh=jyh-80;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
if(gm==13)
{
cout<<"请输入密码:"<<endl;
cin>>sm;
if(mima==sm)
{
tl=tl+100;
jyh=jyh-90;
cout<<"购买成功"<<endl;
Sleep(1000);
}
else
{
cout<<"密码错误"<<endl;
Sleep(1000);
}
}
}
}
}
void lb()
{
cout<<"赛场主持人:欢迎来到精灵争霸赛"<<endl;
Sleep(1000);
if(jt==0)
{
cout<<"赛场主持人:你的精灵没力气了"<<endl;
Sleep(1000);
}
else
{
cout<<"赛场主持人:请问你要返回吗? 1.要 2.不要"<<endl;
cin>>fh;
if(fh==1)
{
cout<<"赛场主持人:好的"<<endl;
Sleep(1000);
}
if(fh==2)
{
cout<<"赛场主持人:好的"<<endl;
Sleep(1000);
cout<<"赛场主持人:首先请出我们的一号选手:"<<jl<<" !!!!!"<<endl;
Sleep(1000);
cout<<"赛场主持人:接着是我们的第二位选手:(lll¬ω¬)"<<" !!!!!"<<endl;
Sleep(1000);
cout<<"赛场主持人:比赛,现在开始!!!"<<endl;
for(int i=1;i<=4;i++)
{
sum++;
if(dj==1)
{
srand(time(0));
fyy=rand()%100+60;
srand(time(0));
gj1=rand()%120+70;
}
if(dj==2)
{
srand(time(0));
fyy=rand()%140+60;
srand(time(0));
gj1=rand()%160+70;
}
if(dj==3)
{
srand(time(0));
fyy=rand()%180+60;
srand(time(0));
gj1=rand()%190+70;
}
if(dj==4)
{
srand(time(0));
fyy=rand()%220+60;
srand(time(0));
gj1=rand()%230+70;
}
if(dj==5)
{
srand(time(0));
fyy=rand()%260+60;
srand(time(0));
gj1=rand()%280+70;
}
if(fyy>gjh or gj1>fyh)
{
cout<<"赛场主持人:第"<<sum<<"回合"<<"(lll¬ω¬)"<<"赢了"<<endl;
y2=y2+1;
Sleep(1000);
}
if(dj==1)
{
srand(time(0));
fyy=rand()%100+60;
srand(time(0));
gj1=rand()%120+70;
}
if(dj==2)
{
srand(time(0));
fyy=rand()%140+60;
srand(time(0));
gj1=rand()%160+70;
}
if(dj==3)
{
srand(time(0));
fyy=rand()%180+60;
srand(time(0));
gj1=rand()%190+70;
}
if(dj==4)
{
srand(time(0));
fyy=rand()%220+60;
srand(time(0));
gj1=rand()%230+70;
}
if(dj==5)
{
srand(time(0));
fyy=rand()%260+60;
srand(time(0));
gj1=rand()%280+70;
}
if(fyy<gjh or gj1<fyh)
{
cout<<"赛场主持人:第"<<sum<<"回合"<<jl<<"赢了"<<endl;
yy=yy+1;
Sleep(1000);
}
if(dj==1)
{
srand(time(0));
fyy=rand()%100+60;
srand(time(0));
gj1=rand()%120+70;
}
if(dj==2)
{
srand(time(0));
fyy=rand()%140+60;
srand(time(0));
gj1=rand()%160+70;
}
if(dj==3)
{
srand(time(0));
fyy=rand()%180+60;
srand(time(0));
gj1=rand()%190+70;
}
if(dj==4)
{
srand(time(0));
fyy=rand()%220+60;
srand(time(0));
gj1=rand()%230+70;
}
if(dj==5)
{
srand(time(0));
fyy=rand()%260+60;
srand(time(0));
gj1=rand()%280+70;
}
if(fyy==gjh or gj1==fyh)
{
cout<<"赛场主持人:第"<<sum<<"回合"<<"平局"<<endl;
Sleep(1000);
}
}
if(y2<yy)
{
cout<<"赛场主持人:恭喜恭喜,你的精灵取得了胜利!!!奖励经验!!!"<<endl;
srand(time(0));
zbjy=rand()%200+150;
jyh=zbjy+jyh;
Sleep(1000);
}
if(y2>yy)
{
cout<<"赛场主持人:很遗憾,你的精灵失败了,它的体力耗光了...去获得经验补充它的体力吧..."<<endl;
jt=0;
Sleep(1000);
}
}
}
}
void xx()
{
if(fyh<=50 or gjh<=50)
{
dj=1;
jyh=jyh+0;
}
if(fyh>50 and fyh<=100 or gjh>50 and gjh<=100)
{
dj=2;
jyh=jyh+300;
}
if(fyh>100 and fyh<=150 or gjh>100 and gjh<=150)
{
dj=3;
jyh=jyh+600;
}
if(fyh>150 and fyh<=200 or gjh>150 and gjh<=200)
{
dj=4;
jyh=jyh+1200;
}
if(fyh>200 and fyh<=300 or gjh>200 and gjh<=300)
{
dj=5;
cout<<"小女仆:恭喜你呀!达到了最高等级!奖励2400经验"<<endl;
jyh=jyh+2400;
}
cout<<"小女仆:你现在有体力"<<tl<<" "<<"你的精灵现在有体力"<<jt<<" "<<"你现在有经验"<<jyh<<" "<<"精灵防御"<<fyh<<" "<<"精灵攻击"<<gjh<<" "<<"精灵等级"<<dj<<endl;
Sleep(1000);
}
int main()
{
Sleep(2000);
cout<<"在未来的某一天夜里,天空中发出巨大的光芒..."<<endl;
Sleep(2000);
cout<<"你从床上被惊醒,迷茫地看向四周..."<<endl;
Sleep(2000);
cout<<"只见到周围的建筑物,还有生灵全都化为了乌有..."<<endl;
Sleep(2000);
cout<<"你正想走出家门,开门间一股巨大的能量扑面而来..."<<endl;
Sleep(2000);
cout<<"醒来时,你发现你被传送到了一处好似庄园的地方..."<<endl;
Sleep(2000);
cout<<"......"<<endl;
Sleep(3000);
cout<<"小女仆:欢迎来到竣希庄园..."<<endl;
Sleep(1000);
cout<<"小女仆:请告诉我你的名字,还有购买物品时的密码"<<endl;
Sleep(1000);
cout<<"小女仆:名字:";
cin>>id;
cout<<endl;
cout<<"小女仆:密码:";
cin>>mima;
cout<<endl;
cout<<"小女仆:你好:"<<id<<" "<<"密码已保存..."<<endl;
Sleep(1000);
cout<<"小女仆:请给你的精灵取个名字吧:";
cin>>jl;
Sleep(1000);
cout<<"小女仆:你的精灵:"<<jl<<"会帮助你获取经验"<<endl;
Sleep(2000);
cout<<"小女仆:精灵不同的等级有不同的奖励"<<endl;
Sleep(2000);
cout<<"小女仆:对了,让我告诉你你为什么会在这里吧!"<<endl;
Sleep(2000);
cout<<"小女仆:那天夜里你睡得正熟,突然间一股能量将地球上的人都毁灭了,只有你在特殊的保护下活了下来"<<endl;
Sleep(3000);
cout<<"小女仆:于是当你开门的时候,我们瞬间转移了你的注意力,顷刻间把你传送了过来"<<endl;
Sleep(2000);
cout<<"小女仆:所以今后你只能在这里生活了"<<endl;
Sleep(2000);
cout<<"小女仆:靠你自己去探索吧!"<<endl;
Sleep(2000);
while(1)
{
cout<<"小女仆:请选择你要发展的区域吧:"<<setw(2)<<"1.农场"<<setw(2)<<"2.矿洞"<<setw(2)<<"3.精灵花园"<<setw(2)<<"4.商店"<<setw(2)<<"5.擂台争霸"<<setw(2)<<"6.信息"<<endl;
cin>>ms;
if(ms==1)
{
Sleep(1000);
nc();
}
if(ms==2)
{
Sleep(1000);
kd();
}
if(ms==3)
{
jh();
}
if(ms==4)
{
sd();
}
if(ms==5)
{
lb();
}
if(ms==6)
{
xx();
}
}
}
new game 1.0
最新推荐文章于 2024-08-28 14:35:43 发布