跳到正文

个人记录

王者归来

under_the_starsky约 10 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年1月2日
篇幅
约 10 分钟

版本

  1. v1当前

2023f69的新游戏—·王者归来·放出风声!!!

这次和联盟是差不多的机制,比测试版优化了故事线,又打了结构体。 大家先看看半成品:

C
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<time.h>
#include<string.h>
#include<string>
#include<conio.h>
#include<Windows.h>
#include<mmsystem.h>
#pragma comment(lib,"Winmm.lib")
#define n1 523
#define n2 578
#define n3 659
#define n4 698
#define n5 784
#define n6 880
#define n7 988
#define n8 1046
#define scta(a) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
using namespace std;
struct player
{
  string jsm;
  int sm,sm2;
  int gq,gq2;
  int hj,hj2;
  int sd,sd2;
  int nl,nl2;
  int zj;
  int jn1,jn2,jn3,jn4;
}a[10]=
{
  {"德鲁伊",1000,1000,50,50,30,30,5,5,100,100,0,0,0,0},
  {"战士",500,500,120,120,20,20,10,10,100,100,0,0,0,0},
  {"圣骑士",600,600,80,80,50,50,3,3,110,110,0,0,0,0},
  {"法师",500,500,80,80,30,30,7,7,150,150,0,0,0,0},
  {"猎人",500,500,90,90,30,30,5,5,100,100,0,0,0,0},
  {"盗贼",600,600,90,90,20,20,20,20,100,100,0,0,0,0},
  {"死亡骑士",300,300,150,150,50,50,5,5,100,100,0,0,0,0},
  {"萨满祭司",400,400,200,200,0,0,5,5,100,100,0,0,0,0},
  {"术士",500,500,90,90,30,30,10,10,110,110,0,0,0,0},
  {"牧师",600,600,90,90,20,20,15,15,130,130,0,0,0,0}
};
void SlowDisplay(string s)
{
  int len=s.length();
  for(int i=0;i<len;i++)
  {
    cout<<s[i];
	Sleep(10);
  }
}
void HideCursor()
{
  CONSOLE_CURSOR_INFO cursor_info={1,0};
  SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
int main()
{
  HideCursor();
  srand(time(0));
  system("color 7A");
  char js1;
  int js;
  int kk;
  string name,password;
//  if(0==PlaySound(TEXT(""),NULL,SND_FILENAME|SND_ASYNC))
//  {
//  	cout<<"playsound error";
//  }
  cout<<"loading";
  for(int i=0;i<10;i++)
  {
  	Sleep(250);
  	cout<<".";
  }
  system("cls");
  Sleep(1000);
  cout<<"游戏正在载入:";
  cout<<" ";
  for(int i=0;i<90;i++)
  {
    Sleep(rand()%50);
    cout<<"█";
  }
  Beep(n8,500);
  system("cls");
  Sleep(1000);
  system("color 7C");
  cout<<"                                                健康游戏忠告:                                                               "<<endl;
  cout<<"                                         抵制不良游戏,拒绝盗版游戏。                                                         "<<endl;
  cout<<"                                         注意自我保护,谨防受骗上当。                                                         "<<endl;
  cout<<"                                         适度游戏益脑,沉迷游戏伤身。                                                         "<<endl;
  cout<<"                                         合理安排时间,享受健康生活。                                                         "<<endl;
  Sleep(2000);
  system("cls");
  system("color 7D");
  SlowDisplay("                                    作者:2023f69(如需转载,请标明出处)\n");
  SlowDisplay("                                                王者归来\n");
  SlowDisplay("-----------------------------------------------------------------------------------------------------------\n");
  SlowDisplay("           你不知你为何在这里......你不知你是谁......你只知道......当你睁......开......眼......\n");
  SlowDisplay("                                       你的身旁,是一把锋利的宝剑......\n");
  SlowDisplay("                                           请选择一个角色:\n");
  SlowDisplay("                                  1.战士(生命500,攻强120,护甲20,速度10)\n");
  SlowDisplay("                             2.圣骑士(生命600,攻强80,护甲50,能限+10,速度3)\n");
  SlowDisplay("                             3.法师(生命500,攻强80,护甲30,能限+50,速度7)\n");
  SlowDisplay("                                  4.猎人(生命500,攻强90,护甲30,速度5)\n");
  SlowDisplay("                                 5.盗贼(生命600,攻强90,护甲20,速度20)\n");
  SlowDisplay("                               6.死亡骑士(生命300,攻强150,护甲50,速度5)\n");
  SlowDisplay("                               7.萨满祭司(生命400,攻强200,护甲0,速度5)\n");
  SlowDisplay("                             8.术士(生命500,攻强90,护甲30,能限+10,速度10)\n");
  SlowDisplay("                             9.牧师(生命600,攻强90,护甲20,能限+30,速度15)\n");
  SlowDisplay("                               0.德鲁伊(生命1000,攻强50,护甲30,速度5)\n");
  while(true)
  {
  	if(_kbhit())
	{
	  js1=getch();
	  break;
	}
  }
  system("cls");
  js=js1-48;
  system("cls");
  cout<<"输入你的名字:(10字符以内)";
  cin>>name;
  if(name=="亚伦贡")
  {
  	cout<<"既然,你知道你的身份......"<<endl;
	Sleep(2000);
	cout<<"那么......"<<endl;
	Sleep(2000);
	cout<<"觉醒吧!!!!!!人类之帝的血脉!!!消灭夺走你的王权和江山的仇敌......"<<endl;
	Sleep(2000);
	cout<<"复仇的时刻,到了!!!!!!"<<endl;
	Sleep(2000);
	a[js].sm2=10000000;
	a[js].gq2=10000000;
	a[js].hj2=10000000;
	a[js].sd2=10000000;
	a[js].sm=a[js].sm2;
	a[js].gq=a[js].gq2;
	a[js].hj=a[js].hj2;
	a[js].sd=a[js].sd2;
  }
  else
  {
  	cout<<"去吧,寻找你的身份之谜!";
  }
  Sleep(1000);
  system("cls");
  Sleep(1000);
  while(true)
  {
  	cout<<"1.战斗  2.人物详情  3.背包  4.Boss  5.商城  6.锻造  7.技能  0.退出";
	while(true)
    {
  	  if(_kbhit())
	  {
	    kk=getch();
	    break;
	  }
    }
    system("cls");
	if(kk=='0')
	{
	  cout<<"欢迎下次游玩!!!";
	  break;
    }
    system("cls");
  }
  return 0;
}
原文