50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
#ifndef POKEMON_H
|
|
#define POKEMON_H
|
|
|
|
#include "config.h"
|
|
#include "types.h"
|
|
#include <string>
|
|
|
|
namespace PokEng {
|
|
|
|
|
|
class Pokemon {
|
|
public:
|
|
Pokemon() = default;
|
|
~Pokemon() = default;
|
|
|
|
Pokemon(uint16_t id) : m_id(id) {}
|
|
Pokemon(uint16_t id, uint16_t health) : m_id(id), m_health(health) {}
|
|
Pokemon(uint16_t id, uint16_t health, Type primaryType) : m_id(id), m_health(health), m_types(primaryType) {}
|
|
Pokemon(uint16_t id, uint16_t health, Type primaryType, Type secondaryType) : m_id(id), m_health(health), m_types(primaryType, secondaryType) {}
|
|
|
|
public:
|
|
// Getters
|
|
uint16_t getId() const { return m_id; }
|
|
uint16_t getHealth() const { return m_health; }
|
|
PokemonTypes getTypes() const { return m_types; }
|
|
Type getPrimaryType() const { return m_types.getPrimary(); }
|
|
Type getSecondaryType() const { return m_types.getSecondary(); }
|
|
|
|
// Setters
|
|
void setHealth(uint16_t health) { m_health = health; }
|
|
void setTypes(Type primary) { m_types.setPrimary(primary); m_types.setSecondary(Type::NONE); }
|
|
void setTypes(Type primary, Type secondary) { m_types.setPrimary(primary); m_types.setSecondary(secondary); }
|
|
void SetPokemonTypes(PokemonTypes types) { m_types = types; }
|
|
|
|
public:
|
|
// Type-based operations
|
|
template <Generation Gen = Generation::I>
|
|
uint32_t calculateDamageTaken(uint32_t baseDamage, Type attackType) const {
|
|
return calculateDamage<Gen>(baseDamage, attackType, m_types);
|
|
}
|
|
|
|
private:
|
|
uint16_t m_id;
|
|
uint16_t m_health;
|
|
PokemonTypes m_types;
|
|
};
|
|
|
|
} // namespace PokEng
|
|
|
|
#endif |