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
2 changes: 1 addition & 1 deletion Pokemon/Header/Battle/BattleManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace N_Battle
public:
void startBattle(Player* player, N_Pokemon::Pokemon* wildPokemon);
private:
BattleState* battleState;
BattleState battleState;

void battle();
void handleBattleOutcome();
Expand Down
3 changes: 1 addition & 2 deletions Pokemon/Header/Battle/WildEncounterManager.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include <vector>
#include"../Pokemon/Pokemon.hpp"
#include"../Pokemon/Grass.hpp"

//class Pokemon;
Expand All @@ -13,6 +12,6 @@ namespace N_Battle
class WildEncounterManager {
public:
WildEncounterManager();
Pokemon getRandomPokemonFromGrass(const Grass* grass);
Pokemon* getRandomPokemonFromGrass(const Grass &grass);
};
}
8 changes: 5 additions & 3 deletions Pokemon/Header/Character/Player/Player.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#pragma once
#include<iostream>
#include<string>
#include"../../../Header/Pokemon/PokemonType.hpp"
#include"../../../Header/Pokemon/PokemonChoice.hpp"
#include"../../../Header/Pokemon/Pokemon.hpp"
#include"../../../Header/Pokemon/Pokemons/Charmander.hpp"
#include"../../../Header/Pokemon/Pokemons/Squirtle.hpp"
#include"../../../Header/Pokemon/Pokemons/Pikachu.hpp"
#include"../../../Header/Pokemon/Pokemons/Bulbasaur.hpp"
#include"../../../Header/Utility/Utility.hpp"
using namespace std;

Expand All @@ -20,7 +22,7 @@ namespace N_Character
Player();

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


void choosePokemon(int choice);
Expand Down
17 changes: 13 additions & 4 deletions Pokemon/Header/Main/Game.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#pragma once
#include "../Pokemon/Grass.hpp"
#include"../Character/Player/Player.hpp"
#include "../../Header/Character/Player/Player.hpp"
//#include"../../Header/Pokemon/PokemonType.hpp"
#include"../../Header/Utility/Utility.hpp"
#include "../../Header/Battle/WildEncounterManager.hpp"
#include "../../Header/Battle/BattleManager.hpp"
#include"../../Header/Pokemon/Pokemons/Pidgey.hpp"
#include"../../Header/Pokemon/Pokemons/Caterpie.hpp"

using namespace N_Character;
using namespace N_Player;
Expand All @@ -12,11 +18,14 @@ namespace N_Game

public:
Game();
~Game();
void gameLoop(Player* player);

private:
Grass* forestGrass;
Grass* caveGrass;
Grass* shallowWater;
Grass forestGrass;
Pokemon* wildPokemon;

//Grass* caveGrass;
//Grass* shallowWater;
};
}
15 changes: 15 additions & 0 deletions Pokemon/Header/Pokemon/Move.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include <string>
using namespace std;

namespace N_Pokemon {
struct Move {
string name;
int power;

Move(const string& moveName, int movePower) {
name = moveName;
power = movePower;
}
};
}
24 changes: 19 additions & 5 deletions Pokemon/Header/Pokemon/Pokemon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
#include <iostream>
#include <limits>
#include <string>
#include"../../Header/Pokemon/PokemonType.hpp"
#include"../../Header/Pokemon/PokemonChoice.hpp"
#include<vector>
#include"../Utility/Utility.hpp"
#include"../Pokemon/Move.hpp"
#include"../Pokemon/PokemonType.hpp"
#include"../Pokemon/PokemonChoice.hpp"
using namespace std;

struct Move;

