/*
Name: 杀人游戏
Date: 18/07/22 15:12
by_黑客小C
小C出品,必属精品!
*/
//杀人游戏
//版本:1.15
#include
#include
#include
#include
#include
#include
using namespace std;
int me;
int day=1;
int maxrand=3;
int die[10];
int MVP[10];
int mvp;
int play_num=3;
int ID_1=12359;
int ID_2=80435;
int ID_3=37259;
int new_player=0;
void num_first(){
day=0;
die[0]=1;
die[1]=1;
die[2]=1;
die[3]=1;
die[4]=1;
die[5]=1;
die[6]=2;
die[7]=1;
die[8]=1;
die[9]=1;
return ;
}
int x_what(int x) {//取随机数 (用于释放技能、抽角色)
srand((unsigned)time(NULL));
return( rand() % x);
}
void day_over(){
Sleep(2000);
system("cls");
system("color F0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<3"<4"<5"<6"<7"<8"<9"<10"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp2() {//投票
int a;
cout<<"3->4"<5"<6"<7"<8"<9"<10"<1"<2"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp3() {//投票
int a;
cout<<"4->5"<6"<7"<8"<9"<10"<1"<2"<3"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp4() {//投票
int a;
cout<<"5->6"<7"<8"<9"<10"<1"<2"<3"<4"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp5() {//投票
int a;
cout<<"4->5"<7"<8"<9"<10"<1"<2"<3"<4"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp6() {//投票
int a;
cout<<"4->5"<6"<8"<9"<10"<1"<2"<3"<4"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp7() {//投票
int a;
cout<<"4->5"<6"<7"<9"<10"<1"<2"<3"<4"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp8() {//投票
int a;
cout<<"4->5"<6"<7"<8"<10"<1"<2"<3"<4"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp9() {//平民3投票
int a;
cout<<"4->5"<6"<7"<8"<9"<1"<2"<3"<4"<";
cin>>a;
die[a-1]--;
system("cls");
}
bool tp10() {//平民4投票
int a;
cout<<"4->5"<6"<7"<8"<9"<10"<2"<3"<4"<";
cin>>a;
die[a-1]--;
system("cls");
}
int pm() {//平民脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[0]>0) {
tp1();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int nw() {//女巫脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<>Z;
Z--;
Sleep(2000);
system("cls");
cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
Sleep(2000);
if(x_what(10)==2||x_what(10)==5) {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"有狼人被查出,他们被吓走了,平民胜利。";
return 0;
}
system("cls");
system("color F0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
if(H!=Z) {
die[H]--;
cout<<"天亮了,"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[1]>0) {
tp2();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int lr() {//狼人脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<>H;
H--;
Sleep(2000);
system("cls");
cout<<"狼人请闭眼,女巫请睁眼,请问你要救谁?";
Z=x_what(7);
Sleep(2000);
system("cls");
cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
Sleep(2000);
if(x_what(10)==2||x_what(10)==5) {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"有狼人被查出,他们被吓走了,平民胜利。";
return 0;
}
system("cls");
system("color F0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
if(H!=Z) {
die[H]--;
cout<<"天亮了,"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[2]>0) {
tp3();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int lr2() {//狼人脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<>H;
H--;
Sleep(2000);
system("cls");
cout<<"狼人请闭眼,女巫请睁眼,请问你要救谁?";
Z=x_what(7);
Sleep(2000);
system("cls");
cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
Sleep(2000);
if(x_what(10)==2||x_what(10)==5) {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"有狼人被查出,他们被吓走了,平民胜利。";
return 0;
}
system("cls");
system("color F0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
if(H!=Z) {
die[H]--;
cout<<"天亮了,"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[5]>0) {
tp6();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int yyj() {//预言家脚本
while(true) {
int AC;
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<>AC;
if(AC==3||AC==6) {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"有狼人被查出,他们被吓走了,平民胜利。";
return 0;
}
system("cls");
system("color F0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
if(H!=Z) {
die[H]--;
cout<<"天亮了,"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[3]>0) {
tp4();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int sw() {//守卫脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
int WA;
cout<<"day:"<>WA;
die[WA-1]++;
cout<<"天黑请闭眼,狼人请睁眼,请问你要杀谁?";
H=x_what(10);
H--;
Sleep(2000);
system("cls");
cout<<"狼人请闭眼,女巫请睁眼,请问你要救谁?";
Z=x_what(10);
Sleep(2000);
system("cls");
cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
Sleep(2000);
if(x_what(10)==2||x_what(10)==5) {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"有狼人被查出,他们被吓走了,平民胜利。";
return 0;
}
system("cls");
system("color F0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
if(H!=Z) {
die[H]--;
cout<<"天亮了,"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[4]>0) {
tp5();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int bc() {//白痴脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[6]>0) {
tp7();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int pm2() {//平民脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[7]>0) {
tp8();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int pm3() {//平民脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[8]>0) {
tp9();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
//day_over();
day++;
}
}
int pm4() {//平民脚本
while(true) {
system("color 0f");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"day:"<9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
if(die[9]>0) {
tp10();
}
if((die[2]<=0&&die[5]<=0)||day>9) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"平民胜利";
return 0;
}
if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"狼人胜利";
return 0;
}
day_over();
day++;
}
}
int main() {//主干
//Sleep(5000);//劳资这里运行缓慢,以便客户掏钱优化
int in_id;
char ch;
char next_ch;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
open1();
ch='x';
cout<<"账号1:"<>in_id;
if(in_id==ID_1||in_id==ID_2||in_id==ID_3||in_id==new_player){
cout<<"登录成功。";
Sleep(2000);
system("cls");
}
else{
cout<<"你没有账号";
return 0;
}
while(ch!='o'){
if(play_num==0){
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"游戏时间结束,已强制退出";
return 0;
}
open2();
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"我准备好了(按任意键):";
cin>>next_ch;
system("cls");
num_first();
for(int i=0; i<5; i++) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"随机分配角色中";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
system("cls");
Sleep(100);
}
me=x_what(8);
me++;
system("cls");
//角色判定代码
//me=1;
//me=2;
//me=3;
//me=4;
//me=5;
//me=6;
//me=7;
//me=8;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
if(me==1) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"你是1号"<>ch;
system("cls");
play_num--;
}
return 0;
}