diff --git a/Pokemon/Pokemon/BattleManager.cpp b/Pokemon/Pokemon/BattleManager.cpp new file mode 100644 index 0000000..0417db6 --- /dev/null +++ b/Pokemon/Pokemon/BattleManager.cpp @@ -0,0 +1,49 @@ +#include "BattleManager.hpp" +#include "Pokemons.hpp" +#include "Player.hpp" +#include + +using namespace std; + +using namespace N_Utility; + +void BattleManager::StartBattle(Player& player, Pokemons& wild_pokemon) +{ + battle_state.player_pokemon = &player.captured_pokemon; + battle_state.wild_pokemon = &wild_pokemon; + battle_state.player_turn = true; + battle_state.battle_unfinished = true; + cout << "A wild " << wild_pokemon.name << " appeared!\n"; + Battle(player.captured_pokemon, wild_pokemon); +} + +void BattleManager::Battle(Pokemons& player_pokemon, Pokemons& wild_pokemon) +{ + while (battle_state.battle_unfinished) + { + if (battle_state.player_turn) + battle_state.player_pokemon->Attack(*battle_state.wild_pokemon); + else + battle_state.wild_pokemon->Attack(*battle_state.player_pokemon); + UpdateBattleState(); + battle_state.player_turn = !battle_state.player_turn; + Utility::WaitForEnter(); + } + BattleOutcome(); +} + +void BattleManager::UpdateBattleState() +{ + if (battle_state.player_pokemon->IsFainted()) + battle_state.battle_unfinished = false; + else if (battle_state.wild_pokemon->IsFainted()) + battle_state.battle_unfinished = false; +} + +void BattleManager::BattleOutcome() +{ + if(battle_state.player_pokemon->IsFainted()) + cout << "Oh no! " << battle_state.player_pokemon->name << " fainted! You need to visit the PokeCenter.\n"; + else if(battle_state.wild_pokemon->IsFainted()) + cout << "Congratulations!!! " << battle_state.player_pokemon->name << " is victorious! Keep an eye on the health of your Pokemon.\n"; +} \ No newline at end of file diff --git a/Pokemon/Pokemon/BattleManager.hpp b/Pokemon/Pokemon/BattleManager.hpp new file mode 100644 index 0000000..32ad311 --- /dev/null +++ b/Pokemon/Pokemon/BattleManager.hpp @@ -0,0 +1,15 @@ +#include "BattleState.hpp" + +class Player; +class Pokemons; + +class BattleManager +{ + public: + void StartBattle(Player& player, Pokemons &wild_pokemon); + private: + BattleState battle_state; + void Battle(Pokemons &player_pokemon, Pokemons &wild_pokemon); + void BattleOutcome(); + void UpdateBattleState(); +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/BattleState.hpp b/Pokemon/Pokemon/BattleState.hpp new file mode 100644 index 0000000..53e5aec --- /dev/null +++ b/Pokemon/Pokemon/BattleState.hpp @@ -0,0 +1,9 @@ +class Pokemons; + +struct BattleState +{ + Pokemons *player_pokemon; + Pokemons *wild_pokemon; + bool player_turn; + bool battle_unfinished; +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Bulbasaur.cpp b/Pokemon/Pokemon/Bulbasaur.cpp new file mode 100644 index 0000000..e6c6185 --- /dev/null +++ b/Pokemon/Pokemon/Bulbasaur.cpp @@ -0,0 +1,14 @@ +#include "Bulbasaur.hpp" +#include "PokemonType.hpp" +#include + +Bulbasaur::Bulbasaur() +{ + Pokemons("Bulbasaur", Pokemon_Types::Grass_Type, 100, 100, 35); +} + +void Bulbasaur::VineWhip(Pokemons& target_pokemon) +{ + cout << name << " uses Vinewhip on " << target_pokemon.name << "!!!\n"; + target_pokemon.TakeDamage(35); +} \ No newline at end of file diff --git a/Pokemon/Pokemon/Bulbasaur.hpp b/Pokemon/Pokemon/Bulbasaur.hpp new file mode 100644 index 0000000..7a31ed2 --- /dev/null +++ b/Pokemon/Pokemon/Bulbasaur.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "Pokemons.hpp" + +class Bulbasaur :public Pokemons +{ +public: + Bulbasaur(); +private: + void VineWhip(Pokemons& target_pokemon); +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Caterpie.cpp b/Pokemon/Pokemon/Caterpie.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Caterpie.hpp b/Pokemon/Pokemon/Caterpie.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Charmander.cpp b/Pokemon/Pokemon/Charmander.cpp new file mode 100644 index 0000000..cb43e8d --- /dev/null +++ b/Pokemon/Pokemon/Charmander.cpp @@ -0,0 +1,14 @@ +#include "Charmander.hpp" +#include "PokemonType.hpp" +#include + +Charmander::Charmander() +{ + Pokemons("Charmander", Pokemon_Types::Fire_Type, 100, 100, 35); +} + +void Charmander::FlameBurst(Pokemons& target_pokemon) +{ + cout << name << " uses Supersonic on " << target_pokemon.name << "!!!\n"; + target_pokemon.TakeDamage(35); +} \ No newline at end of file diff --git a/Pokemon/Pokemon/Charmander.hpp b/Pokemon/Pokemon/Charmander.hpp new file mode 100644 index 0000000..0e6b803 --- /dev/null +++ b/Pokemon/Pokemon/Charmander.hpp @@ -0,0 +1,9 @@ +#include "Pokemons.hpp" + +class Charmander :public Pokemons +{ +public: + Charmander(); +private: + void FlameBurst(Pokemons& target_pokemon); +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Game.cpp b/Pokemon/Pokemon/Game.cpp new file mode 100644 index 0000000..aa6e746 --- /dev/null +++ b/Pokemon/Pokemon/Game.cpp @@ -0,0 +1,80 @@ +#include "Game.hpp" +#include "Player.hpp" +#include "PokemonType.hpp" +#include "Utility.hpp" +#include "WildPokemonEncounterHandler.hpp" +#include "BattleManager.hpp" +#include + + +using namespace std; + +using namespace N_Utility; + +Game::Game() +{ + forest_grass = { + "Forest", + {{"Pidgey",Pokemon_Types::Normal_Type,40, 40, 2}, + {"Zubat",Pokemon_Types::Poison_Type,30, 30, 10}, + {"Caterpie",Pokemon_Types::Bug_Type,35, 35, 5}}, + 70 }; +} +void Game::GameLoop(Player &player) +{ + BattleManager battle_manager; + 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: + { + WildPokemonEncounterHandler encounters; + Pokemons encountered_pokemon = encounters.GetRandomWildPokemonFromGrass(forest_grass); + battle_manager.StartBattle(player,encountered_pokemon); + player.captured_pokemon.ShowHealth(player.captured_pokemon); + break; + } + case 2: + { + player.captured_pokemon.Heal(); + cout << player.captured_pokemon.name << "'s health is fully restored.\n"; + player.captured_pokemon.ShowHealth(player.captured_pokemon); + 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"; +} \ No newline at end of file diff --git a/Pokemon/Pokemon/Game.hpp b/Pokemon/Pokemon/Game.hpp new file mode 100644 index 0000000..e01f21b --- /dev/null +++ b/Pokemon/Pokemon/Game.hpp @@ -0,0 +1,12 @@ +#include "Grass.hpp" + +class Player; + +class Game +{ + private: + Grass forest_grass; + public: + Game(); + void GameLoop(Player &player); +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Grass.hpp b/Pokemon/Pokemon/Grass.hpp new file mode 100644 index 0000000..9a98da9 --- /dev/null +++ b/Pokemon/Pokemon/Grass.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include "Pokemons.hpp" + +using namespace std; + +struct Grass +{ + string environment; + vector wild_pokemons_list; + int pokemon_encounter_rate; +}; + +//Grass forestGrass = { +// "Cave", +// {{"Zubat",Pokemon_Types::Poison_Type,30},{"Geodude",Pokemon_Types::Rock_Type,50},{"Caterpie",Pokemon_Types::Bug_Type,10}}, +// 80 +//}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Pidgey.cpp b/Pokemon/Pokemon/Pidgey.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Pidgey.hpp b/Pokemon/Pokemon/Pidgey.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Pikachu.cpp b/Pokemon/Pokemon/Pikachu.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Pikachu.hpp b/Pokemon/Pokemon/Pikachu.hpp new file mode 100644 index 0000000..b5ff2c8 --- /dev/null +++ b/Pokemon/Pokemon/Pikachu.hpp @@ -0,0 +1,8 @@ +#include "Pokemons.hpp" + +class Pikachu : public Pokemons +{ + public: + Pikachu(); + void ThunderShock(Pokemons& target_pokemon); +}; diff --git a/Pokemon/Pokemon/Player.cpp b/Pokemon/Pokemon/Player.cpp new file mode 100644 index 0000000..5f35b82 --- /dev/null +++ b/Pokemon/Pokemon/Player.cpp @@ -0,0 +1,38 @@ +#include "Player.hpp" +#include "Pokemons.hpp" +#include + +using namespace std; + +using namespace N_Utility; + +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, 100, 20); + break; + case Pokemon_Choice::Bulbasaur: + Player::captured_pokemon = Pokemons("Bulbasaur", Pokemon_Types::Grass_Type, 100, 100, 10); + break; + case Pokemon_Choice::Squirtle: + Player::captured_pokemon = Pokemons("Squirtle", Pokemon_Types::Water_Type, 100, 100, 15); + break; + default: + Player::captured_pokemon = Pokemons("Pikachu", Pokemon_Types::Electric_Type, 100, 100, 20); + break; + } + cout << name << " chose " << captured_pokemon.name << "\n"; + Utility::WaitForEnter(); +} \ No newline at end of file diff --git a/Pokemon/Pokemon/Player.hpp b/Pokemon/Pokemon/Player.hpp new file mode 100644 index 0000000..53c977a --- /dev/null +++ b/Pokemon/Pokemon/Player.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include + +#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); +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Pokemon.cpp b/Pokemon/Pokemon/Pokemon.cpp index 70d0cba..e8a50a4 100644 --- a/Pokemon/Pokemon/Pokemon.cpp +++ b/Pokemon/Pokemon/Pokemon.cpp @@ -1,20 +1,108 @@ -// Pokemon.cpp : This file contains the 'main' function. Program execution begins and ends there. -// - #include +#include +#include "PokemonType.hpp" +#include "PokemonChoice.hpp" +#include "Utility.hpp" +#include "Player.hpp" +#include "Game.hpp" + +using namespace std; + +using namespace N_Utility; + + +class ProfessorOak +{ + 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(); + } +}; int main() { - std::cout << "Hello World!\n"; -} - -// Run program: Ctrl + F5 or Debug > Start Without Debugging menu -// Debug program: F5 or Debug > Start Debugging menu - -// 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 + Game loop; + + Pokemons charmander("Charmander", Pokemon_Types::Fire_Type, 100, 100, 15); + + ProfessorOak Oak("Professor Oak"); + Player player("Ash", charmander); + + Oak.GreetPlayer(player); + Oak.PlayerIntro(player); + Oak.FirstPokemon(player); + + Oak.ExplainMainQuest(player); + + loop.GameLoop(player); +} \ No newline at end of file diff --git a/Pokemon/Pokemon/Pokemon.vcxproj b/Pokemon/Pokemon/Pokemon.vcxproj index 3cb6302..6caeea9 100644 --- a/Pokemon/Pokemon/Pokemon.vcxproj +++ b/Pokemon/Pokemon/Pokemon.vcxproj @@ -127,7 +127,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Pokemon/Pokemon/Pokemon.vcxproj.filters b/Pokemon/Pokemon/Pokemon.vcxproj.filters index 8e148e6..48f2690 100644 --- a/Pokemon/Pokemon/Pokemon.vcxproj.filters +++ b/Pokemon/Pokemon/Pokemon.vcxproj.filters @@ -18,5 +18,58 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + \ No newline at end of file diff --git a/Pokemon/Pokemon/PokemonChoice.hpp b/Pokemon/Pokemon/PokemonChoice.hpp new file mode 100644 index 0000000..0abd64e --- /dev/null +++ b/Pokemon/Pokemon/PokemonChoice.hpp @@ -0,0 +1,9 @@ +#pragma once + +enum class Pokemon_Choice +{ + Charmander = 1, + Bulbasaur, + Squirtle, + Pikachu +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/PokemonType.hpp b/Pokemon/Pokemon/PokemonType.hpp new file mode 100644 index 0000000..2e8afd0 --- /dev/null +++ b/Pokemon/Pokemon/PokemonType.hpp @@ -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 +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Pokemons.cpp b/Pokemon/Pokemon/Pokemons.cpp new file mode 100644 index 0000000..b8a1226 --- /dev/null +++ b/Pokemon/Pokemon/Pokemons.cpp @@ -0,0 +1,77 @@ +#include +#include "Pokemons.hpp" +#include "PokemonType.hpp" + +using namespace std; + +Pokemons::Pokemons() +{ + Pokemons::name = "Unknown"; + Pokemons::type = Pokemon_Types::Normal_Type; + Pokemons::health = 50; + Pokemons::max_health = 100; + Pokemons::attack_power = 10; +} + +Pokemons::Pokemons(string poke_name, Pokemon_Types poke_type, int poke_health, int poke_max_health, int poke_attack_power) +{ + Pokemons::name = poke_name; + Pokemons::type = poke_type; + Pokemons::health = poke_health; + Pokemons::max_health = poke_max_health; + Pokemons::attack_power = poke_attack_power; +} + +Pokemons::Pokemons(const Pokemons& other) +{ + Pokemons::name = other.name; + Pokemons::type = other.type; + Pokemons::health = other.health; + Pokemons::max_health = other.max_health; + Pokemons::attack_power = other.attack_power; +} + +Pokemons::~Pokemons() +{ + +} + +void Pokemons::Attack(Pokemons &target_pokemon) +{ + int damage = attack_power; + cout << name << " inflicts an attack to " << target_pokemon.name << " that does " << damage << " damage!\n"; + target_pokemon.TakeDamage(damage); +} + +void Pokemons::TakeDamage(int damage) +{ + health -= damage; + if (health < 0) + health = 0; +} + +bool Pokemons::IsFainted() const +{ + return health <= 0; +} + +void Pokemons::Heal() +{ + health = max_health; +} + +void Pokemons::ShowHealth(Pokemons pokemon) +{ + cout << "\n" << pokemon.name << "'s health is at " << pokemon.health << endl; +} + +int Pokemons::GetHealth() +{ + return health; +} + +void Pokemons::SetHealth(int updated_health) +{ + health = updated_health; +} + diff --git a/Pokemon/Pokemon/Pokemons.h b/Pokemon/Pokemon/Pokemons.h new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Pokemons.hpp b/Pokemon/Pokemon/Pokemons.hpp new file mode 100644 index 0000000..857e8e5 --- /dev/null +++ b/Pokemon/Pokemon/Pokemons.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include +#include "PokemonType.hpp" + +using namespace std; + +class Pokemons +{ +public: + string name; + Pokemon_Types type; + int health; + int max_health; + int attack_power; + + Pokemons(); + Pokemons(string poke_name, Pokemon_Types poke_type, int poke_health, int poke_max_health, int poke_attack_power); + Pokemons(const Pokemons& other); + ~Pokemons(); + void Attack(Pokemons &target_pokemon); + void TakeDamage(int damage); + bool IsFainted() const; + void Heal(); + void ShowHealth(Pokemons pokemon); + int GetHealth(); + void SetHealth(int updated_health); +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Squirtle.cpp b/Pokemon/Pokemon/Squirtle.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Squirtle.hpp b/Pokemon/Pokemon/Squirtle.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Pokemon/Pokemon/Utility.cpp b/Pokemon/Pokemon/Utility.cpp new file mode 100644 index 0000000..9b1c285 --- /dev/null +++ b/Pokemon/Pokemon/Utility.cpp @@ -0,0 +1,21 @@ +#include "Utility.hpp" +#include + +using namespace std; + +using namespace N_Utility; + +void Utility::WaitForEnter() +{ + cin.get(); +} + +void Utility::ClearConsole() +{ + system("cls"); +} + +void Utility::ClearInputBuffer() +{ + cin.ignore(numeric_limits::max(), '\n'); +} \ No newline at end of file diff --git a/Pokemon/Pokemon/Utility.hpp b/Pokemon/Pokemon/Utility.hpp new file mode 100644 index 0000000..2d064db --- /dev/null +++ b/Pokemon/Pokemon/Utility.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace N_Utility +{ + class Utility + { + public: + static void WaitForEnter(); + static void ClearConsole(); + static void ClearInputBuffer(); + }; +} \ No newline at end of file diff --git a/Pokemon/Pokemon/WildPokemonEncounterHandler.cpp b/Pokemon/Pokemon/WildPokemonEncounterHandler.cpp new file mode 100644 index 0000000..d508697 --- /dev/null +++ b/Pokemon/Pokemon/WildPokemonEncounterHandler.cpp @@ -0,0 +1,14 @@ +#include "WildPokemonEncounterHandler.hpp" +#include +#include + +WildPokemonEncounterHandler::WildPokemonEncounterHandler() +{ + srand(time(0)); +} + +Pokemons WildPokemonEncounterHandler::GetRandomWildPokemonFromGrass(const Grass& grass) +{ + int random_index = rand() % grass.wild_pokemons_list.size(); + return grass.wild_pokemons_list[random_index]; +} diff --git a/Pokemon/Pokemon/WildPokemonEncounterHandler.hpp b/Pokemon/Pokemon/WildPokemonEncounterHandler.hpp new file mode 100644 index 0000000..4bee1e9 --- /dev/null +++ b/Pokemon/Pokemon/WildPokemonEncounterHandler.hpp @@ -0,0 +1,9 @@ +#include "Grass.hpp" +#include + +class WildPokemonEncounterHandler +{ +public: + WildPokemonEncounterHandler(); + Pokemons GetRandomWildPokemonFromGrass(const Grass& grass); +}; \ No newline at end of file diff --git a/Pokemon/Pokemon/Zubat.cpp b/Pokemon/Pokemon/Zubat.cpp new file mode 100644 index 0000000..3a42c5d --- /dev/null +++ b/Pokemon/Pokemon/Zubat.cpp @@ -0,0 +1,14 @@ +#include "Zubat.hpp" +#include "Pokemons.hpp" +#include + +Zubat::Zubat() +{ + Pokemons("Zubat", Pokemon_Types::Poison_Type, 100, 100, 20); +} + +void Zubat::SuperSonic(Pokemons& target_pokemon) +{ + cout << name << " uses Supersonic on " << target_pokemon.name << "!!!\n"; + target_pokemon.TakeDamage(20); +} \ No newline at end of file diff --git a/Pokemon/Pokemon/Zubat.hpp b/Pokemon/Pokemon/Zubat.hpp new file mode 100644 index 0000000..47c4832 --- /dev/null +++ b/Pokemon/Pokemon/Zubat.hpp @@ -0,0 +1,7 @@ +#include "Pokemons.hpp" + +class Zubat :public Pokemons +{ + Zubat(); + void SuperSonic(Pokemons& target_pokemon); +}; \ No newline at end of file