PkmnLib/src/Battling/Pokemon/Pokemon.hpp

66 lines
3.3 KiB
C++
Raw Normal View History

#ifndef PKMNLIB_POKEMON_HPP
#define PKMNLIB_POKEMON_HPP
#include <CreatureLib/Battling/Models/Creature.hpp>
#include <utility>
2020-01-05 14:18:30 +00:00
#include "../../Library/Statistic.hpp"
#include "../Library/BattleLibrary.hpp"
#include "LearnedMove.hpp"
namespace PkmnLib::Battling {
class Pokemon : public CreatureLib::Battling::Creature {
private:
CreatureLib::Library::StatisticSet<uint8_t> _individualValues;
CreatureLib::Library::StatisticSet<uint8_t> _effortValues;
ArbUt::BorrowedPtr<const PkmnLib::Library::Nature> _nature;
2020-01-02 19:26:01 +00:00
ArbUt::BorrowedPtr<const BattleLibrary> GetLibrary() const { return _library.ForceAs<const BattleLibrary>(); }
2020-01-02 19:26:01 +00:00
public:
Pokemon(ArbUt::BorrowedPtr<const BattleLibrary> library,
const ArbUt::BorrowedPtr<const Library::PokemonSpecies>& species,
2020-05-27 15:26:25 +00:00
const ArbUt::BorrowedPtr<const Library::PokemonForme>& forme, uint8_t level, uint32_t experience,
uint32_t uid, CreatureLib::Library::Gender gender, uint8_t coloring,
2020-07-04 13:50:30 +00:00
ArbUt::BorrowedPtr<const Library::Item> heldItem, const std::string_view& nickname,
2020-05-27 15:26:25 +00:00
const CreatureLib::Library::TalentIndex& talent,
const std::vector<CreatureLib::Battling::LearnedAttack*>& moves,
CreatureLib::Library::StatisticSet<uint8_t> individualValues,
CreatureLib::Library::StatisticSet<uint8_t> effortValues,
ArbUt::BorrowedPtr<const PkmnLib::Library::Nature> nature, bool allowedExperienceGain = true)
: CreatureLib::Battling::Creature(library.ForceAs<const CreatureLib::Battling::BattleLibrary>(),
species.ForceAs<const CreatureLib::Library::CreatureSpecies>(),
2020-05-27 15:26:25 +00:00
forme.As<const CreatureLib::Library::SpeciesVariant>(), level, experience,
uid, gender, coloring, heldItem.As<const CreatureLib::Library::Item>(),
nickname, talent, moves, allowedExperienceGain),
2020-01-02 19:26:01 +00:00
_individualValues(individualValues), _effortValues(effortValues), _nature(nature) {}
2020-05-27 15:26:25 +00:00
const ArbUt::BorrowedPtr<const Library::PokemonForme> GetForme() const {
return _variant.As<const Library::PokemonForme>();
2020-01-05 14:18:30 +00:00
}
2020-04-18 11:43:05 +00:00
inline bool IsShiny() const noexcept { return _coloring == 1; }
2020-05-27 15:26:25 +00:00
const ArbUt::List<LearnedMove*>& GetMoves() const {
return reinterpret_cast<const ArbUt::List<LearnedMove*>&>(_attacks);
}
inline const ArbUt::BorrowedPtr<const PkmnLib::Library::Nature>& GetNature() const noexcept { return _nature; }
2020-04-18 11:43:05 +00:00
inline uint8_t GetIndividualValue(CreatureLib::Library::Statistic stat) const {
return _individualValues.GetStat(stat);
}
2020-04-18 11:43:05 +00:00
inline uint8_t GetEffortValue(CreatureLib::Library::Statistic stat) const {
return _effortValues.GetStat(stat);
}
2020-05-20 14:05:52 +00:00
2020-05-27 15:26:25 +00:00
inline ArbUt::BorrowedPtr<const PkmnLib::Library::PokemonSpecies> GetPokemonSpecies() const noexcept {
return _species.As<const PkmnLib::Library::PokemonSpecies>();
2020-05-20 14:05:52 +00:00
}
2020-06-10 10:33:51 +00:00
void Evolve(ArbUt::BorrowedPtr<const Library::PokemonSpecies> mon,
ArbUt::BorrowedPtr<const Library::PokemonForme> forme);
};
}
#endif // PKMNLIB_POKEMON_HPP