跳到正文

个人记录

在这

jihanyu123约 57 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月21日
篇幅
约 57 分钟
获赞
1

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<vector>
#include<stack>
#define RED(x) "\033[31m" << x << "\033[0m"
#define GREEN(x) "\033[32m" << x << "\033[0m"
#define YELLOW(x) "\033[33m" << x << "\033[0m"
#define BULE(x) "\033[34m" << x <<"\033[0m"
#define PURPLE(x) "\033[35m"<<x<<"\033[0m"
#define SKYBULE(x) "\033[36m"<<x<<"\033[0m"
using namespace std;
int kill,dodge,peach,healthy1,kill1,dodge1,peach1,healthy2,healthy_max1,
    healthy_max2;
int beeh,beeh1,beeh_kill,beeh_kill1;
int ladder1,ladder2,none1,none2;
int create,create1;
int x,y;
int m,tot=1;
int arms1,arms2;
string t[100],won,lose;
int c,p;
int fl,fr;
int rice1,rice2;
stack<int>card;
void tle(int x,string a,string b) {
	if(x==0) {
		cout<<a;
	} else {
		cout<<b;
	}
}
string mle(int x) {
	if(x==3 or x==4) {
		//kill++;
		return "杀";
	} else if(x==1 or x==2) {
		//dodge++;
		return "闪";
	} else if(x==5) {
		//peach++;
		//cout<<SKYBULE(" ");
		return "桃";
	} else if(x==6) {
		//arms1++;
		return "诸葛连弩";
	} else if(x==7) {
		//beeh++;
		//cout<<SKYBULE(" ");
		return "酒";
	} else if(x==8) {
		//ladder1++;
		//cout<<SKYBULE(" ");
		return "过河拆桥";
	} else if(x==9) {
		//none1++;
		return "无懈可击";
		//cout<<SKYBULE(" ");
	} else if(x==10) {
		//create++;
		return "无中生有";
		//cout<<SKYBULE("");
	} else {
		//rice1++;
		return "五谷丰登";
		//cout<<SKYBULE("");
	}
}
void card_push() {
	for(int j=1; j<=100; j++) {
		int x=rand()%11+1;
		card.push(x);
	}
}
void print() {
	cout<<RED("1.杀")<<RED(kill)<<BULE("张,2.闪")<<BULE(dodge)
	    <<PURPLE("张,3.桃")<<PURPLE(peach)<<PURPLE("张")<<GREEN("  诸葛连弩")
	    <<GREEN(arms1)<<YELLOW("张,4.酒")<<YELLOW(beeh)<<SKYBULE("张,5.过河拆桥")
	    <<SKYBULE(ladder1)<<RED("张,6.无懈可击")
	    <<RED(none1)<<BULE("张,7.无中生有")<<BULE(create)<<BULE("张,8.五谷丰登 ")<<RED(
	        rice1)<<RED("张");
}
void out() {
	cout<<BULE("§ 三国杀(改写) §\n");
	Sleep(2000);
	system("cls");
	cout<<"请选择人物(按数字即可):\n";
	cout<<"0.刘备(蜀):仁德\n可以弃置两张手牌,体力+1(每轮至多+1体力)\n主公技,激将:\n当你要打出杀时,你可以让其他蜀势力角色打出\n";
	t[0]="刘备";
	cout<<"1.张飞(蜀):咆哮\n可以无限出杀\n";
	t[1]="张飞";
	cout<<"2.吕布(群):暴怒\n出杀时对手要出两张闪\n";
	t[2]="吕布";
	cout<<"3.曹操(魏):奸雄\n可以获得对你造成伤害的牌\n主公技:\n可以从魏势力手里获得一张闪\n";
	t[3]="曹操";
	cout<<"4.孙策(吴):英姿\n可以弃置任意数量的手牌,再摸同等数量的手牌\n主公技:\n可以从吴势力手里获得一张闪;使用桃时多回一点体力\n";
	t[4]="孙策";
	cout<<"5.关羽(蜀):武圣\n可以弃置任意手牌当杀\n";
	t[5]="关羽";
	cout<<"6.华佗(群):急救\n弃置一张手牌,体力+1\n";
	t[6]="华佗";
	cout<<"7.周瑜(吴):兵粮\n任何摸牌阶段都可以多摸2张手牌\n";
	t[7]="周瑜";
	cout<<"8.甄姬(魏):\n倾国:弃置任意数量的手牌,获得同等数量的闪\n洛神:若堆顶的牌是黑色,你获得之。你可重复此流程直至是红色\n";
	t[8]="甄姬";
	cout<<"9.董卓(群):酒池\n可弃置任意数量的手牌,获得同等数量的酒\n";
	t[9]="董卓";
	cout<<"10.李儒(群):焚城\n你弃置一张牌,对方可以弃置X(X为当前人数+1)张牌,或受到两点火焰伤害\n";
	t[10]="李儒";
	cout<<"11.吕蒙(神)(吴):看破\n你可以观看牌堆顶5张牌,获得其中花色不同的牌\n";
	t[11]="吕蒙";
	cout<<"12.李典(魏):恂恂\n你可以观看堆顶X+2张牌(X为你本应该摸的牌数),选择X张\n当你受到伤害时,你和对方各摸一张牌\n";
	t[12]="李典";
	cout<<">12.小卒:人数\n可以复活一次,然后摸4张牌\n";
	t[13]="小卒";
}
void potrct() {
	if(card.size()<=10) {//补牌。
		card_push();
	}
}
void card_how1(int x) {
	if(x==3 or x==4) {
		kill++;
		cout<<SKYBULE("获得杀一张\n");
	} else if(x==1 or x==2) {
		dodge++;
		cout<<SKYBULE("获得闪一张\n");
	} else if(x==5) {
		peach++;
		cout<<SKYBULE("获得桃一张\n");
	} else if(x==6) {
		arms1++;
		cout<<SKYBULE("获得诸葛连弩一张\n");
	} else if(x==7) {
		beeh++;
		cout<<SKYBULE("获得酒一张\n");
	} else if(x==8) {
		ladder1++;
		cout<<SKYBULE("获得过河拆桥一张\n");
	} else if(x==9) {
		none1++;
		cout<<SKYBULE("获得无懈可击一张\n");
	} else if(x==10) {
		create++;
		cout<<SKYBULE("获得无中生有一张\n");
	} else {
		rice1++;
		cout<<SKYBULE("获得五谷丰登一张\n");
	}
	potrct();
}
void card_how2(int x) {
	if(x==1 or x==2) {
		kill1++;
	} else if(x==3 or x==4) {
		dodge1++;
	} else if(x==5) {
		peach1++;
	} else if(x==6) {
		arms2++;
	} else if(x==7) {
		beeh1++;
	} else if(x==8) {
		ladder2++;
	} else if(x==9) {
		none2++;
	} else if(x==10) {
		create1++;
	} else {
		rice2++;
	}
	potrct();
}
string color(int x) {
	if(x==1) return "草花";
	if(x==2) return "黑桃";
	if(x==3) return "红心";
	if(x==4) return "方块";
}
void re(int x) {
	if(x==3 or x==4) {
		//kill++;
		cout<<SKYBULE(" 杀");
	} else if(x==1 or x==2) {
		//dodge++;
		cout<<SKYBULE(" 闪");
	} else if(x==5) {
		//peach++;
		cout<<SKYBULE(" 桃");
	} else if(x==6) {
		//arms1++;
		cout<<SKYBULE(" 诸葛连弩");
	} else if(x==7) {
		//beeh++;
		cout<<SKYBULE(" 酒");
	} else if(x==8) {
		//ladder1++;
		cout<<SKYBULE(" 过河拆桥");
	} else if(x==9) {
		//none1++;
		cout<<SKYBULE(" 无懈可击");
	} else if(x==10) {
		//create++;
		cout<<SKYBULE(" 无中生有");
	} else {
		//rice1++;
		cout<<SKYBULE(" 五谷丰登");
	}
}
void give1(int c) {
	if(t[c]=="甄姬") {
		cout<<"洛神开始\n";
		string s=color(rand()%4+1);
		while(s!="红心"&&s!="方块"){
			int x=card.top();
			card.pop();
			cout<<"结果为"<<s<<" ";
			re(x);
			cout<<"\n";
			if(s!="红心"&&s!="方块"){
				card_how1(x);
			}
			s=color(rand()%4+1);
		}
		cout<<"洛神结束\n";
	}
	if(t[c]=="周瑜") {
		for(int i=1; i<=2; i++) {
			card_how1(card.top());
			card.pop();
		}
	}
	potrct();
}
void give2(int p) {
	if(t[p]=="甄姬") {
		cout<<"对方洛神开始\n";
		string s=color(rand()%4+1);
		while(s!="红心"&&s!="方块"){
			int x=card.top();
			card.pop();
			//cout<<"结果为"<<s<<" "<<re(x)<<"\n";
			if(s!="红心"&&s!="方块"){
				card_how2(x);
			}
			s=color(rand()%4+1);
		}
		cout<<"对方洛神结束\n";
	}
	if(t[p]=="周瑜") {
		for(int i=1; i<=2; i++) {
			card_how2(card.top());
			card.pop();
		}
	}
	potrct();
}
void hel1() {
	if(t[c]=="小卒"&&healthy1<=0&&fl==0) {
		healthy1=3;
		cout<<"已复活\n";
		kill=dodge=peach=beeh=ladder1=arms1=create=none1=0;
		for(int i=1; i<=4; i++) {
			card_how1(card.top());
			card.pop();
		}
		give1(c);
		x++;
		fl=1;
	}
}
void hel2() {
	if(t[p]=="小卒"&&healthy2<=0&&fr==0) {
		healthy2=2;
		cout<<"对方已复活\n";
		kill1=dodge1=peach1=beeh1=ladder2=arms2=create1=none2=0;
		for(int j=1; j<=4; j++) {
			card_how2(card.top());
			card.pop();
		}
		give2(p);
		y++;
		fr=1;
	}
}
void heal() {
	if(c<=4) {
		healthy1=4;
		healthy_max1=4;
	} else if(c==5) {
		healthy1=5;
		healthy_max1=5;
	} else if(c==9) {
		healthy1=8;
		healthy_max1=8;
	} else if(c>12) {
		healthy1=2;
		healthy_max1=2;
	} else {
		healthy1=3;
		healthy_max1=3;
	}
	if(p<=4) {
		healthy2=4;
		healthy_max2=4;
	} else if(p==5) {
		healthy2=5;
		healthy_max2=5;
	} else if(p==9) {
		healthy2=8;
		healthy_max2=8;
	} else if(p>12) {
		healthy2=2;
		healthy_max2=2;
	} else {
		healthy2=3;
		healthy_max2=3;
	}
}
void axe() {
	hel1();
	hel2();
}
bool win_or_lose() {
	axe();
	if(healthy1<=0) {
		cout<<"你已进入濒死状态,是(1)否(0)使用桃或酒?\n";
		int x;
		cin>>x;
		if(x==1) {
			if(peach>0) {
				peach--;
				healthy1=1;
				cout<<"已使用桃,体力值1\n";
				return false;
			} else {
				if(beeh>0) {
					beeh--;
					healthy1=1;
					cout<<"已使用酒,体力值1\n";
					return false;
				} else {
					won="对方";
					lose="玩家";
					return true;
				}
			}
		}
		cout<<"你没有桃或酒\n";
		won="对方";
		lose="玩家";
		return true;
	} else if(healthy2<=0) {
		cout<<"电脑已进入濒死状态\n";
		if(beeh1>0) {
			beeh1--;
			healthy2=1;
			cout<<"对方已使用酒,体力值1\n";
			return false;
		} else if(peach1>0) {
			peach1--;
			healthy2=1;
			cout<<"对方已使用桃,体力值1\n";
			return false;
		} else {
			cout<<"电脑死亡\n";
			won="玩家";
			lose="对方";
			return true;
		}
	}
	return false;
}
string cha(int d) {
	stringstream ss;
	ss<<d;
	string t;
	ss>>t;
	return t;
}
string check(int x) {
	if(x==1) return "A";
	if(x<=10) return cha(x);
	if(x>=11) {
		if(x==11) return "J";
		else if(x==12) return "Q";
		else if(x==13) return "K";
	}
}
int read1(int x) {
	int qp=rand()%13+1;
	cout<<SKYBULE(check(qp));
	if(x==3 or x==4) {
		//kill++;
		cout<<SKYBULE(" 杀");
	} else if(x==1 or x==2) {
		//dodge++;
		cout<<SKYBULE(" 闪");
	} else if(x==5) {
		//peach++;
		cout<<SKYBULE(" 桃");
	} else if(x==6) {
		//arms1++;
		cout<<SKYBULE(" 诸葛连弩");
	} else if(x==7) {
		//beeh++;
		cout<<SKYBULE(" 酒");
	} else if(x==8) {
		//ladder1++;
		cout<<SKYBULE(" 过河拆桥");
	} else if(x==9) {
		//none1++;
		cout<<SKYBULE(" 无懈可击");
	} else if(x==10) {
		//create++;
		cout<<SKYBULE(" 无中生有");
	} else {
		//rice1++;
		cout<<SKYBULE(" 五谷丰登");
	}
	cout<<"\n";
	return qp;
}
int read2(int x) {
	int pq=rand()%13+1;
	return pq;
}
int which1() {
	cout<<"是否选择挑牌\n(1)是(2)否\n";
	int ida;
	cin>>ida;
	if(ida!=1) {
		return 1;
	}
	int a[10],b[10],c[10],caohua=0,heitao=0,hongxin=0,fangkuai=0,ans=0;
	for(int i=1; i<=5; i++) {
		cout<<i<<".";
		c[i]=rand()%4+1;
		cout<<SKYBULE(color(c[i]));
		b[i]=read1(card.top());//数字
		a[i]=card.top();
		card.pop();
		//cout<<"\n";
	}
	int u,k=5,num=0;
	while(cin>>u&&k!=0) {
		ans=caohua+heitao+hongxin+fangkuai;
		if(ans>4||caohua>1||heitao>1||fangkuai>1||hongxin>1) {
			cout<<"你不能再挑了!\n";
			break;
		}
		card_how1(a[u]);
		num+=b[u];
		for(int i=u; i<k; i++) {
			a[i]=a[i+1];
			b[i]=b[i+1];
			c[i]=c[i+1];
		}
		k--;
		for(int i=1; i<=k; i++) {
			cout<<i<<".";
			cout<<SKYBULE(color(c[i]))<<SKYBULE(check(b[i]));
			switch(c[i]) {
				case 1:
					caohua++;
				case 2:
					heitao++;
				case 3:
					hongxin++;
				case 4:
					fangkuai++;
			}
			re(a[i]);
			cout<<"\n";
		}
	}
	x++;
	return 0;
}
void which2() {
	struct node {
		int id,in;
	} a[10];
	//int a[10],b[10];
	for(int i=1; i<=5; i++) {
		//cout<<i<<".";
		a[i].id=read2(card.top());
		a[i].in=card.top();
		card.pop();
	}
	int u,k=5,num=0;
	while(num<=13&&k!=0) {
		if(num>13) {
			//cout<<"你不能再挑了!\n";
			break;
		}
		u=1;
		card_how2(a[u].in);
		num+=a[u].id;
		for(int i=u; i<k; i++) {
			a[i].in=a[i+1].in;
			a[i].id=a[i+1].id;
		}
		k--;
		u++;
	}
	y++;
}
int X1(int x) {
	cout<<"是否选择挑牌\n(1)是(2)否\n";
	int ida;
	cin>>ida;
	if(ida!=1) {
		return 1;
	}
	int a[10],b[10];
	for(int i=1; i<=x+2; i++) {
		cout<<i<<".";
		b[i]=read1(card.top());//数字
		a[i]=card.top();
		card.pop();
		//cout<<"\n";
	}
	int u,k=x+2,num=0;
	for(int i=1; cin>>u&&k!=0; i++) {
		if(i>x) {
			cout<<"你不能再挑了!\n";
			break;
		}
		card_how1(a[u]);
		num+=b[u];
		for(int i=u; i<k; i++) {
			a[i]=a[i+1];
			b[i]=b[i+1];
		}
		k--;
		for(int i=1; i<=k; i++) {
			cout<<i<<".";
			cout<<SKYBULE(check(b[i]));
			re(a[i]);
			cout<<"\n";
		}
		num++;
	}
	x++;
	return 0;
}
void X2(int x) {
	struct node {
		int id,in;
	} a[10];
	//int a[10],b[10];
	for(int i=1; i<=x+2; i++) {
		//cout<<i<<".";
		a[i].id=read2(card.top());
		a[i].in=card.top();
		card.pop();
	}
	int u=1,k=x+2,num=0;
	while(num<=x&&k!=0) {
		if(num>x) {
			//cout<<"你不能再挑了!\n";
			break;
		}
		//u=1;
		card_how2(a[u].in);
		num+=a[u].id;
		for(int i=u; i<k; i++) {
			a[i].in=a[i+1].in;
			a[i].id=a[i+1].id;
		}
		k--;
		//u++;
	}
	y++;
}
void card_new() { //here
	if(t[c]=="吕蒙") {
		int zxc=which1();
		if(zxc) {
			for(int i=1; i<=4; i++) {
				card_how1(card.top());
				card.pop();
			}
		}
	}
	if(t[c]=="李典") {
		int axp=X1(4);
		if(axp==1) {
			for(int i=1; i<=4; i++) {
				card_how1(card.top());
				card.pop();
			}
		}
	}
	if(t[c]!="吕蒙"&&t[c]!="李典") {
		for(int i=1; i<=4; i++) {
			card_how1(card.top());
			card.pop();
		}
		//x++;
	}
	give1(c);
	x++;
	for(int j=1; j<=4; j++) {
		card_how2(card.top());
		card.pop();
	}
	give2(p);
	y++;
	cout<<"双方已获得初始手牌\n";
	Sleep(3000);
}
int main() {
	srand(time(NULL));
	p=rand()%13;
	out();
	//int c;
	cin>>c;
	//Sleep(2000);
	if(p==c) {
		p++;
	}
	//p=11;
	system("cls");
	heal();
	c=(c>12?13:c);
	cout<<"你选择了"<<t[c];
	cout<<"\n体力值"<<healthy1<<"\n";
	cout<<"对方选择了"<<t[p]<<"\n体力值"<<healthy2<<"\n";
	cout<<RED("接下来,你要使出手牌,尽早杀掉对方,按0结束出牌。还有,酒不是茅台\n");
	Sleep(3000);
	card_push();
	card_new();
	for(int i=1; ; i++) {
		//cout<<"你的体力值"<<healthy1<<"敌人的体力值"<<healthy2<<"\n";

		if(win_or_lose()) break;
		//
		if(tot%2==1) {
			system("cls");
			potrct();
			cout<<"玩家\n牌堆剩余数量"<<card.size()<<"\n";
			x++;
			potrct();
			if(x==1) {
				for(int i=1; i<=4; i++) {
					card_how1(card.top());
					card.pop();
				}
				give1(c);
			} else {
				if(t[c]=="吕蒙") {
					int xn=which1();
					if(xn==1) {
						for(int j=1; j<=2; j++) {
							//int x=rand()%10+1;
							card_how1(card.top());
							card.pop();
						}
					}
				}
				if(t[c]=="李典") {
					int xn=X1(2);
					if(xn) {
						for(int j=1; j<=2; j++) {
							//int x=rand()%10+1;
							card_how1(card.top());
							card.pop();
						}
					}
				}
				if(t[c]!="吕蒙"&&t[c]!="李典") {
					for(int j=1; j<=2; j++) {
						//int x=rand()%10+1;
						card_how1(card.top());
						card.pop();
					}
				}
				give1(c);
			}
			int h=1;
			if(t[c]=="张飞" or arms1>=1) {
				h=100;
			}
			for(int j=1; j<=h; ) {
				cout<<"你的体力值"<<healthy1<<"敌人的体力值"<<healthy2<<"\n";
				if((t[p]=="关羽"||t[p]=="张飞")&&kill1>0&&t[c]=="刘备") {
					cout<<"是否获得对手的一张杀(1) 否则(0)?\n";
					int idx;
					cin>>idx;
					if(kill1!=0) {
						kill++;
						kill1--;
						cout<<"获得对手的一张杀\n";
					} else if(kill1==0) {
						cout<<"对方没杀\n";
					}
				}
				if((t[p]=="甄姬"||t[p]=="李典")&&dodge1>0&&t[c]=="曹操") {
					cout<<"是否获得对手的一张闪(1) 否则(0)?\n";
					int idx;
					cin>>idx;
					if(dodge1!=0) {
						dodge++;
						dodge1--;
						cout<<"获得对手的一张闪\n";
					} else if(dodge1==0) {
						cout<<"对方没闪\n";
					}
				}
				if((t[p]=="周瑜"||t[p]=="吕蒙")&&dodge1>0&&t[c]=="孙策") {
					cout<<"是否获得对手的一张闪(1) 否则(0)?\n";
					int idx;
					cin>>idx;
					if(dodge1!=0) {
						dodge++;
						dodge1--;
						cout<<"获得对手的一张闪\n";
					} else if(dodge1==0) {
						cout<<"对方没闪\n";
					}
				}
				print();
				if(beeh!=0 and kill!=0) {
					cout<<" 9.酒杀\n";
				}
				int r;
				cin>>r;
				if(r==0) {
					cout<<"结束出牌\n";
					break;
				}
				if(r==1 and kill!=0 or r==9&&beeh!=0) {
					kill--;
					if(r==9&&beeh>0) {
						beeh_kill=1;
						beeh--;
					}
					if(dodge1==0) {
						healthy2--;
						cout<<"\n造成伤害1\n";
						if(t[p]=="李典") {
							card_how1(card.top());
							card.pop();
							card_how2(card.top());
							card.pop();
							cout<<"双方各摸一张牌\n";
						}
						if(beeh_kill==1) {
							cout<<"造成酒杀伤害1\n";
							healthy2--;
							beeh_kill=0;
							if(t[p]=="李典") {
								card_how1(card.top());
								card.pop();
								card_how2(card.top());
								card.pop();
								cout<<"双方各摸一张牌\n";
							}
						}
						cout<<"\n你的体力值"<<healthy1<<"\n敌人的体力值"<<healthy2<<"\n";
						print();
						cout<<"\n对方体力值"<<healthy2<<"\n";
						Sleep(1500);
						if(t[p]=="曹操") {
							cout<<"对方获得你对他造成伤害的牌\n";
							kill1++;
							if(beeh_kill==1) {
								beeh1++;
								beeh_kill=0;
							}
							//Sleep(1500);
						}
					} else if(dodge1!=0 and t[c]!="吕布") {
						dodge1--;
						cout<<"对手躲开了你的进攻\n";
						Sleep(1500);
					} else if(t[c]=="吕布") {
						if(dodge1<2) {
							healthy2--;
							cout<<"造成伤害1\n";
							if(t[p]=="李典") {
								card_how1(card.top());
								card.pop();
								card_how2(card.top());
								card.pop();
								cout<<"双方各摸一张牌\n";
							}
							if(beeh_kill==1) {
								cout<<"造成酒杀伤害1\n";
								healthy2--;
								if(t[p]=="李典") {
									card_how1(card.top());
									card.pop();
									card_how2(card.top());
									card.pop();
									cout<<"双方各摸一张牌\n";
								}
							}
							cout<<"\n对方体力值"<<healthy2<<"\n";
							Sleep(1500);
							if(t[p]=="曹操") {
								cout<<"对方获得你对他造成伤害的牌\n";
								kill1++;
								if(beeh_kill==1) {
									beeh1++;
									beeh_kill=0;
								}
								//Sleep(1500);
							}
						} else {
							dodge1-=2;
							cout<<"对手躲开了你的进攻\n";
							Sleep(1500);
						}
					}
					j++;
					beeh_kill=0;
					if(win_or_lose()) break;
				} else if(kill==0&&(r==1||r==8)) {
					cout<<"你没杀!\n";
					j++;
					beeh_kill=0;
				}
				if(r==2) {
					cout<<"你的回合无法出闪!\n";
					Sleep(1500);
				}
				if(r==3 and healthy1<healthy_max1&&peach>0) {
					if(t[c]!="孙策") {
						cout<<"体力+1\n";
						peach--;
						healthy1++;
					} else {
						cout<<"体力+2";
						peach--;
						healthy1+=2;
						healthy1=(healthy1>=healthy_max1?healthy_max1:healthy1);
					}
					cout<<"\n你的体力值"<<healthy1<<"\n敌人的体力值"<<healthy2<<"\n";
				} else if(r==3 and healthy1>=healthy_max1&&peach>0) {
					cout<<"体力已满\n";
					healthy1=healthy_max1;
				}
				if(r==4 and healthy1<healthy_max1&&beeh>0) {
					cout<<"体力+1\n";
					beeh--;
					healthy1++;
					cout<<"\n你的体力值"<<healthy1<<"\n敌人的体力值"<<healthy2<<"\n";
				} else if(r==4 and healthy1==healthy_max1) {
					cout<<"体力已满\n";
				}
				if(r==5&&arms2>0&&ladder1>0) {//here
					if(none2==0) {
						arms2--;
						cout<<"已拆除对方的诸葛连弩\n";
						ladder1--;
					} else {
						cout<<"对方使用了无懈可击\n";
						cout<<"是否使用无懈可击(6),否则(0)?\n";
						int xp;
						cin>>xp;
						ladder1--;
						none2--;
						if(xp==6&&none1>0) {
							//none2--;
							if(none1>0) {
								cout<<"已使用无懈可击\n";
								none1--;
								arms2--;
								cout<<"已拆除对方的诸葛连弩\n";
								//ladder1--;
							} else {
								cout<<"没有无懈可击\n";
								/*ladder1--;
								none1--;*/
							}
						} else {
							none2--;
						}
					}
					//cout<<"1.杀"<<kill<<"张,2.闪"<<dodge<<"张,3.桃"<<peach<<"张"<<"  诸葛连弩"<<arms1<<"张,4.酒"<<beeh<<"张,5.过河拆桥"<<ladder1<<"张\n";
				} else if(r==5&&arms2==0) {
					cout<<"对方没有诸葛连弩\n";
				}
				if(r==6) {
					cout<<"你的回合无法使用无懈可击\n";
				}
				if(r==7&&create>0) {
					cout<<"已使用无中生有\n";
					create--;
					for(int j=1; j<=2; j++) {
						card_how1(card.top());
						card.pop();
					}
					give1(c);
					print();
				}
				if(r==8&&rice1!=0) {
					rice1--;
					cout<<"五谷丰登开牌\n";
					int a[10],b[10];
					for(int i=1; i<=2; i++) {
						cout<<i<<".";
						//b[i]=read1(card.top());//数字
						re(card.top());
						a[i]=card.top();
						card.pop();
						//cout<<"\n";
					}
					int u,k=2,num=0;
					/*if(num+b[u]>13) {
						cout<<"你不能再挑了!\n";
						break;
					}*/
					cin>>u;
					card_how1(a[u]);
					//num+=b[u];
					for(int i=u; i<k; i++) {
						a[i]=a[i+1];
						//b[i]=b[i+1];
					}
					k--;
					for(int i=1; i<=k; i++) {
						cout<<i<<".";
						//cout<<SKYBULE(check(b[i]));
						re(a[i]);
						cout<<"\n";
					}
					cout<<"电脑获得";
					re(a[k]);
					cout<<"\n";
					card_how2(a[k]);
				}
				beeh_kill1=beeh_kill=0;
			}

			cout<<"\n是否弃牌 是(s),否(n)\n";
			char e;
			cin>>e;
			if(e=='s') {
				cout<<"各弃几张牌?\n";
				int q,a,z,w,u,o,cv,nm;
				cin>>q>>a>>z>>w>>u>>o>>cv>>nm;
				if(q<0||kill-q<0) q=0;
				if(a<0||dodge-a<0) a=0;
				if(z<0||peach-z<0) z=0;
				if(w<0||arms1-w<0) w=0;
				if(u<0||beeh-u<0) u=0;
				if(o<0||ladder1-o<0) o=0;
				if(cv<0||none1-cv<0) cv=0;
				if(nm<0||create-nm<0) nm=0;
				kill-=q;
				dodge-=a;
				peach-=z;
				arms1-=w;
				beeh-=u;
				ladder1-=o;
				none1-=cv;
				create-=nm;
				int nn=q+a+z+w+u+o+cv+nm;
				if(t[c]=="华佗") {
					healthy1+=nn;
					if(healthy1>healthy_max1) {
						healthy1=healthy_max1;
					}
					cout<<"体力值"<<healthy1<<"\n";
					Sleep(1500);
				}
				if(t[c]=="孙策") {
					for(int j=1; j<=nn; j++) {
						//int x=rand()%10+1;
						card_how1(card.top());
						card.pop();
					}
				}
				if(t[c]=="关羽") {
					kill+=nn;
				}
				if(t[c]=="甄姬") {
					dodge+=nn;
				}
				if(t[c]=="董卓") {
					beeh+=nn;
				}
				if(t[c]=="刘备"&&nn>=2) {
					cout<<"体力+1\n";
					healthy1++;
				} else if(nn<2 &&t[c]=="刘备") {
					cout<<"体力未增加\n";
				}
				if(t[c]=="李儒"&&nn>=1) {
					cout<<"开始焚城\n";
					if(kill1+dodge1+peach1+arms2+beeh1+ladder2+none2+create1>=3) {
						if(kill1>=3) {
							//cout<<"对方已弃置手牌\n";
							kill1-=3;
						} else {
							int x=3-kill1;
							if(dodge1>=x) {
								dodge1-=x;
								//cout<<"对方已弃置手牌\n";
							} else {
								x=x-dodge1;
								if(peach1>=x) {
									peach1-=x;
									//cout<<"对方已弃置手牌\n";
								} else {
									x=x-peach1;
									if(ladder2>=x) {
										ladder2-=x;
										//cout<<"对方已弃置手牌\n";
									} else {
										x=x-ladder2;
										if(none2>=x) {
											none2-=x;
											//cout<<"对方已弃置手牌\n";
										}
									}
								}
							}
						}
						cout<<"对方已弃置手牌\n";
					} else if(kill1+dodge1+peach1+arms2+beeh1+ladder2+none2+create1<3) {
						cout<<"对方已扣血\n";
						healthy2-=2;
						card_how1(card.top());
						if(t[p]=="李典") {
							card_how1(card.top());
							card.pop();
							card_how2(card.top());
							card.pop();
							cout<<"双方各摸一张牌\n";
						}
						//

						if(win_or_lose()) break;
					}
				} else if(t[c]=="李儒"&&nn<1) {
					cout<<"手牌不足!\n";
				}
				print();
				Sleep(2000);
				//tot++;
			}
			if(win_or_lose())break;
			potrct();
			tot++;
		}
		if(win_or_lose())break;
		if(tot%2==0) {
			system("cls");
			cout<<"敌人\n牌堆剩余数量"<<card.size()<<"\n";
			y++;
			if(y==1) {
				for(int j=1; j<=4; j++) {
					card_how2(card.top());
					card.pop();
				}
				give2(p);
			} else {
				int x=rand()%2;
				if(x==1&&t[p]=="吕蒙") {
					which2();
				} else if(x==1&&t[p]!="吕蒙"||x==1&&t[p]!="李典") {
					for(int j=1; j<=2; j++) {
						card_how2(card.top());
						card.pop();
					}
					give2(p);
				} else if(x==0) {
					X2(2);
				}
			}
			int h=1;
			if(t[p]=="张飞" or arms2>0) {
				h=kill1;
				if(h==0) {
					h=1;
				}
			}
			for(int i=1; i<=h /*and kill1!=0*/; i++) {
				if((t[c]=="关羽"||t[c]=="张飞")&&t[p]=="刘备"&&kill>0) {
					if(kill!=0) {
						kill1++;
						kill--;
						cout<<"对手获得你的一张杀\n";
					}
				}
				if((t[c]=="甄姬"||t[c]=="李典")&&dodge1>0&&t[p]=="曹操") {
					if(dodge!=0) {
						dodge--;
						dodge1++;
						cout<<"对手获得你的一张闪\n";
					} else if(dodge1==0) {
						cout<<"对方没闪\n";
					}
				}
				if((t[c]=="周瑜"||t[c]=="吕蒙")&&dodge>0&&t[p]=="孙策") {
					if(dodge!=0) {
						dodge--;
						dodge1++;
						cout<<"对手获得你的一张闪\n";
					} else if(dodge1==0) {
						cout<<"对方没闪\n";
					}
				}
				if(create1!=0) {
					cout<<"对方使用了无中生有\n";
					create1--;
					for(int j=1; j<=2; j++) {
						card_how2(card.top());
						card.pop();
					}
					give2(p);
				}
			}
			if(healthy2!=healthy_max2 and peach1!=0) {
				if(t[p]!="孙策") {
					cout<<"对方恢复了1点体力\n";
					peach1--;
					healthy2++;
				} else {
					cout<<"对方恢复了2点体力\n";
					peach1--;
					healthy2+=2;
					healthy2=(healthy2>=healthy_max2?healthy_max2:healthy2);
				}
				Sleep(1500);
				//peach1--;
				cout<<"\n你的体力值"<<healthy1<<"\n敌人的体力值"<<healthy2<<"\n";
			} else if(beeh!=0 and healthy2!=healthy_max2) {
				cout<<"对方恢复了1点体力\n";
				healthy2++;
				cout<<"\n你的体力值"<<healthy1<<"\n敌人的体力值"<<healthy2<<"\n";
				beeh1--;
				Sleep(1500);
			}
			if(ladder2>0&&arms1>0) {
				cout<<"对方使用了过河拆桥\n";
				cout<<"按下(6)使用无懈可击,否则(0)\n";
				//here
				int kl;
				cin>>kl;
				if(kl==6) {
					if(none1>0) {//BUG
						cout<<"已使用无懈可击\n";
						none1--;
						ladder2--;
						if(none2>0) {
							cout<<"对方使用了无懈可击\n";
							none2--;
							arms1--;
						}
						//arms1--;
						print();
					} else {
						cout<<"没有无懈可击\n";
						arms1--;
						ladder2--;
						none2--;
						print();
					}
				} else if(kl==0) {
					arms1--;
					ladder2--;
					none2--;
					print();
				}

			}
			if(kill1>0) {
				kill1--;
				cout<<"\n对方发动了攻击!\n";
				if(beeh1!=0) {
					cout<<"对方是酒杀!\n";
					beeh1--;
					beeh_kill1=1;
				}
				cout<<"按2打出闪,否则按0\n";
				char v;
				cin>>v;
				if(v=='2') {
					if(t[p]=="吕布" and dodge>=2) {
						cout<<"已打出闪\n";
						dodge-=2;
					} else if(t[p]!="吕布" and dodge>=1) {
						cout<<"已打出闪\n";
						dodge--;
					} else if(t[p]=="吕布" and dodge<2) {
						cout<<"闪避失败\n";
						cout<<"受到1伤害\n";
						healthy1--;
						if(t[c]=="李典") {
							card_how1(card.top());
							card.pop();
							card_how2(card.top());
							card.pop();
							cout<<"双方各摸一张牌\n";
						}
						if(beeh_kill1==1) {
							cout<<"\n受到1酒杀伤害\n";
							if(t[c]=="李典") {
								card_how1(card.top());
								card.pop();
								card_how2(card.top());
								card.pop();
								cout<<"双方各摸一张牌\n";
							}
							healthy1--;
						}
						if(t[c]=="曹操") {
							cout<<"你获得对方对你造成伤害的牌\n";
							kill++;
							if(beeh_kill1==1)beeh++;
							print();
							//Sleep(1500);
						}
					} else if(dodge==0) {
						cout<<"闪避失败\n";
						cout<<"受到1伤害\n";
						healthy1--;
						if(t[c]=="李典") {
							card_how1(card.top());
							card.pop();
							card_how2(card.top());
							card.pop();
							cout<<"双方各摸一张牌\n";
						}
						if(beeh_kill1==1) {
							cout<<"受到1酒杀伤害\n";
							healthy1--;
							if(t[c]=="李典") {
								card_how1(card.top());
								card.pop();
								card_how2(card.top());
								card.pop();
								cout<<"双方各摸一张牌\n";
							}
						}
						if(t[c]=="曹操") {
							cout<<"你获得对方对你造成伤害的牌\n";
							kill++;
							if(beeh_kill1==1)beeh++;
							print();
							//Sleep(1500);
						}
					}
				} else if(v=='0') {
					healthy1--;
					cout<<"对你造成伤害1\n";
					if(t[c]=="李典") {
						card_how1(card.top());
						card.pop();
						card_how2(card.top());
						card.pop();
						cout<<"双方各摸一张牌\n";
					}
					if(beeh_kill1==1) {
						cout<<"对你造成1点酒杀伤害\n";
						if(t[c]=="李典") {
							card_how1(card.top());
							card.pop();
							card_how2(card.top());
							card.pop();
							cout<<"双方各摸一张牌\n";
						}
						healthy1--;
					}
					if(t[c]=="曹操") {
						cout<<"你获得对方对你造成伤害的牌\n";
						kill++;
						if(beeh_kill1==1)beeh++;
						print();
						//Sleep(1500);
					}
					cout<<"你的体力值"<<healthy1<<"敌人的体力值"<<healthy2<<"\n";
					//Sleep(1500);
					//system("cls");
					//cout<<"体力值"<<healthy1<<"\n";
					//Sleep(1500);
					if(t[c]=="曹操") {
						cout<<"你获得对方对你造成伤害的牌\n";
						kill++;
						if(beeh_kill1==1)beeh++;
						print();
						Sleep(1500);
					}
				} else if(t[p]!="吕布") {
					if(dodge1==0) {
						healthy1--;
						cout<<"对手造成伤害1\n";
						if(t[c]=="李典") {
							card_how1(card.top());
							card.pop();
							card_how2(card.top());
							card.pop();
							cout<<"双方各摸一张牌\n";
						}
						if(beeh_kill==1) {
							cout<<"对你造成1点酒杀伤害\n";
							healthy1--;
							if(t[c]=="李典") {
								card_how1(card.top());
								card.pop();
								card_how2(card.top());
								card.pop();
								cout<<"双方各摸一张牌\n";
							}
						}
						Sleep(1500);
						system("cls");
						cout<<"体力值"<<healthy1<<"\n";
						if(t[c]=="曹操") {
							cout<<"你获得对方对你造成伤害的牌\n";
							kill++;
							if(beeh_kill1==1) beeh++;
							print();
							Sleep(1500);
						}
					}
					beeh_kill1=0;
				}
				if(rice2!=0) {
					rice2--;
					cout<<"电脑使用了五谷丰登\n";
					int k=2,u,a[10];
					for(int i=1; i<=2; i++) {
						cout<<i<<".";
						re(card.top());
						a[i]=card.top();
						card.pop();
					}
					int gg=rand()%2;
					//card_how2(gg);
					cout<<"电脑已选择"<<gg+1<<". ";
					tle(gg,mle(a[1]),mle(a[2]));
					card_how2(a[gg]);
					cout<<"\n请选择\n";
					cin>>u;
					card_how1(a[u]);
				}
				if(t[p]=="华佗"&&healthy2<healthy_max2) { //here
					int op=healthy_max1-healthy2;
					if(kill1!=0) {
						kill1--;
						healthy2++;
						cout<<"对方已回复1点体力\n";
					}
				}
				//

				if(win_or_lose()) break;
			}
		}
		if(kill1+dodge1+peach1>=1&&t[p]=="李儒") {
			cout<<"对方使用了焚城!\n";
			if(kill1>=1) kill1--;
			else if(dodge1>=1) dodge1--;
			else if(peach1>=1) peach1--;
			cout<<"\n是否弃牌 是(s),否(n)\n";
			//cout<<"1.杀"<<kill<<"张,2.闪"<<dodge<<"张,3.桃"<<peach<<"张"<<"  诸葛连弩"<<arms1<<"张,4.酒"<<beeh<<"张,5.过河拆桥"<<ladder1<<"张,6.无懈可击"<<none1<<"张,7.无中生有"<<create<<"张\n";
			print();
			char e;
			cin>>e;
			if(e=='s') {
				cout<<"各弃几张牌?\n";
				int q,a,z,w,u,o,cv,nm;
				cin>>q>>a>>z>>w>>u>>o>>cv>>nm;
				if(q<0) q=0;//防越界
				if(a<0) a=0;
				if(z<0) z=0;
				if(w<0) w=0;
				if(u<0) u=0;
				if(o<0) o=0;
				if(cv<0) cv=0;
				if(nm<0) nm=0;
				kill-=q;
				dodge-=a;
				peach-=z;
				arms1-=w;
				beeh-=u;
				ladder1-=o;
				none1-=cv;
				create-=nm;
				int nn=q+a+z+w+u+o+cv+nm;
				if(t[c]=="华佗") {
					healthy1+=nn;
					if(healthy1>healthy_max1) {//恢复体力值
						healthy1=healthy_max1;
					}
					cout<<"体力值"<<healthy1<<"\n";
					Sleep(1500);
				}
				if(t[c]=="孙策") {
					for(int j=1; j<=nn; j++) {
						card_how1(card.top());
						card.pop();
					}
				}
				if(t[c]=="关羽") {
					kill+=nn;
				}
				if(t[c]=="甄姬") {
					dodge+=nn;
				}
				if(t[c]=="董卓") {
					beeh+=nn;
				}
				if(t[c]=="刘备"&&nn>=2) {
					cout<<"体力+1\n";
					healthy1++;
				} else if(nn<2 &&t[c]=="刘备") {
					cout<<"体力未增加\n";
				}
				if(nn<3) {
					cout<<"数量不足,体力减少2\n";
					healthy1-=2;
					if(t[c]=="李典") {
						card_how1(card.top());
						card.pop();
						card_how2(card.top());
						card.pop();
						cout<<"双方各摸一张牌\n";
					}
				} else cout<<"已弃置手牌\n";
			} else {
				cout<<"体力减少2\n";
				healthy1-=2;
				if(t[c]=="李典") {
					card_how1(card.top());
					card.pop();
					card_how2(card.top());
					card.pop();
					cout<<"双方各摸一张牌\n";
				}
				if(win_or_lose()) break;
			}
			beeh_kill1=beeh_kill=0;
		}
		cout<<"\n对方结束了出牌\n";
		cout<<"\n你的体力值"<<healthy1<<"\n敌人的体力值"<<healthy2<<"\n";


		//if(win_or_lose()) break;
		Sleep(2000);
		system("cls");
		tot++;
	}
	Sleep(1000);
	system("cls");
	cout<<"~~~胜负已分~~~\n";
	if(won=="玩家") {
		cout<<won<<"使用"<<t[c]<<",获胜\n";
		cout<<lose<<"使用"<<t[p]<<",战败";
	} else {
		cout<<won<<"使用"<<t[p]<<",获胜\n";
		cout<<lose<<"使用"<<t[c]<<",战败";
	}
	return 0;
}
//修复bug中
原文