namespace N_Pokemon
{
class Pokemon {
Expand All @@ -15,14 +20,14 @@ namespace N_Pokemon
Pokemon();

// Parameterized constructor
Pokemon(std::string p_name, PokemonType p_type, int p_health, int p_attackPower);
Pokemon(std::string p_name, PokemonType p_type, int p_health, vector<Move> p_moves);

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

~Pokemon();

void attack(Pokemon* target);
virtual void attack(Move selectedMove, Pokemon* target) = 0;

void heal();

Expand All @@ -35,11 +40,20 @@ namespace N_Pokemon

void setName(string _name);

void selectAndUseMove(Pokemon* target);

void reduceAttackPower(int reducedDamage);

protected:
string name;
PokemonType type;
int health;
int maxHealth;
int attackPower;
vector<Move> moves;
int attackBonus = 0;

void printAvailableMoves();
int selectMove();
void useMove(Move selectedMove, Pokemon* target);
};
}
5 changes: 1 addition & 4 deletions Pokemon/Header/Pokemon/Pokemons/Bulbasaur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace N_Pokemon {
class Bulbasaur : public Pokemon {
public:
Bulbasaur();

private:
int leafBlade_dmg;
void leafBlade(Pokemon* target);
void attack(Move selectedMove, Pokemon* target) override;
};

}
Expand Down
5 changes: 1 addition & 4 deletions Pokemon/Header/Pokemon/Pokemons/Caterpie.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace N_Pokemon {
class Caterpie : public Pokemon {
public:
Caterpie();

private:
int bugBite_dmg;
void bugBite(Pokemon* target);
void attack(Move selectedMove, Pokemon* target) override;
};

}
Expand Down
5 changes: 1 addition & 4 deletions Pokemon/Header/Pokemon/Pokemons/Charmander.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace N_Pokemon {
class Charmander : public Pokemon {
public:
Charmander();

private:
int flameThrower_dmg;
void flameThrower(Pokemon* target);
void attack(Move selectedMove, Pokemon* target) override;
};

}
Expand Down
5 changes: 1 addition & 4 deletions Pokemon/Header/Pokemon/Pokemons/Pidgey.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace N_Pokemon {
class Pidgey : public Pokemon {
public:
Pidgey();

private:
int wingAttack_dmg;
void WingAttack(Pokemon* target);
void attack(Move selectedMove, Pokemon* target) override;
};
}
}
5 changes: 1 addition & 4 deletions Pokemon/Header/Pokemon/Pokemons/Pikachu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace N_Pokemon {
class Pikachu : public Pokemon {
public:
Pikachu();

private:
int thunderShock_dmg;
void thunderShock(Pokemon* target);
void attack(Move selectedMove, Pokemon* target) override;
};

}
Expand Down
14 changes: 14 additions & 0 deletions Pokemon/Header/Pokemon/Pokemons/Squirtle.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once
#include "../Pokemon.hpp"

namespace N_Pokemon {
namespace N_Pokemons {

class Squirtle : public Pokemon {
public:
Squirtle();
void attack(Move selectedMove, Pokemon* target) override;
};

}
}
17 changes: 0 additions & 17 deletions Pokemon/Header/Pokemon/Pokemons/Squitle.hpp

This file was deleted.

5 changes: 3 additions & 2 deletions Pokemon/Pokemon.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -181,14 +181,15 @@
<ClInclude Include="Header\Main\Game.hpp" />
<ClInclude Include="Header\Pokemon\Grass.hpp" />
<ClInclude Include="Header\Character\Player\Player.hpp" />
<ClInclude Include="Header\Pokemon\Move.hpp" />
<ClInclude Include="Header\Pokemon\Pokemon.hpp" />
<ClInclude Include="Header\Pokemon\PokemonChoice.hpp" />
<ClInclude Include="Header\Pokemon\Pokemons\Bulbasaur.hpp" />
<ClInclude Include="Header\Pokemon\Pokemons\Charmander.hpp" />
<ClInclude Include="Header\Pokemon\Pokemons\Pidgey.hpp" />
<ClInclude Include="Header\Pokemon\Pokemons\Caterpie.hpp" />
<ClInclude Include="Header\Pokemon\Pokemons\Pikachu.hpp" />
<ClInclude Include="Header\Pokemon\Pokemons\Squitle.hpp" />
<ClInclude Include="Header\Pokemon\Pokemons\Squirtle.hpp" />
<ClInclude Include="Header\Pokemon\PokemonType.hpp" />
<ClInclude Include="Header\Character\ProfessorOak.hpp" />
<ClInclude Include="Header\Utility\Utility.hpp" />
Expand Down
5 changes: 4 additions & 1 deletion Pokemon/Pokemon.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@
<ClInclude Include="Header\Pokemon\Pokemons\Charmander.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Header\Pokemon\Pokemons\Squitle.hpp">
<ClInclude Include="Header\Pokemon\Pokemons\Squirtle.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Header\Pokemon\Move.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
Expand Down
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.ilk
Binary file not shown.
13 changes: 11 additions & 2 deletions Pokemon/Pokemon/x64/Debug/Pokemon.log
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
 Bulbasaur.cpp
 BattleManager.cpp
