小游戏(开心)(2.0)

yanghy 2024-07-17 16:09:43 45
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x;
	int w=100;
	cout<<"欢迎来到Su生成器"<<endl;
	cout<<"有三种难度:"<<endl;
	cout<<"1.简单 2.中等 3.困难";
	int n;
	cin>>n;
	cout<<"请输入名字"<<endl;
	string p;
	cin>>p;
	if(n==1){
		cout<<p<<" VS curry1"<<endl;
		x=100;
		while(x>0 && w>0){
			cout<<"他有"<<x<<"格血"<<endl;
			cout<<"你有"<<w<<"格血"<<endl;
			srand(time(NULL));
			int ma = 3;
			int mi = 1;
			int o = mi+rand()%(ma-mi+1);
			cout<<"1.拳击 2.闪避 3.抵挡"<<endl;
			int r;
			cin>>r;
			if(r==1){
				int sum=0;
				sum++;
				if(sum==5){
					cout<<"次数过多了哟"<<endl; 
					continue;
				}
				x-=10;
				if(o==1){
					w -=10;
					cout<<"你和他都减了10格血"<<endl; 
				}
				else if(o==2){
					srand(time(NULL));
					int max = 100;
					int min = 0;
					int b = min+rand()%(max-min+1);
					if(b>=50){
						x+=10;
						cout<<"他躲掉了"<<endl; 
					}
					else{
						cout<<"他没躲掉"<<endl; 
					}
				}
				else{
					x+=5;
					cout<<"他当了50%"<<endl; 
				}
			}
			else if(r==2){
				if(o==1){
					srand(time(NULL));
					int maxx = 100;
					int minn = 0;
					int k = mi+rand()%(ma-mi+1);
					if(k>=50){
						cout<<"你躲掉了"<<endl; 
					}
					else{
						w-=10;
						cout<<"你没躲掉"<<endl; 
					}
				}
				else if(o==2 || o==3){
					cout<<"谁也没扣"<<endl;
				}
			}
			else{
				if(o==1){
					w-=10;
					w+=5; 
					cout<<"你挡了50%"<<endl; 
				}
				else if(o==2 || o==3){
					cout<<"谁也没扣"<<endl;
				}
			}
		}
		if(w==0 && x!=0){
			cout<<"你个撒比这都没赢"<<endl;
		}
		else if(x==0 && w!=0){
			cout<<"YOU WIN"<<endl;
		}
		else if(w==0 && x==0){
			cout<<"平了哈哈哈!"<<endl;
		}
	}
	else if(n==2){
		cout<<p<<" VS curry2"<<endl;
		x=150;
		while(x>0 && w>0){
			cout<<"他有"<<x<<"格血"<<endl;
			cout<<"你有"<<w<<"格血"<<endl;
			srand(time(NULL));
			int ma = 3;
			int mi = 1;
			int o = mi+rand()%(ma-mi+1);
			cout<<"1.拳击 2.闪避 3.抵挡"<<endl;
			int r;
			cin>>r;
			if(r==1){
				int sum=0;
				sum++;
				if(sum==5){
					cout<<"次数过多了哟"<<endl; 
					continue;
				}
				x-=10;
				if(o==1){
					w -=10;
					cout<<"你和他都减了10格血"<<endl; 
				}
				else if(o==2){
					srand(time(NULL));
					int max = 100;
					int min = 0;
					int b = min+rand()%(max-min+1);
					if(b>=50){
						x+=10;
						cout<<"他躲掉了"<<endl; 
					}
					else{
						cout<<"他没躲掉"<<endl; 
					}
				}
				else{
					x+=5;
					cout<<"他当了50%"<<endl; 
				}
			}
			else if(r==2){
				if(o==1){
					srand(time(NULL));
					int maxx = 100;
					int minn = 0;
					int k = mi+rand()%(ma-mi+1);
					if(k>=50){
						cout<<"你躲掉了"<<endl; 
					}
					else{
						w-=10;
						cout<<"你没躲掉"<<endl; 
					}
				}
				else if(o==2 || o==3){
					cout<<"谁也没扣"<<endl;
				}
			}
			else{
				if(o==1){
					w+=5; 
					cout<<"你挡了50%"<<endl; 
				}
				else if(o==2 || o==3){
					cout<<"谁也没扣"<<endl;
				}
			}
		}
		if(w==0 && x!=0){
			cout<<"你个撒比这都没赢"<<endl;
		}
		else if(x==0 && w!=0){
			cout<<"YOU WIN"<<endl;
		}
		else if(w==0 && x==0){
			cout<<"平了哈哈哈!"<<endl;
		}
	} 
	else if(n==3){
		cout<<p<<" VS curry3"<<endl;
		x=200;
		while(x>0 && w>0){
			cout<<"他有"<<x<<"格血"<<endl;
			cout<<"你有"<<w<<"格血"<<endl;
			srand(time(NULL));
			int ma = 3;
			int mi = 1;
			int o = mi+rand()%(ma-mi+1);
			cout<<"1.拳击 2.闪避 3.抵挡"<<endl;
			int r;
			cin>>r;
			if(r==1){
				int sum=0;
				sum++;
				if(sum==5){
					cout<<"次数过多了哟"<<endl; 
					continue;
				}
				x-=10;
				if(o==1){
					w -=10;
					cout<<"你和他都减了10格血"<<endl; 
				}
				else if(o==2){
					srand(time(NULL));
					int max = 100;
					int min = 0;
					int b = min+rand()%(max-min+1);
					if(b>=50){
						x+=10;
						cout<<"他躲掉了"<<endl; 
					}
					else{
						cout<<"他没躲掉"<<endl; 
					}
				}
				else{
					x+=5;
					cout<<"他当了50%"<<endl; 
				}
			}
			else if(r==2){
				if(o==1){
					srand(time(NULL));
					int maxx = 100;
					int minn = 0;
					int k = mi+rand()%(ma-mi+1);
					if(k>=50){
						cout<<"你躲掉了"<<endl; 
					}
					else{
						w-=10;
						cout<<"你没躲掉"<<endl; 
					}
				}
				else if(o==2 || o==3){
					cout<<"谁也没扣"<<endl;
				}
			}
			else{
				if(o==1){
					w-=10;
					w+=5; 
					cout<<"你挡了50%"<<endl; 
				}
				else if(o==2 || o==3){
					cout<<"谁也没扣"<<endl;
				}
			}
		}
		if(w==0 && x!=0){
			cout<<"你个撒比这都没赢"<<endl;
		}
		else if(x==0 && w!=0){
			cout<<"YOU WIN"<<endl;
		}
		else if(w==0 && x==0){
			cout<<"平了哈哈哈!"<<endl;
		}
	}
	if(w==0){
		for(int i=1;i<123456;i++){
			cout<<"哈哈哈哈哈"; 
		} 
	}
}
{{ vote && vote.total.up }}

共 1 条回复

yanghy

本次更新处理了bage 感谢qinxihe