#include "src/interface/creation.hpp"
|
|
#include "src/interface/info.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
Player *Creation::ofPlayer()
|
|
{
|
|
std::cout << "=== Welcome to Character Creation ===\n"
|
|
<< std::flush;
|
|
|
|
while (true)
|
|
{
|
|
std::cout << "Please enter your character name below\n"
|
|
<< ">" << std::flush;
|
|
|
|
std::string name;
|
|
std::cin >> name;
|
|
|
|
if (name.size() > 15)
|
|
{
|
|
std::cout << "Your character name is too long!\n"
|
|
<< std::flush;
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
std::cout << "Creating your character...\n"
|
|
<< std::flush;
|
|
|
|
Player *newPlayer = new Player(name);
|
|
Info::ofPlayer(newPlayer);
|
|
|
|
std::cout << "Accept? [Y/n] \n"
|
|
<< ">" << std::flush;
|
|
char choice = 'Y';
|
|
std::cin >> choice;
|
|
|
|
if (choice == 'Y' || choice == 'y')
|
|
{
|
|
return newPlayer;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Monster *Creation::ofMonster()
|
|
{
|
|
|
|
const Monster monsterDen[] = {
|
|
Monster("Slime", 10, 1, 0, 1),
|
|
Monster("Goblin", 30, 2, 1, 2),
|
|
Monster("Wolf", 50, 3, 1, 3),
|
|
Monster("Zombie", 100, 4, 0, 4),
|
|
Monster("Zombie Knight", 200, 10, 7, 5),
|
|
Monster("Baby Dragon", 500, 20, 15, 10),
|
|
Monster("Dragon", 1000, 50, 20, 20)};
|
|
while (true)
|
|
{
|
|
int count = 0;
|
|
std::cout << "=== Welcome to Hunting Ground ===\n"
|
|
<< std::flush;
|
|
|
|
for (Monster monster : monsterDen)
|
|
{
|
|
std::cout << "[" << ++count << "] " << monster.getName() << std::endl;
|
|
}
|
|
|
|
std::cout << "[0] Exit\n"
|
|
<< ">" << std::flush;
|
|
|
|
char input;
|
|
std::cin >> input;
|
|
|
|
if (input <= ('0' + count) && input > '0')
|
|
{
|
|
char decision = 'Y';
|
|
Monster *summoned = new Monster(monsterDen[input - '1']);
|
|
Info::ofMonster(summoned);
|
|
std::cout << "Fight this monster? [Y/n]" << std::endl;
|
|
std::cout << ">" << std::flush;
|
|
std::cin >> decision;
|
|
|
|
if (decision == 'y' || decision == 'Y')
|
|
{
|
|
return summoned;
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (input == '0')
|
|
{
|
|
return nullptr;
|
|
}
|
|
else
|
|
{
|
|
std::cout << "Monster not found!" << std::endl;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
Monster *Creation::ofBoss()
|
|
{
|
|
Monster *boss = new Monster("Flag Guardian", 987654321, 123456789, 123456789, 0);
|
|
std::cout << "You are gonna fight the final boss:\n" << std::flush;
|
|
Info::ofMonster(boss);
|
|
std::cout << "Are you sure? [Y/n]\n"
|
|
<< "> " << std::flush;
|
|
|
|
char choice = 'Y';
|
|
std::cin >> choice;
|
|
|
|
if (choice == 'Y' || choice == 'y')
|
|
{
|
|
return boss;
|
|
}
|
|
else
|
|
{
|
|
return nullptr;
|
|
}
|
|
}
|