憋了一小时,盘出来了
  • 板块灌水区
  • 楼主jihanyu123
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/8/20 13:28
  • 上次更新2024/8/20 13:31:21
查看原帖
憋了一小时,盘出来了
1330135
jihanyu123楼主2024/8/20 13:28
#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;
stack<int>card;
void card_push() {
	for(int j=1; j<=100; j++) {
		int x=rand()%10+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("张 ");
}
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张牌,获得其中数字之和不大于13的牌\n";
	t[11]="吕蒙";
	cout<<">11.小卒:人数\n可以复活一次,然后摸4张牌\n";
	t[12]="小卒";
}
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 {
		create++;
		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 {
		create1++;
	}
	potrct();
}
void give1(int c) {
	if(t[c]=="甄姬") {
		card_how1(card.top());
		card.pop();
	}
	if(t[c]=="周瑜") {
		for(int i=1; i<=2; i++) {
			card_how1(card.top());
			card.pop();
		}
	}
	potrct();
}
void give2(int p) {
	if(t[p]=="甄姬") {
		card_how2(card.top());
		card.pop();
	}
	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>11) {
		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>11) {
		healthy2=2;
		healthy_max2=2;
	} else {
		healthy2=3;
		healthy_max2=3;
	}
}
void axe() {
	hel1();
	hel2();
}
bool win_or_lose() {
	axe();
	if(healthy1<=0) {
		won="对方";
		lose="玩家";
		return true;
	} else if(healthy2<=0) {
		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 {
		//create++;
		cout<<SKYBULE(" 无中生有");
	}
	cout<<"\n";
	return qp;
}
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 {
		//create++;
		cout<<SKYBULE(" 无中生有");
	}
}
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];
	for(int i=1; i<=5; i++) {
		cout<<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) {
		if(num+b[u]>13) {
			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";
		}
	}
	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++;
}
void card_new() { //here
	if(t[c]!="吕蒙") {
		for(int i=1; i<=4; i++) {
			card_how1(card.top());
			card.pop();
		}
		//x++;
	} else {
		int zxc=which1();
		if(zxc) {
			for(int i=1; i<=4; i++) {
				card_how1(card.top());
				card.pop();
			}
		}
	}
	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>11?12: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();
						}
					}
				} else {
					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]=="甄姬")&&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]=="周瑜")&&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<<" 8.酒杀\n";
				}
				int r;
				cin>>r;
				if(r==0) {
					cout<<"结束出牌\n";
					break;
				}
				if(r==1 and kill!=0 or r==8&&beeh!=0) {
					kill--;
					if(r==8&&beeh>0) {
						beeh_kill=1;
						beeh--;
					}
					if(dodge1==0) {
						healthy2--;
						cout<<"\n造成伤害1\n";
						if(beeh_kill==1) {
							cout<<"造成酒杀伤害1\n";
							healthy2--;
							beeh_kill=0;
						}
						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(beeh_kill==1) {
								cout<<"造成酒杀伤害1\n";
								healthy2--;
							}
							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();
				}
			}
			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;
						//

						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) {
					which2();
				} else {
					for(int j=1; j<=2; j++) {
						card_how2(card.top());
						card.pop();
					}
					give2(p);
				}
			}
			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]=="甄姬")&&dodge1>0&&t[p]=="曹操") {
					if(dodge!=0) {
						dodge--;
						dodge1++;
						cout<<"对手获得你的一张闪\n";
					} else if(dodge1==0) {
						cout<<"对方没闪\n";
					}
				}
				if((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(beeh_kill1==1) {
							cout<<"\n受到1酒杀伤害\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(beeh_kill1==1) {
							cout<<"受到1酒杀伤害\n";
							healthy1--;
						}
						if(t[c]=="曹操") {
							cout<<"你获得对方对你造成伤害的牌\n";
							kill++;
							if(beeh_kill1==1)beeh++;
							print();
							//Sleep(1500);
						}
					}
				} else if(v=='0') {
					healthy1--;
					cout<<"对你造成伤害1\n";
					if(beeh_kill1==1) {
						cout<<"对你造成1点酒杀伤害\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(beeh_kill==1) {
							cout<<"对你造成1点酒杀伤害\n";
							healthy1--;
						}
						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(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;
				} else cout<<"已弃置手牌\n";
			} else {
				cout<<"体力减少2\n";
				healthy1-=2;

				if(win_or_lose()) break;
			}
		}
		cout<<"\n对方结束了出牌\n";
		cout<<"\n你的体力值"<<healthy1<<"\n敌人的体力值"<<healthy2<<"\n";
		beeh_kill1=beeh_kill=0;

		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中
2024/8/20 13:28
加载中...