#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int xue1=6,xue2=6,xs1=6,xs2=6,djs=4,fdj1,fdj2,xy1,xy2,sk1,sk2,xd1,xd2,qs1,qs2,sj1,sj2,nzq1,nzq2,yp1,yp2,ssx1,ssx2,sd,kd,zd,s,thing,k,zdj1,zdj2;
int d[10];
bool ask1,ask2,xd,pd1,pd2;
string s2;
void jz(){
Sleep(800);
system("cls");
cout<<"正在加载.";
Sleep(800);
system("cls");
cout<<"正在加载..";
Sleep(800);
system("cls");
cout<<"正在加载...";
Sleep(800);
system("cls");
cout<<"正在加载.";
Sleep(800);
system("cls");
cout<<"正在加载..";
Sleep(800);
system("cls");
cout<<"正在加载...";
Sleep(800);
}
void dong(){
cout<<"1.打对方"<<endl;
cout<<"2.打自己"<<endl;
cout<<"3.使用放大镜"<<endl;
cout<<"4.使用香烟"<<endl;
cout<<"5.使用手铐"<<endl;
cout<<"6.使用小刀"<<endl;
cout<<"7.使用汽水"<<endl;
cout<<"8.使用手机"<<endl;
cout<<"9.使用逆转器"<<endl;
cout<<"10.使用药片"<<endl;
cout<<"11.使用肾上腺素"<<endl;
}
void pd(){
if(xue1<=0){
system("cls");
cout<<"你死了"<<endl;
Sleep(10000);
exit(0);
}else if(xue2<=0){
system("cls");
cout<<"你赢了"<<endl;
Sleep(10000);
exit(0);
}
if(xue1==1&&!pd1){
cout<<"你无法回血"<<endl;
Sleep(1000);
pd1=1;
}
if(xue2==1&&!pd2){
cout<<"恶魔无法回血"<<endl;
Sleep(1000);
pd2=1;
}
}
void zy(){
zdj1=fdj1+xy1+sk1+xd1+qs1+sj1+nzq1+yp1+ssx1;
zdj2=fdj2+xy2+sk2+xd2+qs2+sj2+nzq2+yp2+ssx2;
system("cls");
cout<<"你的血量:"<<xue1<<"/"<<xs1<<" "<<"恶魔血量:"<<xue2<<"/"<<xs2<<endl;
cout<<"剩余实弹"<<sd<<"个 "<<"空弹"<<kd<<"个"<<endl;
cout<<"你的道具:放大镜"<<fdj1<<"个,香烟"<<xy1<<"个,手铐"<<sk1<<"个,小刀"<<xd1<<"个,汽水"<<qs1;
cout<<"个,手机"<<sj1<<"个,逆转器"<<nzq1<<"个,药片"<<yp1<<"个,肾上腺素"<<ssx1<<"个"<<endl;
cout<<"恶魔道具:放大镜"<<fdj2<<"个,香烟"<<xy2<<"个,手铐"<<sk2<<"个,小刀"<<xd2<<"个,汽水"<<qs2;
cout<<"个,手机"<<sj2<<"个,逆转器"<<nzq2<<"个,药片"<<yp2<<"个,肾上腺素"<<ssx2<<"个"<<endl;
}
void cs(){
system("cls");
cout<<"弹夹刷新"<<endl;
cout<<"你获得了道具"<<endl;
if(zdj1+djs>=8) cout<<"你的道具已满(8个)"<<endl;
Sleep(1500);
dan:;
k=1,sd=0,kd=0,ask1=0,ask2=0,xd=0;
zd=rand()%2+6;
for(int i=1;i<=zd;i++){
d[i]=rand()%2;
if(d[i])sd++;
else kd++;
}
if(!sd)goto dan;
for(int i=1;i<=min(djs,8-zdj1);i++){
s=rand()%9;
if(s==0)fdj1++;
if(s==1)xy1++;
if(s==2)sk1++;
if(s==3)xd1++;
if(s==4)qs1++;
if(s==5)sj1++;
if(s==6)nzq1++;
if(s==7)yp1++;
if(s==8)ssx1++;
}
for(int i=1;i<=min(djs,8-zdj2);i++){
s=rand()%9;
if(s==0)fdj2++;
if(s==1)xy2++;
if(s==2)sk2++;
if(s==3)xd2++;
if(s==4)qs2++;
if(s==5)sj2++;
if(s==6)nzq2++;
if(s==7)yp2++;
if(s==8)ssx2++;
}
}
void xingdong1(){
system("cls");
cout<<"你的回合"<<endl;
Sleep(800);
go:;
zy();
dong();
shi:;
cout<<"你的行动:";
cin>>thing;
if(thing==1){
cout<<"你对恶魔开枪"<<endl;
Sleep(800);
if(d[k]){
cout<<"是实弹"<<endl;
Sleep(800);
if(xd){
xd=0;
xue2-=2;
cout<<"恶魔扣2滴血"<<endl;
}else{
xue2--;
cout<<"恶魔扣1滴血"<<endl;
}
Sleep(800);
sd--;
pd();
if(sd==0)return;
}else{
xd=0;
cout<<"是空弹"<<endl;
Sleep(800);
kd--;
}
k++;
}
if(thing==2){
cout<<"你对自己开枪"<<endl;
Sleep(800);
if(d[k]){
cout<<"是实弹"<<endl;
Sleep(800);
k++;
if(xd){
xd=0;
xue1-=2;
cout<<"你扣2滴血"<<endl;
}else{
xue1--;
cout<<"你扣1滴血"<<endl;
}
Sleep(800);
sd--;
pd();
if(sd==0)return;
}else{
xd=0;
cout<<"是空弹"<<endl;
Sleep(800);
cout<<"你可再行动一次"<<endl;
Sleep(800);
k++;
kd--;
goto go;
}
}
if(thing==3){
if(!fdj1){
cout<<"你没有放大镜"<<endl;
Sleep(800);
goto go;
}
fdj1--;
zy();
dong();
cout<<"你使用了放大镜"<<endl;
Sleep(800);
if(d[k])cout<<"下一发是实弹"<<endl;
else cout<<"下一发是空弹"<<endl;
Sleep(800);
goto shi;
}
if(thing==4){
if(!xy1){
cout<<"你没有香烟"<<endl;
Sleep(800);
goto go;
}
if(xue1==xs1){
cout<<"你的血量已满"<<endl;
Sleep(800);
goto go;
}
if(xue1==1){
cout<<"你无法回血"<<endl;
Sleep(800);
goto go;
}
xy1--;
cout<<"你使用了香烟"<<endl;
Sleep(800);
cout<<"你回复了一滴血"<<endl;
Sleep(800);
xue1++;
goto go;
}
if(thing==5){
if(!sk1){
cout<<"你没有手铐"<<endl;
Sleep(800);
goto go;
}
if(ask1){
cout<<"你已用过手铐"<<endl;
Sleep(800);
goto go;
}
sk1--;
ask1=1;
zy();
dong();
cout<<"你使用了手铐"<<endl;
Sleep(800);
cout<<"恶魔下回合无法行动"<<endl;
Sleep(800);
goto shi;
}
if(thing==6){
if(!xd1){
cout<<"你没有小刀"<<endl;
Sleep(800);
goto go;
}
if(xd){
cout<<"你已用过小刀"<<endl;
Sleep(800);
goto go;
}
xd1--;
xd=1;
zy();
dong();
cout<<"你使用了小刀"<<endl;
Sleep(800);
cout<<"本回合下次伤害加一"<<endl;
Sleep(800);
goto shi;
}
if(thing==7){
if(!qs1){
cout<<"你没有汽水"<<endl;
Sleep(800);
goto go;
}
qs1--;
cout<<"你使用了汽水"<<endl;
Sleep(800);
if(d[k]){
cout<<"你弹出了一枚实弹"<<endl;
sd--;
if(sd==0)return;
}else{
cout<<"你弹出了一枚空弹"<<endl;
kd--;
}
k++;
Sleep(800);
goto go;
}
if(thing==8){
if(!sj1){
cout<<"你没有手机"<<endl;
Sleep(800);
goto go;
}
if(kd==0){
cout<<"当前没有实弹"<<endl;
Sleep(800);
goto go;
}
sj1--;
zy();
dong();
cout<<"你使用了手机"<<endl;
Sleep(800);
for(int i=k;i<=zd;i++){
if(!d[i]){
cout<<"第"<<i-k+1<<"发为空弹"<<endl;
break;
}
}
Sleep(800);
goto shi;
}
if(thing==9){
if(!nzq1){
cout<<"你没有逆转器"<<endl;
Sleep(800);
goto go;
}
nzq1--;
swap(sd,kd);
for(int i=k;i<=zd;i++){
d[i]=!d[i];
}
zy();
dong();
cout<<"你使用了逆转器"<<endl;
Sleep(800);
cout<<"你逆转了所有子弹"<<endl;
Sleep(800);
if(sd==0)return;
goto shi;
}
if(thing==10){
if(!yp1){
cout<<"你没有药片"<<endl;
Sleep(800);
goto go;
}
if(xue1==xs1){
cout<<"你的血量已满"<<endl;
Sleep(800);
goto go;
}
if(xue1==1){
cout<<"你无法回血"<<endl;
Sleep(800);
goto go;
}
yp1--;
s=rand()%10;
cout<<"你使用了药片"<<endl;
Sleep(800);
if(s<=3){
cout<<"你回复了2滴血"<<endl;
xue1+=2;
xue1=min(xue1,xs1);
}else{
cout<<"你扣了1滴血"<<endl;
xue1--;
}
Sleep(800);
goto go;
}
if(thing==11){
if(!ssx1){
cout<<"你没有肾上腺素"<<endl;
Sleep(800);
goto go;
}
if(zdj2==0){
cout<<"恶魔没有道具"<<endl;
Sleep(800);
goto go;
}
ssx1--;
cout<<"你使用了肾上腺素"<<endl;
Sleep(800);
cout<<"你要偷的道具:";
cx:;
cin>>s2;
if(s2=="放大镜"){
if(!fdj2){
cout<<"恶魔没有放大镜"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
fdj1++;
fdj2--;
cout<<"你偷取了放大镜"<<endl;
}else if(s2=="香烟"){
if(!xy2){
cout<<"恶魔没有香烟"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
xy1++;
xy2--;
cout<<"你偷取了香烟"<<endl;
}else if(s2=="手铐"){
if(!sk2){
cout<<"恶魔没有手铐"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
sk1++;
sk2--;
cout<<"你偷取了手铐"<<endl;
}else if(s2=="小刀"){
if(!xd2){
cout<<"恶魔没有小刀"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
xd1++;
xd2--;
cout<<"你偷取了小刀"<<endl;
}else if(s2=="汽水"){
if(!qs2){
cout<<"恶魔没有汽水"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
qs1++;
qs2--;
cout<<"你偷取了汽水"<<endl;
}else if(s2=="手机"){
if(!sj2){
cout<<"恶魔没有手机"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
sj1++;
sj2--;
cout<<"你偷取了手机"<<endl;
}else if(s2=="逆转器"){
if(!nzq2){
cout<<"恶魔没有逆转器"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
nzq1++;
nzq2--;
cout<<"你偷取了逆转器"<<endl;
}else if(s2=="药片"){
if(!yp2){
cout<<"恶魔没有药片"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
yp1++;
yp2--;
cout<<"你偷取了药片"<<endl;
}else if(s2=="肾上腺素"){
if(!ssx2){
cout<<"恶魔没有肾上腺素"<<endl;
Sleep(800);
cout<<"请重新输入:";
goto cx;
}
ssx1++;
ssx2--;
cout<<"你偷取了肾上腺素"<<endl;
}else{
cout<<"请重新输入:";
goto cx;
}
Sleep(800);
goto go;
}
while(thing<=0||thing>11){
cout<<"请重新输入"<<endl;
Sleep(800);
goto go;
}
if(ask1){
ask1=0;
cout<<"还是你的回合"<<endl;
Sleep(800);
system("cls");
goto go;
}
}
void xingdong2(){
system("cls");
cout<<"恶魔的回合"<<endl;
Sleep(800);
ego:;
zy();
Sleep(800);
while(ssx2&&zdj1){
ssx2--;
cout<<"恶魔使用了肾上腺素"<<endl;
Sleep(1000);
ecx:;
s=rand()%9;
if(s==0){
if(!fdj1){
goto ecx;
}
fdj2++;
fdj1--;
cout<<"恶魔偷取了放大镜"<<endl;
}else if(s==1){
if(!xy1){
goto ecx;
}
xy2++;
xy1--;
cout<<"恶魔偷取了香烟"<<endl;
}else if(s==2){
if(!sk1){
goto ecx;
}
sk2++;
sk1--;
cout<<"恶魔偷取了手铐"<<endl;
}else if(s==3){
if(!xd1){
goto ecx;
}
xd2++;
xd1--;
cout<<"恶魔偷取了小刀"<<endl;
}else if(s==4){
if(!qs1){
goto ecx;
}
qs2++;
qs1--;
cout<<"恶魔偷取了汽水"<<endl;
}else if(s==5){
if(!sj1){
goto ecx;
}
sj2++;
sj1--;
cout<<"恶魔偷取了手机"<<endl;
}else if(s==6){
if(!nzq1){
goto ecx;
}
nzq2++;
nzq1--;
cout<<"恶魔偷取了逆转器"<<endl;
}else if(s==7){
if(!yp1){
goto ecx;
}
yp2++;
yp1--;
cout<<"恶魔偷取了药片"<<endl;
}else if(s==8){
if(!ssx1){
goto ecx;
}
ssx2++;
ssx1--;
cout<<"恶魔偷取了肾上腺素"<<endl;
}
Sleep(1000);
zy();
Sleep(1000);
}
while(yp2&&xue2<xs2-1&&xue2!=1){
yp2--;
cout<<"恶魔使用了药片"<<endl;
Sleep(1000);
s=rand()%10;
if(s<=3){
cout<<"恶魔回复了2滴血"<<endl;
xue2+=2;
}else{
cout<<"恶魔扣了1滴血"<<endl;
xue2--;
}
Sleep(1000);
zy();
Sleep(1000);
}
while(xy2&&xue2<xs2&&xue2!=1){
xue2++;
xy2--;
cout<<"恶魔使用了香烟"<<endl;
Sleep(1000);
cout<<"恶魔回复了一滴血"<<endl;
Sleep(1000);
zy();
Sleep(1000);
}
if(sk2){
sk2--;
ask2=1;
zy();
cout<<"恶魔使用了手铐"<<endl;
Sleep(1000);
cout<<"你下回合无法行动"<<endl;
Sleep(1000);
}
if(nzq2){
s=rand()%2;
if(s){
nzq2--;
cout<<"恶魔使用了逆转器"<<endl;
Sleep(1000);
swap(sd,kd);
for(int i=k;i<=zd;i++){
d[i]=!d[i];
}
cout<<"恶魔逆转了所有子弹"<<endl;
if(sd==0)return;
Sleep(1000);
zy();
Sleep(1000);
}
}
if(qs2){
s=rand()%2;
if(s){
qs2--;
cout<<"恶魔使用了汽水"<<endl;
Sleep(1000);
if(d[k]){
cout<<"恶魔弹出了一枚实弹"<<endl;
sd--;
if(sd==0)return;
}else{
cout<<"恶魔弹出了一枚空弹"<<endl;
kd--;
}
k++;
Sleep(1000);
zy();
Sleep(1000);
}
}
if(fdj2){
fdj2--;
cout<<"恶魔使用了放大镜"<<endl;
Sleep(1000);
zy();
Sleep(1000);
if(d[k]){
if(xd2){
xd2--;
cout<<"恶魔使用了小刀"<<endl;
Sleep(1000);
cout<<"恶魔对你开枪"<<endl;
Sleep(1000);
cout<<"是实弹"<<endl;
Sleep(1000);
cout<<"你扣2滴血"<<endl;
Sleep(1000);
xue1-=2;
sd--;
k++;
pd();
if(sd==0)return;
zy();
Sleep(1000);
}else{
cout<<"恶魔对你开枪"<<endl;
Sleep(1000);
cout<<"是实弹"<<endl;
Sleep(1000);
cout<<"你扣1滴血"<<endl;
Sleep(1000);
xue1--;
sd--;
k++;
pd();
if(sd==0)return;
zy();
Sleep(1000);
}
}else{
cout<<"恶魔对自己开枪"<<endl;
Sleep(1000);
cout<<"是空弹"<<endl;
Sleep(1000);
cout<<"恶魔可再行动一次"<<endl;
Sleep(1000);
kd--;
k++;
goto ego;
}
}else if(sj2){
sj2--;
cout<<"恶魔使用了手机"<<endl;
Sleep(1000);
zy();
Sleep(1000);
if(d[k]){
if(xd2){
xd2--;
cout<<"恶魔使用了小刀"<<endl;
Sleep(1000);
cout<<"恶魔对你开枪"<<endl;
Sleep(1000);
cout<<"是实弹"<<endl;
Sleep(1000);
cout<<"你扣2滴血"<<endl;
Sleep(1000);
xue1-=2;
sd--;
k++;
pd();
if(sd==0)return;
zy();
Sleep(1000);
}else{
cout<<"恶魔对你开枪"<<endl;
Sleep(1000);
cout<<"是实弹"<<endl;
Sleep(1000);
cout<<"你扣1滴血"<<endl;
Sleep(1000);
xue1--;
sd--;
k++;
pd();
if(sd==0)return;
zy();
Sleep(1000);
}
}else{
cout<<"恶魔对自己开枪"<<endl;
Sleep(1000);
cout<<"是空弹"<<endl;
Sleep(1000);
cout<<"恶魔可再行动一次"<<endl;
Sleep(1000);
kd--;
k++;
goto ego;
}
}else{
if(sd>=kd){
if(xd2){
xd2--;
zy();
cout<<"恶魔使用了小刀"<<endl;
Sleep(1000);
cout<<"恶魔对你开枪"<<endl;
Sleep(1000);
if(d[k]){
cout<<"是实弹"<<endl;
Sleep(1000);
cout<<"你扣2滴血"<<endl;
Sleep(1000);
xue1-=2;
sd--;
pd();
if(sd==0)return;
}else{
cout<<"是空弹"<<endl;
Sleep(1000);
kd--;
}
k++;
zy();
Sleep(1000);
}else{
cout<<"恶魔对你开枪"<<endl;
Sleep(1000);
if(d[k]){
cout<<"是实弹"<<endl;
Sleep(1000);
cout<<"你扣1滴血"<<endl;
Sleep(1000);
xue1--;
sd--;
pd();
if(sd==0)return;
}else{
cout<<"是空弹"<<endl;
Sleep(1000);
kd--;
}
k++;
zy();
Sleep(1000);
}
}else{
cout<<"恶魔对自己开枪"<<endl;
Sleep(1000);
if(d[k]){
cout<<"是实弹"<<endl;
Sleep(1000);
cout<<"恶魔扣1滴血"<<endl;
Sleep(1000);
xue2--;
sd--;
k++;
pd();
if(sd==0)return;
zy();
Sleep(1000);
}else{
cout<<"是空弹"<<endl;
Sleep(1000);
cout<<"恶魔可再行动一次"<<endl;
Sleep(1000);
kd--;
k++;
zy();
Sleep(1000);
goto ego;
}
}
}
if(ask2){
ask2=0;
cout<<"还是恶魔的回合"<<endl;
Sleep(1000);
goto ego;
}
}
signed main(){
cout<<"欢迎来到恶魔轮盘赌"<<endl;
cout<<"请输入你的血量(推荐6):";
cin>>xs1;
while(xs1<=0||xs1>10000){
cout<<"请重新输入:";
cin>>xs1;
}
cout<<"请输入恶魔血量(推荐6):";
cin>>xs2;
while(xs2<=0||xs2>10000){
cout<<"请重新输入:";
cin>>xs2;
}
cout<<"请输入每回合道具数(推荐4):";
cin>>djs;
while(djs<=0||djs>8){
cout<<"请重新输入:";
cin>>djs;
}
jz();
xue1=xs1,xue2=xs2;
srand(time(NULL));
while(1){
hh:;
cs();
while(1){
if(sd==0)goto hh;
xingdong1();
if(sd==0)goto hh;
xingdong2();
}
}
js:;
return 0;
}
/*
*/