Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Pokemon/Pokemon/Player.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "Player.hpp"
#include "Pokemons.hpp"
#include<iostream>

using namespace std;

Player::Player()
{
Player::captured_pokemon = Pokemons();
}

Player::Player(string playerName, Pokemons playerCapturedPokemon)
{
Player::name = playerName;
Player::captured_pokemon = playerCapturedPokemon;
}
void Player::ChosenPokemon(int choice)
{
switch ((Pokemon_Choice)choice)
{
case Pokemon_Choice::Charmander:
Player::captured_pokemon = Pokemons("Charmander", Pokemon_Types::Fire_Type, 100);
break;
case Pokemon_Choice::Bulbasaur:
Player::captured_pokemon = Pokemons("Bulbasaur", Pokemon_Types::Grass_Type, 100);
break;
case Pokemon_Choice::Squirtle:
Player::captured_pokemon = Pokemons("Squirtle", Pokemon_Types::Water_Type, 100);
break;
default:
Player::captured_pokemon = Pokemons("Pikachu", Pokemon_Types::Electric_Type, 100);
break;
}
cout << name << " chose " << captured_pokemon.name << "\n";
Utility::WaitForEnter();
}
22 changes: 22 additions & 0 deletions Pokemon/Pokemon/Player.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

#include<string>

#include "PokemonType.hpp"
#include "PokemonChoice.hpp"
#include "Utility.hpp"
#include "Pokemons.hpp"

using namespace std;

class Player
{
public:
string name;
Pokemons captured_pokemon;

Player();
Player(string playerName, Pokemons playerCapturedPokemon);
void ChosenPokemon(int choice);

};
157 changes: 143 additions & 14 deletions Pokemon/Pokemon/Pokemon.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,149 @@
// Pokemon.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include<string>
#include "PokemonType.hpp"
#include "PokemonChoice.hpp"
#include "Utility.hpp"
#include "Player.hpp"

int main()
using namespace std;

class ProfessorOak
{
std::cout << "Hello World!\n";
public:
string name;
void GreetPlayer(Player& player)
{
cout << name << ": Welcome to the world of Pokemon! I am Professor Oak.\n";
Utility::WaitForEnter();
cout << name << ": People call me the Pokemon Professor!\n";
Utility::WaitForEnter();
cout << name << ": But enough about me. Let's talk about you!\n";
Utility::WaitForEnter();
}

ProfessorOak(string prof_name)
{
name = prof_name;
}

void PlayerIntro(Player& player)
{
cout << name << ": First, tell me what is your name?\n";
getline(cin, player.name);
cout << name << ": Ah, " << player.name << "! What a fantastic name!\n";
Utility::WaitForEnter();
cout << name << ": You must be eager to start your adventure. But first, you will need a Pokemon of your own!\n";
Utility::WaitForEnter();
}
void FirstPokemon(Player& player)
{
int choice;
cout << name << ": I have three Pokemon here with me. They are all quite feisty!\n";
Utility::WaitForEnter();
cout << name << ": Choose wisely...\n";
cout << name << ": 1. Charmander - The fire type. A real hothead!\n";
cout << name << ": 2. Bulbasaur - The grass type. Calm and collected!\n";
cout << name << ": 3. Squirtle - The water type. Cool as a cucumber!\n";

cout << name << ": So, which one will it be? Enter the number of your choice:";
cin >> choice;
player.ChosenPokemon(choice);

cout << "Professor Oak: " << player.captured_pokemon.name << " and you, " << player.name << ", are going to be the best of friends!\n";
Utility::WaitForEnter();
}

void ExplainMainQuest(Player player)
{
Utility::ClearConsole();
cout << name << ": Ok, " << player.name << ", I am about to explain you about your upcoming grand adventure.\n";
Utility::WaitForEnter();
cout << name << ": You see, becoming a Pokemon Master is no easy feat, it takes courage, wisdom, and a bit of luck.\n";
Utility::WaitForEnter();
cout << name << ": Your mission, should you choose to accept it (and trust me, you really do not have a choice) is to collect all the Pokemon Badges and conquer the Pokemon League. \n";
Utility::WaitForEnter();
cout << player.name << ": Wait... that sounds a lot like every other Pokemon game out there.\n";
Utility::WaitForEnter();
cout << name << ": Shhh! Don't break the fourth wall " << player.name << "! This is serious business.\n";
Utility::WaitForEnter();
cout << name << ": To achieve this, you will need to battle wild Pokemon, challenge gym leaders, and of course, keep your Pokemon healthy at the PokeCenter.\n";
Utility::WaitForEnter();
cout << name << ": Along the way, you'll capture new Pokemon to strengthen your team. Just remember�there�s a limit to how many Pok�mon you can carry, so choose wisely!\n";
Utility::WaitForEnter();
cout << player.name << ": Sounds like a walk in the park... right?\n";
Utility::WaitForEnter();
cout << name << ": Hah! Thats what they all say! But beware, young Trainer, the path to victory is fraught with challenges. And if you lose a battle... well, let�s just say you'll be starting from square one.\n";
Utility::WaitForEnter();
cout << name << ": So, what do you say? Are you ready to become the next Pokemon Champion?\n";
Utility::WaitForEnter();
cout << player.name << ": Ready as I will ever be, Professor!\n";
Utility::WaitForEnter();
cout << name << ": That is the spirit! Now, your journey begins.\n";
Utility::WaitForEnter();
cout << name << ": But first... let's just pretend I didn't forget to set up the actual game loop... Ahem, onwards!\n";
Utility::WaitForEnter();
}
};

