初级光能
system("color 2a");
颜色(绿的)
===========================
system("cls");
清屏
===========================
system("shutdown -s -t 25");
关机,不用讲了吧
===========================
MessageBox(NULL,"内容","名称",MB_OK);
弹窗
新手天翼
#include<bits/stdc++.h>
#include<windows.h>
#include<windows.h>
#include<cstdio>
#include<iostream>
#define qdo 262
#define qre 294
#define qmi 330
#define qfa 349
#define qso 392
#define qla 440
#define qsi 494
#define do 523
#define re 578
#define mi 659
#define fa 698
#define so 784
#define la 880
#define si 988
#define do1 1046
#define re1 1175
#define mi1 1318
#define fa1 1480
#define so1 1568
#define la1 1760
#define si1 1976
#define sqdo 277
#define sqre 311
#define sqfa 370
#define sqso 415
#define sqla 466
#define sdo 554
#define sre 622
#define sfa 740
#define sso 831
#define sla 932
#define sdo1 1046
#define sre1 1245
#define sfa1 1480
#define sso1 1661
#define sla1 1865
using namespace std;
string s3="";
string s="";
int mima;
void kc()
{
srand(int(time(0)));
int a;
cout<<"是否进入游戏,谨慎选择\n1、进入 2、退出";
cin>>a;
if(a==1)
{
system("Cls");
cout<<"正在加载";
Sleep(500);
for(int i=1;i<=9;i++)
{
system("Cls");
s+="*";
cout<<s<<"\n "<<s.size()<<"0%";
Sleep(500);
}
Sleep(2000);
system("Cls");
s+="*";
cout<<s<<"\n "<<s.size()<<"0%";
}
else
{
cout<<"已退出。" ;
exit(0);
}
Sleep(1000);
system("Cls");
cout<<"您好!欢迎来到坑人冒险。\n————作者:神之右手\n\n";
cout<<"请建一个用户名\n";
getline(cin,s);
getline(cin,s);
cout<<"请记住下面这密码,很有用的(两秒后消失)";
Sleep(500);
mima=rand()%100+100;
cout<<endl<<mima<<endl;
s3+=char(mima/100+'0');
s3+=char(mima/10%10+'0');
s3+=char(mima%10+'0');
Sleep(2000);
system("Cls");
cout<<"加油吧!少年";
}
void agangjuex()
{
int ban=500,pai=200,dw=128,bs;
Beep(la,ban*1.5);
Sleep(ban*3.6);
Beep(la,ban*1.5);
Sleep(ban*3.6);
Beep(fa,pai);
Beep(mi,pai);//
Beep(re,ban);
Beep(re,pai);
Beep(re,pai);
Beep(re,ban);
Beep(re,pai);
Beep(re,pai);
Beep(fa,ban);
Beep(re,pai);
Beep(re,pai);
Beep(re,ban);
Beep(fa,pai);
Beep(so,pai);//
Beep(la,ban);
Beep(la,pai);
Beep(la,pai);
Beep(la,ban);
Beep(fa,pai);
Beep(so,pai);
Beep(la,ban);
Beep(so,pai);
Beep(so,pai);
Beep(so,ban);
Sleep(ban);//
Beep(so,ban*1.5);
Sleep(ban*3.6);
Beep(so,ban*1.5);
Sleep(ban*3.6);
Beep(mi,pai);
Beep(re,pai);//
Beep(do,ban);
Beep(do,pai);
Beep(do,pai);
Beep(do,ban);
Beep(do,pai);
Beep(do,pai);
Beep(sre,ban);
Beep(do,pai);
Beep(do,pai);
Beep(do,ban);
Beep(sre,pai);
Beep(fa,pai);//
Beep(so,ban);
Beep(so,pai);
Beep(so,pai);
Beep(so,ban);
Beep(sre,pai);
Beep(fa,pai);
Beep(so,ban);
Beep(fa,pai);
Beep(fa,pai);
Beep(fa,ban);
Sleep(ban);
cout<<"\n\n完毕";
}
void shaon()
{
int ban=500,pai=200,dw=128,bs;
Beep(do1,ban);
Beep(re1,ban);
Beep(do1,ban);
for(int i=1;i<=3;i++)
Beep(so1,ban);
Beep(mi1,pai);
Beep(so1,ban+pai);
Beep(mi1,ban);
Beep(mi1,ban);
for(int i=1;i<=4;i++)
Beep(re1,ban);
Beep(do1,pai);
Beep(mi1,pai);
Beep(re1,ban);
Beep(re1,ban);
Beep(mi1,ban);
Beep(la,ban);
Beep(do1,ban);
Beep(do1,ban);
Beep(la,pai);
Beep(la,ban+pai);
Beep(do1,ban);
Beep(re1,ban);
Beep(do1,ban);
for(int i=1;i<=3;i++)
Beep(fa1,pai);
Beep(mi1,pai);
Beep(fa1,pai);
Beep(mi1,pai);
Beep(re1,pai);
Beep(do1,pai);
for(int i=1;i<=3;i++)
Beep(so1,pai);
Beep(mi1,dw);
Beep(so1,dw+pai);
Beep(mi1,pai);
Beep(mi1,pai);
for(int i=1;i<=4;i++)
Beep(re1,pai);
Beep(do1,dw);
Beep(mi1,dw);
Beep(re1,ban);
Beep(re1,pai);
Beep(mi1,pai);
Beep(la,pai);
Beep(do1,pai);
Beep(do1,pai);
Beep(la,pai);
Beep(la,pai);
Beep(do1,pai);
Beep(do1,pai+pai+dw);
Beep(do1,pai);
for(int i=1;i<=3;i++)
{
Beep(fa1,pai);
Beep(mi1,pai);
}
Sleep(pai);
Beep(fa1,pai);
Beep(mi1,pai);
Beep(re1,pai);
Beep(do1,pai+ban*4);
cout<<"\n\n完毕";
}
void wohaiy()
{
int ban=500,pai=200,dw=128,bs;
Beep(do,ban);
Beep(do,ban);
Beep(mi,ban);
Beep(mi,ban);
Beep(re,pai);
Beep(do,ban+pai);
Beep(qla,ban);
Beep(qso,pai);
Beep(qso,pai);
Beep(do,ban);
Beep(do,ban);
Beep(mi,pai);
Beep(mi,ban+pai);
Beep(re,ban*2);
Sleep(ban*2);
Beep(do,ban);
Beep(do,pai);
Beep(do,pai);
Beep(mi,pai);
Beep(mi,ban);
Beep(mi,pai);
Beep(re,ban);
Beep(do,ban);
Beep(qla,pai+dw);
Beep(qla,pai);
Beep(qso,pai);
Beep(qla,pai);
Beep(re,pai);
Beep(do,pai+dw);
Beep(re,pai);
Beep(do,pai);
Beep(re,pai);
Beep(mi,ban+pai);
Beep(do,ban*2);
Sleep(ban*2);
Beep(do,ban);
Beep(do,ban);
Beep(mi,ban);
Beep(mi,pai);
Beep(mi,pai);
Beep(re,pai);
Beep(do,ban+pai);
Beep(qla,ban);
Beep(qso,ban);
Beep(do,ban);
Beep(do,pai);
Beep(do,pai);
Beep(mi,pai);
Beep(mi,ban+pai);
Beep(re,ban*2);
Sleep(ban*2);
Beep(do,ban);
Beep(do,ban);
Beep(mi,pai);
Beep(mi,ban);
Beep(mi,pai);
Beep(mi,pai);
Beep(re,ban);
Beep(do,pai);
Beep(qla,pai);
Beep(qso,dw);
Beep(qla,pai);
Beep(do,pai);
Beep(re,pai);
Beep(do,dw);
Beep(re,pai);
Beep(do,pai);
Beep(mi,pai);
Beep(mi,pai+ban);
Beep(do,ban*2);
Sleep(ban*2);
Beep(mi,pai);
Beep(so,ban+pai);
Beep(do1,ban*2);
Sleep(ban);
Beep(mi,pai);
Beep(re,ban);
Beep(mi,pai);
Beep(do,ban*2);
Beep(mi,pai);
Beep(so,ban+pai);
Beep(do1,ban+pai);
Beep(do1,pai);
Sleep(ban);
Beep(mi,pai);
Beep(la,ban);
Beep(so,pai);
Beep(so,ban*2);
Sleep(pai);
Beep(mi,pai);
Beep(so,ban+pai);
Beep(do1,ban*2);
Sleep(ban);
Beep(mi,pai);
Beep(re,ban);
Beep(mi,pai);
Beep(do,ban*2);
Beep(mi,pai);
Beep(so,ban);
for(int i=1;i<=4;i++)
Beep(so,pai);
Beep(mi,pai);
Beep(la,ban);
Beep(so,pai+ban);
Beep(mi,pai);
Beep(so,ban+pai);
Beep(do1,ban*2);
Sleep(ban);
Beep(mi,pai);
Beep(re,ban);
Beep(mi,pai);
Beep(do,ban*2);
Beep(mi,pai);
Beep(so,pai+ban);
Beep(do1,ban+pai);
Beep(do1,pai);
Beep(do1,pai);
Beep(la,ban);
Beep(so,pai);
Beep(so,dw);
Beep(la,dw);
Beep(so,ban*2);
Sleep(pai);
Beep(mi,pai);
Beep(so,ban+pai);
Beep(do1,ban*2);
Sleep(ban);
Beep(mi,pai);
Beep(re,ban);
Beep(mi,pai);
Beep(do,ban*2);
for(int i=1;i<=2;i++)
{
Beep(re,pai+dw);
Beep(do,dw);
}
Beep(re,ban);
Beep(mi,ban);
Beep(fa,ban*2);
Sleep(pai);
Beep(mi,ban);
Beep(re,pai);
Beep(do,pai);
Beep(do,ban*4);
}
void bir()
{
int ban=500,pai=200,dw=128,bs;
Beep(qso,ban);
Beep(qso,ban);
Beep(qla,ban);
Beep(qso,ban);
Beep(do,ban);
Beep(qsi,ban);
Beep(qso,ban);
Beep(qso,ban);
Beep(qla,ban);
Beep(qso,ban);
Beep(re,ban);
Beep(do,ban);
Beep(qso,ban);
Beep(qso,ban);
Beep(so,ban);
Beep(mi,ban);
Beep(re,ban);
Beep(do,pai);
Beep(qsi,pai);
Beep(qla,ban);
Beep(fa,ban);
Beep(fa,ban);
Beep(mi,ban);
Beep(do,ban);
Beep(re,ban);
Beep(do,ban);
}
int main() {
int s,xz;
kc();
Sleep(3000);
while(s!=4)
{
system("Cls");
cout<<"有一天,你发现你桌上有一台录音机。你决定?\n1、吃下去 2、听音乐 3、听公告 4、扔掉";
cout<<"\n you ↓ \n";
cout<<" @ |=|\n";
cin>>s;
if(s==1)
{
cout<<"你是一个狠人……\n你因吃录音机而不幸去世。";
cout<<"\n对了,录音机啥味道能给我讲讲呗";
for(int i=1;i<=6;i++)
{
cout<<".";
Sleep(300);
}
exit(0);
}
if(s==2)
{
s=12;
string s1;
cout<<"请输入密码";
cin>>s1;
while(s1!="密码")
{
if(s1==s3)
{
cout<<"你的断句和词语理解不对\n再试试";
Sleep(2000);
system("Cls");
}
else
{
cout<<"……";
exit(0);
}
cout<<"请输入密码 ";
cin>>s1;
}
if(s1=="密码")
{
cout<<"密码正确!";
Sleep(2000);
system("Cls");
while(s!=5)
{
cout<<"你想听啥?(剩下的还在补充,敬请期待)\n1、阿纲觉醒 2、少年(高潮) 3、我还有点小糊涂。 4、生日快乐 5、退出 ";
cin>>s;
Sleep(2000);
if(s==1)
{
agangjuex();
system("Cls");
}
if(s==2)
{
shaon();
system("Cls");
}
if(s==3)
{
wohaiy();
system("Cls");
}
if(s==4)
{
bir();
system("Cls");
}
if(s==5)
{
cout<<"已退出";
break;
}
}
}
}
if(s==3)
{
cout<<"最新消息:\n坑人冒险1.0上线了!有问题可以在评论反馈给我哦……";
cout<<"\n技巧:如果有一个坑,你不要跳过去%¥%!";
Sleep(2000);
system("Cls");
}
if(s==4)
{
cout<<"这时,你突然眼前一黑,耳边传来阵阵声音:\n";
string shengyin="我TM弄死你\n我TM弄死你\n沙雕,滚!";
for(int i=0;i<shengyin.size();i++)
{
cout<<shengyin[i];
Sleep(150);
}
cout<<"\n你:⊙(?◇?)?\n";
Sleep(1500);
int xuan;
while(1)
{
cout<<"这时\n";
cout<<" ~~ ~~~:我是白云 \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n我TM的目标是啥\n系统:现在,你要进行冒险,拿回你的收音机,不然你就回不去了。\n你:好吧\n";
cout<<"你决定?1、走过去 2、跳过去 3、高跳过去 4、我飞~ 5、氪金 6、零氪";
cin>>xuan;
if(xuan==1)
{
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~\n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" ===\n";
cout<<"========== 你 ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" ===\n";
cout<<"========== ========\n";
cout<<" _▋_ \n";
cout<<"\n你死了";
Sleep(700);
system("Cls");
}
if(xuan==2)
{
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== @ ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" @ ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" _▋_ =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
cout<<"\n superise ** fuck\n你死了";
Sleep(2000);
system("Cls");
}
if(xuan==3)
{
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~你~:我是白云~~~~~ \n";
cout<<" =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~ ~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~ ~: ~~~~~ \n";
cout<<" 我是白云 =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~ ~: ~~~~~ \n";
cout<<" =\n";
cout<<" 我是白云 ===\n";
cout<<"========== _▋_ ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~ ~: ~~~~~ \n";
cout<<" =\n";
cout<<" 云 ===\n";
cout<<"========== _▋_ ========\n";
cout<<" 我是白 ";
cout<<"\n superise ** fuck\n你死了";
Sleep(2000);
system("Cls");
}
if(xuan==4)
{
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" ﹥你 =\n";
cout<<" 超级加速! ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" >}你 =\n";
cout<<" 充能! ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" =≯你 =\n";
cout<<" 加~速! ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" ∑你 =\n";
cout<<" 冲啊!!! ===\n";
cout<<"========== ========\n";
Sleep(100);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(100);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(100);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" 你 =\n";
cout<<" @ ===\n";
cout<<"========== @ @========\n";
Sleep(100);
system("Cls");
cout<<" ~~ ~~~:我是白云~~~~~ \n";
cout<<" @ 你 =\n";
cout<<" @ ===\n";
cout<<"========== @========\n";
Sleep(100);
system("Cls");
cout<<" ~~ ~~~:∷是白云~~~~~ \n";
cout<<" @ 你 =\n";
cout<<" @ ===\n";
cout<<"========== ========\n";
Sleep(100);
system("Cls");
cout<<" ~~ ~~~:∷∷白云~~~~~ \n";
cout<<" @你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:∷∷∷云~~~~~ \n";
cout<<" 你 =\n";
cout<<" ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:∷∷∷云~~~~~ \n";
cout<<" =\n";
cout<<" 你 ===\n";
cout<<"========== ========\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:∷∷∷云~~~~~ \n";
cout<<" =\n";
cout<<" ===\n";
cout<<"========== === 你=====\n";
Sleep(200);
system("Cls");
cout<<" ~~ ~~~:∷∷∷云~~~~~ \n";
cout<<" =\n";
cout<<" ===\n";
cout<<"========== === =====\n";
cout<<" _▋_ ";
cout<<"\n小朋友,你是否有很多问号?";
Sleep(2000);
system("Cls");
}
if(xuan==5)
{
cout<<"\n果然,氪金的力量是强大的!!!\n但你没钱,你被……";
Sleep(1000);
exit(0);
}
if(xuan==6)
{
cout<<"\n系统“高兴”地把你踹到了对面……下一关!\n";
break;
}
}
Sleep(1500);
system("Cls");
while(1)
{
cout<<"你来到了:\n";
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~\n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" 你 [祭坛] <O 架| \n";
cout<<"================TTT========\n";
cout<<"神:要想过去,必须献祭才行!\n 你:1、献祭自己 2、先跳到祭坛上,再跳到刑事架上,最后到传送门 3、和神干架 4、挖隧道";
cin>>xz;
if(xz==1)
{
system("Cls");
cout<<"简单明了,你死了。";
exit(0);
}
if(xz==2)
{
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~\n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" 你 [祭坛] <O 架| \n";
cout<<"================TTT========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" _你_ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"================TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" ______ \n";
cout<<" 你 <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"================TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" __你__ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"================TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" ___你_ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"================TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌 ~~~~~~~ \n";
cout<<" _____ 云 \n";
cout<<" <| 邢| 你 @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"================TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌 ~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢|云 @@ \n";
cout<<" ____ <| 事|你 @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"================TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌 ~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事|云 @@ \n";
cout<<" [祭坛] <O 架|你 \n";
cout<<"================TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌 ~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架|_▋_ \n";
cout<<"================TTT云=======\n";
cout<<"你以为这么简单吗";
Sleep(2000);
system("Cls");
}
if(xz==3)
{
int red=100,cs=0;
int shuz=0,gr;
cout<<"~&Boss战!&~";
string boss="\n前方高能\n 做好警戒 \n奥利给!!!!!";
for(int i=0;i<boss.size();i++)
{
cout<<boss[i];
Sleep(100);
}
Sleep(2000);
system("Cls");
while(1)
{
cout<<" 生命值:"<<red;
cout<< " 生命值:"<<red<<endl;
cout<<"1、火炮 2、滑稽之力 3、冰雪风暴 4、觉醒:"<<shuz<<"%";
cin>>xz;
cs++;
if(shuz!=100)
shuz+=20;
if(shuz!=100)
{
if(xz==4)
{
cout<<"能量正在汇集…";
Sleep(1000);
system("Cls");
}
}
else
{
if(xz==4)
{
cout<<"你使用了觉醒·神之冲击\n";
cout<<"神:居然使用我的力量……\n";
cout<<"系统:ACE";
Sleep(3000);
system("Cls");
string s="一切事,该结束了……\n 在一闪闪白光中,你看到了曾经的少年……\n";
for(int i=0;i<s.size();i++)
{
cout<<s[i];
Sleep(100);
}
Sleep(2000);
system("Cls");
s="你醒来了,你的神力化作了金光,钻进了你的右手……";
for(int i=0;i<s.size();i++)
{
cout<<s[i];
Sleep(100);
}
Sleep(2000);
system("Cls");
cout<<"作者:终于完结了……\n请期待坑人冒险2.0!";
exit(0);
}
}
if(xz!=4)
{
cout<<"\n对手使用了滑稽盾\n";
if(cs==1)
cout<<"并嘲讽你:神是不可消灭的,一个人和一个神。";
if(cs==2)
cout<<"神:你没发现我和你长一样吗 \n 你:呵呵,我要杀了你";
if(cs==3)
cout<<"神:我是你的化身,我和你的名字一样,也叫"<<s;
if(cs>=4)
cout<<"神:杀了我也就杀了你 ,只要杀了你,我才是主角。";
Sleep(2000);
system("Cls");
}
}
}
if(xz==4)
{
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~\n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"===你===========TTT========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"=====你=========TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"========你======TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] <O 架| \n";
cout<<"===========你===TTT=========\n";
Sleep(200);
system("Cls");
cout<<"~~ ~~~~ ~~:我是乌云~~~~~~~ \n";
cout<<" ______ \n";
cout<<" <| 邢| @@ \n";
cout<<" ____ <| 事| @@ \n";
cout<<" [祭坛] 架| \n";
cout<<"============<O==TTT=========\n";
cout<<" _▋_ ";
string hah="惊喜不?意外不?(doge)";
for(int i=0;i<hah.size();i++)
{
cout<<hah[i];
Sleep(100);
}
Sleep(2000);
system("Cls");
}
}
}
}
return 0;
}
中级天翼
#include<iostream>
#include<time.h>
#include<stdio.h>
#include <stdlib.h>
using namespace std;
struct pai
{
int paifu;
int huase;
int yanse;
int dianshu;
int leixing;
int changdu;
void Kanpai()
{
if(paifu==0||paifu==1);
else
printf("牌副参数错误!\n");
switch(huase)
{
case 0:cout<<"黑桃";break;
case 1:cout<<"红桃";break;
case 2:cout<<"草花";break;
case 3:cout<<"方片";break;
case -1:cout<<"无色";break;
default:printf("花色错误!\n");break;
}
switch(dianshu)
{
case 0:cout<<"A ";break;
case 1:cout<<"2 ";break;
case 2:cout<<"3 ";break;
case 3:cout<<"4 ";break;
case 4:cout<<"5 ";break;
case 5:cout<<"6 ";break;
case 6:cout<<"7 ";break;
case 7:cout<<"8 ";break;
case 8:cout<<"9 ";break;
case 9:cout<<"10 ";break;
case 10:cout<<"J ";break;
case 11:cout<<"Q ";break;
case 12:cout<<"K ";break;
case -1:cout<<"无点数";break;
default:printf("点数错误!\n");break;
}
switch(leixing)
{
case 101:cout<<"【杀】"<<endl;break;
case 102:cout<<"【闪】"<<endl;break;
case 103:cout<<"【桃】"<<endl;break;
case 201:cout<<"【过河拆桥】"<<endl;break;
case 202:cout<<"【顺手牵羊】"<<endl;break;
case 203:cout<<"【无中生有】"<<endl;break;
case 204:cout<<"【决斗】"<<endl;break;
case 205:cout<<"【借刀杀人】"<<endl;break;
case 206:cout<<"【桃园结义】"<<endl;break;
case 207:cout<<"【五谷丰登】"<<endl;break;
case 208:cout<<"【南蛮入侵】"<<endl;break;
case 209:cout<<"【万箭齐发】"<<endl;break;
case 210:cout<<"【无懈可击】"<<endl;break;
case 251:cout<<"【乐不思蜀】"<<endl;break;
case 252:cout<<"【闪电】"<<endl;break;
case 301:cout<<"【诸葛连弩(1)】"<<endl;break;
case 302:cout<<"【雌雄双股剑(2)】"<<endl;break;
case 303:cout<<"【青釭剑(2)】"<<endl;break;
case 304:cout<<"【青龙偃月刀(3)】"<<endl;break;
case 305:cout<<"【丈八蛇矛(3)】"<<endl;break;
case 306:cout<<"【贯石斧(3)】"<<endl;break;
case 307:cout<<"【方天画戟(4)】"<<endl;break;
case 308:cout<<"【麒麟弓(5)】"<<endl;break;
case 331:cout<<"【八卦阵】"<<endl;break;
case 361:cout<<"【赤兔(-1)】"<<endl;break;
case 362:cout<<"【大宛(-1)】"<<endl;break;
case 363:cout<<"【紫辛(-1)】"<<endl;break;
case 381:cout<<"【爪黄飞电(+1)】"<<endl;break;
case 382:cout<<"【的卢(+1)】"<<endl;break;
case 383:cout<<"【绝影(+1)】"<<endl;break;
default:printf("类型参数错误!");break;
}
}
};
void Qishixipai(pai A[2][4][13],pai paidui[104])
{
int i,m,x,y,z,a[104]={0};
srand((unsigned)time(NULL));
for(i=1;i<=104;i++)
{
while(a[m=rand()%104]);
a[m]=i;
}
for(i=0;i<=103;i++)
{
x=(a[i]-1)/52;
y=((a[i]-1)-52*x)/13;
z=(a[i]-1)%13;
paidui[i]=A[x][y][z];
}
}
void Xipai(pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int i,m,a[104]={0};
srand((unsigned)time(NULL));
for(i=1;i<=(*qipaishu);i++)
{
while(a[m=rand()%(*qipaishu)]);
a[m]=i;
}
for(i=0;i<=((*qipaishu)-1);i++)
{
paidui[i]=qipaidui[a[i]];
qipaidui[a[i]].leixing=-1;
(*paiduishu)++;
(*qipaishu)--;
}
for(i=(*paiduishu);i<=103;i++)paidui[i].leixing=-1;
}
pai Mo1pai(pai A[104],int *x,pai B[104],int*y,int *b)
{
pai p;
if((*x)==0)Xipai(A,x,B,y);
else if((*x)<0)printf("摸牌参数错误!");
else;
p=A[104-(*x)];
(*x)--;
(*b)++;
return(p);
}
struct wujiang
{
char name;
int tili;
int tilishangxian;
int shoupaishangxian;
int huihekaishi;
int panding;
int mopai;
int chupai;
int qipai;
int huihejieshu;
int juese;
pai shoupai[20];
int shoupaishu;
pai zhuangbei[4];
int zhuangbeishu;
pai pandingpai[3];
int pandingshu;
int juli[1];
void Kanshoupai()
{
printf("玩家当前手牌:\n");
if(shoupaishu)
{
int m;
for(m=0;m<=(shoupaishu-1);m++)
{
printf("%d ",m);
(shoupai[m]).Kanpai();
}
}
else printf("空城!\n");
printf("\n");
}
void Kanzhuangbei()
{
if(juese)printf("玩家");
else printf("电脑");
printf("当前装备:\n");
printf("0 武器: ");
if((zhuangbei[0]).leixing==-1)printf("空\n");
else (zhuangbei[0]).Kanpai();
printf("1 防具: ");
if((zhuangbei[1]).leixing==-1)printf("空\n");
else (zhuangbei[1]).Kanpai();
printf("2 进攻马: ");
if((zhuangbei[2]).leixing==-1)printf("空\n");
else (zhuangbei[2]).Kanpai();
printf("3 防御马: ");
if((zhuangbei[3]).leixing==-1)printf("空\n");
else (zhuangbei[3]).Kanpai();
printf("\n");
}
void Kanpandingpai()
{
if(juese)printf("玩家");
else printf("电脑");
printf("当前判定区:\n");
if((pandingpai[0]).leixing==-1)printf("空\n");
else
{
printf("0 ");
(pandingpai[0]).Kanpai();
if((pandingpai[1]).leixing==-1);
else
{
printf("1 ");
(pandingpai[1]).Kanpai();
if((pandingpai[2]).leixing==-1);
else
{
printf("2 ");
(pandingpai[2]).Kanpai();
}
}
}
}
};
void Mopai(int*shoupaishu,pai shoupai[20],pai A[104],int *x,pai B[104],int*y,int juese)
{
if(juese)printf("玩家从牌堆摸2张牌\n");
else printf("电脑从牌堆摸2张牌\n");
pai p;
p=Mo1pai(A,x,B,y,shoupaishu);
shoupai[*shoupaishu-1]=p;
pai q;
q=Mo1pai(A,x,B,y,shoupaishu);
shoupai[*shoupaishu-1]=q;
int m;
if(juese)
{
printf("玩家当前手牌:\n");
for(m=0;m<=(*shoupaishu-1);m++)
{
printf("%d ",m);
(shoupai[m]).Kanpai();
}
}
printf("牌堆还剩%100000000000000000000000张牌!\n\n",*x);
}
void Qishishoupai(wujiang *w,pai A[104],int *x,pai B[104],int*y)
{
pai a;
a=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=a;
pai b;
b=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=b;
pai c;
c=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=c;
pai d;
d=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=d;
int m;
if((*w).juese)printf("玩家从牌堆摸4张牌\n");
else printf("电脑从牌堆摸4张牌\n");
if((*w).juese)
{
printf("玩家当前手牌:\n");
for(m=0;m<=((*w).shoupaishu-1);m++)
{
printf("%d ",m);
((*w).shoupai[m]).Kanpai();
}
}
printf("牌堆还剩%d张牌!\n\n",*x);
}
void Panding(pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
paidui[*paiduishu].Kanpai();
qipaidui[*qipaishu]=paidui[*paiduishu];
(*paiduishu)--;
(*qipaishu)++;
}
pai Zhangba(wujiang*w,pai qipaidui[104],int*qipaishu)
{
int x,y;
pai p;
for(;;)
{
int i,j;
printf("请输入任意两张手牌之前的编号,以空格隔开,以回车结束!\n");
scanf("%d",&x);
scanf("%d",&y);
if((x>=0)&&(x<(*w).shoupaishu)&&(y>=0)&&(y<(*w).shoupaishu-1))
{
switch((((*w).shoupai[x].huase)%2)+(((*w).shoupai[y].huase)%2))
{
case 0:p.yanse=0;break;
case 2:p.yanse=1;break;
case 1:p.yanse=2;break;
default:printf("【丈八蛇矛】函数参数错误!\n");
}
qipaidui[*qipaishu]=(*w).shoupai[x];
(*w).shoupai[x].leixing=-1;
((*w).shoupaishu)--;
(*qipaishu)++;
qipaidui[*qipaishu]=(*w).shoupai[y];
(*w).shoupai[y].leixing=-1;
((*w).shoupaishu)--;
(*qipaishu)++; printf("弃牌数:%d",*qipaishu);
for(i=0;i<=(((*w).shoupaishu)+1);i++)
{
if((*w).shoupai[i].leixing==-1)
{
for(j=i+1;j<=(((*w).shoupaishu)+2);j++)
(*w).shoupai[j-1]=(*w).shoupai[j];
i--;
}
}
printf("玩家把:\n");
qipaidui[(*qipaishu)-2].Kanpai();
qipaidui[(*qipaishu)-1].Kanpai();
printf("当作一张");
switch(p.yanse)
{
case 0:printf("黑色");break;
case 2:printf("红色");break;
case 1:printf("无色");break;
default:printf("绿色");break;
}
printf("无点数的【杀】");
p.dianshu=-1;
p.leixing=101;
return p;
break;
}
printf("你将两张空气当作一张空气属性的【杀】使用或打出!\n");
}
}
int Xuanpai(wujiang*w,int t)
{
int x;
if((*w).juese)
{
for(;;)
{
printf("出牌请输入手牌之前的编号,以回车结束!\n如果你想结束出牌阶段,请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if((x>=-1&&x<((*w).shoupaishu))||((x==100)&&((*w).zhuangbei[0].leixing==305)))
{
return x;
break;
}
printf("你打出了一张空气!\n");
}
}
else return t;
}
pai Panpai(wujiang*w1,int*sha,int y,pai qipaidui[104],int*qipaishu)
{
pai p,q;
p.leixing=0;
q.leixing=-1;
if(y==-1)return q;
else
{
if(y==100)
{
if((*sha)>0)
{
q=Zhangba(w1,qipaidui,qipaishu);
printf("使用!\n");
return q;
}
else
{
printf("当前回合使用【杀】的次数已用尽,你也不能使用【丈八蛇矛】效果!\n");
return p;
}
}
switch((*w1).shoupai[y].leixing)
{
case 101:
if(((*sha)>0)||((*w1).zhuangbei[0].leixing==301))
{
if(((*w1).zhuangbei[0].leixing==301))printf("武器【诸葛连弩】效果被触发!\n");
return (*w1).shoupai[y];
break;
}
else
{
if((*w1).juese)printf("当前回合使用【杀】的次数已用尽,你不能使用【杀】!\n");
return p;break;
}
case 102:
if((*w1).juese)
printf("当前不需要响应任何操作,你不能主动打出【闪】!\n");
return p;break;
case 103:
if(((*w1).tili)<((*w1).tilishangxian))
{
return (*w1).shoupai[y];
break;
}
else
{
if((*w1).juese)
printf("你并未受伤,不能对自己使用【桃】!\n");
}
return p;break;
case 210:
if((*w1).juese)
printf("当前不需要响应任何锦囊,你不能主动打出【无懈可击】!\n");
return p;break;
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 251:
case 252:
case 301:
case 302:
case 303:
case 304:
case 305:
case 306:
case 307:
case 308:
case 331:
case 361:
case 362:
case 363:
case 381:
case 382:
case 383:return (*w1).shoupai[y];break;
default:printf("手牌类型参数错误!\n");return p;break;
}
}
}
int Mubiao(pai p,wujiang *w1,wujiang *w2,int*sha)
{
int x;
switch(p.leixing)
{
case 101:
if((*w1).juese)
{
printf("请选择【杀】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
if((*w1).zhuangbei[0].changdu>=(*w1).juli[0])
{
(*sha)--;
return((*w2).juese);
}
else
{
printf("武器长度不够!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
if((*w1).zhuangbei[0].changdu>=(*w1).juli[0])
{
(*sha)--;
return((*w2).juese);
}
else return -2;
}
break;
case 103:return((*w1).juese);break;
case 201:
if((*w1).juese)
{
printf("请选择【过河拆桥】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
if((*w2).shoupaishu||(*w2).zhuangbeishu||(*w2).pandingshu)return((*w2).juese);
else
{
printf("目标没有牌!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else return((*w2).juese);
break;
case 202:
if((*w1).juese)
{
printf("请选择【顺手牵羊】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
if(((*w2).shoupaishu||(*w2).zhuangbeishu||(*w2).pandingshu)&&((*w1).juli[0]<=1))return((*w2).juese);
else
{
printf("目标没有牌!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
if((*w1).juli[0]<=1)return((*w2).juese);
else return -2;
}
break;
case 203:
return((*w1).juese);break;
case 204:
if((*w1).juese)
{
printf("请选择【决斗】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)return((*w2).juese);
else
{
printf("目标错误!\n");
return -2;
}
}
else return((*w2).juese);
break;
case 205:
int y;
if((*w1).juese)
{
printf("请选择【借刀杀人】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x!=0)
{
printf("目标错误!\n");
return -2;
}
else
{
if(((*w2).zhuangbei[0]).leixing<=300||((*w2).zhuangbei[0]).leixing>=331)
{
printf("目标装备区里没有武器!\n");
return -2;
}
else
{
printf("请选择【杀】的目标!\n提示:【杀】的目标必须在【借刀杀人】的目标的攻击范围之内!\n输入目标前的编号,以回车结束!\n0 玩家\n");
scanf("%d",&y);
if(y!=0)
{
printf("目标错误!\n");
return -2;
}
else
{
if(((*w2).zhuangbei[0].changdu)<(*w2).juli[0])
{
printf("武器距离不够!\n");
return -2;
}
else
return((*w2).juese);
}
}
}
}
else
{
if(((*w2).zhuangbei[0]).leixing<=300||((*w2).zhuangbei[0]).leixing>=331)return -2;
else
{
if(((*w2).zhuangbei[0].changdu)<(*w2).juli[0])return -2;
else return((*w2).juese);
}
}
break;
case 206:
case 207:return 99;break;
case 208:
case 209:return 100;break;
case 251:
if((*w1).juese)
{
printf("请选择【乐不思蜀】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
int i;
for(i=0;i<=2;i++)
{
if((*w2).pandingpai[i].leixing==251)
i=-1;
break;
}
if(i==-1)
{
printf("目标判定区里不能同时存在两张相同的延时类锦囊!\n");
return -2;
}
else return((*w2).juese);
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
int i;
for(i=0;i<=2;i++)
{
if((*w2).pandingpai[i].leixing==251)
i=-1;
break;
}
if(i==-1)return -2;
else return((*w2).juese);
}
break;
case 252:
int i;
for(i=0;i<=2;i++)
{
if((*w1).pandingpai[i].leixing==252)
i=-1;
break;
}
if(i==-1)
{
if((*w1).juese)printf("目标判定区里不能同时存在两张相同的延时类锦囊!\n");
return -2;
}
else return ((*w1).juese);
break;
case 301:
case 302:
case 303:
case 304:
case 305:
case 306:
case 307:
case 308:
case 331:
case 361:
case 362:
case 363:
case 381:
case 382:
case 383:return((*w1).juese);break;
default:return -2;break;
}
}
void Da1pai(wujiang *w1,wujiang*w2,pai qipaidui[104],int *qipaishu,int x)
{
int i;
if((x<0||x>=((*w1).shoupaishu))&&x!=100)
printf("你的牌呢?!\n");
else
{
switch(((*w1).shoupai)[x].leixing)
{
case 101:
case 102:
case 103:
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 210:
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
break;
case 251:
for(i=1;i>=0;i--)(*w2).pandingpai[i+1]=(*w2).pandingpai[i];
(*w2).pandingpai[0]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
((*w2).pandingshu)++;
break;
case 252:
for(i=1;i>=0;i--)(*w1).pandingpai[i+1]=(*w1).pandingpai[i];
(*w1).pandingpai[0]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
((*w1).pandingshu)++;
break;
case 301:
case 302:
case 303:
case 304:
case 305:
case 306:
case 307:
case 308:
if((*w1).zhuangbei[0].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[0];
(*qipaishu)++;
}
(*w1).zhuangbei[0]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
case 331:
if((*w1).zhuangbei[1].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[1];
(*qipaishu)++;
}
(*w1).zhuangbei[1]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
case 361:
case 362:
case 363:
if((*w1).zhuangbei[2].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[2];
(*qipaishu)++;
}
(*w1).zhuangbei[2]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
case 381:
case 382:
case 383:
if((*w1).zhuangbei[3].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[3];
(*qipaishu)++;
}
(*w1).zhuangbei[3]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
default:break;
}
}
}
void Miaoshu(pai p,int juese,int duixiang)
{
if(juese==0)printf("电脑");
else if(juese==1)printf("玩家");
else printf("角色参数错误!\n");
if(p.leixing<=300&&p.leixing>100)
{
switch(duixiang)
{
case -1:printf("打出");break;
case 0:printf("对电脑使用");break;
case 1:printf("对玩家使用");break;
case 99:printf("使用");break;
case 100:printf("对所有人使用");break;
default:printf("对象参数错误\n");break;
}
}
else if(p.leixing>=301&&p.leixing<=400)
printf("装备");
else printf("你出的是什么东西?\n");
p.Kanpai();
if(!juese&&(p.leixing==101||p.leixing==204||p.leixing==205||p.leixing==207||p.leixing==208||p.leixing==209))printf("请响应!\n");
}
int Wuxie(pai *p,wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu,int a)
{
int x;
if((*w1).juese)
{
printf("是否使用【无懈可击】响应?\n\n");
for(;;)
{
(*w1).Kanshoupai();
printf("如果要使用【无懈可击】请输入手牌之前编号,不需要请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==210)
{
printf("电脑使用");
((*w2).shoupai)[x].Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w2).shoupai)[x];
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
a++;
break;
}
}
break;
}
else if((*w1).shoupai[x].leixing==210)
{
printf("玩家使用");
((*w1).shoupai)[x].Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w1).shoupai)[x];
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(int i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
(*w1).Kanshoupai();
a++;
break;
}
else printf("你确定你使用的是【无懈可击】?\n");
}
}
else
{
printf("是否使用【无懈可击】响应?\n");
for(;;)
{
(*w2).Kanshoupai();
printf("如果要使用【无懈可击】请输入手牌之前编号,不需要请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if(x==-1)break;
else if((*w2).shoupai[x].leixing==210)
{
printf("玩家使用");
((*w2).shoupai)[x].Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w2).shoupai)[x];
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
(*w2).Kanshoupai();
a++;
break;
}
else printf("你确定你使用的是【无懈可击】?\n");
}
}
return a;
}
int Qiutao(wujiang*w,pai qipaidui[104],int*qipaishu)
{
int x;
if((*w).juese)
{
for(;;)
{
printf("如果要使用【桃】请输入手牌之前的编号,不需要请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
return -1;
break;
}
else if((*w).shoupai[x].leixing==103)
{
qipaidui[*qipaishu]=((*w).shoupai)[x];
for(int i=x+1;i<=((*w).shoupaishu);i++)((*w).shoupai)[i-1]=((*w).shoupai)[i];
((*w).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你使用的是【桃】?\n");
}
}
else
{
for(x=0;x<((*w).shoupaishu);x++)
{
if((*w).shoupai[x].leixing==103)
{
qipaidui[*qipaishu]=((*w).shoupai)[x];
for(int i=x+1;i<=((*w).shoupaishu);i++)((*w).shoupai)[i-1]=((*w).shoupai)[i];
((*w).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
return -1;
}
}
int Binsi(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
if(((*w2).tili)>0)return 0;
else
{
int i;
if((*w1).juese)
{
for(;;)
{
printf("电脑濒死,是否使用【桃】?\n");
i=Qiutao(w1,qipaidui,qipaishu);
if(i==0)((*w2).tili)++;
if((i==-1)||((*w2).tili>0))break;
}
if((*w2).tili>0)return 0;
else
{
for(;;)
{
i=Qiutao(w2,qipaidui,qipaishu);
if(i==0)((*w2).tili)++;
if((i==-1)||((*w2).tili>0))break;
}
if((*w2).tili>0)return 0;
else return -1;
}
}
else
{
for(;;)
{
printf("玩家濒死,是否使用【桃】?\n");
i=Qiutao(w2,qipaidui,qipaishu);
if(i==0)((*w2).tili)++;
if((i==-1)||((*w2).tili>0))break;
}
if((*w2).tili>0)return 0;
else return -1;
}
}
}
int Shan(wujiang*w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int x;
if((*w2).juese)
{
if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing!=303))
{
for(;;)
{
int m;
printf("是否发动【八卦阵】防具效果?\n0 否\n1 是\n请输入选项之前的编号,以回车结束!\n");
scanf("%d",&m);
if(m==1)
{
Panding(paidui,paiduishu,qipaidui,qipaishu);
if(qipaidui[(*qipaishu)-1].huase%2)
{
printf("【八卦阵】判定成功!\n");
return 0;
}
}
else if(m==0)
{
printf("【八卦阵】判定失败!\n");
break;
}
else printf("你确定你输入的是“0”或“1”?\n");
}
}
else if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing==303))printf("【青釭剑】锁定技被触发!\n");
for(;;)
{
printf("请输入手牌之前的编号,或者输入“-1”放弃打出【闪】,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
return -1;
break;
}
else if((*w2).shoupai[x].leixing==102)
{
printf("玩家打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你打出的是【闪】?\n");
}
}
else
{
if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing!=303))
{
Panding(paidui,paiduishu,qipaidui,qipaishu);
if(qipaidui[(*qipaishu)-1].huase%2)
{
printf("【八卦阵】判定成功!\n");
return 0;
}
else printf("【八卦阵】判定失败!\n");
}
else if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing==303))printf("【青釭剑】锁定技被触发!\n");
int i;
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==102)
{
printf("电脑打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
return -1;
}
}
int Sha(wujiang *w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int x;
if((*w2).juese)
{
printf("请打出【闪】响应【杀】!否则你将受到1点伤害!\n");
x=Shan(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(x==-1)
{
int i;
((*w2).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else if(x==0&&((*w1).zhuangbei[0].leixing==306))
{
int i;
if(((*w1).shoupaishu)>=2)
{
printf("电脑弃掉:\n");
((*w1).shoupai)[0].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[0];
for(i=1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
((*w1).shoupai)[0].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[0];
for(i=1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
printf("发动【贯石斧】武器效果使【杀】造成伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else return 0;
}
else if(x==0&&((*w1).zhuangbei[0].leixing==304))
{
int i;
for(x=0;x<((*w1).shoupaishu);x++)
{
if((*w1).shoupai[x].leixing==101)
{
printf("电脑发动【青龙偃月刀】效果对玩家使用");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
i=Sha(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
return i;
break;
}
}
return 0;
}
}
else
{
x=Shan(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(x==-1)
{
if((*w1).zhuangbei[0].leixing==308)
{
for(;;)
{
printf("是否发动【麒麟弓】武器效果?\n0 否\n1 是\n");
scanf("%d",&x);
if(x==1)
{
if(((*w2).zhuangbei[2].leixing==-1)&&((*w2).zhuangbei[3].leixing==-1))
{
printf("电脑根本没有马,射你妹的马啊!\n");
break;
}
else
{
for(;;)
{
printf("0 ");
((*w2).zhuangbei[2]).Kanpai();
printf("1 ");
((*w2).zhuangbei[3]).Kanpai();
printf("请选择要弃掉的马,输入之前的编号,以回车结束!\n");
scanf("%d",&x);
if((x==0)&&((*w2).zhuangbei[2].leixing!=-1))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei)[2].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[2];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[2].leixing=-1;
((*w2).juli[0])++;
break;
}
else if((x==1)&&((*w2).zhuangbei[3].leixing!=-1))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei)[3].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[3];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[3].leixing=-1;
((*w1).juli[0])--;
break;
}
else printf("射你妹的马!");
}
break;
}
}
else if(x==0)break;
else printf("键盘上的“0”和“1”被你吃了吗?\n");
}
}
int i;
((*w2).tili)--;
printf("玩家对电脑造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else if(x==0&&((*w1).zhuangbei[0].leixing==306))
{
for(;;)
{
printf("是否发动【贯石斧】武器效果?\n0 否\n1 是\n");
scanf("%d",&x);
if(x==1)
{
int i;
if((*w1).shoupaishu+(*w1).zhuangbeishu<=2)
{
printf("你除了【贯石斧】以外连2张牌都没有,发动你妹的效果!\n");
break;
}
else
{
printf("请分别弃掉两张牌!\n");
for(i=0;i<=2;i++)
{
for(;;)
{
printf("请选择区域:\n0 手牌\n1 装备\n");
scanf("%d",&x);
if(x==0&&((*w1).shoupaishu==0))printf("你根本没有手牌,弃你妹啊!\n");
else if(x==1&&((*w1).zhuangbeishu==1))printf("你根本没有别的装备,弃你妹啊!\n");
else if(x>=0&&x<=1)break;
else printf("键盘上的“0”和“1”被你吃了吗?\n");
}
if(x==0)
{
for(;;)
{
(*w1).Kanshoupai();
printf("弃牌请输入手牌之前的编号,以回车结束!\n");
scanf("%d",&x);
if(x>=0&&x<((*w1).shoupaishu))break;
else printf("弃你妹的手牌!\n");
}
printf("你弃掉了");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
}
else
{
for(;;)
{
(*w1).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&x);
if((((*w1).zhuangbei[x]).leixing!=-1)&&(x>=0)&&(x<=3))
{
printf("你弃掉了");
((*w1).zhuangbei)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).zhuangbei)[x];
((*w1).zhuangbeishu)--;
(*qipaishu)++;
((*w1).zhuangbei)[x].leixing=-1;
break;
}
else printf("弃你妹的装备!\n");
}
}
}
}
printf("玩家发动【贯石斧】武器效果使【杀】造成伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
else if(x==0)break;
else printf("键盘上的“0”和“1”被你吃了吗?\n");
}
}
else if(x==0&&((*w1).zhuangbei[0].leixing==304))
{
for(;;)
{
printf("是否发动【青龙偃月刀】武器效果?\n0 否\n1 是\n");
scanf("%d",&x);
if(x==1)
{
for(;;)
{
printf("请对电脑使用一张【杀】!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
(*w1).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
return 0;
break;
}
else if((*w1).shoupai[x].leixing==101)
{
int i;
printf("玩家对电脑使用");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
i=Sha(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
return i;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
else if(x==0)
{
return 0;
break;
}
else printf("你确定你输入的是“0”或“1”?\n");
}
}
else return 0;
}
return 0;
}
void Tao(wujiang*w1)
{
((*w1).tili)++;
if((*w1).juese)printf("玩家");
else printf("电脑");
printf("恢复了1点体力!\n");
if(((*w1).tili)>((*w1).tilishangxian))printf("你被撑死了!\n");
}
void Chai(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
int i,x,y;
if((*w1).juese)
{
for(;;)
{
if((*w2).shoupaishu+(*w2).zhuangbeishu+(*w2).pandingshu==0)
{
printf("对方空城,拆你妹啊!\n");
break;
}
else
{
printf("请选择想拆的区域,输入选项之前的编号,以回车结束!\n0 手牌\n1 装备区\n2 判定区\n");
scanf("%d",&x);
if(x==0&&((*w2).shoupaishu==0))printf("你拆掉了一张空气!\n");
else if(x==1&&((*w2).zhuangbeishu==0))printf("你拆掉了一张空气!\n");
else if(x==2&&((*w2).pandingshu==0))printf("你拆掉了一张空气!\n");
else if(x>=0&&x<=2)break;
else printf("你拆掉了太空区里的一张牌!\n");
}
}
switch(x)
{
case 0:
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("你弃掉了电脑的");
((*w2).shoupai)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
break;
case 1:
for(;;)
{
(*w2).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((((*w2).zhuangbei[y]).leixing!=-1)&&(y>=0)&&(y<=3))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[y];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[y].leixing=-1;
if(!y)((*w2).zhuangbei)[y].changdu=1;
else if(y==2)((*w2).juli[0])++;
else if(y==3)((*w1).juli[0])--;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
case 2:
for(;;)
{
(*w2).Kanpandingpai();
printf("请输入判定牌之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((*w2).pandingpai[y].leixing!=-1)
{
printf("你弃掉了电脑的");
((*w2).pandingpai)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).pandingpai)[y];
((*w2).pandingshu)--;
(*qipaishu)++;
((*w2).pandingpai)[y].leixing=-1;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
default:break;
}
}
else
{
if((*w2).zhuangbeishu)
{
if((*w2).zhuangbei[1].leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[1].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[1];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[1].leixing=-1;
}
else if((*w2).zhuangbei[3].leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[3].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[3];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[3].leixing=-1;
((*w1).juli[0])--;
}
else if((*w2).zhuangbei[0].leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[0].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
}
else
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[2].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[2];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[2].leixing=-1;
((*w2).juli[0])++;
}
}
else
{
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("电脑弃掉了玩家的手牌");
((*w2).shoupai)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
}
}
}
void Qian(wujiang *w1,wujiang *w2)
{
int i,x,y;
if((*w1).juese)
{
for(;;)
{
if((*w2).shoupaishu+(*w2).zhuangbeishu+(*w2).pandingshu==0)
{
printf("对方空城啦!你牵走了一张寂寞!\n");
break;
}
else
{
printf("请选择想牵的区域,输入选项之前的编号,以回车结束!\n0 手牌\n1 装备区\n2 判定区\n");
scanf("%d",&x);
if(x==0&&((*w2).shoupaishu==0))printf("你牵走了一张空气!\n");
else if(x==1&&((*w2).zhuangbeishu==0))printf("你牵走了一张空气!\n");
else if(x==2&&((*w2).pandingshu==0))printf("你牵走了一张空气!\n");
else if(x>=0&&x<=2)break;
else printf("你牵走了太空区里的一张牌!\n");
}
}
switch(x)
{
case 0:
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("你牵走了电脑的");
((*w2).shoupai)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
((*w1).shoupaishu)++;
break;
case 1:
for(;;)
{
(*w2).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((((*w2).zhuangbei[y]).leixing!=-1)&&(y>=0)&&(y<=3))
{
printf("你牵走了电脑的");
((*w2).zhuangbei)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[y];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[y].leixing=-1;
if(!y)((*w2).zhuangbei[y]).changdu=1;
else if(y==2)((*w2).juli[0])++;
else if(y==3)((*w1).juli[0])--;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
case 2:
for(;;)
{
(*w2).Kanpandingpai();
printf("请输入判定牌之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((*w2).pandingpai[y].leixing!=-1)
{
printf("你牵走了电脑的");
((*w2).pandingpai)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).pandingpai)[y];
((*w2).pandingshu)--;
((*w1).shoupaishu)++;
((*w2).pandingpai)[y].leixing=-1;
break;
}
else printf("你牵走了一张空气!\n");
}
break;
default:break;
}
}
else
{
if((*w2).zhuangbeishu)
{
if((*w2).zhuangbei[1].leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[1].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[1];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[1].leixing=-1;
}
else if((*w2).zhuangbei[3].leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[3].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[3];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[3].leixing=-1;
((*w1).juli[0])--;
}
else if((*w2).zhuangbei[0].leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[0].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
}
else
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[2].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[2];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[2].leixing=-1;
((*w2).juli[0])--;
}
}
else
{
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("电脑牵走了玩家的手牌");
((*w2).shoupai)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
((*w1).shoupaishu)++;
}
}
}
void Wuzhong(wujiang*w1,pai A[104],int *x,pai B[104],int*y)
{
Mopai(&((*w1).shoupaishu),(*w1).shoupai,A,x,B,y,(*w1).juese);
}
int Juedou(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
int i,j,x;
if((*w1).juese)
{
for(;;)
{
j=0;
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==101)
{
printf("电脑打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
}
if(!j)
{
printf("玩家对电脑造成1点伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
j=0;
for(;;)
{
printf("请打出一张【杀】响应【决斗】,否则你将受到1点伤害!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w1).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w1).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
int i;
((*w1).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w2,w1,qipaidui,qipaishu);
return i;
break;
}
else if(((*w1).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w1,qipaidui,qipaishu);
p.paifu=-1;
printf("打出!\n");
j=1;
break;
}
else if((*w1).shoupai[x].leixing==101)
{
printf("玩家打出");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
}
else
{
for(;;)
{
j=0;
for(;;)
{
printf("请打出一张【杀】响应【决斗】,否则你将受到1点伤害!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w1).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w2).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
int i;
((*w2).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
else if(((*w2).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("打出!\n");
j=1;
break;
}
else if((*w2).shoupai[x].leixing==101)
{
printf("玩家打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
j=0;
for(x=0;x<((*w1).shoupaishu);x++)
{
if((*w1).shoupai[x].leixing==101)
{
printf("电脑打出");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(int i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
}
if(!j)
{
printf("玩家对电脑造成1点伤害!\n");
((*w2).tili)--;
i=Binsi(w2,w1,qipaidui,qipaishu);
return i;
break;
}
}
}
}
int Jiedao(wujiang*w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int i,j=0,x;
if((*w1).juese)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==101)
{
printf("电脑对玩家使用");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
}
if(j)
{
i=Sha(w2,w1,paidui,paiduishu,qipaidui,qipaishu);
return i;
printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
}
else
{
printf("电脑放弃使用【杀】,玩家获得电脑的武器");
(*w2).zhuangbei[0].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
(*w1).Kanshoupai();
return 0;
}
}
else
{
for(;;)
{
printf("请对电脑使用一张【杀】,否则电脑将获得你的武器!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w2).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w2).Kanshoupai();
scanf("%d",&x);
if(x==-1)break;
else if(((*w2).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("使用!\n");
j=1;
break;
}
else if((*w2).shoupai[x].leixing==101)
{
printf("玩家对电脑使用");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你使用的是【杀】?\n");
}
if(j)
{
i=Sha(w2,w1,paidui,paiduishu,qipaidui,qipaishu);
return i;
printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
else
{
printf("玩家放弃使用【杀】,电脑获得玩家的武器");
((*w2).zhuangbei)[0].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
return 0;
}
}
}
void Taoyuan(wujiang*w)
{
if((*w).tili<(*w).tilishangxian)
{
((*w).tili)++;
if((*w).juese)printf("玩家");
else printf("电脑");
printf("恢复1点体力!\n");
}
}
void Kaipai(pai paidui[104],int* paiduishu,int renshu,pai wugu[10])
{
int i;
printf("五谷丰登开牌:\n");
for(i=1;i<=renshu;i++)
{
wugu[i-1]=paidui[104-(*paiduishu)];
(*paiduishu)--;
printf("%d ",i-1);
wugu[i-1].Kanpai();
}
}
void Qupai(pai wugu[10],wujiang*w)
{
int i,x;
printf("五谷丰登开牌:\n");
for(i=0;(wugu[i].leixing)!=-1;i++)
{
printf("%d ",i);
wugu[i].Kanpai();
}
if((*w).juese)
{
for(;;)
{
printf("请选择你想要的卡牌,输入卡牌之前的编号,以回车结束!\n");
scanf("%d",&x);
if(wugu[x].leixing!=-1)
{
printf("玩家选择");
wugu[x].Kanpai();
(*w).shoupai[(*w).shoupaishu]=wugu[x];
((*w).shoupaishu)++;
for(i=x+1;i<=9;i++)wugu[i-1]=wugu[i];
wugu[9].leixing=-1;
break;
}
printf("你选择了一张空气加入手牌!");
}
}
else
{
printf("电脑选择");
wugu[0].Kanpai();
(*w).shoupai[(*w).shoupaishu]=wugu[0];
((*w).shoupaishu)++;
for(i=1;i<=9;i++)wugu[i-1]=wugu[i];
wugu[9].leixing=-1;
}
}
void Rengpai(pai wugu[10],pai qipaidui[104],int*qipaishu)
{
int i;
for(i=0;wugu[i].leixing!=-1;i++)
{
qipaidui[*qipaishu]=wugu[i];
(*qipaishu)++;
wugu[i].leixing=-1;
}
}
int Nanman(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
int i,x;
if((*w1).juese)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==101)
{
printf("电脑打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
printf("玩家对电脑造成1点伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else
{
for(;;)
{
printf("请打出一张【杀】响应【南蛮入侵】,否则你将受到1点伤害!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w2).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w2).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
int i;
((*w2).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
else if(((*w2).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("使用!\n");
return 0;
break;
}
else if((*w2).shoupai[x].leixing==101)
{
printf("玩家打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
}
int Wanjian(wujiang*w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int i;
i=Shan(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1)
{
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else return 0;
}
int Chupai(pai paidui[104],pai qipaidui[104],int *paiduishu,int*qipaishu,wujiang*w1,wujiang*w2,pai yuanshipaidui[2][4][13])
{
pai p1;
int sha=1;int y=-1,i,t=((*w1).shoupaishu)-1;
for(;;t--)
{
if((*w1).juese)
{
printf("\n电脑当前手牌数:%d\n",((*w2).shoupaishu));
(*w2).Kanzhuangbei();
(*w1).Kanshoupai();
(*w1).Kanzhuangbei();
}
int j=0;
if((*w1).juese&&((*w1).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
y=Xuanpai(w1,t);
p1=Panpai(w1,&sha,y,qipaidui,qipaishu);
if((p1).leixing==-1)break;
else if((p1).leixing==0)continue;
else
{
int duixiang;
duixiang=Mubiao(p1,w1,w2,&sha);
if(duixiang==-2)continue;
else
{
Da1pai(w1,w2,qipaidui,qipaishu,y);
Miaoshu(p1,((*w1).juese),duixiang);
if(!((*w1).juese))
{
printf("\n电脑当前手牌数:%d\n",((*w1).shoupaishu));
(*w1).Kanzhuangbei();
(*w2).Kanshoupai();
(*w2).Kanzhuangbei();
}
switch(p1.leixing)
{
case 101:
i=Sha(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1){return -1;break;}
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
break;
case 103:
Tao(w1);
break;
case 201:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Chai(w1,w2,qipaidui,qipaishu);
else;
if((*w1).juese)(*w1).Kanshoupai();
break;
case 202:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Qian(w1,w2);
else;
if((*w1).juese)(*w1).Kanshoupai();
break;
case 203:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Wuzhong(w1,paidui,paiduishu,qipaidui,qipaishu);
else;
break;
case 204:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Juedou(w1,w2,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 205:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Jiedao(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 206:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Taoyuan(w1);
j=0;
for(;;)
{
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Taoyuan(w2);
break;
case 207:
pai wugu[10];
for(i=1;i<=10;i++)wugu[i-1].leixing=-1;
Kaipai(paidui,paiduishu,2,wugu);
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Qupai(wugu,w1);
for(;;)
{
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Qupai(wugu,w2);
Rengpai(wugu,qipaidui,qipaishu); printf("弃牌数:%d\n",*qipaishu);
break;
case 208:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Nanman(w1,w2,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 209:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Wanjian(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 361:
case 362:
case 363:
((*w1).juli[0])--;break;
case 381:
case 382:
case 383:
((*w2).juli[0])++;break;
default:break;
}
printf("\n");
}
}
}
return 0;
}
void Qipai(pai shoupai[20],int *shoupaishu,pai qipaidui[104],int *qipaishu,int juese,int *shoupaishangxian)
{
int x;
if((*shoupaishu)>(*shoupaishangxian))
{
if(juese!=1&&juese!=0)printf("身份参数错误!");
int q=(*shoupaishu)-(*shoupaishangxian);
int i,j;
for(j=1;j<=q;j++)
{
for(;;)
{
if(juese)
{
printf("弃牌请输入手牌之前的编号,以回车结束!\n注:一次只能弃一张牌\n");
printf("手牌数:%d\n",*shoupaishu);
scanf("%d",&x);
if(x>=0&&x<(*shoupaishu))break;
else printf("你弃掉了一张空气!\n");
}
else
{
srand((unsigned)time(NULL));
x=rand()%(*shoupaishu);
break;
}
}
qipaidui[*qipaishu]=shoupai[x];
for(i=x+1;i<=(*shoupaishu);i++)shoupai[i-1]=shoupai[i];
(*shoupaishu)--;
if(juese)printf("弃牌阶段玩家弃置");
else printf("弃牌阶段电脑弃置");
qipaidui[*qipaishu].Kanpai();
(*qipaishu)++;
int m;
if(juese)
{
printf("玩家当前手牌:\n");
for(m=0;m<=(*shoupaishu-1);m++)
{
printf("%d ",m);
(shoupai[m]).Kanpai();
}
} printf("弃牌堆:%d\n",*qipaishu);
}
}
}
int Huihe(pai A[104],pai B[104],int *x,int *y,pai yuanshipaidui[2][4][13],wujiang *w1,wujiang *w2)
{
printf("\n回合开始阶段……\n");
switch((*w1).huihekaishi)
{
case 0:break;
default:printf("回合开始阶段参数错误!\n");break;
}
printf("判定阶段……\n");
int K=0;
if((*w1).pandingshu>0)
{
int i,j;
for(;(*w1).pandingshu;)
{
switch((*w1).pandingpai[0].leixing)
{
case 251:printf("【乐不思蜀】开始判定……\n"); break;
case 252:printf("【闪电】开始判定……\n");break;
default:printf("【??】开始判定……\n");break;
}
j=0;
pai p=((*w1).pandingpai[0]);
for(;;)//在判定之前询问【无懈】
{
i=Wuxie(&p,w2,w1,B,y,0);
if(!i)break;
j++;
i=Wuxie(&p,w1,w2,B,y,0);
if(!i)break;
j++;
}
switch((*w1).pandingpai[0].leixing)
{
case 251:
if(!(j%2))
{
printf("【乐不思蜀】的判定牌是:");
Panding(A,x,B,y);
if((B[(*y)-1].huase)!=1)
{
printf("【乐不思蜀】判定成功!\n");
if((*w1).juese)printf("玩家");
else printf("电脑");
printf("跳过出牌阶段!\n");
K=-1;
}
else printf("【乐不思蜀】判定失败!\n");
}
B[*y]=(*w1).pandingpai[0];
((*w1).pandingshu)--;
(*w1).pandingpai[0]=(*w1).pandingpai[1];
(*w1).pandingpai[1]=(*w1).pandingpai[2];
(*w1).pandingpai[2].leixing=-1;
(*y)++;
break;
case 252:
if(!(j%2))
{
printf("【闪电】的判定牌是:");
Panding(A,x,B,y);
if((B[(*y)-1].huase==0)&&(B[(*y)-1].dianshu>=1)&&(B[(*y)-1].dianshu<=8))
{
printf("【闪电】判定成功!\n");
if((*w1).juese)printf("玩家");
else printf("电脑");
printf("受到3点雷电伤害!");
((*w1).tili)=((*w1).tili)-3;
i=Binsi(w2,w1,B,y);
B[*y]=(*w1).pandingpai[0];
((*w1).pandingshu)--;
(*w1).pandingpai[0]=(*w1).pandingpai[1];
(*w1).pandingpai[1]=(*w1).pandingpai[2];
(*w1).pandingpai[2].leixing=-1;
(*y)++;
if(i==-1)return -1;
}
else
{
printf("【闪电】判定失败!\n");
(*w2).pandingpai[2]=(*w2).pandingpai[1];
(*w2).pandingpai[1]=(*w2).pandingpai[0];
(*w2).pandingpai[0]=(*w1).pandingpai[0];
(*w1).pandingpai[0]=(*w1).pandingpai[1];
(*w1).pandingpai[1]=(*w1).pandingpai[2];
(*w1).pandingpai[2].leixing=-1;
((*w1).pandingshu)--;
((*w2).pandingshu)++;
}
break;
}
default:printf("判定牌错误!");
} printf("弃牌数:%d\n",*y);
}
}
else if(!((*w1).pandingshu));
else printf("判定阶段参数错误!\n");
printf("摸牌阶段……\n");
switch((*w1).mopai)
{
case 0:Mopai(&((*w1).shoupaishu),(*w1).shoupai,A,x,B,y,(*w1).juese);break;
case -1:break;
default:printf("摸牌阶段参数错误!\n");break;
}
if(K==-1)goto M;
printf("出牌阶段……\n");
switch((*w1).chupai)
{
case 0:
{
int i;
i=Chupai(A,B,x,y,w1,w2,yuanshipaidui);
if(i==-1)
{
return -1;
break;
}
else break;
}
case -1:break;
default:printf("出牌阶段参数错误!\n");break;
}
M:
printf("弃牌阶段……\n");
switch((*w1).qipai)
{
case 0:
Qipai((*w1).shoupai,&((*w1).shoupaishu),B,y,(*w1).juese,&((*w1).tili));break;
default:printf("弃牌阶段参数错误!\n");break;
}
printf("回合结束阶段……\n");
switch((*w1).huihejieshu)
{
case 0:break;
default:printf("回合结束阶段参数错误!\n");break;
}
return 0;
}
int main()
{
void Kanshoupai(pai p);
pai yuanshipaidui[2][4][13],qipaidui[104],paidui[104];
wujiang wanjia,com;
com.tili=wanjia.tili=5;
com.tilishangxian=wanjia.tilishangxian=5;
com.huihekaishi=wanjia.huihekaishi=0;
com.panding=wanjia.panding=0;
com.mopai=wanjia.mopai=0;
com.chupai=wanjia.chupai=0;
com.qipai=wanjia.qipai=0;
com.huihejieshu=wanjia.huihejieshu=0;
com.shoupaishu=wanjia.shoupaishu=0;
com.pandingshu=wanjia.pandingshu=0;
com.zhuangbeishu=wanjia.zhuangbeishu=0;
com.juese=0;wanjia.juese=1;
pai p;
p.leixing=-1;
com.zhuangbei[0]=com.zhuangbei[1]=com.zhuangbei[2]=com.zhuangbei[3]=wanjia.zhuangbei[0]=wanjia.zhuangbei[1]=wanjia.zhuangbei[2]=wanjia.zhuangbei[3]=p;
com.zhuangbei[0].changdu=wanjia.zhuangbei[0].changdu=1;
com.pandingpai[0]=com.pandingpai[1]=com.pandingpai[2]=wanjia.pandingpai[0]=wanjia.pandingpai[1]=wanjia.pandingpai[2]=p;
com.juli[0]=wanjia.juli[0]=1;
int a,b,c;
for(a=0;a<=1;a++)
{
for(b=0;b<=3;b++)
{
for(c=0;c<=12;c++)
{
yuanshipaidui[a][b][c].paifu=a;
yuanshipaidui[a][b][c].huase=b;
yuanshipaidui[a][b][c].dianshu=c;
}
}
}
yuanshipaidui[0][0][0].leixing=204;
yuanshipaidui[0][0][1].leixing=331;
yuanshipaidui[0][0][2].leixing=201;
yuanshipaidui[0][0][3].leixing=201;
yuanshipaidui[0][0][4].leixing=304;yuanshipaidui[0][0][4].changdu=3;
yuanshipaidui[0][0][5].leixing=251;
yuanshipaidui[0][0][6].leixing=101;
yuanshipaidui[0][0][7].leixing=101;
yuanshipaidui[0][0][8].leixing=101;
yuanshipaidui[0][0][9].leixing=101;
yuanshipaidui[0][0][10].leixing=202;
yuanshipaidui[0][0][11].leixing=201;
yuanshipaidui[0][0][12].leixing=208;
yuanshipaidui[0][1][0].leixing=209;
yuanshipaidui[0][1][1].leixing=102;
yuanshipaidui[0][1][2].leixing=103;
yuanshipaidui[0][1][3].leixing=103;
yuanshipaidui[0][1][4].leixing=308;yuanshipaidui[0][1][4].changdu=5;
yuanshipaidui[0][1][5].leixing=103;
yuanshipaidui[0][1][6].leixing=103;
yuanshipaidui[0][1][7].leixing=103;
yuanshipaidui[0][1][8].leixing=103;
yuanshipaidui[0][1][9].leixing=101;
yuanshipaidui[0][1][10].leixing=101;
yuanshipaidui[0][1][11].leixing=103;
yuanshipaidui[0][1][12].leixing=102;
yuanshipaidui[0][2][0].leixing=204;
yuanshipaidui[0][2][1].leixing=101;
yuanshipaidui[0][2][2].leixing=101;
yuanshipaidui[0][2][3].leixing=101;
yuanshipaidui[0][2][4].leixing=101;
yuanshipaidui[0][2][5].leixing=101;
yuanshipaidui[0][2][6].leixing=101;
yuanshipaidui[0][2][7].leixing=101;
yuanshipaidui[0][2][8].leixing=101;
yuanshipaidui[0][2][9].leixing=101;
yuanshipaidui[0][2][10].leixing=101;
yuanshipaidui[0][2][11].leixing=205;
yuanshipaidui[0][2][12].leixing=205;
yuanshipaidui[0][3][0].leixing=204;
yuanshipaidui[0][3][1].leixing=102;
yuanshipaidui[0][3][2].leixing=102;
yuanshipaidui[0][3][3].leixing=102;
yuanshipaidui[0][3][4].leixing=102;
yuanshipaidui[0][3][5].leixing=101;
yuanshipaidui[0][3][6].leixing=101;
yuanshipaidui[0][3][7].leixing=101;
yuanshipaidui[0][3][8].leixing=101;
yuanshipaidui[0][3][9].leixing=101;
yuanshipaidui[0][3][10].leixing=102;
yuanshipaidui[0][3][11].leixing=103;
yuanshipaidui[0][3][12].leixing=101;
yuanshipaidui[1][0][0].leixing=252;
yuanshipaidui[1][0][1].leixing=302;yuanshipaidui[1][0][1].changdu=2;
yuanshipaidui[1][0][2].leixing=202;
yuanshipaidui[1][0][3].leixing=202;
yuanshipaidui[1][0][4].leixing=383;
yuanshipaidui[1][0][5].leixing=303;yuanshipaidui[1][0][5].changdu=2;
yuanshipaidui[1][0][6].leixing=208;
yuanshipaidui[1][0][7].leixing=101;
yuanshipaidui[1][0][8].leixing=101;
yuanshipaidui[1][0][9].leixing=101;
yuanshipaidui[1][0][10].leixing=210;
yuanshipaidui[1][0][11].leixing=305;yuanshipaidui[1][0][11].changdu=3;
yuanshipaidui[1][0][12].leixing=362;
yuanshipaidui[1][1][0].leixing=206;
yuanshipaidui[1][1][1].leixing=102;
yuanshipaidui[1][1][2].leixing=207;
yuanshipaidui[1][1][3].leixing=207;
yuanshipaidui[1][1][4].leixing=361;
yuanshipaidui[1][1][5].leixing=251;
yuanshipaidui[1][1][6].leixing=203;
yuanshipaidui[1][1][7].leixing=203;
yuanshipaidui[1][1][8].leixing=203;
yuanshipaidui[1][1][9].leixing=101;
yuanshipaidui[1][1][10].leixing=203;
yuanshipaidui[1][1][11].leixing=201;
yuanshipaidui[1][1][12].leixing=381;
yuanshipaidui[1][2][0].leixing=301;yuanshipaidui[1][2][0].changdu=1;
yuanshipaidui[1][2][1].leixing=331;
yuanshipaidui[1][2][2].leixing=201;
yuanshipaidui[1][2][3].leixing=201;
yuanshipaidui[1][2][4].leixing=382;
yuanshipaidui[1][2][5].leixing=251;
yuanshipaidui[1][2][6].leixing=208;
yuanshipaidui[1][2][7].leixing=101;
yuanshipaidui[1][2][8].leixing=101;
yuanshipaidui[1][2][9].leixing=101;
yuanshipaidui[1][2][10].leixing=101;
yuanshipaidui[1][2][11].leixing=210;
yuanshipaidui[1][2][12].leixing=210;
yuanshipaidui[1][3][0].leixing=301;yuanshipaidui[1][3][0].changdu=1;
yuanshipaidui[1][3][1].leixing=102;
yuanshipaidui[1][3][2].leixing=202;
yuanshipaidui[1][3][3].leixing=202;
yuanshipaidui[1][3][4].leixing=306;yuanshipaidui[1][3][4].changdu=3;
yuanshipaidui[1][3][5].leixing=102;
yuanshipaidui[1][3][6].leixing=102;
yuanshipaidui[1][3][7].leixing=102;
yuanshipaidui[1][3][8].leixing=102;
yuanshipaidui[1][3][9].leixing=102;
yuanshipaidui[1][3][10].leixing=102;
yuanshipaidui[1][3][11].leixing=307;yuanshipaidui[1][3][11].changdu=4;
yuanshipaidui[1][3][12].leixing=363;
int paiduishu=104;
int qipaishu=0;
printf("游戏开始! by cyh\n");
Qishixipai(yuanshipaidui,paidui);
Qishishoupai(&wanjia,paidui,&(paiduishu),qipaidui,&(qipaishu));
Qishishoupai(&com,paidui,&(paiduishu),qipaidui,&(qipaishu));
int i;
for(;;)
{
i=Huihe(paidui,qipaidui,&paiduishu,&qipaishu,yuanshipaidui,&wanjia,&com);
if(i==-1)break;
i=Huihe(paidui,qipaidui,&paiduishu,&qipaishu,yuanshipaidui,&com,&wanjia);
if(i==-1)break;
}
}
新手光能
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#define qdo 262
#define qre 294
#define qmi 330
#define qfa 349
#define qso 392
#define qla 440
#define qsi 494
#define re 578
#define mi 659
#define fa 698
#define so 784
#define la 880
#define si 988
#define do1 1046
#define re1 1175
#define mi1 1318
#define fa1 1480
#define so1 1568
#define la1 1760
#define si1 1976
#define sqdo 277
#define sqre 311
#define sqfa 370
#define sqso 415
#define sqla 466
#define sdo 554
#define sre 622
#define sfa 740
#define sso 831
#define sla 932
#define sdo1 1046
#define sre1 1245
#define sfa1 1480
#define sso1 1661
#define sla1 1865
using namespace std;
string cut;
int c=53,d=5,mm=0;
inline void Refresh(char q[][22], int grade, int gamespeed){
system("cls");
int i,j;
cout<<"\n";
for(i=0;i<22;i++){
cout<<"\t";
for(j=0;j<22;j++)
cout<<q[i][j]<<' ';
if(i==0) cout<<"\t等级为:"<<grade;
if(i==4) cout<<"\t自动前进时间";
if(i==6) cout<<"\t间隔为:"<<gamespeed<<"ms";
cout<<"\n";
}
}
string getTime(){
time_t timep;
time(&timep);
char tmp[64];
strftime(tmp, sizeof(tmp), "%Y-%m-%d %H:%M",localtime(&timep) );
return tmp;
}
void out(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
cout<<"\n";
}
void quicklyout(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(20);
}
cout<<"\n";
}
int main(){
system("mode con cols=400 lines=110");
int jb=0;
cout<<"加载中";
cout<<".";
Sleep(550);
cout<<".";
Sleep(500);
cout<<".";
Sleep(500);
system("cls");
system("color 8e");
out("欢迎来到包包工作室(1.3)~~~\n作者:中国红客");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
system("pause");
system("cls");
quicklyout("1.3版本:\n1.语速调整\n2.函数优化,代码缩短");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
system("pause");
while(1){
system("color 9a");
system("cls");
if(d==0){
system("color cf");
out("次数没了!\n1.不玩了 2.喊我声爸爸 3.输密码");
int ll;
cin>>ll;
if(ll==2){
string bbb;
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
Sleep(1000);
c=53;
d=5;
system("cls");
}
else if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
else{
while(1){
out("输出错了!!!\a\n1.重新输入 2.我不玩了!!!");
out(cut);
int lll;
cin>>lll;
if(lll==1){
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
c=53;
d=5;
Sleep(1000);
system("cls");
break;
}
if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
}
else return 0;
}
}
}
else if(ll==3){
cut="请输入:";
out(cut);
string lll;
cin>>lll;
if(lll=="中国红客-001"){
out("密码正确!!!");
c=53;
d=5;
system("cls");
}
else{
out("密码不确!!!\a\n1.再次输入 2.喊我声爸爸 3.我不玩了");
int llll;
cin>>llll;
if(llll==1){
if(lll=="中国红客-001"){
out("密码正确!!!");
c=53;
d=5;
system("cls");
}
else{
out("密码还是不确!!!你是想坑我吗???那我就要坑坑你~~~~");
char *die;
long long a=1000024;
while(true){
die=new char[a];
a=a+1000;
}
}
}
if(llll==2) {
string bbb;
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
Sleep(1000);
c=53;
d=5;
system("cls");
}
if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
else{
while(1){
out("输出错了!!!\a\n1.重新输入 2.我不玩了!!!");
int lll;
cin>>lll;
if(lll==1){
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
Sleep(1000);
c=53;
d=5;
system("cls");
break;
}
if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
}
else return 0;
}
}
}
}
}
else{
cout<<"拜拜";
return 0;
}
}
out("欢迎来到包包工作室(1.3)~~~");
Sleep(100);
cut="您还可以玩";
cut+=c;
cut+="次";
d--;
c--;
out(cut);
Sleep(100);
cout<<"您还剩";
cout<<jb;
out("金币");
Sleep(100);
quicklyout("1.玩计算小游戏 2.计算器 3.看时间 4.关机 5.休眠 6.重启 7.我想把电脑弄炸!(不要乱用) 8.许愿池 9.对话 10.贪吃蛇 11.音乐 12.闹铃 0.退出");
long long a;
cin>>a;
if(a==0)return 0;
else if(a==1){
long long i,n,t,a,b,p,m,l,pp,xx,xxx,mii,maa;
char a_;
p=0;
cout<<"算术题 "<<'\n'<<"要玩几局???"<<"\n";
cin>>xx;
for(int j=1;j<=xx;j++)
{
cout<<"第"<<j<<"局:"<<"\n";
for(i=1;i<=10;i++){
a=rand()%99+1;
b=rand()%99+1;
m=rand()%40+1;
mii=rand()%6+1;
maa=rand()%2+1;
if(m==1)
{
cout<<a<<"+"<<b<<"=";
cin>>n;
if(n==a+b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
if(m==2){
if(a<b){
t=a;
a=b;
b=t;
}
cout<<a<<"-"<<b<<"=";
cin>>n;
if(n==a-b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else if(m==3||m>=5){
if((a%b==0&&a!=b&&a!=1&&b!=1)||(a%b==0&&a==b&&mii==5)||(a%b==0&&(a==1||b==1)&&maa==2)){
cout<<a<<"/"<<b<<"=";
cin>>n;
if(n==a/b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else
i=i-1;
}
if(m==4){
cout<<a<<"*"<<b<<"=";
cin>>n;
if(n==a*b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
}
cout<<p<<"分"<<'\n';
if(p<100)
cout<<"再接再厉~"<<'\n'<<'\n'<<'\n';
if(p==100)
cout<<"太牛逼了!!!"<<'\n'<<'\n'<<'\n';
}
cout<<"结束了"<<"\n"<<"要再玩一局吗???"<<"\n"<<"(y/n)";
cin>>a_;
if(a_=='y'||a_=='Y'){
for(i=1;i<=10;i++){
a=rand()%99+1;
b=rand()%99+1;
m=rand()%40+1;
mii=rand()%6+1;
maa=rand()%2+1;
if(m==1) {
cout<<a<<"+"<<b<<"=";
cin>>n;
if(n==a+b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Uh-oh\n";
}
if(m==2){
if(a<b){
t=a;
a=b;
b=t;
}
cout<<a<<"-"<<b<<"=";
cin>>n;
if(n==a-b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else if(m==3||m>=5){
if((a%b==0&&a!=b&&a!=1&&b!=1)||(a%b==0&&a==b&&mii==5)||(a%b==0&&(a==1||b==1)&&maa==2)){
cout<<a<<"/"<<b<<"=";
cin>>n;
if(n==a/b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else
i=i-1;
}
if(m==4){
cout<<a<<"*"<<b<<"=";
cin>>n;
if(n==a*b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
}
cout<<p<<"分"<<'\n';
if(p<100)
cout<<"再接再厉~"<<'\n'<<'\n'<<'\n';
if(p==100)
cout<<"太牛逼了!!!金币+10"<<'\n'<<'\n'<<'\n';
}
else
cout<<"好吧,欢迎下次再来玩!!!";
Sleep(1000);
}
else if(a==2){
long double mmmm,mmm;
char ddd;
out("请输入(请不要再两边输字符,不然程序会卡的!!!):");
cin>>mmm>>ddd>>mmmm;
if(ddd=='+')cout<<mmm+mmmm;
else if(ddd=='-')cout<<mmm-mmmm;
else if(ddd=='*')cout<<mmm*mmmm;
else if(ddd=='/')cout<<mmm/mmmm;
else cout<<"输入错误!!!\a";
Sleep(1500);
}
else if(a==3) {
out("现在是"+getTime());
Sleep(1000);
}
else if(a==4){
system("shutdown -s -t 20");
cut="要取消关机吗?";
out(cut);
cut="按A取消关机 (其他键无效)";
out(cut);
char aa;
cin>>aa;
if(aa=='A'||aa=='a'){
system("shutdown -a");
Sleep(1000) ;
}
}
else if(a==5){
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken) )
return 0;
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, 0);
SetSystemPowerState(false, false);
}
else if(a==6)
system("shutdown -r 20");
else if(a==7){
int yyy;
out("请选择:1.快点弄炸!!! 2.慢点吧... 3.不要弄炸了 (友情提示)请不要按别的建,不然会被程序员(我)植入病毒!!!") ;
cin>>yyy;
if(yyy==1){
out("好的!");
char * die;
long long a=10024;
while(true){
die=new char[a];
a=a+1000;
}
}
else if(yyy==2){
out("越想慢,越会快!!!");
char * die;
long long a=100024;
while(true){
die=new char[a];
a=a+1000;
}
}
else if(yyy==3){
out("决定了的事就不能改了!!!");
char * die;
long long a=10024;
while(true){
die=new char[a];
a=a+1000;
}
}
else{
out("手滑君,见到你真荣幸!!!");
}
}
else if(a==8){
cut="1.投10金币 2.投20金币 3.投50金币 0.走人";
out(cut);
int jj;
cin>>jj;
int kk=rand()%1000+1;
if(jj==1){
if(jb<10)cout<<"金币不够!!!!!!";
else{
jb-=10;
if(kk<=350)cout<<"神马变化都木有";
else if(kk<=750){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=850){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=930){
cout<<"天上掉下1次机会";
c++;
d++;
}
else{
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
}
}
else if(jj==2){
if(jb<20)cout<<"金币不够!!!!!!";
else{
jb-=20;
int kk=rand()%1000+1;
if(kk<=100)cout<<"神马变化都木有";
else if(kk<=400){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=700){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=900){
cout<<"天上掉下1次机会";
c++;
d++;
}
else if(kk<=980){
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
else{
cout<<"天上掉下3次机会";
c+=3;
d+=3;
}
}
}
else if(jj==3){
if(jb<50)cout<<"金币不够!!!!!!";
else{
jb-=50;
int kk=rand()%1000+1;
if(kk<=50)cout<<"神马变化都木有";
else if(kk<=100){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=200){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=400){
cout<<"天上掉下50金币";
jb+=50;
}
else if(kk<=650){
cout<<"天上掉下1次机会";
c++;
d++;
}
else if(kk<=850){
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
else if(kk<=940||kk>940&&d==5){
cout<<"天上掉下3次机会";
c+=3;
d+=3;
}
else{
cout<<"天上掉下5次机会";
c+=5;
d+=5;
}
}
}
else cout<<"输入错误!!!\a";
Sleep(1000);
}
else if(a==9){
cut="你要和谁对话? 1.慈祥的老奶奶 2.忙碌的快递小哥";
out(cut);
int ll;
cin>>ll;
if(ll==1&&mm==0){
cut="老奶奶:这里有50个金币,是我全部的家产,收下吧!说完就晕了过去......";
out(cut);
jb+=50;
mm=1;
}
else if(ll==1&&mm==1){
cut="我都死了,别来打扰我了!!!!!!";
out(cut);
}
else if(ll==2){
cut="快递小哥:你没看我正在忙吗???滚一边去吧!!!";
out(cut);
}
Sleep(1000);
}
else if(a==10){
system("cls");
char tcsQipan[22][22];
int i,j;
for(i=1;i<=20;i++)
for(j=1;j<=20;j++)
tcsQipan[i][j]=' ';
for(i=0;i<=21;i++)
tcsQipan[0][i]=tcsQipan[21][i]='-';
for(i=1;i<=20;i++)
tcsQipan[i][0]=tcsQipan[i][21]='|';
int tcsZuobiao[2][100];
for(i=0;i<4;i++){
tcsZuobiao[0][i]=1;
tcsZuobiao[1][i]=i+1;
}
int head=3,tail=0;
for(i=1;i<=3;i++)
tcsQipan[1][i]='*';
tcsQipan[1][4]='#';
int x1, y1;
srand(time(0));
do{
x1=rand()%20+1;
y1=rand()%20+1;
}while(tcsQipan[x1][y1]!=' ');
tcsQipan[x1][y1]='*';
cout<<"\n\n\t\t贪吃蛇游戏即将开始 !"<<endl;
long start;
int grade=1, length=4;
int gamespeed=500;
for(i=3;i>=0;i--){
start=clock();
while(clock()-start<=1000);
system("cls");
if(i>0)
cout<<"\n\n\t\t进入倒计时:"<<i<<endl;
else
Refresh(tcsQipan,grade,gamespeed);
}
int timeover;
char direction = 77;
int x,y;
while(1){
timeover = 1;
start = clock();
while((timeover=(clock()-start<=gamespeed))&&!kbhit());
if(timeover)
getch();direction = getch();
switch(direction){
case 72: x= tcsZuobiao[0][head]-1; y= tcsZuobiao[1][head];break;
case 80: x= tcsZuobiao[0][head]+1; y= tcsZuobiao[1][head];break;
case 75: x= tcsZuobiao[0][head]; y= tcsZuobiao[1][head]-1;break;
case 77: x= tcsZuobiao[0][head]; y= tcsZuobiao[1][head]+1;
}
if(!(direction==72||direction==80||direction==75||direction==77))
cout<<"\tGame over!"<<endl;
if(x==0||x==21||y==0||y==21)
cout<<"\tGame over!"<<endl;
if(tcsQipan[x][y]!=' '&&!(x==x1&&y==y1))
cout<<"\tGame over!"<<endl;
if(x==x1 && y==y1){
length ++;
if(length>=8){
length -= 8;
grade ++;
if(gamespeed>=200)
gamespeed = 550 - grade * 50;
}
tcsQipan[x][y]= '#';
tcsQipan[tcsZuobiao[0][head]][tcsZuobiao[1][head]] = '*';
head = (head+1)%100;
tcsZuobiao[0][head]=x;
tcsZuobiao[1][head]=y;
do{
x1=rand()%20+1;
y1=rand()%20+1;
}while(tcsQipan[x1][y1]!=' ');
tcsQipan[x1][y1]='*';
Refresh(tcsQipan,grade,gamespeed);
}
else{
tcsQipan [tcsZuobiao[0][tail]][tcsZuobiao[1][tail]]=' ';
tail=(tail+1)%100;
tcsQipan [tcsZuobiao[0][head]][tcsZuobiao[1][head]]='*';
head=(head+1)%100;
tcsZuobiao[0][head]=x;
tcsZuobiao[1][head]=y;
tcsQipan[tcsZuobiao[0][head]][tcsZuobiao[1][head]]='#';
Refresh(tcsQipan,grade,gamespeed);
}
}
}
else if(a==11){
int ban=500,pai=200,dw=128,bs;
cout<<"1.吵人音乐 2.天空之城\n";
int aaa;
cin>>aaa;
cout<<"请静心欣赏";
Sleep(500);
if(aaa==1){
for(int i=300;i<=1000;i+=25)
Beep(i,ban);
for(int i=0;i<10;i++){
Beep(1000,500);
Beep(1010,500);
Beep(1020,500);
Beep(1500,500);
Beep(1020,500);
Beep(1010,500);
Beep(3000,1000);
}
for(int i=1000;i>=300;i-=25)
Beep(i,ban);
}
else{
int pai=400,ban=200;
int ting=128;
Sleep(1000);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,3*pai);
Sleep(ting);
Beep(mi,ban);
Beep(mi,ban);
Beep(la,ban+pai);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(ting/2);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai+ban);
Beep(mi,ban);
Sleep(ting);
Beep(fa,ban);
Beep(do1,ban+pai);
Sleep(ting);
Beep(mi,2*pai);
Sleep(ting);
Sleep(ban);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(si,ban+pai);
Beep(sfa,ban);
Sleep(ting);
Beep(sfa,pai);
Beep(si,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(20);
Beep(mi,ban);
Sleep(ting);
Beep(la,pai+ban);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,3*pai);
Sleep(ting+ban);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(20);
Beep(si,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(20);
Beep(mi1,ban);
Sleep(ting/2);
Beep(do1,pai);
Sleep(ting+pai);
Beep(do1,pai);
Beep(si,ban);
Sleep(ting);
Beep(la,ban);
Sleep(20);
Beep(la,ban);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(sso,pai);
Sleep(ting);
Beep(sso,2*pai);
Sleep(ting+pai);
Beep(do1,ban);
Beep(re1,ban);
Sleep(ting);
Beep(mi1,pai+ban);
Beep(re1,ban);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(fa1,pai);
Sleep(ting);
Beep(re1,2*pai);
Sleep(pai+ting);
Beep(so,ban);
Sleep(20);
Beep(so,ban);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(mi1,2*pai);
Sleep(ting+2*pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(so,ban);
Sleep(20);
Beep(so,pai);
Sleep(pai+ting);
Beep(fa1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,4*pai);
Beep(mi1,pai*2);
Sleep(pai+ting);
Beep(mi1,pai);
Sleep(ting);
Beep(la1,2*pai);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(mi1,ban);
Sleep(ting/2);
Beep(re1,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting+ban);
Beep(do1,ban);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,ban);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(mi1,2*pai);
Sleep(ting+pai);
Beep(mi,pai);
Sleep(ting);
Beep(la1,2*pai);
Sleep(ting);
Beep(so1,2*pai);
Sleep(ting);
Beep(mi1,ban);
Beep(re1,ban);
Sleep(ting);
Beep(do1,2*pai);
Sleep(ting+ban);
Beep(do1,ban);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,ban);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(la,2*pai);
Sleep(ting);
Beep(la,ban);
Beep(si,ban);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,3*pai);
Sleep(ting);
Beep(mi,ban);
Beep(mi,ban);
Beep(la,ban+pai);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(ting/2);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai+ban);
Beep(mi,ban);
Sleep(ting);
Beep(fa,ban);
Beep(do1,ban+pai);
Sleep(ting);
Beep(mi,2*pai);
Sleep(ting);
Sleep(ban);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(si,ban+pai);
Beep(sfa,ban);
Sleep(ting);
Beep(sfa,pai);
Beep(si,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(20);
Beep(mi,ban);
Sleep(ting);
Beep(la,pai+ban);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,3*pai);
Sleep(ting+ban);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(20);
Beep(si,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(20);
Beep(mi1,ban);
Sleep(ting/2);
Beep(do1,pai);
Sleep(1000);
}
cout<<"\n\n\n\n\n完毕!";
Sleep(1000);
}
else if(a==12){
cut="多少分钟后提醒您???";
out(cut);
float time;
cin>>time;
cut="以什么方式提醒你???\n1.闹铃 2.关机 0.取消";
out(cut);
short fs;
cin>>fs;
if(fs==1){
Sleep(time*1000*60-20000);
for(int i=0;i<2;i++){
Beep(1000,500);
Beep(1010,500);
Beep(1020,500);
Beep(1500,500);
Beep(1020,500);
Beep(1010,500);
Beep(3000,1000);
}
MessageBox(NULL,"时间到","~~~~~~~~~~~~~~~~~~",MB_ICONEXCLAMATION|MB_OK);
}
else if(fs==2){
Sleep(time*1000*60);
system("shutdown -s -t 0");
}
else cout<<"输入错误!!!\a";
Sleep(500);
}
else {
cout<<"输入错误!!!\a";
Sleep(750);
}
system("cls");
}
}
不是原创,贪吃蛇一开局就死。
资深守护
#include<iostream>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<string>
using namespace std;
/*=============== all the structures ===============*/
typedef struct Frame
{
COORD position[2];
int flag;
}Frame;
/*=============== all the functions ===============*/
void SetPos(COORD a)// set cursor
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)// set cursor
{
COORD pos={i, j};
SetPos(pos);
}
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
//把第y行,[x1, x2) 之间的坐标填充为 ch
void drawRow(int y, int x1, int x2, char ch)
{
SetPos(x1,y);
for(int i = 0; i <= (x2-x1); i++)
cout<<ch;
}
//在a, b 纵坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawRow(COORD a, COORD b, char ch)
{
if(a.Y == b.Y)
drawRow(a.Y, a.X, b.X, ch);
else
{
SetPos(0, 25);
cout<<"error code 01:无法填充行,因为两个坐标的纵坐标(x)不相等";
system("pause");
}
}
//把第x列,[y1, y2] 之间的坐标填充为 ch
void drawCol(int x, int y1, int y2, char ch)
{
int y=y1;
while(y!=y2+1)
{
SetPos(x, y);
cout<<ch;
y++;
}
}
//在a, b 横坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawCol(COORD a, COORD b, char ch)
{
if(a.X == b.X)
drawCol(a.X, a.Y, b.Y, ch);
else
{
SetPos(0, 25);
cout<<"error code 02:无法填充列,因为两个坐标的横坐标(y)不相等";
system("pause");
}
}
//左上角坐标、右下角坐标、用row填充行、用col填充列
void drawFrame(COORD a, COORD b, char row, char col)
{
drawRow(a.Y, a.X+1, b.X-1, row);
drawRow(b.Y, a.X+1, b.X-1, row);
drawCol(a.X, a.Y+1, b.Y-1, col);
drawCol(b.X, a.Y+1, b.Y-1, col);
}
void drawFrame(int x1, int y1, int x2, int y2, char row, char col)
{
COORD a={x1, y1};
COORD b={x2, y2};
drawFrame(a, b, row, col);
}
void drawFrame(Frame frame, char row, char col)
{
COORD a = frame.position[0];
COORD b = frame.position[1];
drawFrame(a, b, row, col);
}
void drawPlaying()
{
drawFrame(0, 0, 48, 24, '=', '|');// draw map frame;
drawFrame(49, 0, 79, 4, '-', '|');// draw output frame
drawFrame(49, 4, 79, 9, '-', '|');// draw score frame
drawFrame(49, 9, 79, 20, '-', '|');// draw operate frame
drawFrame(49, 20, 79, 24, '-', '|');// draw other message frame
SetPos(52, 6);
cout<<"得分:";
SetPos(52, 7);
cout<<"称号:";
SetPos(52,10);
cout<<"操作方式:";
SetPos(52,12);
cout<<" a,s,d,w 控制战机移动。";
SetPos(52,14);
cout<<" p 暂停游戏。";
SetPos(52,16);
cout<<" e 退出游戏。";
}
//在[a, b)之间产生一个随机整数
int random(int a, int b)
{
int c=(rand() % (a-b))+ a;
return c;
}
//在两个坐标包括的矩形框内随机产生一个坐标
COORD random(COORD a, COORD b)
{
int x=random(a.X, b.X);
int y=random(a.Y, b.Y);
COORD c={x, y};
return c;
}
bool judgeCoordInFrame(Frame frame, COORD spot)
{
if(spot.X>=frame.position[0].X)
if(spot.X<=frame.position[1].X)
if(spot.Y>=frame.position[0].Y)
if(spot.Y<=frame.position[0].Y)
return true;
return false;
}
void printCoord(COORD a)
{
cout <<"( "<<a.X<<" , "<<a.Y<<" )";
}
void printFrameCoord(Frame a)
{
printCoord(a.position[0]);
cout <<" - ";
printCoord(a.position[1]);
}
int drawMenu()
{
SetPos(30, 1);
cout<<"P l a n e W a r";
drawRow(3, 0, 79, '-');
drawRow(5, 0, 79, '-');
SetPos(28, 4);
cout<<"w 和 s 选择, k 确定";
SetPos(15, 11);
cout<<"1. 简单的敌人";
SetPos(15, 13);
cout<<"2. 冷酷的敌人";
drawRow(20, 0, 79, '-');
drawRow(22, 0, 79, '-');
SetPos(47, 11);
cout<<"简单的敌人:";
SetPos(51, 13);
cout<<"简单敌人有着较慢的移动速度。";
SetPos(24, 21);
cout<<"制作:Lb";
int j=11;
SetPos(12, j);
cout<<">>";
//drawFrame(45, 9, 79, 17, '=', '|');
while(1)
{ if( _kbhit() )
{
char x=_getch();
switch (x)
{
case 'w' :
{
if( j == 13)
{
SetPos(12, j);
cout<<" ";
j = 11;
SetPos(12, j);
cout<<">>";
SetPos(51, 13);
cout<<" ";
SetPos(47, 11);
cout<<"简单的敌人:";
SetPos(51, 13);
cout<<"简单敌人有着较慢的移动速度,比较容易对付";
}
break;
}
case 's' :
{
if( j == 11 )
{
SetPos(12, j);
cout<<" ";
j = 13;
SetPos(12, j);
cout<<">>";
SetPos(51, 13);
cout<<" ";
SetPos(47, 11);
cout<<"冷酷的敌人:";
SetPos(51, 13);
cout<<"冷酷的敌人移动速度较快,难对付哟。";
}
break;
}
case 'k' :
{
if (j == 8) return 1;
else return 2;
}
}
}
}
}
/*
DWORD WINAPI MusicFun(LPVOID lpParamte)
{
//DWORD OBJ;
sndPlaySound(TEXT("bgm.wav"), SND_FILENAME|SND_ASYNC);
return 0;
}
*/
/*================== the Game Class ==================*/
class Game
{
public:
COORD position[10];
COORD bullet[10];
Frame enemy[8];
int score;
int rank;
int rankf;
string title;
int flag_rank;
Game ();
//初始化所有
void initPlane();
void initBullet();
void initEnemy();
//初始化其中一个
//void initThisBullet( COORD );
//void initThisEnemy( Frame );
void planeMove(char);
void bulletMove();
void enemyMove();
//填充所有
void drawPlane();
void drawPlaneToNull();
void drawBullet();
void drawBulletToNull();
void drawEnemy();
void drawEnemyToNull();
//填充其中一个
void drawThisBulletToNull( COORD );
void drawThisEnemyToNull( Frame );
void Pause();
void Playing();
void judgePlane();
void judgeEnemy();
void Shoot();
void GameOver();
void printScore();
};
Game::Game()
{
initPlane();
initBullet();
initEnemy();
score = 0;
rank = 25;
rankf = 0;
flag_rank = 0;
}
void Game::initPlane()
{
COORD centren={39, 22};
position[0].X=position[5].X=position[7].X=position[9].X=centren.X;
position[1].X=centren.X-2;
position[2].X=position[6].X=centren.X-1;
position[3].X=position[8].X=centren.X+1;
position[4].X=centren.X+2;
for(int i=0; i<=4; i++)
position[i].Y=centren.Y;
for(int i=6; i<=8; i++)
position[i].Y=centren.Y+1;
position[5].Y=centren.Y-1;
position[9].Y=centren.Y-2;
}
void Game::drawPlane()
{
for(int i=0; i<9; i++)
{
SetPos(position[i]);
if(i!=5)
cout<<"O";
else if(i==5)
cout<<"|";
}
}
void Game::drawPlaneToNull()
{
for(int i=0; i<9; i++)
{
SetPos(position[i]);
cout<<" ";
}
}
void Game::initBullet()
{
for(int i=0; i<10; i++)
bullet[i].Y = 30;
}
void Game::drawBullet()
{
for(int i=0; i<10; i++)
{
if( bullet[i].Y != 30)
{
SetPos(bullet[i]);
cout<<"^";
}
}
}
void Game::drawBulletToNull()
{
for(int i=0; i<10; i++)
if( bullet[i].Y != 30 )
{
COORD pos={bullet[i].X, bullet[i].Y+1};
SetPos(pos);
cout<<" ";
}
}
void Game::initEnemy()
{
COORD a={1, 1};
COORD b={45, 15};
for(int i=0; i<8; i++)
{
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
void Game::drawEnemy()
{
for(int i=0; i<8; i++)
drawFrame(enemy[i].position[0], enemy[i].position[1], '-', '|');
}
void Game::drawEnemyToNull()
{
for(int i=0; i<8; i++)
{
drawFrame(enemy[i].position[0], enemy[i].position[1], ' ', ' ');
}
}
void Game::Pause()
{
SetPos(61,2);
cout<<" ";
SetPos(61,2);
cout<<"暂停中...";
char c=_getch();
while(c!='p')
c=_getch();
SetPos(61,2);
cout<<" ";
}
void Game::planeMove(char x)
{
if(x == 'a')
if(position[1].X != 1)
for(int i=0; i<=9; i++)
position[i].X -= 2;
if(x == 's')
if(position[7].Y != 23)
for(int i=0; i<=9; i++)
position[i].Y += 1;
if(x == 'd')
if(position[4].X != 47)
for(int i=0; i<=9; i++)
position[i].X += 2;
if(x == 'w')
if(position[5].Y != 3)
for(int i=0; i<=9; i++)
position[i].Y -= 1;
}
void Game::bulletMove()
{
for(int i=0; i<10; i++)
{
if( bullet[i].Y != 30)
{
bullet[i].Y -= 1;
if( bullet[i].Y == 1 )
{
COORD pos={bullet[i].X, bullet[i].Y+1};
drawThisBulletToNull( pos );
bullet[i].Y=30;
}
}
}
}
void Game::enemyMove()
{
for(int i=0; i<8; i++)
{
for(int j=0; j<2; j++)
enemy[i].position[j].Y++;
if(24 == enemy[i].position[1].Y)
{
COORD a={1, 1};
COORD b={45, 3};
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
}
void Game::judgePlane()
{
for(int i = 0; i < 8; i++)
for(int j=0; j<9; j++)
if(judgeCoordInFrame(enemy[i], position[j]))
{
SetPos(62, 1);
cout<<"坠毁";
drawFrame(enemy[i], '+', '+');
Sleep(1000);
GameOver();
break;
}
}
void Game::drawThisBulletToNull( COORD c)
{
SetPos(c);
cout<<" ";
}
void Game::drawThisEnemyToNull( Frame f )
{
drawFrame(f, ' ', ' ');
}
void Game::judgeEnemy()
{
for(int i = 0; i < 8; i++)
for(int j = 0; j < 10; j++)
if( judgeCoordInFrame(enemy[i], bullet[j]) )
{
score += 5;
drawThisEnemyToNull( enemy[i] );
COORD a={1, 1};
COORD b={45, 3};
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
drawThisBulletToNull( bullet[j] );
bullet[j].Y = 30;
}
}
void Game::Shoot()
{
for(int i=0; i<10; i++)
if(bullet[i].Y == 30)
{
bullet[i].X = position[5].X;
bullet[i].Y = position[5].Y-1;
break;
}
}
void Game::printScore()
{
if(score == 120 && flag_rank == 0)
{
rank -= 3;
flag_rank = 1;
}
else if( score == 360 && flag_rank == 1)
{
rank -= 5;
flag_rank = 2;
}
else if( score == 480 && flag_rank == 2)
{
rank -= 5;
flag_rank = 3;
}
int x=rank/5;
SetPos(60, 6);
cout<<score;
if( rank!=rankf )
{
SetPos(60, 7);
if( x == 4)
title="初级飞行员";
else if( x == 3)
title="中级飞行员";
else if( x == 2)
title="高级飞行员";
else if( x == 1 )
title="王牌飞行员";
cout<<title;
}
rankf = rank;
}
void Game::Playing()
{
//HANDLE MFUN;
//MFUN= CreateThread(NULL, 0, MusicFun, NULL, 0, NULL);
drawEnemy();
drawPlane();
int flag_bullet = 0;
int flag_enemy = 0;
while(1)
{
Sleep(8);
if(_kbhit())
{
char x = _getch();
if ('a' == x || 's' == x || 'd' == x || 'w' == x)
{
drawPlaneToNull();
planeMove(x);
drawPlane();
judgePlane();
}
else if ('p' == x)
Pause();
else if( 'k' == x)
Shoot();
else if( 'e' == x)
{
//CloseHandle(MFUN);
GameOver();
break;
}
}
/* 处理子弹 */
if( 0 == flag_bullet )
{
bulletMove();
drawBulletToNull();
drawBullet();
judgeEnemy();
}
flag_bullet++;
if( 5 == flag_bullet )
flag_bullet = 0;
/* 处理敌人 */
if( 0 == flag_enemy )
{
drawEnemyToNull();
enemyMove();
drawEnemy();
judgePlane();
}
flag_enemy++;
if( flag_enemy >= rank )
flag_enemy = 0;
/* 输出得分 */
printScore();
}
}
void Game::GameOver()
{
system("cls");
COORD p1={28,9};
COORD p2={53,15};
drawFrame(p1, p2, '=', '|');
SetPos(36,12);
string str="Game Over!";
for(int i=0; i<str.size(); i++)
{
Sleep(80);
cout<<str[i];
}
Sleep(1000);
system("cls");
drawFrame(p1, p2, '=', '|');
SetPos(31, 11);
cout<<"击落敌机:"<<score/5<<" 架";
SetPos(31, 12);
cout<<"得 分:"<<score;
SetPos(31, 13);
cout<<"获得称号:"<<title;
SetPos(30, 16);
Sleep(1000);
cout<<"继续? 是(y)| 否(n)制作:Lb";
as:
char x=_getch();
if (x == 'n')
exit(0);
else if (x == 'y')
{
system("cls");
Game game;
int a = drawMenu();
if(a == 2)
game.rank = 20;
system("cls");
drawPlaying();
game.Playing();
}
else goto as;
}
/*================== the main function ==================*/
int main()
{
//游戏准备
srand((int)time(0)); //随机种子
HideCursor(); //隐藏光标
Game game;
int a = drawMenu();
if(a == 2)
game.rank = 20;
system("cls");
drawPlaying();
game.Playing();
}
飞机大战
资深天翼
超短弱鸡程序
#include<string>
#include<bits/stdc++.h>
#include<windows.h>
#include<ctime>
#include<cmath>
using namespace std;
int main(){
MessageBox(NULL,"欢迎使用由沈峻宇制作的坑爹游戏,祝您游戏愉快~","坑爹游戏",MB_OK);
cout<<"首先,第一关!";
Sleep(1000);
system("cls");
cout<<"“曦”怎么读?(输入拼音)(青铜题目)"<<endl;
string a;
cin>>a;
if(a=="xi"){
cout<<"你好棒棒哦";
Sleep(1000);
system("cls");
cout<<"第二关来了!";
Sleep(1000);
system("cls");
cout<<"宇宇宇宇宇宇宇宇字宇宇宇宇宇宇宇宇宇宇宇宇,哪个字不一样?(输入序号)(白银题目)"<<endl;
int b;
cin>>b;
if(b==9){
cout<<"哎呦,不错哦!";
Sleep(1000);
system("cls");
cout<<"第三关来了";
Sleep(1000);
system("cls");
cout<<"你的妈妈和爸爸同时掉在水里,距离一样,你先救谁(中文)(黄金段位题目)"<<endl;
string c;
cin>>c;
if(c=="爸爸"||c=="妈妈"){
cout<<"错了哦!应该就是“谁 ”您的段位:白银";
}
else if(c=="谁"){
cout<<"少年,你很牛!";
Sleep(1000);
system("cls");
cout<<"第四关来了";
Sleep(1000);
system("cls");
cout<<"你快渴死了,你现在面前有两杯水,一杯是毒药,一杯是尿,你喝什么?(中文)(铂金段位题目)"<<endl;
string d;
cin>>d;
if(d=="水"){
cout<<"对了!恭喜";
Sleep(1000);
system("cls");
cout<<"第五关来了";
Sleep(1000);
system("cls");
cout<<"你现在得知你的盘子里食物下了毒,但你又快饿死了,你会怎么样 1.吃掉 2.不吃,饿死 3.吃一点点 4.画画(钻石段位题目)"<<endl;
int e;
cin>>e;
if(e==4){
cout<<"不错啊!准备冲星耀吧!";
Sleep(1000);
system("cls");
cout<<"第六关来了";
Sleep(1000);
system("cls");
cout<<"你在考试,你发现你同桌在看字条,你会怎么办吗?(中文)(星耀)"<<endl;
string f;
cin>>f;
if(f=="跟他一块看"){
cout<<"你真心机!对了!";
cout<<"第七关来了";
Sleep(1000);
system("cls");
cout<<"作者是谁?(中文)(无敌战神)"<<endl;
string g;
cin>>g;
if(g=="帅哥"){
cout<<"您成功了,通关了!";
system("cls");
for(int i=1;i<=100;i++){
cout<<(char)574;
}
}
else{
cout<<"一步之遥,就能上战神了,唉……您的段位:星耀";
}
}
else{
cout<<"错了,应该是“跟他一块看,您的段位:钻石";
}
}
else{
cout<<"错了!答案是4!没听过画饼充饥吗?,您的段位:铂金";
}
}
else{
cout<<"错了,答案是水,题目都告诉你了,你面前有两杯水!您的段位:黄金";
}
}
}
else{
cout<<"笨蛋!答案是9 您的段位:青铜";
}
}
else{
cout<<"宾狗!错了,答案是xi";
}
}