#include<windows.h>
#include<bits/stdc++.h>
using namespace std;
void play();
int Your=6,Other=6;
int maxY=6,maxO=6;
string daojuname[]={"放大镜","手铐","小刀","烟","饮料","过期药"};
double Yourmoney;
int lv;//1是简单,2是正常,3是困难,4是炼狱,5是不可能
int n,chu=0,bad=10;
int mod;
int shi,kong;
int q[110],qlen;//1 实 2 空
void Timeother();
int Rand(int x,int y){
int A=rand(),B=rand();
return A1llB%(y-x+1)+x;
}
int T;//ou->you
int daojulen;
int daoju[10];
int daojulen1;
int daoju1[10];
void build(){
kong=Rand(1,8);
shi=Rand(1,8);
if(lv6){
kong=Rand(1,10);
shi=Rand(1,10);
}
qlen=0;
printf("%d发实弹,%d发空弹\n",shi,kong);
int a1=kong,a2=shi;
for(int i=1;i<=kong+shi;i++){
// Sleep(50);
int sum=Rand(1,a1+a2);
if(sum<=a1){
a1--;
q[++qlen]=2;
}else{
a2--;
q[++qlen]=1;
}
}
int maxn;
if(lv1){
maxn=min(7,12-daojulen);
}
else if(lv2){
maxn=min(4,8-daojulen);
}
else if(lv3){
maxn=min(3,8-daojulen);
}
else if(lv4){
maxn=min(2,7-daojulen);
}
else if(lv5){
maxn=0;
}
if(lv6){
maxn=min(3,6-daojulen);
bad=Rand(0,5);
cout<<daojuname[bad]<<"栏已损坏,不可使用"<<endl;
}
int broken;
Sleep(1145);
printf("你获得了%d个道具:\n",maxn);
daojulen+=maxn;
for(int i=1;i<=maxn;i++){
Sleep(50);
int kkk=bad;
while(kkkbad){
kkk=Rand(0,5);
}
if(lv6){
broken=Rand(0,3);
}
if(broken2){
cout<<daojuname[kkk]<<"是盗版,不可使用 , ";
}
else{
daoju[kkk];
cout<<daojuname[kkk];
if(i!=maxn){
printf(" , ");
}
}
}
printf("\n");
maxn=min(4,8-daojulen1);
if(lv4){
maxn=min(4,10-daojulen);
}
else if(lv5){
maxn=666;
}
if(lv==6){
maxn=min(5,11-daojulen);
}
printf("恶魔获得了%d个道具:\n",maxn);
daojulen1+=maxn;
for(int i=1;i<=maxn;i){
int kkk=Rand(0,5);
daoju1[kkk];
cout<<daojuname[kkk];
if(i!=maxn){
printf(" , ");
}
}
printf("\n");
system("pause");
system("cls");
}
void IsOver(){
if(Your<=0){
printf("你输了\n");
system("pause");
exit(0);
}
if(Other<=0){
system("cls");
if(lv1) Yourmoney*=0.5;
else if(lv3) Yourmoney*=2;
else if(lv4) Yourmoney*=3;
else if(lv5) Yourmoney*=114514;
printf("你赢了\n你获得了奖金$%.2lf\n",Yourmoney);
if(n4 and chu1){
Sleep(1145);
printf("你真的赢了吗\n");
Sleep(1145);
printf("我还有一次机会\n");
chu--,Other=maxO;
mod=80;
Timeother();
}
else{
n=lv;
system("pause");
return ;
}
}
}
void wait(){
for(int i=1;i<=3;i){
Sleep(500);
printf(".");
}
Sleep(500);
}
int Hurt=1;
int shoukao_you;
void Timeyou(){
int nb=rand()%mod+1;
int x;
while(1){
printf("你的生命:%d/%d\n恶魔生命:%d/%d\n",Your,maxY,Other,maxO);
printf("剩余实弹数:%d 剩余空弹数:%d\n",shi,kong);
printf("你现在拥有的道具:\n");
for(int i=0;i<=5;i++){
if(ibad) continue;
cout<<daojuname[i];
printf("%d",daoju[i]);
printf("个");
if(i!=5){
printf(",");
}
}
printf("\n");
printf("恶魔现在拥有的道具:\n");
for(int i=0;i<=5;i++){
cout<<daojuname[i];
printf("%d",daoju1[i]);
printf("个");
if(i!=5){
printf(",");
}
}
printf("\n");
printf("现在是你的回合\n");
printf("你要\n1.向恶魔开枪\n2.向自己开枪\n");
for(int i=0;i<=5;i++){
printf("%d.使用",i+3);
cout<<daojuname[i]<<'\n';
}
scanf("%d",&x);
if(1<=x&&x<=8){
break;
}
printf("输入不合法\n");
Sleep(1145);
system("cls");
}
if(x1){
printf("你决定向恶魔开枪");
T++;
wait();
// printf("((%lf))\n",Yourmoney);
Yourmoney+=(double)(5000.0*(Hurt1.0)(1+(double)(kong)1.0/(double)(shi+kong)));
// printf("{{%lf}}\n",Yourmoney);
shi--;
qlen--;
Other-=Hurt;
Hurt=1;
printf("是实弹\n");
Sleep(500);
IsOver();
if(shoukao_you1){
shoukao_you=0;
Yourmoney+=1000.0;
printf("因为你使用了手铐,所以可以再来一次\n");
Sleep(500);
T--;
}
}
}else if(x2){
printf("你决定向自己开枪");
wait();
if(lv==4 and q[qlen]2 and shi!=0){
if(nb<=44){
q[qlen]=2;
}
}
else if(lv3 and q[qlen]==2 and shi!=0){
if(nb<=33){
q[qlen]=1;
}
}
if(q[qlen]==2){
Yourmoney+=(double)(2000.0(Hurt1.0)(1+(double)(kong)1.0/(double)(shi+kong)));
kong--;
qlen--;
Hurt=1;
printf("是空弹\n");
}else{
Yourmoney+=5000.0(1+(double)(shi)1.0/(double)(shi+kong));
T++;
shi--;
qlen--;
Your-=Hurt;
Hurt=1;
printf("是实弹\n");
Sleep(500);
IsOver();
if(shoukao_you1){
shoukao_you=0;
printf("因为你使用了手铐,所以可以再来一次\n");
Sleep(500);
T--;
}
}
}else if(x3){//{"放大镜","手铐","小刀","烟","饮料","过期药"};
if(daoju[0]){
daoju[0]--;
daojulen--;
printf("你使用了放大镜\n");
wait();
printf("\n你看到了");
if(q[qlen]1){
printf("实弹\n");
Yourmoney+=2500.0;
}else{
printf("空弹\n");
}
Sleep(500);
printf("\n");
}else{
printf("你现在没有放大镜\n");
Sleep(1145);
system("cls");
}
}else if(x4){
if(daoju[1]){
if(!shoukao_you){
daoju[1]--;
daojulen--;
printf("你使用了手铐\n");
printf("你获得了连开两枪的机会\n");
shoukao_you=1;
}else{
printf("你已经用过手铐了\n");
}
Sleep(1145);
system("cls");
}else{
printf("你现在没有手铐\n");
Sleep(1145);
system("cls");
}
}else if(x5){
if(daoju[2]){
if(Hurt1){
daoju[2]--;
daojulen--;
printf("你使用了小刀\n");
printf("若下一发为实弹则伤害+1\n");
Yourmoney+=500.0;
Hurt=2;
}else{
printf("你已经用过小刀了\n");
}
Sleep(1145);
system("cls");
}else{
printf("你现在没有小刀\n");
Sleep(1145);
system("cls");
}
}else if(x6){
if(daoju[3]){
if(Your<maxY){
daoju[3]--;
daojulen--;
printf("你使用了烟\n");
printf("你回复了一点生命\n");
Yourmoney+=500.0;
Your++;
}else{
printf("你现在不需要烟\n");
}
Sleep(1145);
}else{
printf("你现在没有烟\n");
Sleep(1145);
system("cls");
}
}else if(x7){
if(daoju[4]){
daoju[4]--;
daojulen--;
printf("你使用了饮料\n");
wait();
printf("\n");
printf("你退了一发");
if(q[qlen]2){
printf("空弹");
kong--;
}else{
printf("实弹");
Yourmoney+=500.0;
shi--;
}
qlen--;
Sleep(500);
}else{
printf("你现在没有饮料\n");
Sleep(1145);
system("cls");
}
}else if(x8){
if(daoju[5]){
int yao=rand()%2+1;//1则药变质,2则药良好
if(lv4){
yao=rand()%3;
}
else if(lv5){
yao=1;
}
else if(n4){
yao=rand()%4;
}
daoju[5]--;
daojulen--;
printf("你使用了过期药\n");
wait();
printf("\n");
if(yao<=1){
printf("药变质了\n中毒减少了1滴血\n");
Your--;
}
else{
printf("药良好\n你回复了2滴血\n");
Your+=2;
if(Your>maxY) Your=maxY;
}
Sleep(500);
}else{
printf("你现在没有过期药\n");
Sleep(1145);
system("cls");
}
}
Sleep(1000);
system("cls");
}
int Know;//通过放大镜得知下一发子弹
int shoukaoemo;
void fightyou(){
printf("恶魔决定向你开枪");
T++;
wait();
int nb=rand()%mod+1;
if(n4 and q[qlen]2 and shi!=0){
printf("恶魔更换了子弹\n");
Sleep(1145);
if(nb<=66){
q[qlen]=1;
}
}
else if(lv5 and q[qlen]==2 and shi!=0){
q[qlen]=1;
}
if(q[qlen]==2){
Yourmoney+=(double)(2000.0(Hurt1.0)(1+(double)(kong)1.0/(double)(shi+kong)));
kong--;
qlen--;
Hurt=1;
Know=0;
printf("是空弹\n");
if(shoukaoemo){
printf("因为恶魔使用了手铐,所以可以再来一次\n");
T--;
Sleep(500);
shoukaoemo=0;
}
}else{
Yourmoney+=(double)(5000.0(Hurt1.0)(1+(double)(kong)1.0/(double)(shi+kong)));
shi--;
qlen--;
Your-=Hurt;
Hurt=1;
printf("是实弹\n");
Know=0;
Sleep(500);
IsOver();
if(shoukaoemo){
printf("因为恶魔使用了手铐,所以可以再来一次\n");
Yourmoney+=1000.0;
T--;
Sleep(500);
shoukaoemo=0;
}
}
}
void fightemo(){
printf("恶魔决定向自己开枪");
wait();
int nb=rand()%mod+1;
if(n==4 and q[qlen]1 and kong!=0){
printf("恶魔更换了子弹\n");
Sleep(1145);
if(nb<=66){
q[qlen]=2;
}
}
else if(lv5 and q[qlen]==1 and kong!=0){
q[qlen]=2;
}
if(q[qlen]==2){
Yourmoney+=2000.0(1+(double)(shi)1.0/(double)(shi+kong));
kong--;
qlen--;
printf("是空弹\n");
Know=0;
}else{
Yourmoney+=5000.0(1+(double)(kong)*1.0/(double)(shi+kong));
shi--;
T++;
qlen--;
Other-=Hurt;
Hurt=1;
printf("是实弹\n");
Know=0;
Sleep(500);
IsOver();
if(shoukaoemo){
printf("因为恶魔使用了手铐,所以可以再来一次\n");
T--;
Sleep(500);
shoukaoemo=0;
}
}
}
void Timeother(){
printf("你的生命:%d/%d\n恶魔生命:%d/%d\n",Your,maxY,Other,maxO);
printf("剩余实弹数:%d 剩余空弹数:%d\n",shi,kong);
printf("你现在拥有的道具:\n");
for(int i=0;i<=5;i++){
cout<<daojuname[i];
printf("%d",daoju[i]);
printf("个");
if(i!=4){
printf(",");
}
}
printf("\n");
printf("恶魔现在拥有的道具:\n");
for(int i=0;i<=5;i++){
cout<<daojuname[i];
printf("%d",daoju1[i]);
printf("个");
if(i!=4){
printf(",");
}
}
printf("\n");
printf("现在是恶魔的回合\n");
Sleep(1500);
Hurt=2;
}
void Play(){
while(1){
if(shi0){
build();
T=0;
continue;
}
if(T%20){
Timeyou();
}else{
Timeother();
}
if(Other<=0) return ;
}
}
void danrenplay(){
for(int i=1;i<=3;i++){
printf(".");
// Sleep(1000);
}
printf("\n");
printf("又来了一位挑战者...\n");
Sleep(1000);
int x;
while(1){
printf("准备好参与恶魔的游戏吗?胜者带走奖金,败者将会在此长眠\n1.好的\n2.没问题\n");
scanf("%d",&x);
if(x1||x2){
break;
}
printf("输入不合法\n");
Sleep(1145);
system("cls");
}
while(1){
printf("你清楚我们的规则吗?\n1.清楚\n2.不清楚\n");
scanf("%d",&x);
if(x1||x2){
break;
}
printf("输入不合法\n");
Sleep(1145);
system("cls");
}
if(x==1){
}
void play(){
while(1){
srand(time(0));
time(0);
int x;
while(1){
printf("请选择你想要的模式:\n1.单人(双人被删了)\n");
scanf("%d",&x);
if(x1){
break;
}
printf("输入不合法\n");
Sleep(1145);
system("cls");
}
system("cls");
if(x1){
danrenplay();
}
}
}
int main(){
play();
return 0;
}