- 取石子
怪兽纪元
- 2025-7-24 9:28:26 @
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#define random(a1,a2) rand()/(a2-a1+1)+a1
using namespace std;
struct user
{
char name[10000];
char ch;
int marketvip;
int talk;
int power_of_earth;
int blood,Gold,exp,LOVE,angry,true_fight,true_blooked;
};
struct computer
{
// char name[10000];
int blood,Gold,exp,true_fight,true_blooked,angry;
};
user a;
computer b;
FILE *fin,*fout;
int item[]={0,160,1500,13500,66000,160,1440,13500,125000,160,1400,14000,125000,1100000,1100000,4800000,4800000};
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
int lv[1001]={0 , 0 , 10 , 25 , 100 , 200 , 400 , 500 , 1000 , 1600 , 2400 , 4000 , 6250 , 8750 , 10000 , 12500 , 15000 , 18000 , 22500 , 25000 , 30000 , 37500 , 50000 , 75000 , 125000};
int blood_[1001]={0 , 100 , 125 , 150 , 200 , 250 , 300 , 500 , 800 , 1250 , 1600 , 2000 , 2500 , 4000 , 6250 , 9750 , 12500 , 16000 , 18000 , 24000 , 32000 , 40000 , 48000 , 60000 , 80000 };
void start();
void game();
void out(string,float);
void fight();
int main()
{
srand(int(time(NULL)));
a.Gold=0;
a.LOVE=1;
a.exp=0;
a.marketvip=0;
a.talk=0;
a.power_of_earth=0;
for(int i=25;i<=600;i++)
{
lv[i]=(lv[i-1]*3-lv[i-2])-(lv[i-1]*3-lv[i-2])%10000;
blood_[i]=(blood_[i-1]*3-blood_[i-2])-(blood_[i-1]*3-blood_[i-2])%10000;
}
for(int i=601;i<=1000;i++)
blood_[i]=lv[i]=2000000000,blood_[i]-=400000000;
cout<<"\t\t\t\t\t\t怪兽纪元\n";
cout<<"\n\n\n\n";
cout<<"\t\t\t\t\t\t1.开始新游戏\n";
cout<<"\t\t\t\t\t\t2.使用旧存档\n";
int say_in;
cin>>say_in;
if(say_in==1)
{
fout=fopen("Archive.Archive","wb");
fprintf(fout,"name\n1\n0\n0\n0\n0\n0\n0\n0\n");
fin=fopen("Archive.Archive","rb");
fscanf(fin,"%s%d%d%d%d%d%d%d",&a.name,&a.LOVE,&a.exp,&a.Gold,&a.true_fight,&a.true_blooked,&a.marketvip,&a.talk,&a.power_of_earth);
fclose(fout);
fclose(fin);
start();
}
else
{
fin=fopen("Archive.Archive","rb");
fscanf(fin,"%s%d%d%d%d%d%d%d%d",&a.name,&a.LOVE,&a.exp,&a.Gold,&a.true_fight,&a.true_blooked,&a.marketvip,&a.talk,&a.power_of_earth);
fclose(fin);
// out("你再取一个新名字吧",0.01);
// cin>>a.name;
// out("哦,"+a.name+",真是个好名字,开始你的复仇之旅吧!!!",0.08);
game();
}
}
void start()
{
system("cls");
cout<<"\t\t\t\t\t\t怪兽纪元";
Sleep(1000);
out("\n“XXX年,”\n",0.01);
Sleep(500);
out("“怪兽入侵S王国,”\n“战火四起,数千万人无家可归”",0.01);
getchar();
out("\n......\n“整个王国陷入了绝望”",0.01);
out("\n“而本国的公主也被怪兽之王附身,去往了一个小岛上...”",0.01);
Sleep(1000);
system("cls");
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
for(int i=25;i;i--)
{
SetCursorPos(rand()%x,rand()%y);
Sleep(40);
}
Sleep(1000);
out("你的耳旁响起了一个声音:\"你是与怪兽之王对战时被打伤的,你已经昏迷了十一年,你是唯一幸存的能拯救王国的人!它们去往了骷髅岛那个与世隔绝的地方,国王希望你能够去救公主,你是我们国家的希望!!!\"\n",0.01);
getch();
Sleep(2000);
system("cls");
out("你抬头看了看四周,这是个岛,海外围裹着一层强力台风,里面是危险的丛林,旁边旧损的牌子上写着Skull Island(骷髅岛)...\n",0.01);
Sleep(1000);
out("勇者,请输入你的名字\n",0.01);
cin>>a.name;
system("cls");
out("哦,",0.08);
out(a.name,0.08);
out(",真是个好名字,开始你的旅途吧!!!",0.08);
Sleep(200);
game();
}
void out(string str,float time)
{
for(int i=0;i<str.size();i++)
{
Sleep(time*1000);
cout<<str[i];
}
}
short fight(string name,int blood,int fight,int blooked)
{
int WayToFight,falseblood=blood,angry=0;
while(true)
{
a.angry++,angry++;
system("cls");
cout<<"你的血量:"<<a.blood<<"\t敌方血量:"<<blood<<"\n你的攻击力:"<<a.true_fight<<"\t敌方攻击力:"<<fight<<"\n你的防御力:"<<a.true_blooked<<"\t敌方防御力:"<<blooked<<"\n我方回合:\n1.普通攻击\t2.怒气攻击(怒气:"<<a.angry<<"/5";
if(a.angry<5)
cout<<",暂时不够";
cout<<")\t3.逃跑\n";
cin>>WayToFight;
if(WayToFight==1)
if(random(1,5)==1)
{
out("你打出了暴击,对"+name+"造成了",0.06);
if(a.true_fight>blooked)
{
cout<<(a.true_fight-blooked)*2;
blood-=(a.true_fight-blooked)*2;
}
else
cout<<0;
out("点伤害",0.01);
}
else
{
out("你打掉了他",0.01);
if(a.true_fight>blooked)
{
cout<<(a.true_fight-blooked);
blood-=(a.true_fight-blooked);
}
else
cout<<0;
out("滴血",0.01);
}
if(WayToFight==2)
if(a.angry>4)
{
a.angry-=5;
out("你使用了怒气攻击,敌方扣了",0.01);
if(a.true_fight>blooked)
{
cout<<(a.true_fight-blooked)*5;
blood-=(a.true_fight-blooked)*5;
}
else
cout<<0;
out("滴血",0.01);
}
if(WayToFight==3)
if(blood*1.0/falseblood<0.4 and random(1,3)<3)
if(random(1,3)==1)
{
out(a.name,0.06);
out(":I'm out of here.",0.06);
return 2;
}
else if(random(1,2)==1)
{
out(a.name,0.01);
out(":别拖我后腿。",0.01);
return 2;
}
else
{
out(a.name,0.01);
out(":我先走一步",0.01);
return 2;
}
else
{
out(name,0.01);
out(":想得美!",0.01);
}
if(blood<=0)
return 1;
Sleep(600);
system("cls");
cout<<"你的血量:"<<a.blood<<"\t敌方血量:"<<blood<<"\n你的攻击力:"<<a.true_fight<<"\t敌方攻击力:"<<fight<<"\n你的防御力:"<<a.true_blooked<<"\t敌方防御力:"<<blooked<<"\n敌方回合:\n";
if(blood*1.0/falseblood<0.01)
{
if(rand()%100<40)
{
out(name+":我先走一步。",0.01);
return 2;
}
}
else if(angry>4)
{
angry-=5;
out("敌方使用了怒气攻击,你扣了",0.01);
if(fight>a.true_blooked)
{
cout<<(fight-a.true_blooked)*5;
a.blood-=(fight-a.true_blooked)*5;
}
else
cout<<0;
out("滴血",0.01);
}
else
{
if(random(1,5)==1)
{
out("他打出了暴击,对你造成了",0.06);
if(fight>a.true_blooked)
{
cout<<(fight-a.true_blooked)*2;
a.blood-=(fight-a.true_blooked)*2;
}
else
cout<<0;
out("点伤害",0.01);
}
else
{
out("他打掉了你",0.01);
if(fight>a.true_blooked)
{
cout<<(fight-a.true_blooked);
a.blood-=(fight-a.true_blooked);
}
else
cout<<0;
out("滴血",0.01);
}
}
if(a.blood<=0)
return 0;
}
}
bool boss(int blood,int fight,int blooked)
{
int WayToFight,falseblood=blood,angry=0;
while(true)
{
a.angry++,angry++;
system("cls");
cout<<"你的血量:"<<a.blood<<"\t怪兽之王血量:"<<blood<<"\n你的攻击力:"<<a.true_fight<<"\t怪兽之王攻击力:"<<fight<<"\n你的防御力:"<<a.true_blooked<<"\t怪兽之王防御力:"<<blooked<<"\n我方回合:\n1.普通攻击\t2.怒气攻击(怒气:"<<a.angry<<"/5";
if(a.angry<5)
cout<<",暂时不够";
cout<<")";
cin>>WayToFight;
if(WayToFight==1)
if(random(1,5)==1)
{
out("你打出了暴击,对怪兽之王造成了",0.06);
if(a.true_fight>blooked)
{
cout<<(a.true_fight-blooked)*2;
blood-=(a.true_fight-blooked)*2;
}
else
cout<<0;
out("点伤害",0.01);
}
else
{
out("你打掉了他",0.01);
if(a.true_fight>blooked)
{
cout<<(a.true_fight-blooked);
blood-=(a.true_fight-blooked);
}
else
cout<<0;
out("滴血",0.01);
}
if(WayToFight==2)
if(a.angry>4)
{
a.angry-=5;
out("你使用了怒气攻击,敌方扣了",0.01);
if(a.true_fight>blooked)
{
cout<<(a.true_fight-blooked)*5;
blood-=(a.true_fight-blooked)*5;
}
else
cout<<0;
out("滴血",0.01);
}
if(blood<=0)
return true;
Sleep(600);
system("cls");
cout<<"你的血量:"<<a.blood<<"\t怪兽之王血量:"<<blood<<"\n你的攻击力:"<<a.true_fight<<"\t怪兽之王攻击力:"<<fight<<"\n你的防御力:"<<a.true_blooked<<"\t怪兽之王防御力:"<<blooked<<"\n敌方回合:\n";
if(angry>4)
{
angry-=5;
out("怪兽之王使用了怒气攻击,你扣了",0.01);
if(fight>a.true_blooked)
{
cout<<(fight-a.true_blooked)*5;
a.blood-=(fight-a.true_blooked)*5;
}
else
cout<<0;
out("滴血",0.01);
}
else
{
if(random(1,5)==1)
{
out("他打出了暴击,对你造成了",0.06);
if(fight>a.true_blooked)
{
cout<<(fight-a.true_blooked)*2;
a.blood-=(fight-a.true_blooked)*2;
}
else
cout<<0;
out("点伤害",0.01);
}
else
{
out("他打掉了你",0.01);
if(fight>a.true_blooked)
{
cout<<(fight-a.true_blooked);
a.blood-=(fight-a.true_blooked);
}
else
cout<<0;
out("滴血",0.01);
}
}
if(a.blood<=0)
return false;
}
}
void game()
{
string his;
int fightflag,TFeasy,choose;
a.blood=blood_[a.LOVE];
Main:
if(a.exp>=lv[a.LOVE+1])
{
while(a.exp>=lv[a.LOVE+1]) a.exp-=lv[++a.LOVE];
out("\n你的等级增加了!",0.01);
}
a.angry=0;
system("cls");
out("你想去做什么:\n",0.01);
if(a.true_fight!=0 or a.true_blooked!=0)
cout<<"1.探索\t2.商店\t3.存档\t4.查看\t5.开挂\t";
cout<<"6.对话\t";
if(a.power_of_earth)
{
cout<<"7.救公主\n";
}
cout<<'\n';
cin>>a.ch;
switch(a.ch)
{
case '1':
if(a.true_fight!=0 or a.true_blooked!=0)
goto steet;
break;
case '2':
if(a.true_fight!=0 or a.true_blooked!=0)
goto supermarket;
break;
case '3':
if(a.true_fight!=0 or a.true_blooked!=0)
{
a.blood=blood_[a.LOVE];
fout=fopen("Archive.Archive","wb");
fprintf(fout,"%s\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",a.name,a.LOVE,a.exp,a.Gold,a.true_fight,a.true_blooked,a.marketvip,a.talk,a.power_of_earth);
fclose(fout);
}
break;
case '4':
if(a.true_fight!=0 or a.true_blooked!=0)
goto info_;
break;
case '5':
if(a.true_fight!=0 or a.true_blooked!=0)
{
out("输入秘钥:",0.01);
cin>>choose;
if(choose==20081115)
{
out("尊贵的VIP,请享受我们的服务.",0.01);
out(".",0.333);
out(".",0.333);
Sleep(1000);
system("cls");
cout<<"抽取资源中...";
a.blood=99999999;
a.LOVE=20;
a.Gold=99999999;
a.true_fight=9999999;
a.true_blooked=99999999;
a.marketvip=1;
a.talk=1;
a.power_of_earth=1;
Sleep(1000);
system("cls");
cout<<"保存中...";
fout=fopen("Archive.Archive","wb");
fprintf(fout,"%s\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",a.name,a.LOVE,a.Gold,a.exp,a.true_fight,a.true_blooked,a.marketvip,a.talk,a.power_of_earth);
Sleep(1000);
}
}
break;
case '6':
if(!a.talk)
{
out("'上一位'勇者:\"你是来救公主的吧?!我劝你小心一点,我之前来的十个勇者都死了,你现在没有攻击力、防御力,是连史莱姆都打不败的,我助你一臂之力,送你一瓶增幅药水,加油吧!\"\n",0.01);
system("PAUSE");
system("cls");
out("你已获得6点攻击力!",0.01);
a.talk=1;
a.true_fight=6;
Sleep(200);
}
else
{
if(rand()%10==0)
{
out("'上一位'勇者:\"对了,我打听到一个消息,只要你得到了大地结晶,你就能开启通往关押公主的地方的门,至于怎么获得?......我尚不知道。\"\n",0.01);
system("PAUSE");
}
else
out("'上一位'勇者:\"加油!你是我们的希望!\"\n",0.01);
}
break;
case '7':
if(a.power_of_earth)
{
out("怪兽之王:\"又一个不自量力的人,敢来挑战我?!\"\n",0.01);
out(a.name,0.01);
out(":\"哼,我今天就得把你这个孽畜斩下,救出公主!!!\"\n",0.01);
out("怪兽之王:\"噢,原来是老熟人啊。想救公主?!(冷笑了两声)那得看你的本事!!!\"\n",0.01);
system("pause");
system("CLS");
out("你遭遇了怪兽之王。",0.01);
if(boss(1000000,500000,500000))
{
out("怪兽之王已被斩杀,勇者",0.01);
out(a.name,0.01);
out("救出了S国的公主。\n国王为了感谢勇者,便把公主许配给了",0.01);
out(a.name,0.01);
out("。\n从此,勇者和公主过上了幸福的生活\n(本游戏已完结,感谢游玩)",0.01);
exit(0);//人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人入人入人人人人人人人人人人人人人入人人人人人人人人人人人人人人人人人人人人人人人人人人
}
else
{
cout<<"\t\t\t\t\t\t失败";
system("start 怪兽纪元.exe");
}
}
break;
}
goto Main;
steet:
system("cls");
cout<<"1.寻宝\t2.挑战\n";
cin>>a.ch;
switch(a.ch)
{
case '1':
goto aaaaa;
case '2':
goto fight;
default:
goto Main;
}
aaaaa:
system("cls");
Sleep(2000);
b.Gold=rand()%50;
a.Gold+=b.Gold;
out("你捡到了",0.01);
cout<<b.Gold;
out("枚金币。",0.01);
Sleep(10);
goto Main;
fight:
system("cls");
if(a.LOVE<2)
TFeasy=1;
else if(a.LOVE<3)
TFeasy=2;
else if(a.LOVE<4)
TFeasy=3;
else if(a.LOVE<6)
TFeasy=4;
else if(a.LOVE<8)
TFeasy=5;
else if(a.LOVE<10)
TFeasy=6;
else if(a.LOVE<12)
TFeasy=7;
else if(a.LOVE<15)
TFeasy=8;
else if(a.LOVE<18)
TFeasy=9;
else if(a.LOVE<24)
TFeasy=10;
else
TFeasy=11;
switch(TFeasy>1?(TFeasy-rand()%4-1):(rand()%4+TFeasy-2))
{
case 0:
his ="史莱姆";
b.Gold=random(20,40);
b.exp=10;
b.blood=50;
b.true_fight=5;
b.true_blooked=1;
break;
case 1:
his="食人花";
b.Gold=random(50,100);
b.exp=25;
b.blood=100;
b.true_fight=60;
b.true_blooked=20;
break;
case 2:
his="红蝙蝠";
b.Gold=random(160,400);
b.exp=50;
b.blood=400;
b.true_fight=40;
b.true_blooked=60;
break;
case 3:
his="灵骷髅";
b.Gold=random(800,1500);
b.exp=250;
b.blood=600;
b.true_fight=250;
b.true_blooked=80;
case 4:
his="巨人";
b.Gold=random(3000,5000);
b.exp=800;
b.blood=800;
b.true_fight=800;
b.true_blooked=80;
break;
case 5:
his="金刚";
b.Gold=random(8000,10000);
b.exp=2500;
b.blood=1500;
b.true_fight=1500;
b.true_blooked=200;
break;
case 6:
his="食人蚯蚓";
b.Gold=random(10000,40000);
b.exp=12500;
b.blood=15000;
b.true_fight=2000;
b.true_blooked=2000;
break;
case 7:
his="朽灵法师";
b.Gold=random(60000,125000);
b.exp=100000;
b.blood=30000;
b.true_fight=10000;
b.true_blooked=6000;
break;
case 8:
his="远古守卫";
b.Gold=random(150000,750000);
b.exp=1250000;
b.blood=80000;
b.true_fight=10000;
b.true_blooked=25000;
break;
case 9:
his="巨龙";
b.Gold=random(1000000,3000000);
b.exp=1250000;
b.blood=100000;
b.true_fight=50000;
b.true_blooked=10000;
break;
case 10:
his="大地之灵";
b.Gold=random(6000000,20000000);
b.exp=3000000;
b.blood=1000;
b.true_fight=200000;
b.true_blooked=400000;
break;
}
out("你遭遇了"+his+",是(1)否(2)攻击?",0.01);
cin>>a.ch;
if(a.ch==49)
{
fightflag=fight(his,b.blood,b.true_fight,b.true_blooked);
if(fightflag==1)
{
out("\n\t\t\t\t胜利\n",0.01);
a.Gold+=b.Gold,a.exp+=b.exp;
if(his=="大地之灵" and !a.power_of_earth)
{
out("恭喜你获得了大地结晶!\0",0.01);
system("pause");
a.power_of_earth=1;
}
}
else if(fightflag==0)
{
cout<<"\n\t\t\t\t失败\n";
Sleep(100);
system("start 怪兽纪元.exe");
exit(0);
}
}
goto Main;
supermarket:
system("cls");
out("神秘老人:你要买什么?\n",0.01);
Sleep(200);
cout<<"1.一瓶劣质经验药水(增长20经验)¥160\n2.一瓶低级经验药水(增长200经验)¥1500\n3.一瓶中级经验药水(增长2000经验)¥13500\n4.一瓶高级经验药水(增长10000经验)¥66000\n";
cout<<"5.一瓶劣质攻击药水(增长10攻击力)¥160\n6.一瓶低级攻击药水(增长100攻击力)¥1440\n7.一瓶中级攻击药水(增长1000攻击力)¥13500\n8.一瓶高级攻击药水(增长10000攻击力)¥125000\n";
cout<<"9.一瓶劣质防御药水(增长8防御力)¥160\n10.一瓶低级防御药水(增长80防御力)¥1400\n11.一瓶中级防御药水(增长875防御力)¥14000\n12.一瓶高级防御药水(增长7500防御力)¥125000\n";
if(a.marketvip)
{
cout<<"13.一瓶一阶极品攻击药水(增长100000攻击力)¥1100000\n14.一瓶一阶极品防御药水(增长90000防御力)¥1100000\n";
cout<<"15.一瓶最高阶极品攻击药水(增长500000攻击力)¥4800000\n16.一瓶最高阶极品防御药水(增长480000防御力)¥4800000\n";
}
if(!a.marketvip)
cout<<"999.高级通行证(可购买高级增幅药水)¥999999\n";
cout<<"0.返回\n";
cin>>choose;
if(!choose)
{
out("神秘老人:慢走!",0.01);
Sleep(200);
goto Main;
}
if(choose==999)
{
if(a.marketvip)
out("神秘老人:你不是已经办了么?\n",0.01);
else
{
if(a.Gold<999999)
out("神秘老人:钱不够,办不了!\n",0.01);
else
{
a.Gold-=999999;
a.marketvip=true;
out("神秘老人:恭喜你能购买新物品了!!!\n",0.01);
}
}
}
else if(choose>16)
out("神秘老人:没有这件商品!\n",0.01);
else if(!a.marketvip and choose>12)
out("神秘老人:没有这件商品!\n",0.01);
else if(a.Gold<item[choose])
out("神秘老人:钱不够,买不了!\n",0.01);
else
{
out("神秘老人:你已获得增幅!\n",0.06);
Sleep(200);
switch(choose)
{
case 1:
a.exp+=20,a.Gold-=160;
break;
case 2:
a.exp+=200,a.Gold-=1500;
break;
case 3:
a.exp+=2000,a.Gold-=13500;
break;
case 4:
a.exp+=10000,a.Gold-=66000;
break;
case 5:
a.true_fight+=10,a.Gold-=160;
break;
case 6:
a.true_fight+=100,a.Gold-=1440;
break;
case 7:
a.true_fight+=1000,a.Gold-=13500;
break;
case 8:
a.true_fight+=10000,a.Gold-=125000;
break;
case 9:
a.true_blooked+=8,a.Gold-=160;
break;
case 10:
a.true_blooked+=80,a.Gold-=1400;
break;
case 11:
a.true_blooked+=875,a.Gold-=14000;
break;
case 12:
a.true_blooked+=7500,a.Gold-=125000;
break;
if(a.marketvip)
{
case 13:
a.true_fight+=100000,a.Gold-=1100000;
break;
case 14:
a.true_blooked+=90000,a.Gold-=1100000;
break;
case 15:
a.true_fight+=500000,a.Gold-=4800000;
case 16:
a.true_blooked+=480000,a.Gold-=4800000;
}
}
}
goto supermarket;
info_:
system("cls");
Sleep(100);
cout<<"\n\t\t\t\t\t名字:"<<a.name<<"\n\n\t\t\t\t\t目前血量:"<<a.blood<<"/"<<blood_[a.LOVE]<<"\n\t\t\t\t\t等级:"<<a.LOVE<<"\n\t\t\t\t\t还差";
cout<<lv[a.LOVE+1]-a.exp<<"exp可升至下一级"<<"\n\t\t\t\t\t攻击力:"<<a.true_fight<<"\n\t\t\t\t\t防御力:"<<a.true_blooked<<"\n\t\t\t\t\t金币:"<<a.Gold;
system("pause");
goto Main;
}
2 条评论
-
曹莫凡 @ 2025-7-24 15:35:44
??
-
2025-7-24 14:19:01@
#include <bits/stdc++.h> using namespace std; int a[123]; int main(){ string s; cin>>s; for(int i=0;i<s.size();i++){ a[int(s[i])]++; } for(int i=1;i<=122;i++){ if(a[i]>=1){ cout<<char(i)<<" "; } } cout<<"\n"; for(int i=1;i<=122;i++){ if(a[i]>0) cout<<a[i]<<" "; } return 0; }
- 1
信息
- ID
- 116
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- 递交数
- 56
- 已通过
- 9
- 上传者