跳到正文

休闲·娱乐

飞竹-究极原子

fly_bamboo约 39 分钟
原文
文章信息与版本

文章信息

发布
2025年6月4日
收录
2025年12月12日
更新
2026年10月24日
篇幅
约 39 分钟

版本

  1. v1当前

AD和空格移动,E打开商店,Q退出商店。
Z使用技能炸弹,X使用道具炸弹(需要购买)
OP对应左右普攻。

C++
#include<bits/stdc++.h>
#include<windows.h>
#define RESET "\033[0m"
#define BLACK "\033[30m"
#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define BLUE "\033[34m"
#define MAGENTA "\033[35m"
#define CYAN "\033[36m"
#define WHITE "\033[37m"
#define int long long
using namespace std;
const string mod1="AABCD",mod2="HAHAHABBD",mod3="ABCDEFGHJK",mod4="KKKCAC",mod5="JJJJJJJ",mod6="AKJAJ";
double x,y,x_stone,y_stone;
int n=51,m=200,cd_boom,energy,cnt_boom,ccd_boom,cd_attackl,cd_attackr;
double l,r,u,L,R,U,d,D,hp;
char a[55][205];
string make="";	
int stone,paper,glass,plastics,steel,cotton,candy,gold,meteorite,cnt_rare,cnt_epic,cnt_legend;
bool IsKeyPressed(WORD key)
{
    return (GetAsyncKeyState(key) & 0x8000) != 0;
}
void SetPos(int x, int y) {
    COORD pos;
    pos.X = x;
    pos.Y = y;
    HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOutput, pos);
}
void stop()
{
    cout<<"请按A键继续......"<<endl;
    while(!IsKeyPressed('A'))
    {
        
    }
    system("cls");
    return;
}
void move(char f,int len)
{
    if(f=='L')
    {
        for(int i=1;i<=51;i++)
        {
            for(int j=200;j>=1;j--)
            {
                a[i][j+len]=a[i][j];
            }
        }
        for(int j=len;j>=1;j--)
        {
            for(int i=51;i>=1;i--)
            {
                if(a[i][j+1]=='-') a[i][j]='-';
                else if(a[i+1][j+1]=='#'&&i>=20)
                {
                    int aa=rand()%10;
                    if(aa<=4) a[i][j]='#';
                    else a[i][j]=' ';
                }
                else if(a[i][j+1]=='#')
                {
                    int aa=rand()%10;
                    if(aa<=5) a[i][j]='#';
                    else a[i][j]=' ';
				}
                else if(a[i-1][j+1]=='#')
                {
                	int aa=rand()%10;
                	if(aa<=4) a[i][j]='#';
                	else a[i][j]=' ';
				}
                else if(i==50)
                {
                	int aa=rand()%1000;
                	if(aa<=980) a[i][j]='#';
                	else a[i][j]=' ';
				}
                else a[i][j]=' ';
                if(rand()%10==0&&a[i+1][j]=='#')
                {
                	a[i][j]='@';
				}
				if(rand()%1000<=0&&a[i+1][j]=='#')
				{
				    a[i][j]='V';
				}
            }
        }
    }
    else
    {
        for(int i=1;i<=51;i++)
        {
            for(int j=1;j<=200;j++)
            {
                a[i][max(1ll,j-len)]=a[i][j];
            }
        }
        for(int j=200-len+1;j<=200;j++)
        {
            for(int i=51;i>=1;i--)
            {
                if(a[i][j-1]=='-') a[i][j]='-';
                else if(a[i+1][j-1]=='#'&&i>=20)
                {
                    int aa=rand()%10;
                    if(aa<=4) a[i][j]='#';
                    else a[i][j]=' ';
                }
                else if(a[i-1][j-1]=='#')
                {
                	int aa=rand()%10;
                	if(aa<=5) a[i][j]='#';
                	else a[i][j]=' ';
				}
                else if(a[i][j-1]=='#')
                {
                    int aa=rand()%10;
                    if(aa<=4) a[i][j]='#';
                    else a[i][j]=' ';
				}
                else if(i==50)
                {
                	int aa=rand()%500;
                	if(aa<=490) a[i][j]='#';
                	else a[i][j]=' ';
				}
                else a[i][j]=' ';
                if(rand()%10==0&&a[i+1][j]=='#')
                {
                	a[i][j]='@';
				}
				if(rand()%1000<=0&&a[i+1][j]=='#')
				{
				    a[i][j]='V';
				}
            }
        }
    }
    return;
}
void boom()
{
	for(int i=x-10;i<=x+10;i++)
	{
		for(int j=100-10;j<=100+10;j++)
		{
			if(a[i][j]!='-'&&i>0&&j>0&&i<=50&&j<=200)
            {
                if(a[i][j]=='@') energy++;
                if(a[i][j]=='V') energy+=100;
                a[i][j]=' ';
            }
		}
	}
	return;
}
void luck()
{
    int x=rand()*rand()%10000+1;
    if(x<=10||cnt_legend+1>=200)
    {
        int y=rand()%1;
        if(y==0)
        {
            meteorite++;
            cout<<YELLOW<<"陨石"<<RESET<<" ";
        }
        cnt_legend=0;
        cnt_epic=0;
        cnt_rare=0;
    }
    else if(x<=100||cnt_epic+1>=100)
    {
        int y=rand()%2;
        if(y==0)
        {
            gold++;
            cout<<MAGENTA<<"黄金"<<RESET<<" ";
        }
    	if(y==1)
    	{
    		candy++;
    		cout<<MAGENTA<<"糖果"<<RESET<<" ";
		}
		cnt_legend++;
        cnt_epic=0;
        cnt_rare=0;
	}
	else if(x<=1000||cnt_rare+1>=10)
	{
        int y=rand()%2;
        if(y==0)
        {
            steel++;
            cout<<" ";
        }
    	if(y==1)
    	{
    		cotton++;
    		cout<<BLUE<<"棉花"<<RESET<<" ";
		}
		cnt_legend++;
		cnt_epic++;
        cnt_rare=0;
	}
	else
	{
		int y=rand()%4;
		if(y==0)
		{
			stone++;
			cout<<"岩石 ";
		}
		else if(y==1)
		{
			paper++;
			cout<<"纸团 ";
		}
		else if(y==2)
		{
			glass++;
			cout<<"玻璃 ";
		}
		else
		{
			plastics++;
			cout<<"塑料 "; 
		}
		cnt_legend++;
		cnt_epic++;
        cnt_rare++;
	}
    return;
}
void monster_check()
{
    return;
}
void attack()
{
    for(int k=1;k<=3;k++)
    {
        for(int i=1;i<=50;i++)
        {
            for(int j=200;j>=1;j--)
            {
                if(a[i][j]==')')
                {
                    if(a[i][j+1]=='#') a[i][j+1]=' ';
                    else a[i][j+1]=')';
                    a[i][j]=' ';
                }
            }
        }
        for(int i=1;i<=50;i++)
        {
            for(int j=1;j<=200;j++)
            {
                if(a[i][j]=='(')
                {
                    if(a[i][j-1]=='#') a[i][j-1]=' ';
                    else a[i][j-1]='(';
                    a[i][j]=' ';
                }
            }
        }
        monster_check();
    }
    return;
}
int read()
{
    string s;
    cin>>s;
    int len=s.size();
    for(int i=0;i<len;i++) s[i]--;
    len-=(int)mod6.size();
    for(int i=0;i<len;i++) s[i]--;
    len-=(int)mod5.size();
    for(int i=0;i<len;i++) s[i]--;
    len-=(int)mod4.size();
    for(int i=0;i<len;i++) s[i]--;
    len-=(int)mod3.size();
    for(int i=0;i<len;i++) s[i]--;
    len-=(int)mod2.size();
    for(int i=0;i<len;i++) s[i]--;
    len-=(int)mod1.size();
    int cnt=0;
    for(int i=0;i<len;i++) cnt=cnt*10+s[i]-'A';
    return cnt;
}
string add1(int x)
{
    string s="";
    while(x)
    {
        s=char(x%10+'A')+s;
        x/=10;
    }
    s+=mod1;
    for(int i=0;i<s.size();i++) s[i]++;
    s+=mod2;
    for(int i=0;i<s.size();i++) s[i]++;
    s+=mod3;
    for(int i=0;i<s.size();i++) s[i]++;
    s+=mod4;
    for(int i=0;i<s.size();i++) s[i]++;
    s+=mod5;
    for(int i=0;i<s.size();i++) s[i]++;
    s+=mod6;
    for(int i=0;i<s.size();i++) s[i]++;
    return s;
}
void result()
{
    freopen("file.in","w",stdout);
    cout<<add1(energy)<<" "<<add1(cnt_boom)<<endl;
    cout<<add1(stone)<<" "<<add1(paper)<<" "<<add1(glass)<<" "<<add1(plastics)<<" "<<add1(steel)<<" "<<add1(cotton)<<" "<<add1(candy)<<" "<<add1(gold)<<" "<<add1(meteorite)<<" "<<add1(cnt_rare)<<" "<<add1(cnt_epic)<<" "<<add1(cnt_legend)<<endl;
    exit(0); 
    return;
}
signed main()
{
    srand(time(0));
    ios::sync_with_stdio(false);
    cout.tie(0);
    freopen("file.in","r",stdin);
    energy=read();
    cnt_boom=read();
    stone=read(),paper=read(),glass=read(),plastics=read(),steel=read(),cotton=read(),candy=read(),gold=read(),meteorite=read(),cnt_rare=read(),cnt_epic=read(),cnt_legend=read();
    hp=100;
    cout<<"把exe全屏游玩体验更佳"<<endl;
    cout<<"欢迎来到究极原子"<<endl;
    cout<<"如需正常游玩,请提前在桌面新建一个file.in"<<endl;
    cout<<"按0手动存档"<<endl;
    cout<<"不是按退出游戏结束的exe不会进行存档,存档和cpp的位置最好在一起,不要去改存档,数据丢失概不负责"<<endl; 
    cout<<"希望您有一个良好的体验!"<<endl;
    stop();
    x=50,y=100;
    x_stone=50,y_stone=100;
    for(int i=1;i<=51;i++)
    {
        for(int j=1;j<=200;j++) a[i][j]=' ';
    }
    for(int j=1;j<=200;j++) a[51][j]=a[1][j]='-';
    while(1)
    {
    	SetPos(0, 0);
        for(int i=1;i<=51;i++)
        {
            for(int j=1;j<=200;j++)
            {
            	if(i==1)
            	{
            		if(j<=hp) cout<<RED<<"#"<<RESET;
            		else cout<<" ";
				}
            	else if(i==2)
            	{
            		if(j==1) cout<<"e";
            		else if(j==2) cout<<"n";
            		else if(j==3) cout<<"e";
            		else if(j==4) cout<<"r";
            		else if(j==5) cout<<"g";
            		else if(j==6) cout<<"y";
            		else if(j==7) cout<<":";
            		else if(j==8) cout<<energy/10000000000%10;
            		else if(j==9) cout<<energy/1000000000%10;
            		else if(j==10) cout<<energy/100000000%10;
            		else if(j==11) cout<<energy/10000000%10;
            		else if(j==12) cout<<energy/1000000%10;
            		else if(j==13) cout<<energy/100000%10;
            		else if(j==14) cout<<energy/10000%10;
            		else if(j==15) cout<<energy/1000%10;
            		else if(j==16) cout<<energy/100%10;
            		else if(j==17) cout<<energy/10%10;
            		else if(j==18) cout<<energy%10;
            		else cout<<"-";
				}
            	else if(i==3)
            	{
            		if(j==1) cout<<"b";
            		else if(j==2) cout<<"o";
            		else if(j==3) cout<<"o";
            		else if(j==4) cout<<"m";
            		else if(j==5) cout<<"_";
            		else if(j==6) cout<<"c";
            		else if(j==7) cout<<"d";
            		else if(j==8) cout<<":";
            		else if(j==9) cout<<cd_boom/1000%10;
            		else if(j==10) cout<<cd_boom/100%10;
            		else if(j==11) cout<<cd_boom/10%10;
            		else if(j==12) cout<<cd_boom%10;
            		else if(j==16) cout<<"b";
            		else if(j==17) cout<<"o";
            		else if(j==18) cout<<"o";
            		else if(j==19) cout<<"m";
            		else if(j==20) cout<<":";
            		else if(j==21) cout<<cnt_boom/1000%10;
            		else if(j==22) cout<<cnt_boom/100%10;
            		else if(j==23) cout<<cnt_boom/10%10;
            		else if(j==24) cout<<cnt_boom%10;
            		else cout<<" ";
				}
				else if(i==4)
				{
				    if(j==1) cout<<"a";
				    else if(j==2) cout<<"t";
				    else if(j==3) cout<<"t";
				    else if(j==4) cout<<"a";
				    else if(j==5) cout<<"c";
				    else if(j==6) cout<<"k";
				    else if(j==7) cout<<":";
				    else if(j==8) cout<<cd_attackl/10%10;
				    else if(j==9) cout<<cd_attackl%10;
				    else if(j==11) cout<<cd_attackr/10%10;
				    else if(j==12) cout<<cd_attackr%10;
				    else cout<<" ";
				}
                else if(i==(int)x&&j==100)
				{
					cout<<"O";
				}
                else if(a[i][j]=='@')
				{
					cout<<YELLOW<<"@"<<RESET;
				}
                else if(a[i][j]=='#')
                {
					cout<<GREEN<<"#"<<RESET;
				}
                else if(a[i][j]=='V')
				{
					cout<<BLUE<<"V"<<RESET;
				}
                else
				{
					cout<<a[i][j];
				}
            }
            cout<<endl;
        }
        if(a[(int)x+1][100]=='@') energy++,a[(int)x+1][100]=' ';
        if(a[(int)x-1][100]=='@') energy++,a[(int)x-1][100]=' ';
        if(a[(int)x+1][100-1]=='@') energy++,a[(int)x+1][100-1]=' ';
        if(a[(int)x-1][100-1]=='@') energy++,a[(int)x-1][100-1]=' ';
        if(a[(int)x+1][100+1]=='@') energy++,a[(int)x+1][100+1]=' ';
        if(a[(int)x-1][100+1]=='@') energy++,a[(int)x-1][100+1]=' ';
        if(a[(int)x][100-1]=='@') energy++,a[(int)x][100-1]=' ';
        if(a[(int)x][100+1]=='@') energy++,a[(int)x][100+1]=' ';
        if(a[(int)x+1][100]=='V') energy+=100,a[(int)x+1][100]=' ';
        if(a[(int)x-1][100]=='V') energy+=100,a[(int)x-1][100]=' ';
        if(a[(int)x+1][100-1]=='V') energy+=100,a[(int)x+1][100-1]=' ';
        if(a[(int)x-1][100-1]=='V') energy+=100,a[(int)x-1][100-1]=' ';
        if(a[(int)x+1][100+1]=='V') energy+=100,a[(int)x+1][100+1]=' ';
        if(a[(int)x-1][100+1]=='V') energy+=100,a[(int)x-1][100+1]=' ';
        if(a[(int)x][100-1]=='V') energy+=100,a[(int)x][100-1]=' ';
        if(a[(int)x][100+1]=='V') energy+=100,a[(int)x][100+1]=' ';
        if(IsKeyPressed('0'))
        {
            result();
        }
        if(IsKeyPressed('O')&&cd_attackl==0)
        {
            if(a[(int)x][100-1]!='#')
            {
                a[(int)x][100-1]='(';
            }
            else a[(int)x][100-1]=' ';
            cd_attackl=20;
        }
        if(IsKeyPressed('P')&&cd_attackr==0)
        {
            if(a[(int)x][100+1]!='#')
            {
                a[(int)x][100+1]=')';
            }
            else a[(int)x][100+1]=' ';
            cd_attackr=20;
        }
        if(IsKeyPressed('E'))
        {
    		system("cls");
    		while(!IsKeyPressed('Q'))
    		{
    			cout<<"欢迎来到亡灵之碑"<<endl;
    			cout<<"1.购买炸弹"<<endl;
    			cout<<"2.材质祈福"<<endl;
    			cout<<"3.切换材质"<<endl;
    			cout<<"Q退出"<<endl;
    			while((!IsKeyPressed('1'))&&(!IsKeyPressed('2'))&&(!IsKeyPressed('3'))&&(!IsKeyPressed('Q')))
    			{
    				
				}
				if(IsKeyPressed('1'))
				{
					system("cls"); 
    				cout<<"购买炸弹需要100能量,是否购买(y/n)"<<endl;
    				while((!IsKeyPressed('Y'))&&(!IsKeyPressed('N')))
        			{
        				
					}
					if(IsKeyPressed('Y')&&energy>=100)
    				{
    					energy-=100;
    					cnt_boom++;
    					cout<<"购买成功";
						stop(); 
					}
					else
					{
						cout<<"购买失败";
						stop();
					}
				}
				if(IsKeyPressed('2'))
				{
				    system("cls");
				    cout<<"1抽1000能量,你要一抽/十连/百连/不抽(o/t/h/n)"<<endl;
				    cout<<"10抽保底1稀有,100抽保底1史诗,200抽保底1传说"<<endl;
				    while((!IsKeyPressed('O'))&&(!IsKeyPressed('T'))&&(!IsKeyPressed('H'))&&(!IsKeyPressed('N')))
				    {
				        
				    }
				    if(IsKeyPressed('O')&&energy>=1000)
				    {
				        luck();
				        energy-=1000;
				    }
				    else if(IsKeyPressed('T')&&energy>=10000)
				    {
				        for(int i=1;i<=10;i++) luck();
				        energy-=10000;
				    }
				    else if(IsKeyPressed('H')&&energy>=100000)
				    {
				        for(int i=1;i<=100;i++) luck();
				        energy-=100000;
					}
					stop();
				}
				if(IsKeyPressed('3'))
				{
					system("cls");
					cout<<"请选择查看的等级:普通/稀有/史诗/传说(c/d/e/l)"<<endl;
					while((!IsKeyPressed('C'))&&(!IsKeyPressed('A'))&&(!IsKeyPressed('D'))&&(!IsKeyPressed('L')))
					{
						
					}
					if(IsKeyPressed('C'))
					{
						cout<<"你拥有的普通材料"<<endl;
						if(stone>0) cout<<"A:"<<"Lv."<<stone<<"岩石"<<endl;
						if(paper>0) cout<<"B:"<<"Lv."<<paper<<"纸团"<<endl;
						if(glass>0) cout<<"C:"<<"Lv."<<stone<<"玻璃"<<endl;
						if(plastics>0) cout<<"D:"<<"Lv."<<plastics<<"塑料"<<endl;
						cout<<"请选择你的材质"<<endl;
						while((!IsKeyPressed('A'))&&(!IsKeyPressed('B'))&&(!IsKeyPressed('C'))&&(!IsKeyPressed('D')))
						{
							
						}
						if(IsKeyPressed('A'))
						{
							make="stone";
						}
						if(IsKeyPressed('B'))
						{
							make="paper";
						}
						if(IsKeyPressed('C'))
						{
							make="glass";
						}
						if(IsKeyPressed('D'))
						{
							make="plastics";
						}
					}
					if(IsKeyPressed('D'))
					{
						cout<<"你拥有的稀有材料"<<endl;
						if(steel>0) cout<<"A:"<<"Lv."<<steel<<"钢铁"<<endl;
						if(cotton>0) cout<<"B:"<<"Lv."<<cotton<<"棉花"<<endl;
						cout<<"请选择你的材质"<<endl;
						while((!IsKeyPressed('A'))&&(!IsKeyPressed('B')))
						{
							
						}
						if(IsKeyPressed('A'))
						{
							make="steel";
						}
						if(IsKeyPressed('B'))
						{
							make="cotton";
						}
					}
					if(IsKeyPressed('E'))
					{
						cout<<"你拥有的史诗材料"<<endl;
						if(candy>0) cout<<"A:"<<"Lv."<<candy<<"糖果"<<endl;
						if(gold>0) cout<<"B:"<<"Lv."<<gold<<"黄金"<<endl;
						cout<<"请选择你的材质"<<endl;
						while((!IsKeyPressed('A'))&&(!IsKeyPressed('B')))
						{
							
						}
						if(IsKeyPressed('A'))
						{
							make="candy";
						}
						if(IsKeyPressed('B'))
						{
							make="gold";
						}
					}
					if(IsKeyPressed('L'))
					{
						cout<<"你拥有的传说材料"<<endl;
						if(meteorite>0) cout<<"A:"<<"Lv."<<meteorite<<"陨石"<<endl;
						cout<<"请选择你的材质"<<endl;
						while((!IsKeyPressed('A')))
						{
							
						}
						if(IsKeyPressed('A'))
						{
							make="meteorite";
						}
					}
				}
				system("cls");
			}
			system("cls");
		}
        if(IsKeyPressed('X'))
        {
        	if(cnt_boom>0&&ccd_boom==0) boom(),cnt_boom--,ccd_boom=50;
		}
        if(IsKeyPressed('Z'))
        {
        	if(cd_boom<=0) boom(),cd_boom=2000;
		}
        if(IsKeyPressed('A'))
        {
            l+=0.05;
            l=min(l,1.0+(make=="cotton")*cotton*0.01);
            L+=l;
            L=min(L,3.0+(make=="cotton")*cotton*0.1);
            int tmp=y;
            for(double i=0.01;i<=L;i+=0.01)
            {
            	y-=0.01;
            	if(a[(int)x][100-(int)abs((int)y-tmp)]!=' ')
            	{
            		y+=0.01;
            		break;
				}
			}
            y_stone+=abs(tmp-y);
            move('L',abs(tmp-y));
        }
        else
        {
            l-=0.1;
            l=max(l,0.0);
            L-=0.5;
            L=max(L,0.0);
            int tmp=y;
            for(double i=0.01;i<=L;i+=0.01)
            {
            	y-=0.01;
            	if(a[(int)x][100-(int)abs((int)y-tmp)]!=' ')
            	{
            		y+=0.01;
            		break;
				}
			}
            y_stone+=abs(tmp-y);
            move('L',abs(tmp-y));
        }
        if(IsKeyPressed('D'))
        {
            r+=0.05;
            r=min(r,1.0+(make=="cotton")*cotton*0.01);
            R+=r;
            R=min(R,3.0+(make=="cotton")*cotton*0.1);
            int tmp=y;
            for(double i=0.01;i<=R;i+=0.01)
            {
            	y+=0.01;
            	if(a[(int)x][100+(int)abs((int)y-tmp)]!=' ')
            	{
            		y-=0.01;
            		break;
				}
			}
            y_stone-=abs(tmp-y);
            move('R',abs(tmp-y));
        }
        else
        {
            r-=0.1;
            r=max(r,0.0);
            R-=0.5;
            R=max(R,0.0);
            int tmp=y;
            for(double i=0.01;i<=R;i+=0.01)
            {
            	y+=0.01;
            	if(a[(int)x][100+(int)abs((int)y-tmp)]!=' ')
            	{
            		y-=0.01;
            		break;
				}
			}
            y_stone-=abs(tmp-y);
            move('R',abs(tmp-y));
        }
        if(IsKeyPressed(' '))
        {
            u+=0.05;
            u=min(u,0.5);
            U+=u;
            U=min(U,1.0);
            int tmp=x;
            for(double i=0.01;i<=U;i+=0.01)
            {
            	x-=0.01;
            	if(a[(int)x][100]!=' ')
            	{
            		x+=0.01;
            		break;
				}
			}
        }
        else if(a[(int)x+1][100]!='#')
        {
            d+=max(0.01,0.1-(make=="meteorite")*meteorite*0.01);
            d=min(d,max(0.2,1.0-(make=="meteorite")*meteorite*0.03));
            D+=d;
            D=min(D,max(0.2,1.0-(make=="meteorite")*meteorite*0.03));
            x+=D;
            x=min(x,50.0); 
        }
        else d=0,D=0;
        attack();
        cd_boom--;
        ccd_boom--;
        cd_attackl--,cd_attackr--;
        cd_attackl=max(cd_attackl,0ll);
        cd_attackr=max(cd_attackr,0ll);
        ccd_boom=max(ccd_boom,0ll);
        cd_boom=max(cd_boom,0ll);
        Sleep(20);
    }
    return 0;
}
原文