|
|
- #include "src/class/player.hpp"
- #include "src/class/monster.hpp"
- #include "src/interface/battle.hpp"
- #include "src/interface/creation.hpp"
- #include "src/interface/info.hpp"
- #include "src/system/betatest.hpp"
- #include "src/system/memory.hpp"
- #include "src/system/flag.hpp"
-
- #include <iostream>
-
- void printMenu();
-
- void printMenu()
- {
- printf("===== HackTheGame v0.0.1 (Beta) =====\n");
- printf("[1] Create new Character\n");
- printf("[2] Character Info\n");
- printf("[9] Credits\n");
- printf("[0] Exit\n");
- printf(">");
- }
-
- int main(int argc, char const *argv[])
- {
- Player *player;
- Monster *enemy;
- std::cout << "This game is still in closed beta\n"
- << "Please input your beta test code\n"
- << ">" << std::flush;
-
- std::string betaCode;
- std::cin >> betaCode;
-
- if (BetaTest::check(betaCode))
- {
- std::cout << "Welcome back tester!\n"
- << "do you have your character backup code?\n"
- << "[y/N] " << std::flush;
-
- char choice = 'n';
- std::cin >> choice;
-
- if (choice == 'Y' || choice == 'y')
- {
- std::cout << "Please input your backup code\n"
- << "> " << std::flush;
-
- std::string code;
- std::cin >> code;
-
- player = Memory::loadFromCode(code);
- if (player == nullptr)
- {
- std::cout << "Your backup code is invalid, please try again..." << std::endl;
- return 1;
- }
- }
- else
- {
- player = Creation::ofPlayer();
- }
-
- do
- {
- std::cout << "====== HackTheGame v0.0.2 (Closed Beta) =====\n"
- << "[1] Character Info\n"
- << "[2] Hunt Monster\n"
- << "[3] Fight Boss\n"
- << "[4] Rest\n"
- << "[9] Credits\n"
- << "[0] Exit\n"
- << ">" << std::flush;
-
- choice = '0';
- std::cin >> choice;
- switch (choice)
- {
- case '1':
- Info::ofPlayer(player);
- break;
- case '2':
- enemy = Creation::ofMonster();
- if (enemy != nullptr)
- {
- Battle::Start(player, enemy);
- if (Battle::Lose())
- {
- std::cout << "GAME OVER !!!!" << std::endl;
- return 0;
- }
- }
- break;
- case '3':
- enemy = Creation::ofBoss();
- if (enemy != nullptr)
- {
- Battle::Start(player, enemy);
- if (Battle::Won())
- {
- Flag::Print();
- }
- else
- {
- std::cout << "GAME OVER !!!!" << std::endl;
- return 0;
- }
- }
- break;
- case '4':
- std::cout << "You take a rest at nearby Inn...\n"
- << "You wrote your journey to a diary in some cryptic language...\n"
- << Memory::saveToCode(player) << "\n"
- << "You woke up feeling resfreshed...\n"
- << std::flush;
- player->restoreHP();
- break;
- case '9':
- Info::ofApplication();
- break;
- case '0':
- return 0;
- break;
- default:
- printf("Not Implemented...\n");
- }
-
- } while (choice != 0);
- }
- else
- {
- std::cout << "Invalid code, exiting..." << std::endl;
- return 0;
- }
- }
|