67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
// Pokemon Battle Engine Header
|
|
// High-performance Pokemon battle simulator with type system
|
|
|
|
#ifndef POKEMON_BATTLE_SIM_H
|
|
#define POKEMON_BATTLE_SIM_H
|
|
|
|
#include <string>
|
|
#include "types.h"
|
|
|
|
namespace PokemonSim {
|
|
|
|
// Forward declarations
|
|
class Pokemon;
|
|
|
|
// Pokemon class with type support
|
|
class Pokemon {
|
|
public:
|
|
Pokemon(const std::string& name, int health = 100);
|
|
Pokemon(const std::string& name, int health, Type primaryType);
|
|
Pokemon(const std::string& name, int health, Type primaryType, Type secondaryType);
|
|
~Pokemon() = default;
|
|
|
|
// Getters
|
|
std::string getName() const;
|
|
int getHealth() const;
|
|
const PokemonTypes& getTypes() const;
|
|
|
|
// Setters
|
|
void setHealth(int health);
|
|
void setTypes(Type primary);
|
|
void setTypes(Type primary, Type secondary);
|
|
|
|
// Type-based operations
|
|
template <Generation Gen = Generation::GENERATION_1>
|
|
uint32_t calculateDamageTaken(uint32_t baseDamage, Type attackType) const {
|
|
return calculateDamage<Gen>(baseDamage, attackType, types_);
|
|
}
|
|
|
|
private:
|
|
std::string name_;
|
|
int health_;
|
|
PokemonTypes types_;
|
|
};
|
|
|
|
// Battle simulation function
|
|
bool simulateBattle(Pokemon& pokemon1, Pokemon& pokemon2);
|
|
|
|
// High-level type system functions for easy use
|
|
template <Generation Gen = Generation::GENERATION_1>
|
|
inline uint32_t calculateTypeDamage(uint32_t baseDamage, Type attackType, const PokemonTypes& defenderTypes) {
|
|
return calculateDamage<Gen>(baseDamage, attackType, defenderTypes);
|
|
}
|
|
|
|
template <Generation Gen = Generation::GENERATION_1>
|
|
inline uint32_t calculateTypeDamage(uint32_t baseDamage, Type attackType, Type defenderType) {
|
|
return calculateDamage<Gen>(baseDamage, attackType, PokemonTypes(defenderType));
|
|
}
|
|
|
|
template <Generation Gen = Generation::GENERATION_1>
|
|
inline uint32_t calculateTypeDamage(uint32_t baseDamage, Type attackType, Type defenderType1, Type defenderType2) {
|
|
return calculateDamage<Gen>(baseDamage, attackType, PokemonTypes(defenderType1, defenderType2));
|
|
}
|
|
|
|
} // namespace PokemonSim
|
|
|
|
#endif // POKEMON_BATTLE_SIM_H
|