#include <iostream>
#include <string>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
string array_race[5]={"人类","精灵","兽人","矮人","元素"};
string array_professional[6]={"狂战士","圣骑士","刺客","猎手","祭司","巫师"};
class create_player //生成角色类,若做游戏建议只用作生成,毕竟这种封装方式不适合继承,和因为技能和装备而改变属性,或者将属性归到保护类继承,然后写共有函数set属性
{
private:
char name[50];
char sex[2];
int race; //0人类,1精灵,2兽人,3矮人,4元素
int professional; //0狂战士,1圣骑士,2刺客,3猎手,4祭祀,5巫师
int STR; //力量
int DEX; //敏捷
int CON; //体力
int INT; //智力
int WIT; //智慧
int HP; //血
int MP; //蓝
protected:
void jichu()
{
cout<<"请输入角色的姓名"<<endl;
cin>>name;
cout<<"请输入性别(男/女)"<<endl;
cin>>sex;
cout<<"请输入种族(0人类,1精灵,2兽人,3矮人,4元素)"<<endl;
cin>>race;
}
void set_professional()
{
cout<<"请选择你的职业"<<endl;
switch(race)
{
case 0:
{
cout<<"0狂战士,1圣骑士,2刺客,3猎手,4祭司,5巫师";
cin>>professional;
if(professional<0||professional>5)
{
cout<<"输入错误或者你的种族无法转职成此职业"<<endl;
set_professional();
}
break;
}
case 1:
{
cout<<"2刺客,3猎手,4祭司
RPG角色生成器 c++
最新推荐文章于 2019-04-24 19:40:03 发布