我们班大佬的狼人杀
anqishen
·
·
个人记录
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<windows.h>
#include<iomanip>
using namespace std;
enum RoleType {
VILLAGER, WEREWOLF, WITCH, SEER, HUNTER, GUARD, WEREWOLF_KING, IDIOT,
CUPID, LOVER, SILENCER, BEAR, WILD_CHILD, HUNTER_MAGE,WHITE_WEREWOLF_KING
};
struct IDname {
int geshu;
string NAME;
RoleType type;
};
IDname jue_se[16];
// 新增自爆相关变量
bool has_wolf_exploded = false;
int explode_wolf_id = -1;
int explode_target_id = -1;
int white_wolf_king = 0; // 白狼王位置
struct ID {
int num;
bool life;
string name;
int know;
int how;
RoleType type;
bool is_king_skill_used;
bool is_idiot_out;
bool is_lover;
bool is_silenced;
int bear_left;
int bear_right;
int wild_child_target;
bool wild_child_become_wolf;
bool hunter_mage_skill_used;
bool is_self_exploded; // 新增:是否自爆
};
ID player[21];
int n, MY, kill1, kill2, hunter_mage_target = -1;
char a;
bool jieyao = true, duyao = true;
int lieren = 0, shouwei = 0, langrenwang = 0, silencer = 0, bear = 0, wild_child = 0, hunter_mage = 0;
int shou = 0;
bool lr = false;
int lover1 = -1, lover2 = -1;
bool has_cupid = false;
int silenced_player = -1;
bool is_human_wolf_lover = false;
int cupid_pos = -1;
// 提前声明 panduanlieren 函数,解决未声明错误
void panduanlieren();
void init1() {
jue_se[1] = {0, "村民 ", VILLAGER};
jue_se[2] = {0, "狼人 ", WEREWOLF};
jue_se[3] = {0, "女巫 ", WITCH};
jue_se[4] = {0, "预言家 ", SEER};
jue_se[5] = {0, "猎人 ", HUNTER};
jue_se[6] = {0, "守卫 ", GUARD};
jue_se[7] = {0, "狼王 ", WEREWOLF_KING};
jue_se[8] = {0, "白痴 ", IDIOT};
jue_se[9] = {0, "丘比特 ", CUPID};
jue_se[10] = {0, "情侣 ", LOVER};
jue_se[11] = {0, "禁言长老 ", SILENCER};
jue_se[12] = {0, "熊 ", BEAR};
jue_se[13] = {0, "野孩子 ", WILD_CHILD};
jue_se[14] = {0, "猎魔人 ", HUNTER_MAGE};
jue_se[15] = {0, "白狼王 ", WHITE_WEREWOLF_KING};
}
void init2(int nn) {
for(int i=1; i<=14; i++) jue_se[i].geshu = 0;
switch(nn) {
case 6:
jue_se[1].geshu=3; jue_se[2].geshu=2; jue_se[3].geshu=1;
break;
case 7:
jue_se[1].geshu=3; jue_se[2].geshu=2; jue_se[3].geshu=1; jue_se[4].geshu=1;
break;
case 8:
jue_se[1].geshu=3; jue_se[2].geshu=3; jue_se[3].geshu=1; jue_se[4].geshu=1;
break;
case 9:
jue_se[1].geshu=3; jue_se[2].geshu=3; jue_se[3].geshu=1; jue_se[4].geshu=1; jue_se[5].geshu=1;
break;
case 10:
jue_se[1].geshu=4; jue_se[2].geshu=3; jue_se[3].geshu=1; jue_se[4].geshu=1; jue_se[5].geshu=1;
break;
case 11:
jue_se[1].geshu=2; jue_se[15].geshu=1; jue_se[2].geshu=2; jue_se[3].geshu=1;
jue_se[4].geshu=1; jue_se[5].geshu=1; jue_se[9].geshu=1; jue_se[14].geshu=1;
break;
case 12:
jue_se[1].geshu=1; jue_se[15].geshu=1; jue_se[2].geshu=2; jue_se[7].geshu=1; jue_se[3].geshu=1;
jue_se[4].geshu=1; jue_se[5].geshu=1; jue_se[6].geshu=1; jue_se[9].geshu=1;
jue_se[11].geshu=1; jue_se[12].geshu=1; jue_se[13].geshu=1; jue_se[14].geshu=1;
break;
default:
cout<<"输入错误,请输入6-12之间的人数!"<<endl;
exit(0);
}
}
void make_lover(int p1, int p2) {
lover1 = p1; lover2 = p2;
player[p1].is_lover = true; player[p2].is_lover = true;
bool p1_is_wolf = (player[p1].type == WEREWOLF || player[p1].type == WEREWOLF_KING ||
(player[p1].type == WILD_CHILD && player[p1].wild_child_become_wolf));
bool p2_is_wolf = (player[p2].type == WEREWOLF || player[p2].type == WEREWOLF_KING ||
(player[p2].type == WILD_CHILD && player[p2].wild_child_become_wolf));
bool p1_is_good = !p1_is_wolf && (player[p1].type != CUPID);
bool p2_is_good = !p2_is_wolf && (player[p2].type != CUPID);
if((p1_is_wolf && p2_is_good) || (p1_is_good && p2_is_wolf)) {
is_human_wolf_lover = true;
if(player[MY].type == CUPID) {
cout << endl << "【第三方阵营】" << p1 << "号和" << p2 << "号形成人狼恋,成为第三方阵营!" << endl;
Sleep(2000);
}
}
cupid_pos = -1;
for(int i=1; i<=n; i++) {
if(player[i].type == CUPID) {
cupid_pos = i;
break;
}
}
if(MY == p1 || MY == p2) {
cout << endl << "【重要提醒】你被丘比特连为情侣!你的情侣是" << (MY == p1 ? p2 : p1) << "号玩家!" << endl;
cout << "【丘比特信息】丘比特是" << cupid_pos << "号玩家!" << endl;
if(is_human_wolf_lover) {
cout << "【第三方阵营】你和情侣是人狼恋,需要消灭所有人才能胜利!" << endl;
}
Sleep(2000);
}
else if(player[MY].type == CUPID) {
cout << endl << "【丘比特】你将" << p1 << "号和" << p2 << "号连为情侣!" << endl;
if(is_human_wolf_lover) {
cout << "【丘比特】这对情侣是人狼恋,成为第三方阵营!" << endl;
}
Sleep(2000);
}
if(player[MY].type == CUPID) {
player[p1].know = 2;
player[p2].know = 2;
}
}
void init3(int nn) {
srand(time(0) + nn);
int max_role_idx = 9;
if(n >= 11) max_role_idx = 10;
if(n == 12) max_role_idx = 14;
int x;
do {
x = rand() % max_role_idx + 1;
if(jue_se[x].geshu > 0) {
player[nn].num = nn;
player[nn].life = true;
player[nn].name = jue_se[x].NAME;
player[nn].type = jue_se[x].type;
player[nn].know = 0;
player[nn].how = 0;
player[nn].is_king_skill_used = false;
player[nn].is_idiot_out = false;
player[nn].is_lover = false;
player[nn].is_silenced = false;
player[nn].bear_left = (nn == 1) ? n : nn - 1;
player[nn].bear_right = (nn == n) ? 1 : nn + 1;
player[nn].wild_child_target = -1;
player[nn].wild_child_become_wolf = false;
player[nn].hunter_mage_skill_used = false;
if(player[nn].type == HUNTER) lieren = nn;
if(player[nn].type == GUARD) shouwei = nn;
if(player[nn].type == WEREWOLF_KING) langrenwang = nn;
if(player[nn].type == SILENCER) silencer = nn;
if(player[nn].type == BEAR) bear = nn;
if(player[nn].type == WILD_CHILD) wild_child = nn;
if(player[nn].type == CUPID) {
has_cupid = true;
cupid_pos = nn;
}
if(player[nn].type == HUNTER_MAGE) hunter_mage = nn;
jue_se[x].geshu--;
break;
}
} while(true);
}
void bear_roar() {
if(!player[bear].life) return;
bool has_wolf = false;
if(player[player[bear].bear_left].life &&
(player[player[bear].bear_left].type == WEREWOLF || player[player[bear].bear_left].type == WEREWOLF_KING)) {
has_wolf = true;
}
if(player[player[bear].bear_right].life &&
(player[player[bear].bear_right].type == WEREWOLF || player[player[bear].bear_right].type == WEREWOLF_KING)) {
has_wolf = true;
}
cout << endl << "【熊的咆哮】" << (has_wolf ? "熊咆哮了!" : "熊没有咆哮!") << endl;
Sleep(2000);
}
void silencer_skill(int day) {
if(!player[silencer].life || silencer == 0) return;
Sleep(1000);
cout << "禁~言~长~老~请~睁~眼~~~" << endl;
Sleep(1000);
int target = -1;
if(MY == silencer && player[MY].life) {
cout << "请选择要禁言的玩家(输入编号):";
cin >> target;
while(target < 1 || target > n || !player[target].life || target == silencer) {
cout << "输入错误!请重新输入:";
cin >> target;
}
cout << "你选择禁言" << target << "号玩家!" << endl;
} else {
srand(time(0));
do {
target = rand() % n + 1;
} while(!player[target].life || target == silencer);
cout << "禁言长老正在选择禁言目标..." << endl;
Sleep(1000);
}
silenced_player = target;
player[target].is_silenced = true;
Sleep(1000);
cout << "禁~言~长~老~请~闭~眼~~~" << endl;
Sleep(500);
}
void wild_child_choose_target() {
if(!player[wild_child].life || wild_child == 0) return;
Sleep(1000);
cout << "野~孩~子~请~睁~眼~~~" << endl;
Sleep(1000);
int target = -1;
if(MY == wild_child && player[MY].life) {
cout << "请选择你的榜样玩家(输入编号):";
cin >> target;
while(target < 1 || target > n || !player[target].life || target == wild_child) {
cout << "输入错误!请重新输入:";
cin >> target;
}
cout << "你选择" << target << "号作为你的榜样!" << endl;
Sleep(1000);
} else {
srand(time(0));
do {
target = rand() % n + 1;
} while(!player[target].life || target == wild_child);
cout << "野孩子正在选择榜样玩家..." << endl;
Sleep(1000);
}
player[wild_child].wild_child_target = target;
Sleep(1000);
cout << "野~孩~子~请~闭~眼~~~" << endl;
Sleep(500);
}
void hunter_mage_skill(int day) {
if(hunter_mage == 0 || !player[hunter_mage].life || day < 2) return;
Sleep(1000);
cout << "猎~魔~人~请~睁~眼~~~" << endl;
Sleep(1000);
char choice;
int target = -1;
hunter_mage_target = -1;
if(MY == hunter_mage && player[MY].life) {
cout << "是否使用狩猎技能?(Y/N):";
cin >> choice;
while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n') {
cout << "输入错误!请输入Y或N:";
cin >> choice;
}
if(choice == 'Y' || choice == 'y') {
cout << "请选择要狩猎的玩家(输入编号):";
cin >> target;
while(target < 1 || target > n || !player[target].life || target == hunter_mage) {
cout << "输入错误!请重新输入:";
cin >> target;
}
hunter_mage_target = target;
cout << "你选择狩猎" << target << "号玩家!" << endl;
player[hunter_mage].hunter_mage_skill_used = true;
} else {
cout << "你选择不使用狩猎技能!" << endl;
player[hunter_mage].hunter_mage_skill_used = false;
}
} else {
srand(time(0));
int use_skill = rand() % 2;
if(use_skill == 1) {
do {
target = rand() % n + 1;
} while(!player[target].life || target == hunter_mage);
hunter_mage_target = target;
player[hunter_mage].hunter_mage_skill_used = true;
cout << "猎魔人正在选择狩猎目标..." << endl;
} else {
player[hunter_mage].hunter_mage_skill_used = false;
cout << "猎魔人选择不使用狩猎技能..." << endl;
}
Sleep(1000);
}
Sleep(1000);
cout << "猎~魔~人~请~闭~眼~~~" << endl;
Sleep(500);
if(hunter_mage_target != -1 && player[hunter_mage].life) {
bool target_is_wolf = (player[hunter_mage_target].type == WEREWOLF ||
player[hunter_mage_target].type == WEREWOLF_KING ||
(player[hunter_mage_target].type == WILD_CHILD && player[hunter_mage_target].wild_child_become_wolf));
if(target_is_wolf) {
player[hunter_mage_target].life = false;
player[hunter_mage_target].how = 5;
} else {
player[hunter_mage].life = false;
player[hunter_mage].how = 5;
}
}
}
void check_wild_child() {
if(wild_child == 0 || !player[wild_child].life || player[wild_child].wild_child_become_wolf) return;
int target = player[wild_child].wild_child_target;
if(target != -1 && !player[target].life) {
player[wild_child].wild_child_become_wolf = true;
player[wild_child].type = WEREWOLF;
player[wild_child].name = "狼人(野孩子)";
cout << endl << "【全场通告】" << wild_child << "号野孩子的榜样已死亡,野孩子变成狼人!" << endl;
Sleep(3000);
for(int i=1; i<=n; i++) {
if((player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING ||
(player[i].type == WILD_CHILD && player[i].wild_child_become_wolf)) && player[i].life) {
player[wild_child].know = 1;
}
}
if(MY == wild_child) {
cout << endl << "【野孩子】你的榜样已死亡,你变成狼人!现在你加入狼人阵营!" << endl;
Sleep(2000);
}
if(player[wild_child].is_lover) {
int other_lover = (lover1 == wild_child) ? lover2 : lover1;
bool other_is_wolf = (player[other_lover].type == WEREWOLF || player[other_lover].type == WEREWOLF_KING);
bool other_is_good = !other_is_wolf && (player[other_lover].type != CUPID);
is_human_wolf_lover = (player[wild_child].type == WEREWOLF && other_is_good);
}
}
}
void printhhh() {
int cm=0, sz=0, lr_num=0, lover_alive=0;
int cupid_alive = (cupid_pos != -1 && player[cupid_pos].life) ? 1 : 0;
int all_alive = 0;
for(int i=1; i<=n; i++) {
if(!player[i].life) continue;
all_alive++;
if(player[i].is_lover) lover_alive++;
else if(player[i].type == VILLAGER) cm++;
else if(player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING) lr_num++;
else if(player[i].type != IDIOT && player[i].type != CUPID) sz++;
}
bool player_win = false;
string win_camp = "";
if(is_human_wolf_lover && lover_alive == 2 && (all_alive - lover_alive) == 0) {
win_camp = "第三方情侣阵营";
if((MY == lover1 || MY == lover2) || (MY == cupid_pos && is_human_wolf_lover)) {
player_win = true;
}
}
else if((!is_human_wolf_lover || (is_human_wolf_lover && lover_alive < 2)) &&
lr_num >= (all_alive - lr_num - (is_human_wolf_lover ? lover_alive : 0))) {
win_camp = "狼人阵营";
if(player[MY].type == WEREWOLF || player[MY].type == WEREWOLF_KING ||
(player[MY].type == WILD_CHILD && player[MY].wild_child_become_wolf)) {
player_win = true;
}
}
else if((!is_human_wolf_lover || (is_human_wolf_lover && lover_alive < 2)) && lr_num == 0) {
win_camp = "好人阵营";
if(!(player[MY].type == WEREWOLF || player[MY].type == WEREWOLF_KING ||
(player[MY].type == WILD_CHILD && player[MY].wild_child_become_wolf)) &&
!(is_human_wolf_lover && (MY == lover1 || MY == lover2 || MY == cupid_pos))) {
player_win = true;
}
}
else {
win_camp = "无";
}
cout << "【你的结果】:" << (player_win ? "恭喜你,你赢了!" : "很遗憾,你输了!") << endl;
if(is_human_wolf_lover && lover_alive == 2 && (all_alive - lover_alive) == 0) {
cout<<"?? 第三方情侣阵营胜利!??"<<endl;
} else if(lr_num >= (all_alive - lr_num - (is_human_wolf_lover ? lover_alive : 0))) {
cout<<"?? 狼人阵营胜利!??"<<endl;
} else if(lr_num == 0) {
cout<<"?? 好人阵营胜利!??"<<endl;
} else {
cout<<"?? 游戏未分胜负!??"<<endl;
}
cout<<"==================== 最终结果 ===================="<<endl;
for(int i=1; i<=n; i++) {
cout<<left<<setw(3)<<player[i].num<<": "<<player[i].name<<" - ";
if(player[i].life==0) cout<<"死亡";
else cout<<"存活";
cout<<" - ";
if(player[i].how==0) cout<<"最终存活";
else if(player[i].how==1) cout<<"被狼人杀死";
else if(player[i].how==2) cout<<"被投票投死";
else if(player[i].how==3) cout<<"被女巫毒死";
else if(player[i].how==4) cout<<"被猎人/狼王射杀";
else if(player[i].how==5) cout<<"被猎魔人狩猎/猎魔人狩猎好人死亡";
if(player[i].is_lover) {
cout << " | 情侣(" << (i == lover1 ? lover2 : lover1) << "号)";
}
if(player[i].type == WILD_CHILD || (player[i].type == WEREWOLF && player[i].name.find("野孩子") != string::npos)) {
cout << " | 榜样:" << player[i].wild_child_target << "号";
}
cout<<endl;
}
system("pause");
}
void print(int day,int ti) {
#define FOREGROUND_YELLOW (FOREGROUND_RED | FOREGROUND_GREEN)
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
if(ti==0)
SetConsoleTextAttribute(handle,BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_GREEN|BACKGROUND_BLUE|FOREGROUND_INTENSITY);
else
SetConsoleTextAttribute(handle,FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
system("cls");
cout<<"==================== 狼人杀online ===================="<<endl;
cout<<"\t\t\t\t第"<<day<<"天 ";
if(ti==0) cout<<"白天"<<endl;
else cout<<"夜晚"<<endl;
cout<<"你的位置:"<<MY<<"号 | 你的身份:"<<player[MY].name<<endl;
if(player[MY].is_silenced) {
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"【警告】你被禁言了,本回合无法发言投票!"<<endl;
SetConsoleTextAttribute(handle,FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
}
if(is_human_wolf_lover && (MY == lover1 || MY == lover2 || MY == cupid_pos)) {
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_YELLOW);
cout<<"【第三方阵营】你是人狼恋相关阵营,需消灭所有人才能胜利!"<<endl;
SetConsoleTextAttribute(handle,FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
}
cout<<"-----------------------------------------------------"<<endl;
int min_val = 6;
if(n < 6) min_val = n;
cout<<"玩家列表(1-"<<min_val<<"号):"<<endl;
for(int i=1; i<=min_val; i++) cout<<player[i].num<<"号位 ";
cout<<endl;
for(int i=1; i<=min_val; i++) {
if(player[i].life==1) {
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<"存活 ";
} else {
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"已死亡";
}
}
SetConsoleTextAttribute(handle,FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<endl;
cout<<"身份认知:"<<endl;
for(int i=1; i<=min_val; i++) {
if(player[i].know==0) cout<<" 未知 ";
else if(player[i].know==1) {
if(player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING) cout<<" 狼人 ";
else cout<<" 好人 ";
} else if(player[i].know==2) {
if(player[i].is_lover) cout<<" 情侣 ";
else cout<<player[i].name<<" ";
}
}
cout<<endl;
if(n>6) {
cout<<"-----------------------------------------------------"<<endl;
cout<<"玩家列表(7-"<<n<<"号):"<<endl;
for(int i=7; i<=n; i++) cout<<player[i].num<<"号位 ";
cout<<endl;
for(int i=7; i<=n; i++) {
if(player[i].life==1) {
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout<<" 存活 ";
} else {
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<"已死亡";
}
}
SetConsoleTextAttribute(handle,FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<endl;
cout<<"身份认知:"<<endl;
for(int i=7; i<=n; i++) {
if(player[i].know==0) cout<<"未知 ";
else if(player[i].know==1) {
if(player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING) cout<<"狼人 ";
else cout<<"好人 ";
} else if(player[i].know==2) {
if(player[i].is_lover) cout<<"情侣 ";
else cout<<player[i].name<<" ";
}
}
cout<<endl;
}
cout<<"====================================================="<<endl;
}
void shoushui(int hhh,int hhhh) {
int x;
Sleep(1000);
print(hhh,hhhh);
cout << "守~卫~请~睁~眼~~~" << endl;
Sleep(1000);
if(MY==shouwei&&player[MY].life==1) {
cout<<"请问你要守护谁?(输入玩家编号):";
cin>>x;
while(x==shou||x<1||x>n||player[x].life==0) {
cout<<"输入错误!请重新输入:";
cin>>x;
}
shou=x;
cout<<"你选择守护"<<x<<"号玩家!"<<endl;
Sleep(1000);
} else if(player[shouwei].life==1) {
Sleep(500);
srand(time(0));
x=rand()%n+1;
while(x==shou||player[x].life==0) {
x=rand()%n+1;
}
shou=x;
cout << "守卫正在选择守护目标..." << endl;
Sleep(1000);
} else {
if(MY == shouwei) {
cout<<"守卫已死亡,无法行动!"<<endl;
Sleep(1000);
}
shou=-1;
}
Sleep(1000);
print(hhh,hhhh);
cout << "守~卫~请~闭~眼~~~" << endl;
Sleep(500);
}
struct tou {
int xxx;
int num;
int toupiaoquan;
};
tou TOU[21];
bool cmp(tou x,tou y) {
if(x.xxx==y.xxx) return x.num<y.num;
return x.xxx>y.xxx;
}
void langrenwang_skill(int dead_id) {
if(player[dead_id].type != WEREWOLF_KING || player[dead_id].is_king_skill_used) return;
cout<<dead_id<<"号狼王被淘汰,发动技能!"<<endl;
Sleep(1000);
if(MY==dead_id && player[MY].life==0) {
cout<<"请选择射杀一名玩家(输入编号):";
int x;
cin>>x;
while(x<1||x>n||player[x].life==0) {
cout<<"输入错误!请重新输入:";
cin>>x;
}
player[x].life=0;
player[x].how=4;
cout<<"你射杀了"<<x<<"号玩家!"<<endl;
} else {
srand(time(0));
int x=rand()%n+1;
while(x<1||x>n||player[x].life==0||(player[x].type==WEREWOLF||player[x].type==WEREWOLF_KING)) {
x=rand()%n+1;
}
player[x].life=0;
player[x].how=4;
cout<<"狼王射杀了"<<x<<"号玩家!"<<endl;
}
player[dead_id].is_king_skill_used = true;
Sleep(1500);
}
void toupiao(int ddd,int nnn) {
int x;
Sleep(1000);
print(ddd,nnn);
cout<<"========== 投票阶段 =========="<<endl;
cout<<"现在开始投票,请选择要投出的玩家(0弃权):"<<endl;
for(int i=1; i<=n; i++) {
TOU[i].num = i;
TOU[i].toupiaoquan = 1;
TOU[i].xxx = 0;
}
for(int i=1; i<=n; i++) {
if(player[i].life == 1 && !player[i].is_silenced) {
Sleep(500);
if(i == MY) {
cout<<"你的投票:";
cin>>x;
while((x != 0 && (player[x].life == 0 || (player[x].type == IDIOT && player[x].is_idiot_out) || x == i))) {
cout<<"目标无效!请重新输入(0弃权,可投存活玩家且不能投自己):";
cin>>x;
}
if(x == 0) cout<<"你选择弃权!"<<endl;
else cout<<"你投给了"<<x<<"号玩家!"<<endl;
} else {
srand(time(0) + i * 100);
if(player[i].is_lover && is_human_wolf_lover) {
vector<int> valid_targets;
for(int j=1; j<=n; j++) {
if(player[j].life && !player[j].is_lover && j != i) {
valid_targets.push_back(j);
}
}
// 替换范围for循环为普通for循环
x = valid_targets.empty() ? 0 : valid_targets[rand() % valid_targets.size()];
}
else if(player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING ||
(player[i].type == WILD_CHILD && player[i].wild_child_become_wolf)) {
vector<int> valid_targets;
for(int j=1; j<=n; j++) {
if(player[j].life && !(player[j].type == WEREWOLF || player[j].type == WEREWOLF_KING ||
(player[j].type == WILD_CHILD && player[j].wild_child_become_wolf)) && j != i) {
valid_targets.push_back(j);
}
}
x = valid_targets.empty() ? 0 : valid_targets[rand() % valid_targets.size()];
}
else if(player[i].type == SEER && player[i].know == 1) {
vector<int> valid_targets;
for(int j=1; j<=n; j++) {
if(player[j].life && (player[j].type == WEREWOLF || player[j].type == WEREWOLF_KING) && j != i) {
valid_targets.push_back(j);
}
}
if(valid_targets.empty()) {
for(int j=1; j<=n; j++) {
if(player[j].life && j != i) {
valid_targets.push_back(j);
}
}
}
x = valid_targets.empty() ? 0 : valid_targets[rand() % valid_targets.size()];
}
else if(player[i].type == CUPID && is_human_wolf_lover) {
vector<int> valid_targets;
for(int j=1; j<=n; j++) {
if(player[j].life && !player[j].is_lover && j != i) {
valid_targets.push_back(j);
}
}
x = valid_targets.empty() ? 0 : valid_targets[rand() % valid_targets.size()];
}
else {
vector<int> valid_targets;
for(int j=1; j<=n; j++) {
if(player[j].life && j != i) {
valid_targets.push_back(j);
}
}
x = (rand() % 10 < 2) ? 0 : valid_targets[rand() % valid_targets.size()];
}
if(x == 0) cout<<i<<"号玩家弃权!"<<endl;
else cout<<i<<"号玩家投给了"<<x<<"号玩家!"<<endl;
}
if(x != 0) TOU[x].xxx++;
}
else if(player[i].is_silenced && player[i].life) {
cout<<i<<"号玩家被禁言,无法投票!"<<endl;
}
else if(!player[i].life) {
cout<<i<<"号玩家已死亡,无法投票!"<<endl;
}
}
Sleep(1000);
sort(TOU + 1, TOU + n + 1, cmp);
int max_vote = TOU[1].xxx;
vector<int> max_vote_players;
if(max_vote > 0) {
for(int i=1; i<=n; i++) {
if(TOU[i].xxx == max_vote) {
max_vote_players.push_back(TOU[i].num);
} else {
break;
}
}
}
if(max_vote_players.size() == 1) {
int out_player = max_vote_players[0];
cout<<"投票结束!"<<out_player<<"号玩家获得"<<max_vote<<"票,是最高票!"<<endl;
if(player[out_player].type == IDIOT) {
cout<<out_player<<"号是白痴,被投出不会死亡,但失去投票权!"<<endl;
player[out_player].is_idiot_out = true;
Sleep(1500);
} else {
player[out_player].life = 0;
player[out_player].how = 2;
cout<<out_player<<"号玩家被投票出局!"<<endl;
if(player[out_player].is_lover) {
int lover_id = (lover1 == out_player) ? lover2 : lover1;
if(player[lover_id].life) {
player[lover_id].life = 0;
player[lover_id].how = 2;
cout<<lover_id<<"号情侣殉情死亡!"<<endl;
Sleep(1500);
}
}
if(player[out_player].type == WEREWOLF_KING) {
langrenwang_skill(out_player);
}
if(player[out_player].type == HUNTER && !lr) {
panduanlieren();
}
}
Sleep(1500);
} else if(max_vote_players.empty()) {
cout<<"所有人都选择弃权,本次投票无人出局!"<<endl;
Sleep(1500);
} else {
cout<<"平票!获得最高票("<<max_vote<<"票)的玩家是:";
// 替换范围for循环为普通for循环
for(int i=0; i<max_vote_players.size(); i++) {
cout<<max_vote_players[i]<<"号";
if(i < max_vote_players.size() - 1) cout<<"、";
}
cout<<",需要重新投票!"<<endl;
Sleep(1000);
for(int i=1; i<=n; i++) TOU[i].xxx = 0;
cout<<"重新投票(只能投平票玩家:";
// 替换范围for循环为普通for循环
for(int i=0; i<max_vote_players.size(); i++) {
cout<<max_vote_players[i]<<"号";
if(i < max_vote_players.size() - 1) cout<<"、";
}
cout<<",0弃权):"<<endl;
for(int i=1; i<=n; i++) {
if(player[i].life == 1 && !player[i].is_silenced) {
Sleep(500);
if(i == MY) {
cout<<"你的投票:";
cin>>x;
bool valid = false;
while(!valid) {
if(x == 0) {
valid = true;
} else {
// 替换范围for循环为普通for循环
for(int j=0; j<max_vote_players.size(); j++) {
if(x == max_vote_players[j] && player[x].life == 1) {
valid = true;
break;
}
}
}
if(!valid) {
cout<<"输入错误!只能投平票玩家(";
// 替换范围for循环为普通for循环
for(int j=0; j<max_vote_players.size(); j++) {
cout<<max_vote_players[j]<<"号";
if(j < max_vote_players.size()-1) cout<<"、";
}
cout<<")或0弃权,请重新输入:";
cin>>x;
}
}
if(x == 0) cout<<"你选择弃权!"<<endl;
else cout<<"你投给了"<<x<<"号玩家!"<<endl;
} else {
srand(time(0) + i * 200);
vector<int> valid_targets = max_vote_players;
x = (rand() % 10 < 1) ? 0 : valid_targets[rand() % valid_targets.size()];
if(x == 0) cout<<i<<"号玩家弃权!"<<endl;
else cout<<i<<"号玩家投给了"<<x<<"号玩家!"<<endl;
}
if(x != 0) TOU[x].xxx++;
} else if(player[i].is_silenced && player[i].life) {
cout<<i<<"号玩家被禁言,无法投票!"<<endl;
}
}
Sleep(1000);
sort(TOU + 1, TOU + n + 1, cmp);
int final_max = -1;
int final_out = -1;
int same_max_count = 0;
// 替换范围for循环为普通for循环
for(int j=0; j<max_vote_players.size(); j++) {
int pid = max_vote_players[j];
if(TOU[pid].xxx > final_max) {
final_max = TOU[pid].xxx;
}
}
// 替换范围for循环为普通for循环
for(int j=0; j<max_vote_players.size(); j++) {
int pid = max_vote_players[j];
if(TOU[pid].xxx == final_max) {
same_max_count++;
final_out = pid;
}
}
if(final_max > 0 && same_max_count == 1) {
cout<<"重投结束!"<<final_out<<"号玩家获得"<<final_max<<"票,被投票出局!"<<endl;
if(player[final_out].type == IDIOT) {
cout<<final_out<<"号是白痴,被投出不会死亡!"<<endl;
player[final_out].is_idiot_out = true;
} else {
player[final_out].life = 0;
player[final_out].how = 2;
if(player[final_out].is_lover) {
int lover_id = (lover1 == final_out) ? lover2 : lover1;
if(player[lover_id].life) {
player[lover_id].life = 0;
player[lover_id].how = 2;
cout<<lover_id<<"号玩家殉情死亡!"<<endl;
Sleep(1500);
}
}
if(player[final_out].type == WEREWOLF_KING) {
langrenwang_skill(final_out);
}
if(player[final_out].type == HUNTER && !lr) {
panduanlieren();
}
}
} else {
cout<<"再次平票(或所有人弃权),本轮投票无人出局!"<<endl;
}
Sleep(1500);
}
if(silenced_player != -1) {
player[silenced_player].is_silenced = false;
silenced_player = -1;
}
}
bool game_over() {
int all_alive = 0, wolf_alive = 0, lover_alive = 0;
for(int i=1; i<=n; i++) {
if(!player[i].life) continue;
all_alive++;
if(player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING ||
(player[i].type == WILD_CHILD && player[i].wild_child_become_wolf))
wolf_alive++;
if(player[i].is_lover)
lover_alive++;
}
if(is_human_wolf_lover && lover_alive == 2 && (all_alive - lover_alive) == 0)
return true;
if((!is_human_wolf_lover || (is_human_wolf_lover && lover_alive < 2)) &&
wolf_alive >= (all_alive - wolf_alive - (is_human_wolf_lover ? lover_alive : 0)))
return true;
if((!is_human_wolf_lover || (is_human_wolf_lover && lover_alive < 2)) && wolf_alive == 0)
return true;
return false;
}
void panduanlieren() {
if(lr==1) return;
if(player[lieren].life==0) {
cout<<lieren<<"号猎人被淘汰,发动技能!"<<endl;
Sleep(1000);
if(MY==lieren) {
cout<<"请选择射杀一名玩家(输入编号):";
int x;
cin>>x;
while(x<1||x>n||player[x].life==0) {
cout<<"输入错误!请重新输入:";
cin>>x;
}
player[x].life=0;
player[x].how=4;
cout<<"你射杀了"<<x<<"号玩家!"<<endl;
} else if(n>=9) {
srand(time(0));
int x=rand()%n+1;
while(x<1||x>n||player[x].life==0) {
x=rand()%n+1;
}
player[x].life=0;
player[x].how=4;
cout<<"猎人射杀了"<<x<<"号玩家!"<<endl;
}
lr=1;
Sleep(1500);
}
}
void night() {
system("cls");
cout<<"==================== 狼人杀online ===================="<<endl;
cout<<"天~黑~请~闭~眼~~~"<<endl;
Sleep(1000);
bool cupid_exist = (cupid_pos != -1);
if(cupid_exist) {
cout << "丘~比~特~请~睁~眼~~~" << endl;
Sleep(1000);
int a,b;
if(MY == cupid_pos) {
cout<<"请选择两名玩家成为情侣(输入两个不同的编号):";
cin>>a>>b;
while(a == b || a < 1 || a > n || b < 1 || b > n || !player[a].life || !player[b].life) {
cout<<"输入错误!请选择两名不同的存活玩家:";
cin>>a>>b;
}
make_lover(a,b);
} else {
do{
srand(time(0) + rand());
a=rand()%n+1;
b=rand()%n+1;
} while(a==b || !player[a].life || !player[b].life);
make_lover(a,b);
cout << "丘比特正在选择情侣目标..." << endl;
Sleep(1000);
}
Sleep(1000);
cout << "丘~比~特~请~闭~眼~~~" << endl;
Sleep(500);
}
wild_child_choose_target();
if(n>=12) shoushui(1,1);
Sleep(1000);
cout<<"狼~人~请~睁~眼~~~"<<endl;
Sleep(1000);
if(player[MY].type == WEREWOLF || player[MY].type == WEREWOLF_KING ||
(player[MY].type == WILD_CHILD && player[MY].wild_child_become_wolf)) {
cout<<"你的狼队友:";
for(int i=1; i<=n; i++) {
if(i==MY) continue;
if((player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING) ||
(player[i].type == WILD_CHILD && player[i].wild_child_become_wolf)) {
cout<<i<<"号 ";
player[i].know=2;
}
}
cout<<endl<<"请选择要杀死的玩家(输入编号):";
cin>>kill1;
while(kill1<1||kill1>n||player[kill1].life==0 || kill1 == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>kill1;
}
cout<<"你们选择杀死"<<kill1<<"号玩家!"<<endl;
} else {
do {
srand(time(0) + rand());
kill1=rand()%n+1;
} while(kill1<1||kill1>n||player[kill1].life==0);
Sleep(1000);
cout<<"狼人正在行动..."<<endl;
}
Sleep(1000);
cout<<"狼~人~请~闭~眼~~~"<<endl;
Sleep(1000);
cout<<"女~巫~请~睁~眼~~~"<<endl;
Sleep(1000);
if(player[MY].type == WITCH && player[MY].life==1) {
if(jieyao==1) {
cout<<"今晚"<<kill1<<"号玩家被狼人杀死!"<<endl;
cout<<"是否使用解药?(A.救 B.不救):";
cin>>a;
if(a=='A'||a=='a') {
jieyao=0;
if(shou!=kill1) kill1=0;
cout<<"你使用了解药,"<<kill1<<"号玩家被解救!"<<endl;
} else {
if(shou==kill1) kill1=0;
cout<<"你选择不救!"<<endl;
Sleep(500);
cout<<"是否使用毒药?(A.毒 B.不毒):";
cin>>a;
if(a=='A'||a=='a') {
duyao=0;
cout<<"请选择要毒杀的玩家(输入编号):";
cin>>kill2;
while(kill2<1||kill2>n||player[kill2].life==0 || kill2 == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>kill2;
}
cout<<"你选择毒杀"<<kill2<<"号玩家!"<<endl;
}
}
} else if(duyao==1) {
cout<<"是否使用毒药?(A.毒 B.不毒):";
cin>>a;
if(a=='A'||a=='a') {
duyao=0;
cout<<"请选择要毒杀的玩家(输入编号):";
cin>>kill2;
while(kill2<1||kill2>n||player[kill2].life==0 || kill2 == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>kill2;
}
cout<<"你选择毒杀"<<kill2<<"号玩家!"<<endl;
} else {
cout<<"你选择不使用毒药!"<<endl;
}
} else {
cout<<"你已经没有药了!"<<endl;
}
} else {
bool use_jieyao = false;
if(jieyao==1 && rand()%2==0) {
use_jieyao = true;
jieyao=0;
kill1=0;
}
if(!use_jieyao && duyao==1 && rand()%3==0) {
duyao=0;
do {
kill2=rand()%n+1;
} while(kill2<1||kill2>n||player[kill2].life==0||kill2==kill1);
}
Sleep(1000);
cout<<"女巫正在行动..."<<endl;
}
Sleep(1000);
cout<<"女~巫~请~闭~眼~~~"<<endl;
Sleep(1000);
if(n>6) {
cout<<"预~言~家~请~睁~眼~~~"<<endl;
Sleep(1000);
if(player[MY].type == SEER && player[MY].life==1) {
cout<<"请选择要查验的玩家(输入编号):";
int x;
cin>>x;
while(x<1||x>n||player[x].life==0 || x == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>x;
}
player[x].know=1;
cout<<"查验结果:";
if(player[x].type == WEREWOLF || player[x].type == WEREWOLF_KING ||
(player[x].type == WILD_CHILD && player[x].wild_child_become_wolf)) {
cout<<"狼人"<<endl;
} else {
cout<<"好人"<<endl;
}
} else {
srand(time(0));
int x=rand()%n+1;
while(x<1||x>n||player[x].life==0) {
x=rand()%n+1;
}
Sleep(1000);
cout<<"预言家正在行动..."<<endl;
}
Sleep(1000);
cout<<"预~言~家~请~闭~眼~~~"<<endl;
Sleep(1000);
}
if(n >= 12) {
silencer_skill(1);
}
bear_roar();
if(kill1!=0) {
player[kill1].life=0;
player[kill1].how=1;
if(player[kill1].type == HUNTER && !lr) {
panduanlieren();
}
}
if(kill2!=0) {
player[kill2].life=0;
player[kill2].how=3;
if(player[kill2].type == HUNTER) {
lr = true;
cout<<kill2<<"号猎人被毒死,无法发动技能!"<<endl;
Sleep(1500);
}
}
if(lover1 != -1 && lover2 != -1) {
if(player[lover1].life && !player[lover2].life) {
player[lover1].life=0;
player[lover1].how=2;
cout<<lover1<<"号情侣殉情死亡!"<<endl;
Sleep(1000);
}
if(!player[lover1].life && player[lover2].life) {
player[lover2].life=0;
player[lover2].how=2;
cout<<lover2<<"号情侣殉情死亡!"<<endl;
Sleep(1000);
}
}
check_wild_child();
system("cls");
print(2,0);
}
void night2(int hhh,int hhhh) {
system("cls");
cout<<"==================== 狼人杀online ===================="<<endl;
cout<<"天~黑~请~闭~眼~~~"<<endl;
Sleep(1000);
if(n>=12) shoushui(hhh,hhhh);
hunter_mage_skill(hhh);
Sleep(1000);
cout<<"狼~人~请~睁~眼~~~"<<endl;
Sleep(1000);
if((player[MY].type == WEREWOLF || player[MY].type == WEREWOLF_KING ||
(player[MY].type == WILD_CHILD && player[MY].wild_child_become_wolf)) && player[MY].life==1) {
cout<<"你的狼队友:";
for(int i=1; i<=n; i++) {
if(i==MY) continue;
if((player[i].type == WEREWOLF || player[i].type == WEREWOLF_KING) ||
(player[i].type == WILD_CHILD && player[i].wild_child_become_wolf)) {
cout<<i<<"号 ";
player[i].know=2;
}
}
cout<<endl<<"请选择要杀死的玩家(输入编号):";
cin>>kill1;
while(kill1<1||kill1>n||player[kill1].life==0 || kill1 == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>kill1;
}
cout<<"你们选择杀死"<<kill1<<"号玩家!"<<endl;
} else {
do {
srand(time(0) + rand());
kill1=rand()%n+1;
} while(kill1<1||kill1>n||player[kill1].life==0);
Sleep(1000);
cout<<"狼人正在行动..."<<endl;
}
Sleep(1000);
cout<<"狼~人~请~闭~眼~~~"<<endl;
Sleep(1000);
cout<<"女~巫~请~睁~眼~~~"<<endl;
Sleep(1000);
if(player[MY].type == WITCH && player[MY].life==1) {
if(jieyao==1) {
cout<<"今晚"<<kill1<<"号玩家被狼人杀死!"<<endl;
cout<<"是否使用解药?(A.救 B.不救):";
cin>>a;
if(a=='A'||a=='a') {
jieyao=0;
if(shou!=kill1) kill1=0;
cout<<"你使用了解药!"<<endl;
} else {
if(shou==kill1) kill1=0;
cout<<"是否使用毒药?(A.毒 B.不毒):";
cin>>a;
if(a=='A'||a=='a') {
duyao=0;
cout<<"请选择要毒杀的玩家(输入编号):";
cin>>kill2;
while(kill2<1||kill2>n||player[kill2].life==0 || kill2 == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>kill2;
}
cout<<"你选择毒杀"<<kill2<<"号玩家!"<<endl;
} else {
cout<<"你选择不使用毒药!"<<endl;
}
}
} else if(duyao==1) {
cout<<"是否使用毒药?(A.毒 B.不毒):";
cin>>a;
if(a=='A'||a=='a') {
duyao=0;
cout<<"请选择要毒杀的玩家(输入编号):";
cin>>kill2;
while(kill2<1||kill2>n||player[kill2].life==0 || kill2 == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>kill2;
}
cout<<"你选择毒杀"<<kill2<<"号玩家!"<<endl;
} else {
cout<<"你选择不使用毒药!"<<endl;
}
} else {
cout<<"你已经没有药了!"<<endl;
}
} else {
bool use_jieyao = false;
if(jieyao==1 && rand()%2==0) {
use_jieyao = true;
jieyao=0;
kill1=0;
}
if(!use_jieyao && duyao==1 && rand()%3==0) {
duyao=0;
do {
kill2=rand()%n+1;
} while(kill2<1||kill2>n||player[kill2].life==0||kill2==kill1);
}
Sleep(1000);
cout<<"女巫正在行动..."<<endl;
}
Sleep(1000);
cout<<"女~巫~请~闭~眼~~~"<<endl;
Sleep(1000);
if(n>6) {
cout<<"预~言~家~请~睁~眼~~~"<<endl;
Sleep(1000);
if(player[MY].type == SEER && player[MY].life==1) {
cout<<"请选择要查验的玩家(输入编号):";
int x;
cin>>x;
while(x<1||x>n||player[x].life==0 || x == MY) {
cout<<"输入错误!请选择存活且非自己的玩家:";
cin>>x;
}
player[x].know=1;
cout<<"查验结果:";
if(player[x].type == WEREWOLF || player[x].type == WEREWOLF_KING ||
(player[x].type == WILD_CHILD && player[x].wild_child_become_wolf)) {
cout<<"狼人"<<endl;
} else {
cout<<"好人"<<endl;
}
} else {
srand(time(0));
int x=rand()%n+1;
while(x<1||x>n||player[x].life==0) {
x=rand()%n+1;
}
Sleep(1000);
cout<<"预言家正在行动..."<<endl;
}
Sleep(1000);
cout<<"预~言~家~请~闭~眼~~~"<<endl;
Sleep(1000);
}
if(n >= 12) {
silencer_skill(hhh);
}
bear_roar();
if(kill1!=0) {
player[kill1].life=0;
player[kill1].how=1;
if(player[kill1].type == HUNTER && !lr) {
panduanlieren();
}
}
if(kill2!=0) {
player[kill2].life=0;
player[kill2].how=3;
if(player[kill2].type == HUNTER) {
lr = true;
cout<<kill2<<"号猎人被毒死,无法发动技能!"<<endl;
Sleep(1500);
}
}
if(lover1 != -1 && lover2 != -1) {
if(player[lover1].life && !player[lover2].life) {
player[lover1].life=0; player[lover1].how=2;
cout<<lover1<<"号情侣殉情死亡!"<<endl;
Sleep(1000);
}
if(!player[lover1].life && player[lover2].life) {
player[lover2].life=0; player[lover2].how=2;
cout<<lover2<<"号情侣殉情死亡!"<<endl;
Sleep(1000);
}
}
check_wild_child();
system("cls");
print(hhh+1,0);
}
void print1() {
system("cls");
cout<<"==================== 狼人杀online ===================="<<endl;
cout<<"天~亮~了!"<<endl;
Sleep(500);
hunter_mage_target = -1;
vector<int> dead_players_list;
for(int i=1; i<=n; i++) {
if(!player[i].life && player[i].how != 0) {
dead_players_list.push_back(i);
}
}
if(!dead_players_list.empty()) {
cout<<"昨晚死亡的玩家:";
// 替换范围for循环为普通for循环
for(int i=0; i<dead_players_list.size(); i++) {
cout<<dead_players_list[i]<<"号";
if(i < dead_players_list.size()-1) cout<<"、";
}
cout<<"!"<<endl;
} else {
cout<<"昨晚是平安夜!"<<endl;
}
kill1=0; kill2=0;
cout<<"====================================================="<<endl;
Sleep(1500);
}
int main() {
system("cls");
cout<<"==================== 狼人杀online ===================="<<endl;
cout<<"支持人数:6-12人"<<endl;
cout<<"11、12人局包含丘比特(第三方情侣阵营)、猎魔人"<<endl;
cout<<"12人局额外包含:禁言长老、熊、野孩子"<<endl;
cout<<"请输入游戏人数:";
scanf("%d",&n);
if(n<6 || n>12) {
cout<<"错误!人数必须在6-12之间!"<<endl;
system("pause");
return 0;
}
cout<<"正在初始化游戏...";
init1();
init2(n);
int k=1;
do {
srand(time(0) + k * 10);
init3(k);
cout<<".";
Sleep(10);
k++;
} while(k<=n);
system("cls");
cout<<"游戏初始化完成!"<<endl;
Sleep(500);
MY=rand()%n+1;
cout<<"你的身份是:"<<player[MY].name<<"("<<MY<<"号)"<<endl;
player[MY].know=2;
Sleep(2000);
int day = 1;
while(true) {
if(day == 1) night();
else night2(day, 1);
print1();
if(game_over()) {
system("cls");
cout<<"==================== 游戏结束 ===================="<<endl;
printhhh();
break;
}
panduanlieren();
toupiao(day+1, 0);
if(game_over()) {
system("cls");
cout<<"==================== 游戏结束 ===================="<<endl;
printhhh();
break;
}
day++;
if(day > 10) {
cout<<"游戏超过10天,强制结束!"<<endl;
printhhh();
break;
}
cout<<"即将进入第"<<day<<"个夜晚..."<<endl;
Sleep(1500);
}
return 0;
}