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
34 changes: 34 additions & 0 deletions Pokemon/Player.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once
#include "Player.hpp"
#include <iostream>
using namespace std;


Player::Player() {
name = "Trainer";
chosenPokemon = Pokemon(); // Using the default Pokemon constructor
}

Player::Player(string p_name, Pokemon p_chosenPokemon) {
name = p_name;
chosenPokemon = p_chosenPokemon;
}

void Player::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";
Utility::waitForEnter(); // Wait for user to press Enter before proceeding
}
25 changes: 25 additions & 0 deletions Pokemon/Player.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once
#include<iostream>
#include<string>
#include "PokemonType.hpp"
#include "PokemonChoice.hpp"
#include "Utility.hpp"
#include "Pokemon.hpp"
using namespace std;

class Pokemon;

class Player {
public:
string name;
Pokemon chosenPokemon;

// Default constructor
Player();

// Parameterized constructor
Player(string p_name, Pokemon p_chosenPokemon);


void choosePokemon(int choice);
};
33 changes: 33 additions & 0 deletions Pokemon/Pokemon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once
#include <iostream>
#include <limits>
#include <string>
#include "Pokemon.hpp"
using namespace std;

Pokemon::Pokemon() {
name = "Unknown";
type = PokemonType::NORMAL;
health = 50;
}

// Parameterized constructor
Pokemon::Pokemon(string p_name, PokemonType p_type, int p_health) {
name = p_name;
type = p_type;
health = p_health;
}

// Copy constructor
Pokemon::Pokemon(const Pokemon& other) {
name = other.name;
type = other.type;
health = other.health;
}

// Destructor
Pokemon::~Pokemon() {
// Destructor message removed
}

void Pokemon::attack() { std::cout << name << " attacks with a powerful move!\n"; }
27 changes: 27 additions & 0 deletions Pokemon/Pokemon.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once
#include <iostream>
#include <limits>
#include <string>
#include "PokemonType.hpp"
#include "PokemonChoice.hpp"
using namespace std;

class Pokemon {
public:
string name;
PokemonType type;
int health;

// Default constructor
Pokemon();

// Parameterized constructor
Pokemon(std::string p_name, PokemonType p_type, int p_health);

// Copy constructor
Pokemon(const Pokemon& other);

~Pokemon();

void attack();
};
11 changes: 11 additions & 0 deletions Pokemon/Pokemon.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,24 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="Player.cpp" />
<ClCompile Include="Pokemon.cpp" />
<ClCompile Include="Utility.cpp" />
</ItemGroup>
<ItemGroup>
<Content Include=".idea\.idea.Pokemon\.idea\indexLayout.xml" />
<Content Include=".idea\.idea.Pokemon\.idea\vcs.xml" />
<Content Include=".idea\.idea.Pokemon\.idea\workspace.xml" />
<Content Include="Pokemon.vcxproj.filters" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Header.hpp" />
<ClInclude Include="Player.hpp" />
<ClInclude Include="Pokemon.hpp" />
<ClInclude Include="PokemonChoice.hpp" />
<ClInclude Include="PokemonType.hpp" />
<ClInclude Include="Utility.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
29 changes: 29 additions & 0 deletions Pokemon/Pokemon.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,34 @@
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Player.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Utility.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Pokemon.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Header.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Player.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PokemonChoice.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PokemonType.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Utility.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Pokemon.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Pokemon/Pokemon/x64/Debug/Pokemon.exe.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\x64\Debug\Pokemon.exe</FullPath>
<FullPath>C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\x64\Debug\Pokemon.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
Expand Down
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.ilk
Binary file not shown.
2 changes: 1 addition & 1 deletion Pokemon/Pokemon/x64/Debug/Pokemon.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
 main.cpp
Pokemon.vcxproj -> C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\x64\Debug\Pokemon.exe
Pokemon.vcxproj -> C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\x64\Debug\Pokemon.exe
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.tlog/CL.write.1.tlog
Binary file not shown.
5 changes: 4 additions & 1 deletion Pokemon/Pokemon/x64/Debug/Pokemon.tlog/Cl.items.tlog
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\main.cpp;C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\Pokemon\x64\Debug\main.obj
C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\main.cpp;C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Pokemon\x64\Debug\main.obj
C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Player.cpp;C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Pokemon\x64\Debug\Player.obj
C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Pokemon.cpp;C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Pokemon\x64\Debug\Pokemon.obj
C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Utility.cpp;C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Pokemon\x64\Debug\Utility.obj
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0:
Debug|x64|C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\|
Debug|x64|C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\|
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.tlog/link.command.1.tlog
Binary file not shown.
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.tlog/link.read.1.tlog
Binary file not shown.
4 changes: 2 additions & 2 deletions Pokemon/Pokemon/x64/Debug/Pokemon.tlog/link.secondary.1.tlog
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
^C:\USERS\WASIS\DESKTOP\PROJECT\DUCK_HUNT\POKEMON\POKEMON\POKEMON\X64\DEBUG\MAIN.OBJ
C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\Pokemon\x64\Debug\Pokemon.ilk
^C:\USERS\WASIS\ONEDRIVE\DESKTOP\MY REPOS\POKEMON\POKEMON\POKEMON\X64\DEBUG\MAIN.OBJ|C:\USERS\WASIS\ONEDRIVE\DESKTOP\MY REPOS\POKEMON\POKEMON\POKEMON\X64\DEBUG\PLAYER.OBJ|C:\USERS\WASIS\ONEDRIVE\DESKTOP\MY REPOS\POKEMON\POKEMON\POKEMON\X64\DEBUG\POKEMON.OBJ|C:\USERS\WASIS\ONEDRIVE\DESKTOP\MY REPOS\POKEMON\POKEMON\POKEMON\X64\DEBUG\UTILITY.OBJ
C:\Users\wasis\OneDrive\Desktop\My repos\Pokemon\Pokemon\Pokemon\x64\Debug\Pokemon.ilk
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.tlog/link.write.1.tlog
Binary file not shown.
Binary file modified Pokemon/Pokemon/x64/Debug/vc143.idb
Binary file not shown.
Binary file modified Pokemon/Pokemon/x64/Debug/vc143.pdb
Binary file not shown.
7 changes: 7 additions & 0 deletions Pokemon/PokemonChoice.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
enum class PokemonChoice {
CHARMANDER = 1,
BULBASAUR,
SQUIRTLE,
PIKACHU // Default choice
};
8 changes: 8 additions & 0 deletions Pokemon/PokemonType.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once
enum class PokemonType {
FIRE,
GRASS,
WATER,
ELECTRIC,
NORMAL // Added for the default constructor
};
24 changes: 24 additions & 0 deletions Pokemon/Utility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once
#include"Utility.hpp"
#include<iostream>
#include<limits>
using namespace std;

void Utility::clearConsole()
{
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
}

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

void Utility::clearInputBuffer()
{
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
7 changes: 7 additions & 0 deletions Pokemon/Utility.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
class Utility {
public:
static void clearConsole();
static void waitForEnter();
static void clearInputBuffer(); // New helper function
};
Loading