void GameLoop(Player &player)
{
int choice;
bool keepPlaying = true;
while (keepPlaying)
{
Utility::ClearConsole();
cout << "\nWhat would you like to do next, " << player.name << "?\n";
cout << "1. Battle Wild Pokemon\n";
cout << "2. Visit PokeCenter\n";
cout << "3. Challenge Gyms\n";
cout << "4. Enter Pokemon League\n";
cout << "5. Quit\n";
cout << "Enter your choice: ";
cin >> choice;
Utility::ClearInputBuffer();
switch (choice)
{
case 1:
cout << "You look around... but all the wild Pokemon are on vacation. Maybe try again later?\n";
break;
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 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;
};
Utility::WaitForEnter();
}
cout << "Goodbye, " << player.name << "! Thanks for playing!\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
int main()
{
Pokemons charmander("Charmander", Pokemon_Types::Fire_Type, 100);

ProfessorOak Oak("Professor Oak");
Player player("Ash", charmander);

Oak.GreetPlayer(player);
Oak.PlayerIntro(player);
Oak.FirstPokemon(player);

Oak.ExplainMainQuest(player);

// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
GameLoop(player);
}
11 changes: 11 additions & 0 deletions Pokemon/Pokemon/Pokemon.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,18 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Player.cpp" />
<ClCompile Include="Pokemon.cpp" />
<ClCompile Include="Pokemons.cpp" />
<ClCompile Include="Utility.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Player.hpp" />
<ClInclude Include="Pokemon.hpp" />
<ClInclude Include="PokemonChoice.hpp" />
<ClInclude Include="Pokemons.h" />
<ClInclude Include="PokemonType.hpp" />
<ClInclude Include="Utility.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
29 changes: 29 additions & 0 deletions Pokemon/Pokemon/Pokemon.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,34 @@
<ClCompile Include="Pokemon.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Utility.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Player.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Pokemons.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Pokemon.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PokemonType.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PokemonChoice.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Utility.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Player.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Pokemons.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
9 changes: 9 additions & 0 deletions Pokemon/Pokemon/PokemonChoice.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

enum class Pokemon_Choice
{
Charmander = 1,
Bulbasaur,
Squirtle,
Pikachu
};
23 changes: 23 additions & 0 deletions Pokemon/Pokemon/PokemonType.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

enum class Pokemon_Types
{
Normal_Type,
Fire_Type,
Water_Type,
Electric_Type,
Grass_Type,
Ice_Type,
Fighting_Type,
Poison_Type,
Ground_Type,
Flying_Type,
Psychic_Type,
Bug_Type,
Rock_Type,
Ghost_Type,
Dragon_Type,
Dark_Type,
Steel_Type,
Fairy_Type
};
37 changes: 37 additions & 0 deletions Pokemon/Pokemon/Pokemons.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include<iostream>
#include "Pokemons.hpp"
#include "PokemonType.hpp"

using namespace std;

Pokemons::Pokemons()
{
Pokemons::name = "Unknown";
Pokemons::type = Pokemon_Types::Normal_Type;
Pokemons::health = 50;
}

Pokemons::Pokemons(string poke_name, Pokemon_Types poke_type, int poke_health)
{
Pokemons::name = poke_name;
Pokemons::type = poke_type;
Pokemons::health = poke_health;
}

Pokemons::Pokemons(const Pokemons& other)
{
Pokemons::name = other.name;
Pokemons::type = other.type;
Pokemons::health = other.health;
}

Pokemons::~Pokemons()
{

}

void Pokemons::Attack()
{
cout << name << " attacks with a powerful move!\n";
}

Empty file added Pokemon/Pokemon/Pokemons.h
Empty file.
20 changes: 20 additions & 0 deletions Pokemon/Pokemon/Pokemons.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

#include<string>
#include "PokemonType.hpp"

using namespace std;

class Pokemons
{
public:
string name;
Pokemon_Types type;
int health;

Pokemons();
Pokemons(string poke_name, Pokemon_Types poke_type, int poke_health);
Pokemons(const Pokemons& other);
~Pokemons();
void Attack();
};
19 changes: 19 additions & 0 deletions Pokemon/Pokemon/Utility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Utility.hpp"
#include <iostream>

using namespace std;

void Utility::WaitForEnter()
{
cin.get();
}

void Utility::ClearConsole()
{
system("cls");
}

void Utility::ClearInputBuffer()
{
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
Loading