自己写了个原神杀,跟狼人杀一样
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string shenfen[3]= {"旅行者","雷电将军","芙宁娜"},player[16];
bool IPL[16]= {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},VP[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
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()%3+1,cunhuorenshu=15;
cout<<" 你是"<<id<<"号 \n";
cout<<" 你的身份是"<<shenfen[sf-1]<<endl;
player[id]=shenfen[sf-1];
Sleep(2000);
system("cls");
int night=1,raiden=4,temp=4,tempf=1;
if(player[id]=="雷电将军") {
raiden=3;
temp=3;
}
if(shenfen[sf-1]=="芙宁娜") tempf--;
for(int i=1; i<=15; i++) {//给身份
srand(time(0));
if(i!=id) {
if(temp) {
sf=rand()%3+1;
if(shenfen[sf-1]=="雷电将军") {
temp--;
}
player[i]=shenfen[sf-1];
VP[i]=1;
if(shenfen[sf-1]=="芙宁娜") {
tempf--;
}
}
if(tempf) {
sf=rand()%3+1;
if(shenfen[sf-1]=="芙宁娜") {
tempf--;
}
player[i]=shenfen[sf-1];
VP[i]=1;
if(shenfen[sf-1]=="雷电将军") temp--;
} else if(i!=id&&!VP[i]) player[i]="旅行者";
}
}
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++) {
// cout<<"asfasdgfad\n";
srand(time(0));
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]==false) {
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;
}
}
system("pause");
cout<<"投票环节\n";
Sleep(500);
system("cls");
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;
IPL[maxi]=false;
if(cunhuorenshu==1&&IPL[id]==true) {
cout<<"恭喜你,你存活到了最后\n";
system("pause");
return;
}
if(maxi==id) {
cout<<"你被处死了\n";
for(int i=1;i<=15;i++){
if(IPL[i]) cout<<i<<"号是"<<player[i]<<endl;
}
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");
system("pause");
}
void tujian() {
shuo("旅行者:无特殊技能\n");
shuo("雷电将军:每晚可以杀死一个人\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";
cin>>n;
if(n==1) start();
if(n==2) return 0;
if(n==3) rizhi();
if(n==4) tujian();
}
}
这么点东西就已经176行了!这只是1.0.1版本,以后的版本也许会有一千行吧