Game.cpp
C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\Src\Battle\BattleManager.cpp(25,44): error C2660: 'N_Pokemon::Pokemon::attack': function does not take 1 arguments
C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\Src\Battle\BattleManager.cpp(29,42): error C2660: 'N_Pokemon::Pokemon::attack': function does not take 1 arguments
main.cpp
Player.cpp
Pokemon.cpp
ProfessorOak.cpp
Bulbasaur.cpp
Charmander.cpp
Pidgey.cpp
Caterpie.cpp
Pikachu.cpp
Squirtle.cpp
WildEncounterManager.cpp
C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\Src\Battle\WildEncounterManager.cpp(12,19): warning C4244: 'argument': conversion from 'time_t' to 'unsigned int', possible loss of data
Generating Code...
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.
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\OneDrive\Desktop\My repos\Pokemon\Pokemon\|
Debug|x64|C:\Users\wasis\Desktop\Project\Duck_Hunt\Pokemon\Pokemon\|
Binary file modified Pokemon/Pokemon/x64/Debug/Pokemon.tlog/link.read.1.tlog
Binary file not shown.
Empty file.
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.
35 changes: 18 additions & 17 deletions Pokemon/Src/Battle/BattleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@ using namespace N_Utility;
namespace N_Battle
{
void BattleManager::startBattle(Player* player, N_Pokemon::Pokemon* wildPokemon) {
battleState->playerPokemon = player->chosenPokemon;
battleState->wildPokemon = wildPokemon;
battleState->playerTurn = true; // Player starts first
battleState->battleOngoing = true;
battleState.playerPokemon = player->chosenPokemon;
battleState.wildPokemon = wildPokemon;
battleState.playerTurn = true; // Player starts first
battleState.battleOngoing = true;
std::cout << "A wild " << wildPokemon->getName() << " appeared!\n";
battle();
}

//className* ptrname; declaration
//ptrname->name;
void BattleManager::battle() {
while (battleState->battleOngoing) {
if (battleState->playerTurn) {
while (battleState.battleOngoing) {
if (battleState.playerTurn) {
// Player's turn to attack
battleState->playerPokemon->attack(battleState->wildPokemon);
battleState.playerPokemon->selectAndUseMove(battleState.wildPokemon);
}
else {
// Wild Pok�mon's turn to attack
battleState->wildPokemon->attack(battleState->playerPokemon);
battleState.wildPokemon->selectAndUseMove(battleState.playerPokemon);
}

// Update the battle state after the turn
updateBattleState();

// Switch turns
battleState->playerTurn = !battleState->playerTurn;
battleState.playerTurn = !battleState.playerTurn;

Utility::waitForEnter();
}
Expand All @@ -41,22 +42,22 @@ namespace N_Battle
}

void BattleManager::handleBattleOutcome() {
if (battleState->playerPokemon->isFainted()) {
std::cout << battleState->playerPokemon->getName() << " has fainted! You lose the battle.\n";
if (battleState.playerPokemon->isFainted()) {
std::cout << battleState.playerPokemon->getName() << " has fainted! You lose the battle.\n";
}
else {
std::cout << "You defeated the wild " << battleState->wildPokemon->getName() << "!\n";
std::cout << "You defeated the wild " << battleState.wildPokemon->getName() << "!\n";
}
}



void BattleManager::updateBattleState() {
if (battleState->playerPokemon->isFainted()) {
battleState->battleOngoing = false;
if (battleState.playerPokemon->isFainted()) {
battleState.battleOngoing = false;
}
else if (battleState->wildPokemon->isFainted()) {
battleState->battleOngoing = false;
else if (battleState.wildPokemon->isFainted()) {
battleState.battleOngoing = false;
}
}
}
Expand Down
Loading