当前位置: 首页>>代码示例>>C++>>正文


C++ Items::readItemDatabase方法代码示例

本文整理汇总了C++中Items::readItemDatabase方法的典型用法代码示例。如果您正苦于以下问题:C++ Items::readItemDatabase方法的具体用法?C++ Items::readItemDatabase怎么用?C++ Items::readItemDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Items的用法示例。


在下文中一共展示了Items::readItemDatabase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main() {
	int sleep = 2500;				// to control the duration of Sleep() for debugging purposes
	srand(time(nullptr));
	Time day(6,1);
	Monster monster;
	string name;
	Activities doableActions; //doableActions consists of all the actions you can do in the day.
	Shop shop;
	Weapons weapon;
	Armours armour;
	Potions potion;
	Skills skill;
	Harem harem;
	Items *weapons = &weapon;
	Items *armours = &armour;
	Items *potions = &potion;

	
	monster.readMonsterDatabase(); //READ TEXT FILE FUNCTIONS
	weapons->readItemDatabase();
	armours->readItemDatabase();
	potions->readItemDatabase();
	
	Player player(" ", 100, 0, 100, 0, 0, 1, 2,weapon,armour,potion);	//PLAYER CONSTRUCTOR -> name , int hp,int job, int money, int intel, int str,int minAtk,int maxAtk

	int job;
	////////////////////////////// TESTING ZONE
	
	
	/////////////////////
	//Menu system start from here
	///////
	Sleep(sleep);
	cout << "???? : Agent 1447.\n";  //INTRODUCTION TEXT
	Sleep(sleep);
	cout << "*Project Agent 1447 Initiated.*\n";
	Sleep(sleep);
	cout << "???? : Wake up. Slumber time is over.\n";
	Sleep(sleep);
	cout << "???? : Agent 1447. The world is at stake.\n";
	Sleep(sleep);
	cout << "???? : Decide a public alias for yourself, Agent 1447.\n";
	Sleep(sleep);
	cout << "???? : I am no babysitter, and certainly not your mother, so do it.\n\n\n";
	Sleep(sleep);
	cout << "Please Enter your name: ";
	getline(cin,name);			//Gets player name
	player.setPlayerName(name);	//Sets player name
	Sleep(sleep);
	system("cls");
	cout << "???? : So, '" << player.getCharacterName() << "'. Huh? Can't say I like your decision for that name.\n";
	Sleep(sleep);
	cout << "???? : " << player.getCharacterName() << ", Listen, I don't have much time.\n";
	Sleep(sleep);
	cout << "???? : The world is not in a healthy state right now, choose quickly.\n\n\n";
	Sleep(sleep);
	cout << "*PROFESSION SELECTION, ONLINE.*\n";
	Sleep(sleep);
	ConsoleWindow::equalSignMaker9000(80); //A FUNCTION THAT MAKES EQUAL SIGNS
	cout << "1.Con Man - Notable skills include\n-'YOU ACTIVATED MY TRAP CARD' (70 DAMAGE, 30 MANACOST)\n-'NECK BREAKER' (300 DAMAGE, 50 MANACOST)\n" << endl;
	cout << "2.The Jock - Notable skills include \n-'MUSCLE BODY SLAM' (200 DAMAGE, 70 MANACOST).\n-'MUSCLE UPPERCUT' (30 DAMAGE, 10 MANACOST)\n" << endl << endl;

	ConsoleWindow::equalSignMaker9000(80); //A FUNCTION THAT MAKES EQUAL SIGNS
	while (!(cin >> job) || job <1 || job >2) {
		cin.clear();
		cin.ignore(numeric_limits<streamsize>::max(), '\n');
		cout << "Enter 1 or 2 to choose your job\n";
	}
	player.setJob(job);
	Sleep(1000);
	system("cls");
	
	ConsoleWindow::equalSignMaker9000(80);

	player.addMoney(5); // GIVE PLAYER 5 MONEY 
	player.addPotion(5,0); //GIVE PLAYER 5 BASIC POTIONS
	switch (player.getJob()) {
	case 1: {
		player.addStr(5);
		player.addIntel(10);
		cout << "You are " << player.getCharacterName();
		cout << ",The Con Man. You gained 10 Intelligence and 5 Strength.\n\n" << endl;
		break;
	}
	case 2: {

		player.addStr(10);
		player.addIntel(5);
		cout << "You are " << player.getCharacterName();
		cout << ",The Jock. You gained 10 Strength and 5 Intelligence.\n\n" << endl << endl;
		break;

	}
			
	}
	ConsoleWindow::getCursorXY(); 
	player.showItemandStats(ConsoleWindow::x, ConsoleWindow::y);
	Sleep(sleep);
	cout << "???? : You have 12 hours before the neutral monsters arrive.\n"; //MORE INTRODUCTION TEXTS
	Sleep(sleep);
//.........这里部分代码省略.........
开发者ID:kenolion,项目名称:ProgrammingAssignment,代码行数:101,代码来源:main.cpp


注:本文中的Items::readItemDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。