Untitled

 avatar
unknown
plain_text
2 years ago
1.1 kB
3
Indexable
void Hero::Input()
{
	string name;
	int mana, health, lv;

	cout << "\n--NHAP VAO THONG TIN CUA TUONG--";
	cout << "\nNhap vao ten tuong: ";
	rewind(stdin);
	getline(cin, name);
	this->SetName(name);

	do {
		cout << "\nNhap vao chi so mau: ";
		cin >> health;
		if (health < 0)
			cout << "\nKhong hop le, vui long nhap lai !";
	} while (health < 0);
	this->SetHealth(health);

	do {
		cout << "\nNhap vao chi so nang luong: ";
		cin >> mana;
		if (mana < 0)
			cout << "\nKhong hop le, vui long nhap lai !";
	} while (mana < 0);
	this->SetMana(mana);

	do {
		cout << "\nNhap vao level: ";
		cin >> lv;
		if (lv < 0)
			cout << "\nKhong hop le, vui long nhap lai !";
	} while (lv < 0);
	this->SetLevel(lv);

	cout << "\nNHAP VAO DANH SACH SKILL";

	vector<Skill*>temp;
	while (1)
	{
		Skill* sk = new Skill;
		sk->Input();
		temp.push_back(sk);
		int x;
		cout << "\n! NHAN PHIM 1 DE TIEP TUC NHAP, NHAN PHIM BAT KY DE DUNG LAI: ";
		cin >> x;
		if (x != 1)
			break;
	}
	this->SetSkillList(temp);

	temp.erase(temp.begin(), temp.begin() + temp.size());
}
Editor is loading...