跳到正文

个人记录

简单的小游戏

j2k183约 2 分钟
原文
文章信息与版本

文章信息

发布
2023年8月21日
收录
2025年12月12日
更新
2026年11月15日
篇幅
约 2 分钟

版本

  1. v1当前

搜寻游戏堆时发现的一个简单的小小小游戏

当时连Slowsay都不会,以为80行的小游戏特别多

现在:哎!当时真天真!

C++
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
void sleep(float s)
{
	Sleep(1000*s);
}
int main()
{
	string e,a,aa[5]={"拳击","脚踢","头顶","暴打","无限乱斩"};
	srand(time(0));
	int n;
	for(int i=1;i<=n/4;i++)
	{
		srand(rand());
	}
	int h=1200,hh=rand(),b,f=1,bb=0;
	cout<<"请输入你最讨厌的人的名字:";
	cin>>e;
	if(e=="q")
	{
		cout<<"此对手为Boss,你的潜能爆发!"<<endl;
		hh*=15;
		f*=11.93;
		bb=1;
	}
	int hhp=hh;
	sleep(1);
	cout<<"你要开挂吗?1表示要,0表示不要"<<endl;
	cin>>b;
	if(b)
	{
		h=(pow(2,30)-1)*2+1;
		f*=1.7;
	}
	sleep(1.5);
	while(1)
	{
		cout<<"请说出你想怎么攻击"<<e<<":";
		cin>>a;
		cout<<"你使用"<<a<<"攻击"<<e<<endl;
		sleep(1);
		if(!bb)
		{
			hh-=(hhp/15*1.3+rand()%101)*f;
		}
		else
		{
			hh-=(600+rand()%51)*f;
		}
		cout<<e<<"剩余生命值:"<<hh<<endl;
		if(hh<=0)
		{
			break;
		}
		sleep(0.5);
		int p=rand()%5;
		cout<<e<<"使用"<<aa[p]<<"攻击你"<<endl;
		sleep(1);
		if(p==4)
		{
			h-=300+rand()%151;
		}
		else
		{
			h-=100+rand()%51;
		}
		cout<<"你剩余生命值:"<<h<<endl;
		if(h<=0)
		{
			cout<<"重生中……"<<endl;
			sleep(5);
			h+=1500;
			cout<<"华丽重生!"<<endl;
		}
	}
	cout<<"你击杀了他!"<<endl;
	cout<<"尸体:o-+、"; 
	return 0;
}
原文