自己写的《原神杀》1.0.3版本

1.0.3版本出炉喽!

本次更新新增人物:钟离

修改了雷电将军的杀人机制

新增选项:游戏规则

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string shenfen[5]= {"旅行者","雷电将军","神里绫华","胡桃","钟离"},player[16];//shenfen[]为有什么身份
//player[]记录每个玩家的身份
bool IPL[16]= {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
//IPL[]记录每位玩家是否存活
int toupiao[16];//记录每位玩家票数
void shuo(string s) {
	for(int i=0; i<s.size(); i++) {
		cout<<s[i];
		Sleep(20);
	}
}
void start() {
	system("cls");
	srand(time(0));
	int id=rand()%15+1,sf=rand()%5+1,cunhuorenshu=15;
	cout<<"      你是"<<id<<"号      \n";
	cout<<"      你的身份是"<<shenfen[sf-1]<<endl;
	player[id]=shenfen[sf-1];
	Sleep(2000);
	system("cls");
	int night=1,temp=4,tempf=1,temph=1,tempz=2;
	if(player[id]=="雷电将军") {
		temp=3;
	}
	if(shenfen[sf-1]=="神里绫华") tempf--;
	if(shenfen[sf-1]=="胡桃") temph--;
	if(shenfen[sf-1]=="钟离") tempz--;
	for(int i=1; i<=15; i++) {//初步给身份
		srand(time(0));
		if(i==id) continue;
		sf=rand()%5+1;
		if(shenfen[sf-1]=="雷电将军"&&temp) {
			temp--;
			player[i]="雷电将军";
		} else if(shenfen[sf-1]=="神里绫华"&&tempf) {
			tempf--;
			player[i]="神里绫华";
		} else if(shenfen[sf-1]=="胡桃"&&temph) {
			temph--;
			player[i]="胡桃";
		} else if(shenfen[sf-1]=="钟离"&&tempz) {
			tempz--;
			player[i]="钟离";
		} else player[i]="旅行者";
	}
	if(temp!=0) { //46~78行进一步给身份,确保人数搭配正确,不卡bug
		int lk=temp;
		for(int i=1; i<=lk; i++) {
			int ra=0;
			while(player[ra]!="旅行者") {
				ra=rand()%15+1;
			}
			player[ra]="雷电将军";
			temp--;
		}
	}
	if(tempf!=0) {
		int lk=tempf;
		for(int i=1; i<=lk; i++) {
			int ra=0;
			while(player[ra]!="旅行者") {
				ra=rand()%15+1;
			}
			player[ra]="神里绫华";
			tempf--;
		}
	}
	if(temph!=0) {
		int lk=temph;
		for(int i=1; i<=lk; i++) {
			int ra=0;
			while(player[ra]!="旅行者") {
				ra=rand()%15+1;
			}
			player[ra]="胡桃";
			temph--;
		}
	}
	if(tempz!=0) {
		int lk=tempz;
		for(int i=1; i<=lk; i++) {
			int ra=0;
			while(player[ra]!="旅行者") {
				ra=rand()%15+1;
			}
			player[ra]="钟离";
			tempz--;
		}
	}
	/*for(int i=1; i<=15; i++) {
		cout<<i<<"号是"<<player[i]<<'\n';
	}*/
	while(IPL[id]) {
		memset(toupiao,0,sizeof toupiao);
		cout<<"第"<<night++<<"夜\n";
		cout<<"雷电将军开始行动\n";
		for(int i=1; i<=15; i++) {//夜晚
			srand(time(0));
			if(IPL[id]==0) {
				cout<<"你死了\n";
				system("pause");
				cunhuorenshu--;
				return;
			}
			if(id==i&&player[id]=="雷电将军") {
				cout<<"你要杀几号?\n";
				int f;
				cin>>f;
				IPL[f]=false;
				cout<<f<<"号被杀死了,身份是"<<player[f]<<endl;
				cunhuorenshu--;
			}
			if(player[i]=="雷电将军"&&IPL[i]) {
				int t=rand()%15+1;
				while(IPL[t]==0||player[t]=="雷电将军") {
					t=rand()%15+1;
				}
				IPL[t]=false;
				cout<<t<<"号被杀死了,身份是"<<player[t]<<endl;
				cunhuorenshu--;
			}
			if(IPL[id]==false) {
				cout<<"你死了\n";
				system("pause");
				return;
			}
			if(player[id]=="神里绫华"&&id==i) {
				cout<<"你要查看谁的身份?\n";
				int yy;
				cin>>yy;
				cout<<yy<<"号是"<<player[yy]<<endl;
			}
			if(player[id]=="胡桃"&&id==i) {
				cout<<"你要攻击谁?\n";
				Sleep(100);
				cout<<"存活名单:\n";
				for(int i=1; i<=15; i++)
					if(IPL[i]) cout<<i<<' ';
				int g;
				cin>>g;
				if(player[g]=="雷电将军") {
					cout<<"对方是雷电将军,她死亡了\n";
					IPL[g]=false;
				} else {
					cout<<"对方是好人,你死了\n";
					IPL[id]=false;
					system("pause");
					return;
				}
				cunhuorenshu--;
				if(IPL[id]==0) {
					cout<<"你死了\n";
					system("pause");
					cunhuorenshu--;
					return;
				}
			}
			if(player[i]=="胡桃"&&IPL[i]) {
				int g=rand()%15+1;
				while(IPL[g]==0)
					g=rand()%15+1;
				if(player[g]=="雷电将军") {
					cout<<"胡桃杀死了雷电将军\n";
					IPL[g]=false;
					cunhuorenshu--;
				} else {
					cout<<"胡桃没有攻击对人,亖了\n";
					IPL[id]=false;
					cunhuorenshu--;
				}
			}
			if(i==id&&player[i]=="钟离") {
				cout<<"你要杀谁?\n";
				int f;
				cin>>f;
				cout<<f<<"号被杀死了,身份是"<<player[f]<<"\n";
				cunhuorenshu--;
			}
			if(player[i]=="钟离"&&IPL[i]) {
				int t=rand()%15+1;
				while(IPL[t]==0) {
					t=rand()%15+1;
				}
				cout<<t<<"号被杀死了,身份是"<<player[t]<<"\n";
				cunhuorenshu--;
			}
		}
		if(player[id]=="雷电将军"||player[id]=="钟离") {
			bool flag=1;
			for(int i=1; i<=15; i++) {
				if(IPL[i]==true&&player[i]!="雷电将军"&&player[i]!="钟离") {
					flag=0;
					break;
				}
			}
			if(flag) {
				cout<<"恭喜你,你胜利了\n";
				system("pause");
				return;
			}
		} else {
			bool flag=1;
			for(int i=1; i<=15; i++) {
				if(IPL[i]==true&&(player[i]=="雷电将军"||player[i]=="钟离")) {
					flag=0;
					break;
				}
			}
			if(flag) {
				cout<<"恭喜你,你胜利了\n";
				system("pause");
				return;
			}
		}
		system("pause");
		cout<<"投票环节\n";//白天
		Sleep(500);
		system("cls");
		if(cunhuorenshu==1&&IPL[id]==true) {
			cout<<"恭喜你,你胜利了\n";
			system("pause");
			return;
		}
		cout<<"存活名单:";
		for(int i=1; i<=15; i++)
			if(IPL[i]) cout<<i<<' ';
		cout<<"\n";
		cout<<"你要投谁?\n";
		int tp;
		cin>>tp;
		toupiao[tp]++;
		int maxn=-1,maxi;
		for(int i=1; i<=15; i++) {
			if(i==id) continue;
			if(IPL[i]==true) {
				tp=rand()%15+1;
				while(IPL[tp]==false)
					tp=rand()%15+1;
				toupiao[tp]++;
			}

		}
		for(int i=1; i<=15; i++) {
			if(toupiao[i]>maxn) {
				maxn=max(toupiao[i],maxn);
				maxi=i;
			}
		}
		for(int i=1; i<=15; i++) {
			if(IPL[i])
				cout<<i<<"号"<<toupiao[i]<<"票  ";
		}
		cout<<"\n";
		cout<<maxi<<"号被处死了,他是"<<player[maxi]<<endl;
		if(player[maxi]=="钟离"&&maxi==id){
			cout<<"你被处死了,你要杀死谁?\n";
			int gh;
			cin>>gh;
			while(!IPL[gh]){
				cout<<"他已经寄了\n";
				cin>>gh;
			}
			cout<<gh<<"号被带走了,身份是"<<player[gh];
			IPL[gh]=0;
			system("pause");
			return;
		} 
		IPL[maxi]=false;
		if(player[maxi]=="钟离"){
			int gh;
			while(!IPL[gh]&&gh!=maxi){
				gh=rand()%15+1;
			}
			cout<<gh<<"号被带走了,身份是"<<player[gh];
			IPL[gh]=0;
		}
		if(maxi==id&&player[maxi]!="钟离") {
			cout<<"你被处死了\n";
			for(int i=1; i<=15; i++) {
				if(IPL[i]) cout<<i<<"号是"<<player[i]<<endl;
			}
			system("pause");
			return;
		}
		if(player[id]=="雷电将军") {
			bool flag=1;
			for(int i=1; i<=15; i++) {
				if(IPL[i]==true&&player[i]!="雷电将军") {
					flag=0;
					break;
				}
			}
			if(flag) {
				cout<<"恭喜你,你胜利了\n";
				system("pause");
				return;
			}
		} else {
			bool flag=1;
			for(int i=1; i<=15; i++) {
				if(IPL[i]==true&&player[i]=="雷电将军") {
					flag=0;
					break;
				}
			}
			if(flag) {
				cout<<"恭喜你,你胜利了\n";
				system("pause");
				return;
			}
		}
	}
}
void rizhi() {
	system("cls");
	shuo("1.0.0 《原神杀》面世,bug众多 更新时间:2024/3/6\n");
	shuo("已知bug介绍:\n");
	shuo("1.强转身份:有时候你会直接成为旅行者,不管你先前是什么身份\n");
	shuo("2.闪退:告诉身份后直接闪退\n");
	shuo("3.隐匿杀手:每晚雷电将军杀旅行者但不会公布死去的人\n");
	Sleep(1000);
	shuo("1.0.1 增加新人物:芙宁娜,增加角色图鉴 \n修复强转与隐匿杀手bug\n新增bug:全员雷电,阵营不对 更新时间:2024/3/6\n");
	Sleep(1000);
	shuo("1.0.2 替换人物:神里绫华,增加新人物:胡桃\n");
	shuo("修复全员雷电,阵营不对bug\n闪退bug解决方法:结束程序然后重进\n");
	shuo("暂未发现其他Bug,欢迎补充\n");
	Sleep(1000);
	shuo("1.0.3 增加新人物:钟离\n修改雷电将军的杀人机制,增加雷电将军人数\n新增选项:游戏规则\n");
	system("pause");
}
void tujian() {
	shuo("旅行者:好人阵营,无特殊技能\n");
	shuo("雷电将军:坏人阵营,每晚可以杀死一个人\n");
	shuo("神里绫华:好人阵营,每晚可以用神里流·冰华查看一个人的身份\n");
	shuo("胡桃:好人阵营,从第二晚起,每晚可以用火蝴蝶对一个玩家进行攻击:如果该玩家是好人,则胡桃死亡;如果该玩家是坏人,则该玩家死亡\n");
	shuo("钟离:坏人阵营,每晚可以杀死一个人,如果被处死,还可以带走一个人\n");
	system("pause");
}
void rules() {
	shuo("共15人,其中5个雷电将军,2个钟离,1个神里绫华,1个胡桃,其余旅行者\n");
	shuo("好人需让所有坏人死亡,坏人需杀死所有好人\n");
	system("pause");
}
int main() {
	system("color 07");
	while(1) {
		system("cls");
		cout<<"----------原神杀----------\n\n";
		int n;
		cout<<"--------1.开始游戏--------\n";
		cout<<"--------2.退出游戏--------\n";
		cout<<"--------3.查看日志--------\n";
		cout<<"--------4.游戏规则--------\n";
		cout<<"--------5.角色图鉴--------\n";
		cin>>n;
		if(n==1) start();
		if(n==2) return 0;
		if(n==3) rizhi();
		if(n==4) rules();
		if(n==5) tujian();
	}
}

这次更新比较小,只增加到了365行,时间也少,甚至只用了21小时(

光速更新1.0.4

预告:字体颜色变化,新增人物

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值