狼人杀(预告)

luffy 路飞AFO 2020-06-12 13:40:24 2020-06-15 12:56:46 7
#include<bits/stdc++.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>

using namespace std;

void time4()
{
Sleep(400);
} 


int main()

{

char a;

printf("=====================================================================");

printf("\n\n");

printf("欢迎来到由 仪表不凡、仪表堂堂 、丰神俊秀、文质彬彬的luffy创造的狼人杀");

time4();

printf("\n\n");

printf("=====================================================================");

time4();

printf("\n\n");

printf("现在开始随机抽取身份\n等待中");

time4();

for(int i=1;i<=10;i++)

{

	cout<<".";

	time4();

}

cout<<endl;

cout<<"你的";

Sleep(500);

cout<<"身份是";

Sleep(500);

cout<<"乌鸦!"<<endl;

Sleep(500);

printf("=====================================================================\n");
time4();
cout<<"下面开始介绍游戏规则:"<<endl;
time4();
cout<<"本局游戏采用屠城局,需淘汰所有敌对阵营角色方可胜利"<<endl; 
time4();
cout<<"本局游戏有四名狼人,两名守卫,一名女巫,一名强制OUT,一名超级护盾,一名乌鸦"<<endl<<endl;
time4();
cout<<"狼人:第一晚睁眼认识同伴(第一晚可以短暂交流),随后开始各自选择一名击杀人员,被选择数最多(相同则随机)的角色受到x次攻击(x为选择其的狼人人数)"<<endl<<endl;
time4();
cout<<"守卫:第一晚睁眼认识同伴,其后每晚各自选择一名角色,将其套上护盾(可叠加),每个护盾可以抵消一次攻击"<<endl<<endl;
time4();
cout<<"女巫:每晚拥有一瓶毒药和一瓶解药,解药可以抵消两次攻击(不能得知每晚死亡的人),毒药可以对一名角色造成一次攻击,每晚只能用一瓶药"<<endl<<endl;
time4();
cout<<"强制OUT:每两晚一次,可以强制出局一名角色(可穿透女巫的解药),属于第三方角色,需屠城获胜!!!"<<endl<<endl;
time4();
cout<<"超级护盾:每两晚一次,可以保护一名角色(不可连续两次保护同一人),使其在今夜不会被淘汰(可无视女巫、狼人、强制OUT)"<<endl<<endl;
time4();
cout<<"乌鸦:每晚可指定一名角色,使其在投票放逐时增加一票"<<endl<<endl;
time4();
printf("=====================================================================\n");

cout<<"好好看规则,输入1开始游戏!!!(不输入1有惊喜哦)"<<endl; 

cin>>a;

if(a=='1')
{
	cout<<endl<<"好好等待正式版发行吧!";
}
else
{
	cout<<endl<<"你这个不守规则的SB,接受惩罚吧!!!";
}
return 0;

}
{{ vote && vote.total.up }}

共 8 条回复

raoyiou

我也在编狼人杀

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring> 
#include <windows.h> 
using namespace std;

struct data
{
	string ID;
	int life;
	bool sergeant = false;
} player[15];

void ID_init();
void sergeant();

void werewolves(); 
void witch();
void prophet();
void guard();

void game()
{	
    ID_init();

	for (int day = 1; ; day++)
	{
		for (int i = 1; i <= 12; i++)
    	    player[i].life = 1; 
	
		if (day < 10) cout << setw(59) << "" << 0 << day << "";
		else cout << setw(59) << "" << day << "";
		puts("\n");
    	Sleep(1000);
    	
		puts("    天黑请闭眼");
	    Sleep(1000);
	
    	puts("    狼人请睁眼");
	    Sleep(1000); 
        werewolve();
    	Sleep(1000);
	    puts("    狼人请闭眼");
	    Sleep(1000);
	
    	puts("    女巫请睁眼");
    	Sleep(1000);
		witch();
		Sleep(1000);
		puts("    女巫请闭眼");
		Sleep(1000);
		
		puts("    预言家请睁眼");
    	Sleep(1000);
		prophet();
		Sleep(1000);
		puts("    预言家请闭眼");
		Sleep(1000);
		
		puts("    守卫请睁眼");
    	Sleep(1000);
		prophet();
		Sleep(1000);
		puts("    守卫请闭眼");
		Sleep(1000);
	}
}

