diff --git a/.vscode/settings.json b/.vscode/settings.json index 46e7525..6b03945 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "files.associations": { ".fantomasignore": "ignore", - "iostream": "cpp" + "iostream": "cpp", + "ostream": "cpp" } } \ No newline at end of file diff --git a/main b/main index 91f421e..6afdb54 100755 Binary files a/main and b/main differ diff --git a/main.cpp b/main.cpp index 2ed4f70..947bf86 100644 --- a/main.cpp +++ b/main.cpp @@ -2,54 +2,77 @@ using namespace std; +void WaitforEnter(){ + // cout << "(Press Enter to \033[34mcontinue\033[0m...)" << endl; + + + cin.get(); +} +void clearConsole(){ +#ifdef _WIN32 + system("cls"); +#else + (void)system("clear"); +#endif +} enum class PokemonType{ - Fire, - Water, - Electric + FIRE, + GRASS, + WATER, + ELECTRIC, + NORMAL }; enum class PokemonChoice{ - Bulbasaur, - Charmander, - Squirtle, - Pikachu, - Invalid_Choice + CHARMANDER = 1, + BULBASAUR, + SQUIRTLE, + PIKACHU }; class Pokemon{ +public: string name; PokemonType type; int health; Pokemon(){ - name = "Pikachu"; - type = PokemonType::Electric; - health = 10; + name = "Unknown"; + type = PokemonType::NORMAL; + health = 50; } - + // Parameterized Constructor Pokemon(string p_name, PokemonType p_type, int p_health){ name = p_name; type = p_type; health = p_health; } + Pokemon(const Pokemon &other) { + name = other.name; + type = other.type; + health = other.health; + } + ~Pokemon() { + // Destructor message removed + } void attack(){ - cout <<" attacks with a powerful move!" << endl; + cout << name <<" attacks with a powerful move!" << endl; } }; class Player{ public: string name; - PokemonChoice chosenPokemon; + Pokemon chosenPokemon; Player(){ name = "Trainer"; - chosenPokemon = PokemonChoice::Pikachu; + chosenPokemon = Pokemon(); } // Parameterized Constructor - Player(string p_name, PokemonChoice p_chosenPokemon){ + Player(string p_name, Pokemon p_chosenPokemon){ name = p_name; chosenPokemon = p_chosenPokemon; @@ -61,25 +84,23 @@ class Player{ chosenPokemon = p.chosenPokemon; } - void choosePokemon(int choice){ - - switch (choice) - { - case 1: - chosenPokemon = PokemonChoice::Bulbasaur; - break; - case 2: - chosenPokemon = PokemonChoice::Charmander; - break; - case 3: - chosenPokemon = PokemonChoice::Squirtle; - break; - - default: - chosenPokemon = PokemonChoice::Invalid_Choice; - break; - } - + void choosePokemon(int choice) { + switch ((PokemonChoice)choice) { + case PokemonChoice::CHARMANDER: + chosenPokemon = Pokemon("Charmander", PokemonType::FIRE, 100); + break; + case PokemonChoice::BULBASAUR: + chosenPokemon = Pokemon("Bulbasaur", PokemonType::GRASS, 100); + break; + case PokemonChoice::SQUIRTLE: + chosenPokemon = Pokemon("Squirtle", PokemonType::WATER, 100); + break; + default: + chosenPokemon = Pokemon("Pikachu", PokemonType::ELECTRIC, 100); + break; + } + cout << "Player " << name << " chose " << chosenPokemon.name << "!\n"; + WaitforEnter(); @@ -93,14 +114,17 @@ class ProfessorOak{ ProfessorOak(){ + } + ProfessorOak(string p_name) { + name = p_name; } void greetPlayer(Player &player){ cout << "What's up, kid! I'm Professor Oak, the Pokémon Professor!" << endl; - + WaitforEnter(); cout << "Wait... who are you again? Oh right, you must be the new trainer!" << endl; - + WaitforEnter(); cout << "Ah yes, before we begin, tell me your name, young one." << endl; - + WaitforEnter(); cin >> player.name; cout << player.name << "?! Haha, that's a great name! It reminds me of when I was your age... but let's not get into that." << endl; @@ -113,7 +137,8 @@ class ProfessorOak{ cout << "Don't worry! Every great journey begins with a first step—and a Pokémon partner!" << endl; cout << "\nI've got three amazing Pokémon right here in front of me. Each one has a unique bond with nature. Choose wisely!" << endl; - + + WaitforEnter(); cout << "Here are your choices:\n"; cout << "1) Bulbasaur.\n2) Charmander.\n3) Squirtle.\n" << endl; @@ -122,35 +147,103 @@ class ProfessorOak{ cin >> playerChoice ; cout<<"\n"; player.choosePokemon(playerChoice); - switch (player.chosenPokemon) + WaitforEnter(); + + } + + void explainMainQuest(Player &player){ + + cout<<"Professor Oak: Ah, "<> choice; + + cin.ignore(numeric_limits::max(), '\n'); + switch (choice) + { + case 1: + cout<< "You look around... but all the wild Pokemon are on vacation. Maybe try again later?\n"; break; - case PokemonChoice::Charmander: - cout << "You chose Charmander! A fiery choice, full of energy and potential. Watch out, though, that tail flame means business!" << endl; - cout << "Charmander lets out a cheerful growl, its tail flame burning brightly as it anticipates the challenges ahead." << endl; + case 2: + cout<< "You head to the PokeCenter, but Nurse Joy is out on a coffee break. Guess your Pokemon will have to tough it out for now!\n"; break; - case PokemonChoice::Squirtle: - cout << "You chose Squirtle! A cool, composed choice. This little turtle will help you navigate through any stormy waters you encounter." << endl; - cout << "Squirtle gives you a confident nod, ready to splash into battle whenever you are!" << endl; - default: - cout << "Professor Oak: Hmm, that doesn't seem right. Let me choose for you...\n"; - player.chosenPokemon = PokemonChoice::Charmander; - cout << "Professor Oak: Just kidding! Let's go with Charmander, the fiery dragon in the making!\n"; - break; + case 3: + cout<< "You march up to the Gym, but it's closed for renovations. Seems like even Gym Leaders need a break!\n"; break; + case 4: + cout<< "You boldly step towards the Pokemon League... but the gatekeeper laughs and says, 'Maybe next time, champ!'\n"; + break; + case 5: + cout<< "You try to quit, but Professor Oak's voice echoes: 'There's no quitting in Pokemon training!'\n"; + cout << "Are you sure you want to quit? (y/n): "; + char quitChoice; + cin >> quitChoice; + if (quitChoice == 'y' || quitChoice == 'Y') { + keepPlaying = false; + } + break; + default:cout << "That's not a valid choice. Try again!\n"; + break; + } + WaitforEnter(); } + cout << "Goodbye, " << player.name << "! Thanks for playing!\n"; + } + int main(){ -}; -int main(){ + Pokemon charmander("Charmander", PokemonType::FIRE, 100); // Using parameterized constructor - Player player; - ProfessorOak professor; + + ProfessorOak professor("Professor Oak"); + Player player("Ash", charmander); + + professor.greetPlayer(player); professor.offerPokemonChoices(player); + + clearConsole(); + professor.explainMainQuest(player); + + gameLoop(player); + return 0; + + } \ No newline at end of file