void ID_init()
{
	int count[15] = { 0, 4, 4, 1, 1, 1, 1 };
	
	for (int i = 1, rand_num; i <= 12; )
	{
		rand_num = rand() % 12 + 1;
		
		if (rand_num <= 4 && count[rand_num] > 0) 
	    { player[i].ID = "狼人"; count[rand_num]--; i++; }
	    
	    if (rand_num <= 8 && count[rand_num] > 0)
	    { player[i].ID = "平民"; count[rand_num]--; i++; }
	    
	    if (rand_num = 9 && count[rand_num] > 0)
	    { player[i].ID = "女巫"; count[rand_num]--; i++; }
	    
	    if (rand_num == 10 && count[rand_num] > 0)
	    { player[i].ID = "预言家"; count[rand_num]--; i++; }
	    
	    if (rand_num == 11 && count[rand_num] > 0)
	    { player[i].ID = "猎人"; count[rand_num]--; i++; }
	    
	    if (rand_num == 12 && count[rand_num] > 0)
	    { player[i].ID = "白痴"; count[rand_num]--; i++; }
	}
}

void werewolves()
{
	int kill;
	
	if (player[1].ID == "狼人")
	{
		puts("    你睁眼了");
	    Sleep(1000);
	    
	    puts("    剩余存活的狼人是:");
	    for (int i = 1; i <= 12; i++)
	        if (player[i].ID == "狼人")
	            cout << i << "";
	
	    puts("    \n你要杀几号?");
	    cin >> kill;
	    player[kill].life--;
	    
	    for (int i = 1; i <= 3; ) 
	    {
	    	kill = rand() 12 + 1;
	    	
	    	if (player[kill].ID != "狼人")
	    	{ player[kill].life--; i++ }
		}
	}
	else
	{
		for (int i = 1; i <= 4; )
	    {
		    kill = rand() % 12 + 1;
		
		    if (player[kill].ID != "狼人") 
		    { player[kill].life--; i++; }
	    }
	} 
}

void witch()
{
	int sel;
	int kill, res;
	
	if (player[1].ID == "女巫")
	{
		puts("    你睁眼了");
    	Sleep(1000);
	 
	    cout << "    ";
    	for (int i = 1; i <= 12; i++)
	    	if (player[i].life < 1) 
		        cout << i << "";
    	puts("死了,你要救吗?");
	    puts("        1、救   2、不救");
    	cin >> sel;
	
	    if (sel == 1) 
    	{
	    	puts("    你要救几号?");
		    cin >> res;
    		player[res].life++;
	    }
    	else
    	{
	    	puts("    你要杀几号");
		    cin >> kill;
    		player[kill].life--;
	    }
	}
    else
	{
		sel = rand() % 2 + 1;
	
	    if (rand_sel == 1)
	    {
		    for (; ; )
		    {
			    kill = rand() % 12 + 1;
				
			    if (player[kill].ID != "女巫") 
				{ player[kill].life--; break; }
		    }
	    }
	    else 
		{
			for (; ; )
		    {
			    res = rand() % 12 + 1;
				
			    if (player[res].ID != "女巫") 
				{ player[res].life++; break; }
		    }
		}
	} 
}

void prophet()
{
	int num;
	
	puts("    你睁眼了");
	Sleep(1000);
	
	puts("    你要预言几号的身份?");
	cin >> num;
	
	if (player[num].ID == "狼人") puts("    他是狼人");
	else puts("    他是好人"); 
}

int main()
{
	system("color f4");
	srand(time(0));
	cout << setw(68) << "狼人杀 12人标准局\n";
	Sleep(1000);
	system("cls");
	game();

	return 0;
}

思路清晰了,但还没写完代码

CPP 刷题王

这叫个屁狼人杀!还叫我们等正式版!(•́へ•́╬)

chen_zhe 沙雕

233333333

luffy 路飞AFO

已去除坑人搞笑功能

luffy 路飞AFO

你仔细读读程序

luffy 路飞AFO

......

pikahuan 逗比

85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png85KX_V3___7~9@QOR1RJF5.png

pikahuan 逗比

开头先命令老子叫你爸爸,我反手就把程序关了