Updates CreatureLib, implements ConstStrings.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
d57b5852f1
commit
40a003429e
|
@ -1,7 +1,6 @@
|
||||||
#include "CreatePokemon.hpp"
|
#include "CreatePokemon.hpp"
|
||||||
|
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithRandomIndividualValues(Arbutils::Random rand) {
|
||||||
PkmnLib::Battling::CreatePokemon::WithRandomIndividualValues(CreatureLib::Core::Random rand) {
|
|
||||||
_ivHp = rand.Get(0, 32);
|
_ivHp = rand.Get(0, 32);
|
||||||
_ivAttack = rand.Get(0, 32);
|
_ivAttack = rand.Get(0, 32);
|
||||||
_ivDefense = rand.Get(0, 32);
|
_ivDefense = rand.Get(0, 32);
|
||||||
|
@ -38,15 +37,15 @@ PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithEffortVa
|
||||||
}
|
}
|
||||||
|
|
||||||
PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
|
PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
|
||||||
auto rand = CreatureLib::Core::Random();
|
auto rand = Arbutils::Random();
|
||||||
const PkmnLib::Library::PokemonSpecies* species = nullptr;
|
const PkmnLib::Library::PokemonSpecies* species = nullptr;
|
||||||
if (!this->_library->GetSpeciesLibrary()->TryGet(this->_species.c_str(), species)) {
|
if (!this->_library->GetSpeciesLibrary()->TryGet(this->_species, species)) {
|
||||||
std::stringstream err;
|
std::stringstream err;
|
||||||
err << "Invalid species '" << _species << "'.";
|
err << "Invalid species '" << _species << "'.";
|
||||||
throw CreatureException(err.str());
|
throw CreatureException(err.str());
|
||||||
}
|
}
|
||||||
const PkmnLib::Library::PokemonForme* forme;
|
const PkmnLib::Library::PokemonForme* forme;
|
||||||
if (!species->TryGetForme(this->_forme, forme)){
|
if (!species->TryGetForme(this->_forme, forme)) {
|
||||||
std::stringstream err;
|
std::stringstream err;
|
||||||
err << "Invalid forme '" << _forme << "' for species '" << _forme << "'.";
|
err << "Invalid forme '" << _forme << "' for species '" << _forme << "'.";
|
||||||
throw CreatureException(err.str());
|
throw CreatureException(err.str());
|
||||||
|
@ -66,9 +65,9 @@ PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
|
||||||
gender = species->GetRandomGender(rand);
|
gender = species->GetRandomGender(rand);
|
||||||
}
|
}
|
||||||
const Library::Item* heldItem = nullptr;
|
const Library::Item* heldItem = nullptr;
|
||||||
if (!this->_heldItem.empty()) {
|
if (!this->_heldItem.Empty()) {
|
||||||
if (!_library->GetItemLibrary()->TryGet(this->_heldItem.c_str(), heldItem)) {
|
if (!_library->GetItemLibrary()->TryGet(this->_heldItem, heldItem)) {
|
||||||
throw CreatureException("Unknown Item: " + this->_heldItem);
|
throw CreatureException("Unknown Item: " + this->_heldItem.std_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level);
|
auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level);
|
||||||
|
@ -123,7 +122,8 @@ PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithEffortVa
|
||||||
_evSpeed = speed;
|
_evSpeed = speed;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithForme(const std::string& forme) {
|
PkmnLib::Battling::CreatePokemon*
|
||||||
|
PkmnLib::Battling::CreatePokemon::WithForme(const Arbutils::CaseInsensitiveConstString& forme) {
|
||||||
_forme = forme;
|
_forme = forme;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -136,17 +136,18 @@ PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::IsShiny(bool
|
||||||
_isShiny = value;
|
_isShiny = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithHeldItem(const std::string& item) {
|
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithHeldItem(const Arbutils::CaseInsensitiveConstString& item) {
|
||||||
_heldItem = item;
|
_heldItem = item;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon*
|
||||||
PkmnLib::Battling::CreatePokemon::LearnMove(const std::string& moveName, CreatureLib::Battling::AttackLearnMethod method) {
|
PkmnLib::Battling::CreatePokemon::LearnMove(const Arbutils::CaseInsensitiveConstString& moveName,
|
||||||
|
CreatureLib::Battling::AttackLearnMethod method) {
|
||||||
const PkmnLib::Library::MoveData* move;
|
const PkmnLib::Library::MoveData* move;
|
||||||
if (!_library->GetMoveLibrary()->TryGet(moveName.c_str(), move)){
|
if (!_library->GetMoveLibrary()->TryGet(moveName, move)) {
|
||||||
throw CreatureException("Invalid Move given: " + moveName);
|
throw CreatureException("Invalid Move given: " + moveName.std_str());
|
||||||
}
|
}
|
||||||
if (_attacks.size() >= _library->GetSettings()->GetMaximalMoves()){
|
if (_attacks.size() >= _library->GetSettings()->GetMaximalMoves()) {
|
||||||
throw CreatureException("This pokemon already has the maximal allowed moves.");
|
throw CreatureException("This pokemon already has the maximal allowed moves.");
|
||||||
}
|
}
|
||||||
_attacks.emplace_back(move, method);
|
_attacks.emplace_back(move, method);
|
||||||
|
|
|
@ -7,15 +7,15 @@ namespace PkmnLib::Battling {
|
||||||
class CreatePokemon {
|
class CreatePokemon {
|
||||||
private:
|
private:
|
||||||
const BattleLibrary* _library;
|
const BattleLibrary* _library;
|
||||||
std::string _species;
|
Arbutils::CaseInsensitiveConstString _species;
|
||||||
std::string _forme = "default";
|
Arbutils::CaseInsensitiveConstString _forme = "default"_cnc;
|
||||||
uint8_t _level;
|
uint8_t _level;
|
||||||
std::string _nickname = "";
|
std::string _nickname = "";
|
||||||
|
|
||||||
std::string _ability = "";
|
std::string _ability = "";
|
||||||
uint8_t _nature = 255;
|
uint8_t _nature = 255;
|
||||||
CreatureLib::Library::Gender _gender = static_cast<CreatureLib::Library::Gender>(-1);
|
CreatureLib::Library::Gender _gender = static_cast<CreatureLib::Library::Gender>(-1);
|
||||||
std::string _heldItem = "";
|
Arbutils::CaseInsensitiveConstString _heldItem = ""_cnc;
|
||||||
uint32_t _identifier = 0;
|
uint32_t _identifier = 0;
|
||||||
std::vector<std::tuple<const Library::MoveData*, CreatureLib::Battling::AttackLearnMethod>> _attacks = {};
|
std::vector<std::tuple<const Library::MoveData*, CreatureLib::Battling::AttackLearnMethod>> _attacks = {};
|
||||||
|
|
||||||
|
@ -37,16 +37,16 @@ namespace PkmnLib::Battling {
|
||||||
bool _isShiny = false;
|
bool _isShiny = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CreatePokemon(const BattleLibrary* library, std::string species, uint8_t level)
|
CreatePokemon(const BattleLibrary* library, const Arbutils::CaseInsensitiveConstString& species, uint8_t level)
|
||||||
: _library(library), _species(std::move(species)), _level(level) {}
|
: _library(library), _species(species), _level(level) {}
|
||||||
|
|
||||||
CreatePokemon* WithForme(const std::string& forme);
|
CreatePokemon* WithForme(const Arbutils::CaseInsensitiveConstString& forme);
|
||||||
CreatePokemon* WithGender(CreatureLib::Library::Gender gender);
|
CreatePokemon* WithGender(CreatureLib::Library::Gender gender);
|
||||||
CreatePokemon* IsShiny(bool value);
|
CreatePokemon* IsShiny(bool value);
|
||||||
CreatePokemon* WithHeldItem(const std::string& item);
|
CreatePokemon* WithHeldItem(const Arbutils::CaseInsensitiveConstString& item);
|
||||||
CreatePokemon* LearnMove(const std::string& move, CreatureLib::Battling::AttackLearnMethod method);
|
CreatePokemon* LearnMove(const Arbutils::CaseInsensitiveConstString& move, CreatureLib::Battling::AttackLearnMethod method);
|
||||||
|
|
||||||
CreatePokemon* WithRandomIndividualValues(CreatureLib::Core::Random rand = CreatureLib::Core::Random());
|
CreatePokemon* WithRandomIndividualValues(Arbutils::Random rand = Arbutils::Random());
|
||||||
CreatePokemon* WithIndividualValue(CreatureLib::Core::Statistic stat, uint8_t value);
|
CreatePokemon* WithIndividualValue(CreatureLib::Core::Statistic stat, uint8_t value);
|
||||||
CreatePokemon* WithIndividualValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
|
CreatePokemon* WithIndividualValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
|
||||||
uint8_t speed);
|
uint8_t speed);
|
||||||
|
|
|
@ -7,9 +7,9 @@ namespace PkmnLib::Library {
|
||||||
uint8_t _flingPower;
|
uint8_t _flingPower;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Item(std::string name, CreatureLib::Library::ItemCategory category,
|
Item(const Arbutils::CaseInsensitiveConstString& name, CreatureLib::Library::ItemCategory category,
|
||||||
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
|
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
|
||||||
std::unordered_set<std::string> flags, uint8_t flingPower)
|
std::unordered_set<Arbutils::CaseInsensitiveConstString> flags, uint8_t flingPower)
|
||||||
: CreatureLib::Library::Item(name, category, battleCategory, price, flags), _flingPower(flingPower) {}
|
: CreatureLib::Library::Item(name, category, battleCategory, price, flags), _flingPower(flingPower) {}
|
||||||
|
|
||||||
inline uint8_t GetFlingPower() const { return _flingPower; }
|
inline uint8_t GetFlingPower() const { return _flingPower; }
|
||||||
|
|
|
@ -6,16 +6,16 @@
|
||||||
namespace PkmnLib::Library {
|
namespace PkmnLib::Library {
|
||||||
class ItemLibrary : public CreatureLib::Library::ItemLibrary {
|
class ItemLibrary : public CreatureLib::Library::ItemLibrary {
|
||||||
public:
|
public:
|
||||||
inline bool TryGet(const char* name, const Item*& item) const{
|
inline bool TryGet(const Arbutils::CaseInsensitiveConstString& name, const Item*& item) const {
|
||||||
return CreatureLib::Library::ItemLibrary::TryGet(name, (const CreatureLib::Library::Item*&)item);
|
return CreatureLib::Library::ItemLibrary::TryGet(name, (const CreatureLib::Library::Item*&)item);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Item* Get(const char* name) const{
|
inline const Item* Get(const Arbutils::CaseInsensitiveConstString& name) const {
|
||||||
return reinterpret_cast<const Item*>(CreatureLib::Library::ItemLibrary::Get(name));
|
return reinterpret_cast<const Item*>(CreatureLib::Library::ItemLibrary::Get(name));
|
||||||
}
|
}
|
||||||
const Item* operator[](const char* name) const { return Get(name); }
|
const Item* operator[](const Arbutils::CaseInsensitiveConstString& name) const { return Get(name); }
|
||||||
|
|
||||||
void Insert(const char* name, const Item* item) {
|
void Insert(const Arbutils::CaseInsensitiveConstString& name, const Item* item) {
|
||||||
CreatureLib::Library::ItemLibrary::Insert(name, item);
|
CreatureLib::Library::ItemLibrary::Insert(name, item);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
PkmnLib::Library::MoveData::MoveData(const std::string& name, uint8_t type,
|
PkmnLib::Library::MoveData::MoveData(const std::string& name, uint8_t type,
|
||||||
PkmnLib::Library::MoveCategory category, uint8_t power, uint8_t accuracy,
|
PkmnLib::Library::MoveCategory category, uint8_t power, uint8_t accuracy,
|
||||||
uint8_t baseUsage, CreatureLib::Library::AttackTarget target, int8_t priority,
|
uint8_t baseUsage, CreatureLib::Library::AttackTarget target, int8_t priority,
|
||||||
std::unordered_set<std::string> flags)
|
std::unordered_set<Arbutils::CaseInsensitiveConstString> flags)
|
||||||
: AttackData(name, type, static_cast<CreatureLib::Library::AttackCategory>(category), power, accuracy, baseUsage,
|
: AttackData(name, type, static_cast<CreatureLib::Library::AttackCategory>(category), power, accuracy, baseUsage,
|
||||||
target, priority, std::move(flags)) {}
|
target, priority, std::move(flags)) {}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace PkmnLib::Library {
|
||||||
public:
|
public:
|
||||||
MoveData(const std::string& name, uint8_t type, PkmnLib::Library::MoveCategory category, uint8_t power,
|
MoveData(const std::string& name, uint8_t type, PkmnLib::Library::MoveCategory category, uint8_t power,
|
||||||
uint8_t accuracy, uint8_t baseUsage, CreatureLib::Library::AttackTarget target, int8_t priority,
|
uint8_t accuracy, uint8_t baseUsage, CreatureLib::Library::AttackTarget target, int8_t priority,
|
||||||
std::unordered_set<std::string> flags);
|
std::unordered_set<Arbutils::CaseInsensitiveConstString> flags);
|
||||||
|
|
||||||
PkmnLib::Library::MoveCategory GetCategory() const;
|
PkmnLib::Library::MoveCategory GetCategory() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,12 +8,12 @@ namespace PkmnLib::Library {
|
||||||
public:
|
public:
|
||||||
MoveLibrary(size_t initialCapacity = 32) : CreatureLib::Library::AttackLibrary(initialCapacity) {}
|
MoveLibrary(size_t initialCapacity = 32) : CreatureLib::Library::AttackLibrary(initialCapacity) {}
|
||||||
|
|
||||||
virtual const MoveData* operator[](const char* name) const { return Get(name); }
|
virtual const MoveData* operator[](const Arbutils::CaseInsensitiveConstString& name) const { return Get(name); }
|
||||||
|
|
||||||
inline bool TryGet(const char* name, const MoveData*& move) const {
|
inline bool TryGet(const Arbutils::CaseInsensitiveConstString& name, const MoveData*& move) const {
|
||||||
return CreatureLib::Library::AttackLibrary::TryGet(name, (const CreatureLib::Library::AttackData*&)move);
|
return CreatureLib::Library::AttackLibrary::TryGet(name, (const CreatureLib::Library::AttackData*&)move);
|
||||||
}
|
}
|
||||||
const MoveData* Get(const char* name) const {
|
const MoveData* Get(const Arbutils::CaseInsensitiveConstString& name) const {
|
||||||
return dynamic_cast<const MoveData*>(CreatureLib::Library::AttackLibrary::Get(name));
|
return dynamic_cast<const MoveData*>(CreatureLib::Library::AttackLibrary::Get(name));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define PKMNLIB_NATURELIBRARY_HPP
|
#define PKMNLIB_NATURELIBRARY_HPP
|
||||||
|
|
||||||
#include <CreatureLib/Core/Exceptions/CreatureException.hpp>
|
#include <CreatureLib/Core/Exceptions/CreatureException.hpp>
|
||||||
#include <CreatureLib/Core/Random.hpp>
|
#include <Arbutils/Random.hpp>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Nature.hpp"
|
#include "Nature.hpp"
|
||||||
|
@ -50,7 +50,7 @@ namespace PkmnLib::Library {
|
||||||
return _keyLookup.at(name);
|
return _keyLookup.at(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t GetRandomNature(CreatureLib::Core::Random rand = CreatureLib::Core::Random()) const{
|
uint8_t GetRandomNature(Arbutils::Random rand = Arbutils::Random()) const{
|
||||||
return rand.Get(_current);
|
return rand.Get(_current);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,10 @@ namespace PkmnLib::Library {
|
||||||
std::vector<EvolutionData> _evolutions;
|
std::vector<EvolutionData> _evolutions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PokemonSpecies(uint16_t id, const std::string& name, const PokemonForme* defaultVariant, float genderRatio,
|
PokemonSpecies(uint16_t id, const Arbutils::CaseInsensitiveConstString& name,
|
||||||
const std::string& growthRate, uint8_t captureRate, uint8_t baseHappiness)
|
const PokemonForme* defaultVariant, float genderRatio,
|
||||||
|
const Arbutils::CaseInsensitiveConstString& growthRate, uint8_t captureRate,
|
||||||
|
uint8_t baseHappiness)
|
||||||
: CreatureSpecies(id, name, defaultVariant, genderRatio, growthRate, captureRate),
|
: CreatureSpecies(id, name, defaultVariant, genderRatio, growthRate, captureRate),
|
||||||
_baseHappiness(baseHappiness) {}
|
_baseHappiness(baseHappiness) {}
|
||||||
|
|
||||||
|
@ -21,20 +23,20 @@ namespace PkmnLib::Library {
|
||||||
inline uint8_t GetBaseHappiness() const { return _baseHappiness; }
|
inline uint8_t GetBaseHappiness() const { return _baseHappiness; }
|
||||||
|
|
||||||
inline const PokemonForme* GetDefaultForme() const {
|
inline const PokemonForme* GetDefaultForme() const {
|
||||||
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant("default"));
|
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant("default"_cnc));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool HasForme(const std::string& key) const { return HasVariant(key); }
|
inline bool HasForme(const Arbutils::CaseInsensitiveConstString& key) const { return HasVariant(key); }
|
||||||
|
|
||||||
inline bool TryGetForme(const std::string& key, const PokemonForme*& forme) const {
|
inline bool TryGetForme(const Arbutils::CaseInsensitiveConstString& key, const PokemonForme*& forme) const {
|
||||||
return TryGetVariant(key, (const CreatureLib::Library::SpeciesVariant*&)forme);
|
return TryGetVariant(key, (const CreatureLib::Library::SpeciesVariant*&)forme);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const PokemonForme* GetForme(const std::string& key) const {
|
inline const PokemonForme* GetForme(const Arbutils::CaseInsensitiveConstString& key) const {
|
||||||
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant(key));
|
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AddEvolution(EvolutionData data) { _evolutions.push_back(data); }
|
inline void AddEvolution(const EvolutionData& data) { _evolutions.push_back(data); }
|
||||||
const std::vector<EvolutionData>& GetEvolutions() const { return _evolutions; }
|
const std::vector<EvolutionData>& GetEvolutions() const { return _evolutions; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,18 @@
|
||||||
namespace PkmnLib::Library {
|
namespace PkmnLib::Library {
|
||||||
class SpeciesLibrary : public CreatureLib::Library::SpeciesLibrary {
|
class SpeciesLibrary : public CreatureLib::Library::SpeciesLibrary {
|
||||||
public:
|
public:
|
||||||
inline bool TryGet(const char* name, const PokemonSpecies*& outSpecies) const {
|
inline bool TryGet(const Arbutils::CaseInsensitiveConstString& name, const PokemonSpecies*& outSpecies) const {
|
||||||
return CreatureLib::Library::SpeciesLibrary::TryGet(
|
return CreatureLib::Library::SpeciesLibrary::TryGet(
|
||||||
name, (const CreatureLib::Library::CreatureSpecies*&)outSpecies);
|
name, (const CreatureLib::Library::CreatureSpecies*&)outSpecies);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const PokemonSpecies* Get(const char* name) const {
|
inline const PokemonSpecies* Get(const Arbutils::CaseInsensitiveConstString& name) const {
|
||||||
return dynamic_cast<const PokemonSpecies*>(CreatureLib::Library::SpeciesLibrary::Get(name));
|
return dynamic_cast<const PokemonSpecies*>(CreatureLib::Library::SpeciesLibrary::Get(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
const PokemonSpecies* operator[](const char* name) const { return Get(name); }
|
const PokemonSpecies* operator[](const Arbutils::CaseInsensitiveConstString& name) const { return Get(name); }
|
||||||
|
|
||||||
void Insert(const char* name, const PokemonSpecies* species) {
|
void Insert(const Arbutils::CaseInsensitiveConstString& name, const PokemonSpecies* species) {
|
||||||
CreatureLib::Library::SpeciesLibrary::Insert(name, species);
|
CreatureLib::Library::SpeciesLibrary::Insert(name, species);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef PKMNLIB_TIMEOFDAY_HPP
|
#ifndef PKMNLIB_TIMEOFDAY_HPP
|
||||||
#define PKMNLIB_TIMEOFDAY_HPP
|
#define PKMNLIB_TIMEOFDAY_HPP
|
||||||
|
|
||||||
#include <CreatureLib/Core/Enum.hpp>
|
#include <Arbutils/Enum.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace PkmnLib::Library {
|
namespace PkmnLib::Library {
|
||||||
|
|
|
@ -113,13 +113,15 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const string &in name) const",
|
r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const string &in name) const",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, HasHeldItem), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, HasHeldItem), asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const string &in name)",
|
r = engine->RegisterObjectMethod(
|
||||||
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem, (const std::string&), void),
|
"Pokemon", "void SetHeldItem(const string &in name)",
|
||||||
asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem, (const Arbutils::CaseInsensitiveConstString&), void),
|
||||||
|
asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const Item@ item)",
|
r = engine->RegisterObjectMethod(
|
||||||
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem, (const CreatureLib::Library::Item*), void),
|
"Pokemon", "void SetHeldItem(const Item@ item)",
|
||||||
asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem, (const CreatureLib::Library::Item*), void),
|
||||||
|
asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_CurrentHealth() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_CurrentHealth() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetCurrentHealth), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetCurrentHealth), asCALL_THISCALL);
|
||||||
|
|
|
@ -40,6 +40,11 @@ void RegisterSpeciesTypes::RegisterStatisticEnum(asIScriptEngine* engine) {
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const PkmnLib::Library::PokemonForme* GetFormeWrapper(const std::string& s,
|
||||||
|
const PkmnLib::Library::PokemonSpecies* species) {
|
||||||
|
return species->GetForme(Arbutils::CaseInsensitiveConstString(s.c_str(), s.length()));
|
||||||
|
}
|
||||||
|
|
||||||
void RegisterSpeciesTypes::RegisterSpeciesType(asIScriptEngine* engine) {
|
void RegisterSpeciesTypes::RegisterSpeciesType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("Species", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("Species", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
|
@ -59,13 +64,11 @@ void RegisterSpeciesTypes::RegisterSpeciesType(asIScriptEngine* engine) {
|
||||||
asMETHOD(PkmnLib::Library::PokemonSpecies, GetRandomGender), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::PokemonSpecies, GetRandomGender), asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Species", "const Forme@ GetForme(string key) const",
|
r = engine->RegisterObjectMethod("Species", "const Forme@ GetForme(string key) const",
|
||||||
asMETHOD(PkmnLib::Library::PokemonSpecies, GetForme), asCALL_THISCALL);
|
asFUNCTION(GetFormeWrapper), asCALL_CDECL_OBJLAST);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Species", "const Forme@ GetDefaultForme() const",
|
r = engine->RegisterObjectMethod("Species", "const Forme@ GetDefaultForme() const",
|
||||||
asMETHOD(PkmnLib::Library::PokemonSpecies, GetDefaultForme), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::PokemonSpecies, GetDefaultForme), asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void RegisterSpeciesTypes::RegisterFormeType(asIScriptEngine* engine) {
|
void RegisterSpeciesTypes::RegisterFormeType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("Forme", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("Forme", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
|
@ -94,7 +97,6 @@ void RegisterSpeciesTypes::RegisterFormeType(asIScriptEngine* engine) {
|
||||||
r = engine->RegisterObjectMethod("Forme", "const string& GetAbility(int index) const",
|
r = engine->RegisterObjectMethod("Forme", "const string& GetAbility(int index) const",
|
||||||
asMETHOD(PkmnLib::Library::PokemonForme, GetTalent), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::PokemonForme, GetTalent), asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
void RegisterSpeciesTypes::RegisterSpeciesLibrary(asIScriptEngine* engine) {
|
void RegisterSpeciesTypes::RegisterSpeciesLibrary(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("SpeciesLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("SpeciesLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
|
|
|
@ -10,28 +10,28 @@ TEST_CASE("Able to build and destroy empty library", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to build, destroy and insert library", "library") {
|
TEST_CASE("Able to build, destroy and insert library", "library") {
|
||||||
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
||||||
lib->Insert("foo",
|
lib->Insert("foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonSpecies(
|
new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0},
|
"default", 1.0f, 1.0f, 100, {0},
|
||||||
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
||||||
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100));
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
||||||
delete lib;
|
delete lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Able to insert and retrieve from library", "library") {
|
TEST_CASE("Able to insert and retrieve from library", "library") {
|
||||||
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
||||||
lib->Insert("foo",
|
lib->Insert("foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonSpecies(
|
new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0},
|
"default", 1.0f, 1.0f, 100, {0},
|
||||||
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
||||||
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100));
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
||||||
auto val = lib->Get("foo");
|
auto val = lib->Get("foo"_cnc);
|
||||||
REQUIRE(val->GetName() == "foo");
|
REQUIRE(val->GetName() == "foo");
|
||||||
delete lib;
|
delete lib;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,21 +4,21 @@
|
||||||
|
|
||||||
TEST_CASE("Able to create and destroy species", "library") {
|
TEST_CASE("Able to create and destroy species", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
delete species;
|
delete species;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Able to get default forme", "library") {
|
TEST_CASE("Able to get default forme", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
auto forme = species->GetDefaultForme();
|
auto forme = species->GetDefaultForme();
|
||||||
REQUIRE(forme != nullptr);
|
REQUIRE(forme != nullptr);
|
||||||
|
@ -28,11 +28,11 @@ TEST_CASE("Able to get default forme", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to get default forme name", "library") {
|
TEST_CASE("Able to get default forme name", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
auto forme = species->GetDefaultForme();
|
auto forme = species->GetDefaultForme();
|
||||||
REQUIRE(forme != nullptr);
|
REQUIRE(forme != nullptr);
|
||||||
|
@ -43,11 +43,11 @@ TEST_CASE("Able to get default forme name", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to get species name", "library") {
|
TEST_CASE("Able to get species name", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
REQUIRE(species->GetName() == "foo");
|
REQUIRE(species->GetName() == "foo");
|
||||||
|
|
||||||
|
@ -56,11 +56,11 @@ TEST_CASE("Able to get species name", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to get species id", "library") {
|
TEST_CASE("Able to get species id", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
REQUIRE(species->GetId() == 1);
|
REQUIRE(species->GetId() == 1);
|
||||||
|
|
||||||
|
@ -69,11 +69,11 @@ TEST_CASE("Able to get species id", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to get species gender ratio", "library") {
|
TEST_CASE("Able to get species gender ratio", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
REQUIRE(species->GetGenderRate() == 0.5f);
|
REQUIRE(species->GetGenderRate() == 0.5f);
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ TEST_CASE("Able to get species gender ratio", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to get species growth rate", "library") {
|
TEST_CASE("Able to get species growth rate", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
REQUIRE(species->GetGrowthRate() == "testGrowthRate");
|
REQUIRE(species->GetGrowthRate() == "testGrowthRate");
|
||||||
|
|
||||||
|
@ -95,11 +95,11 @@ TEST_CASE("Able to get species growth rate", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to get species capture rate", "library") {
|
TEST_CASE("Able to get species capture rate", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
REQUIRE(species->GetCaptureRate() == 100);
|
REQUIRE(species->GetCaptureRate() == 100);
|
||||||
|
|
||||||
|
@ -108,11 +108,11 @@ TEST_CASE("Able to get species capture rate", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to get species base happiness", "library") {
|
TEST_CASE("Able to get species base happiness", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
REQUIRE(species->GetBaseHappiness() == 100);
|
REQUIRE(species->GetBaseHappiness() == 100);
|
||||||
|
|
||||||
|
@ -121,17 +121,17 @@ TEST_CASE("Able to get species base happiness", "library") {
|
||||||
|
|
||||||
TEST_CASE("Able to set and get evolution", "library") {
|
TEST_CASE("Able to set and get evolution", "library") {
|
||||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "foo",
|
1, "foo"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
auto species2 = new PkmnLib::Library::PokemonSpecies(
|
auto species2 = new PkmnLib::Library::PokemonSpecies(
|
||||||
2, "bar",
|
2, "bar"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
"default", 1.0f, 1.0f, 100, {0}, CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
||||||
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testAbility"}, {"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100);
|
0.5f, "testGrowthRate"_cnc, 100, 100);
|
||||||
|
|
||||||
species->AddEvolution(PkmnLib::Library::EvolutionData::CreateLevelEvolution(16, species2));
|
species->AddEvolution(PkmnLib::Library::EvolutionData::CreateLevelEvolution(16, species2));
|
||||||
auto evolutions = species->GetEvolutions();
|
auto evolutions = species->GetEvolutions();
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
using namespace PkmnLib::Battling;
|
using namespace PkmnLib::Battling;
|
||||||
|
|
||||||
TEST_CASE("Low level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
TEST_CASE("Low level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 10).WithNature("neutralNature")->Build();
|
auto pkmn =
|
||||||
|
CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10).WithNature("neutralNature")->Build();
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 40);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 40);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 40);
|
CHECK(pkmn->GetCurrentHealth() == 40);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 25);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 25);
|
||||||
|
@ -18,7 +19,8 @@ TEST_CASE("Low level, no IVs, no EVs, neutral nature, no stat boosts stat test")
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("High level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
TEST_CASE("High level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100).WithNature("neutralNature")->Build();
|
auto pkmn =
|
||||||
|
CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100).WithNature("neutralNature")->Build();
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 310);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 310);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 310);
|
CHECK(pkmn->GetCurrentHealth() == 310);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 205);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 205);
|
||||||
|
@ -30,7 +32,7 @@ TEST_CASE("High level, no IVs, no EVs, neutral nature, no stat boosts stat test"
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Low level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
TEST_CASE("Low level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 10)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10)
|
||||||
.WithNature("neutralNature")
|
.WithNature("neutralNature")
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->Build();
|
->Build();
|
||||||
|
@ -45,7 +47,7 @@ TEST_CASE("Low level, max IVs, no EVs, neutral nature, no stat boosts stat test"
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("High level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
TEST_CASE("High level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("neutralNature")
|
.WithNature("neutralNature")
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->Build();
|
->Build();
|
||||||
|
@ -60,7 +62,7 @@ TEST_CASE("High level, max IVs, no EVs, neutral nature, no stat boosts stat test
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("High level, max IVs, max EVs, neutral nature, no stat boosts stat test") {
|
TEST_CASE("High level, max IVs, max EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("neutralNature")
|
.WithNature("neutralNature")
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
|
@ -76,7 +78,7 @@ TEST_CASE("High level, max IVs, max EVs, neutral nature, no stat boosts stat tes
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, no stat boosts stat test") {
|
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("buffsAttackNerfsSpeed")
|
.WithNature("buffsAttackNerfsSpeed")
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
|
@ -92,7 +94,7 @@ TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, no st
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted +6 stat test") {
|
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted +6 stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("buffsAttackNerfsSpeed")
|
.WithNature("buffsAttackNerfsSpeed")
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
|
@ -111,11 +113,11 @@ TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attac
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted -6 stat test") {
|
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted -6 stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("buffsAttackNerfsSpeed")
|
.WithNature("buffsAttackNerfsSpeed")
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
->Build();
|
->Build();
|
||||||
|
|
||||||
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, -6);
|
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, -6);
|
||||||
|
|
||||||
|
@ -129,5 +131,4 @@ TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attac
|
||||||
delete pkmn;
|
delete pkmn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
TEST_CASE("Create and delete Pokemon"){
|
TEST_CASE("Create and delete Pokemon"){
|
||||||
auto lib = TestLibrary::GetLibrary();
|
auto lib = TestLibrary::GetLibrary();
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies", 1).Build();
|
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies"_cnc, 1).Build();
|
||||||
delete mon;
|
delete mon;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Get Nature from Pokemon"){
|
TEST_CASE("Get Nature from Pokemon"){
|
||||||
auto lib = TestLibrary::GetLibrary();
|
auto lib = TestLibrary::GetLibrary();
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies", 1)
|
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies"_cnc, 1)
|
||||||
.WithNature("neutralNature")
|
.WithNature("neutralNature")
|
||||||
->Build();
|
->Build();
|
||||||
auto nature = mon->GetNature();
|
auto nature = mon->GetNature();
|
||||||
|
|
|
@ -68,7 +68,7 @@ TEST_CASE("Validate Pokemon Species in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testSpecies");
|
auto data = GetScript(mainLib, "testSpecies");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30).Build();
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgObject(1, (void*)mon->GetSpecies());
|
data.Context->SetArgObject(1, (void*)mon->GetSpecies());
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ TEST_CASE("Validate Pokemon Forme in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testForme");
|
auto data = GetScript(mainLib, "testForme");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30).WithForme("default")->Build();
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc)->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgObject(1, (void*)mon->GetForme());
|
data.Context->SetArgObject(1, (void*)mon->GetForme());
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ TEST_CASE("Validate Pokemon Level in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testLevel");
|
auto data = GetScript(mainLib, "testLevel");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30).WithForme("default")->Build();
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc)->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgByte(1, mon->GetLevel());
|
data.Context->SetArgByte(1, mon->GetLevel());
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ TEST_CASE("Validate Pokemon Experience in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testExperience");
|
auto data = GetScript(mainLib, "testExperience");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30).WithForme("default")->Build();
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc)->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgDWord(1, mon->GetExperience());
|
data.Context->SetArgDWord(1, mon->GetExperience());
|
||||||
|
|
||||||
|
@ -120,8 +120,8 @@ TEST_CASE("Validate Pokemon Gender in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testGender");
|
auto data = GetScript(mainLib, "testGender");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
|
@ -136,8 +136,8 @@ TEST_CASE("Validate Pokemon Shininess in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testShiny");
|
auto data = GetScript(mainLib, "testShiny");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
|
@ -152,9 +152,9 @@ TEST_CASE("Validate Pokemon HeldItem in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testHeldItem");
|
auto data = GetScript(mainLib, "testHeldItem");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithHeldItem("testItem")
|
->WithHeldItem("testItem"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
|
@ -169,8 +169,8 @@ TEST_CASE("Validate Pokemon CurrentHealth in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testCurrentHealth");
|
auto data = GetScript(mainLib, "testCurrentHealth");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
|
@ -185,8 +185,8 @@ TEST_CASE("Validate Pokemon Nickname in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testNickname");
|
auto data = GetScript(mainLib, "testNickname");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
|
@ -202,8 +202,8 @@ TEST_CASE("Validate Pokemon Active Ability in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testActiveAbility");
|
auto data = GetScript(mainLib, "testActiveAbility");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
data.Context->SetArgObject(0, (void*)mon);
|
data.Context->SetArgObject(0, (void*)mon);
|
||||||
|
@ -219,8 +219,8 @@ TEST_CASE("Validate Pokemon IsFainted in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testIsFainted");
|
auto data = GetScript(mainLib, "testIsFainted");
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
|
@ -234,8 +234,8 @@ TEST_CASE("Validate Pokemon IsFainted in Script") {
|
||||||
TEST_CASE("Validate Pokemon GetTypes in Script") {
|
TEST_CASE("Validate Pokemon GetTypes in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
for (size_t i = 0; i < mon->GetTypes().size(); i++) {
|
for (size_t i = 0; i < mon->GetTypes().size(); i++) {
|
||||||
|
@ -254,8 +254,8 @@ TEST_CASE("Validate Pokemon GetTypes in Script") {
|
||||||
TEST_CASE("Validate Pokemon HasType in Script") {
|
TEST_CASE("Validate Pokemon HasType in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
for (size_t i = 0; i < mon->GetTypes().size(); i++) {
|
for (size_t i = 0; i < mon->GetTypes().size(); i++) {
|
||||||
|
@ -273,8 +273,8 @@ TEST_CASE("Validate Pokemon HasType in Script") {
|
||||||
TEST_CASE("Validate Pokemon Damage in Script") {
|
TEST_CASE("Validate Pokemon Damage in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
auto data = GetScript(mainLib, "testDamage");
|
auto data = GetScript(mainLib, "testDamage");
|
||||||
|
@ -292,8 +292,8 @@ TEST_CASE("Validate Pokemon Damage in Script") {
|
||||||
TEST_CASE("Validate Pokemon Heal in Script") {
|
TEST_CASE("Validate Pokemon Heal in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
->WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
->Build();
|
||||||
mon->Damage(50, CreatureLib::Battling::DamageSource::AttackDamage);
|
mon->Damage(50, CreatureLib::Battling::DamageSource::AttackDamage);
|
||||||
|
@ -311,10 +311,10 @@ TEST_CASE("Validate Pokemon Heal in Script") {
|
||||||
TEST_CASE("Validate Pokemon GetMoves in Script") {
|
TEST_CASE("Validate Pokemon GetMoves in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
|
|
||||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3", 30)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default")
|
.WithForme("default"_cnc)
|
||||||
->LearnMove("testMove", CreatureLib::Battling::AttackLearnMethod::Level)
|
->LearnMove("testMove"_cnc, CreatureLib::Battling::AttackLearnMethod::Level)
|
||||||
->LearnMove("testMove2", CreatureLib::Battling::AttackLearnMethod::Unknown)
|
->LearnMove("testMove2"_cnc, CreatureLib::Battling::AttackLearnMethod::Unknown)
|
||||||
->Build();
|
->Build();
|
||||||
|
|
||||||
for (size_t i = 0; i < mon->GetMoves().size(); i++) {
|
for (size_t i = 0; i < mon->GetMoves().size(); i++) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ TEST_CASE("Validate Forme Name in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testName");
|
auto data = GetScript(mainLib, "testName");
|
||||||
|
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
auto name = forme->GetName();
|
auto name = forme->GetName();
|
||||||
data.Context->SetArgAddress(1, &name);
|
data.Context->SetArgAddress(1, &name);
|
||||||
|
@ -73,7 +73,7 @@ TEST_CASE("Validate Forme Weight in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testWeight");
|
auto data = GetScript(mainLib, "testWeight");
|
||||||
|
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
data.Context->SetArgFloat(1, forme->GetWeight());
|
data.Context->SetArgFloat(1, forme->GetWeight());
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ TEST_CASE("Validate Forme Height in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testHeight");
|
auto data = GetScript(mainLib, "testHeight");
|
||||||
|
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
data.Context->SetArgFloat(1, forme->GetHeight());
|
data.Context->SetArgFloat(1, forme->GetHeight());
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ TEST_CASE("Validate Forme Base Experience in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testBaseExperience");
|
auto data = GetScript(mainLib, "testBaseExperience");
|
||||||
|
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
data.Context->SetArgDWord(1, forme->GetBaseExperience());
|
data.Context->SetArgDWord(1, forme->GetBaseExperience());
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ TEST_CASE("Validate Forme Type Count in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testTypeCount");
|
auto data = GetScript(mainLib, "testTypeCount");
|
||||||
|
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
data.Context->SetArgDWord(1, forme->GetTypeCount());
|
data.Context->SetArgDWord(1, forme->GetTypeCount());
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ TEST_CASE("Validate Forme GetType in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testGetType");
|
auto data = GetScript(mainLib, "testGetType");
|
||||||
|
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
data.Context->SetArgByte(1, forme->GetType(0));
|
data.Context->SetArgByte(1, forme->GetType(0));
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ TEST_CASE("Validate Forme GetStatistic in Script") {
|
||||||
auto stat = static_cast<CreatureLib::Core::Statistic>(statInt);
|
auto stat = static_cast<CreatureLib::Core::Statistic>(statInt);
|
||||||
|
|
||||||
auto data = GetScript(mainLib, "testGetStatistic");
|
auto data = GetScript(mainLib, "testGetStatistic");
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
data.Context->SetArgDWord(1, static_cast<asDWORD>(stat));
|
data.Context->SetArgDWord(1, static_cast<asDWORD>(stat));
|
||||||
data.Context->SetArgDWord(2, forme->GetStatistic(stat));
|
data.Context->SetArgDWord(2, forme->GetStatistic(stat));
|
||||||
|
@ -161,7 +161,7 @@ TEST_CASE("Validate Forme GetAbility in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
|
|
||||||
auto data = GetScript(mainLib, "testGetAbility");
|
auto data = GetScript(mainLib, "testGetAbility");
|
||||||
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2")->GetDefaultForme();
|
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonForme*>(forme));
|
||||||
auto ability = forme->GetAbility(0);
|
auto ability = forme->GetAbility(0);
|
||||||
data.Context->SetArgAddress(1, &ability);
|
data.Context->SetArgAddress(1, &ability);
|
||||||
|
|
|
@ -54,7 +54,7 @@ TEST_CASE("Validate Item Name in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testName");
|
auto data = GetScript(mainLib, "testName");
|
||||||
|
|
||||||
auto item = mainLib->GetItemLibrary()->Get("testItem");
|
auto item = mainLib->GetItemLibrary()->Get("testItem"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
||||||
auto name = item->GetName();
|
auto name = item->GetName();
|
||||||
data.Context->SetArgAddress(1, &name);
|
data.Context->SetArgAddress(1, &name);
|
||||||
|
@ -67,7 +67,7 @@ TEST_CASE("Validate Item Category in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testCategory");
|
auto data = GetScript(mainLib, "testCategory");
|
||||||
|
|
||||||
auto item = mainLib->GetItemLibrary()->Get("testItem");
|
auto item = mainLib->GetItemLibrary()->Get("testItem"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
||||||
data.Context->SetArgDWord(1, static_cast<int32_t >(item->GetCategory()));
|
data.Context->SetArgDWord(1, static_cast<int32_t >(item->GetCategory()));
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ TEST_CASE("Validate Item Battle Category in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testBattleCategory");
|
auto data = GetScript(mainLib, "testBattleCategory");
|
||||||
|
|
||||||
auto item = mainLib->GetItemLibrary()->Get("testItem");
|
auto item = mainLib->GetItemLibrary()->Get("testItem"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
||||||
data.Context->SetArgDWord(1, static_cast<int32_t >(item->GetBattleCategory()));
|
data.Context->SetArgDWord(1, static_cast<int32_t >(item->GetBattleCategory()));
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ TEST_CASE("Validate Item Price in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testPrice");
|
auto data = GetScript(mainLib, "testPrice");
|
||||||
|
|
||||||
auto item = mainLib->GetItemLibrary()->Get("testItem");
|
auto item = mainLib->GetItemLibrary()->Get("testItem"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::Item*>(item));
|
||||||
data.Context->SetArgDWord(1, static_cast<int32_t >(item->GetPrice()));
|
data.Context->SetArgDWord(1, static_cast<int32_t >(item->GetPrice()));
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ TEST_CASE("Validate Move Name in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testName");
|
auto data = GetScript(mainLib, "testName");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
data.Context->SetArgObject(0, (void*)move);
|
data.Context->SetArgObject(0, (void*)move);
|
||||||
auto name = move->GetName();
|
auto name = move->GetName();
|
||||||
data.Context->SetArgAddress(1, &name);
|
data.Context->SetArgAddress(1, &name);
|
||||||
|
@ -71,7 +71,7 @@ TEST_CASE("Validate Move Type in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testType");
|
auto data = GetScript(mainLib, "testType");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
||||||
data.Context->SetArgByte(1, move->GetType());
|
data.Context->SetArgByte(1, move->GetType());
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ TEST_CASE("Validate Move Category in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testCategory");
|
auto data = GetScript(mainLib, "testCategory");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
|
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
||||||
data.Context->SetArgDWord(1, (asDWORD)move->GetCategory());
|
data.Context->SetArgDWord(1, (asDWORD)move->GetCategory());
|
||||||
|
@ -98,7 +98,7 @@ TEST_CASE("Validate Move BasePower in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testBasePower");
|
auto data = GetScript(mainLib, "testBasePower");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
||||||
data.Context->SetArgByte(1, move->GetBasePower());
|
data.Context->SetArgByte(1, move->GetBasePower());
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ TEST_CASE("Validate Move Accuracy in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testAccuracy");
|
auto data = GetScript(mainLib, "testAccuracy");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
||||||
data.Context->SetArgByte(1, move->GetAccuracy());
|
data.Context->SetArgByte(1, move->GetAccuracy());
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ TEST_CASE("Validate Move BaseUsages in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testBaseUsages");
|
auto data = GetScript(mainLib, "testBaseUsages");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
||||||
data.Context->SetArgByte(1, move->GetBaseUsages());
|
data.Context->SetArgByte(1, move->GetBaseUsages());
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ TEST_CASE("Validate Move Target in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testTarget");
|
auto data = GetScript(mainLib, "testTarget");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
||||||
data.Context->SetArgDWord(1, (uint32_t)move->GetTarget());
|
data.Context->SetArgDWord(1, (uint32_t)move->GetTarget());
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ TEST_CASE("Validate Move Priority in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testPriority");
|
auto data = GetScript(mainLib, "testPriority");
|
||||||
|
|
||||||
auto move = mainLib->GetMoveLibrary()->Get("testMove");
|
auto move = mainLib->GetMoveLibrary()->Get("testMove"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::MoveData*>(move));
|
||||||
data.Context->SetArgByte(1, move->GetPriority());
|
data.Context->SetArgByte(1, move->GetPriority());
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ TEST_CASE("Validate Species Name in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testName");
|
auto data = GetScript(mainLib, "testName");
|
||||||
|
|
||||||
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2");
|
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc);
|
||||||
data.Context->SetArgObject(
|
data.Context->SetArgObject(
|
||||||
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
||||||
auto name = species->GetName();
|
auto name = species->GetName();
|
||||||
|
@ -72,7 +72,7 @@ TEST_CASE("Validate Species Id in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testId");
|
auto data = GetScript(mainLib, "testId");
|
||||||
|
|
||||||
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2");
|
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc);
|
||||||
data.Context->SetArgObject(
|
data.Context->SetArgObject(
|
||||||
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
||||||
data.Context->SetArgWord(1, species->GetId());
|
data.Context->SetArgWord(1, species->GetId());
|
||||||
|
@ -87,7 +87,7 @@ TEST_CASE("Validate Species Gender Rate in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testGenderRate");
|
auto data = GetScript(mainLib, "testGenderRate");
|
||||||
|
|
||||||
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2");
|
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc);
|
||||||
data.Context->SetArgObject(
|
data.Context->SetArgObject(
|
||||||
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
||||||
data.Context->SetArgFloat(1, species->GetGenderRate());
|
data.Context->SetArgFloat(1, species->GetGenderRate());
|
||||||
|
@ -102,7 +102,7 @@ TEST_CASE("Validate Species Capture Rate in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testCaptureRate");
|
auto data = GetScript(mainLib, "testCaptureRate");
|
||||||
|
|
||||||
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2");
|
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc);
|
||||||
data.Context->SetArgObject(
|
data.Context->SetArgObject(
|
||||||
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
||||||
data.Context->SetArgByte(1, species->GetCaptureRate());
|
data.Context->SetArgByte(1, species->GetCaptureRate());
|
||||||
|
@ -117,12 +117,15 @@ TEST_CASE("Validate Species Get Forme in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testGetForme");
|
auto data = GetScript(mainLib, "testGetForme");
|
||||||
|
|
||||||
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2");
|
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc);
|
||||||
data.Context->SetArgObject(
|
data.Context->SetArgObject(
|
||||||
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
||||||
data.Context->SetArgObject(1, const_cast<PkmnLib::Library::PokemonForme*>(species->GetForme("default")));
|
data.Context->SetArgObject(1, const_cast<PkmnLib::Library::PokemonForme*>(species->GetForme("default"_cnc)));
|
||||||
|
|
||||||
auto result = data.Context->Execute();
|
auto result = data.Context->Execute();
|
||||||
|
if (result == asEXECUTION_EXCEPTION){
|
||||||
|
FAIL(data.Context->GetExceptionString());
|
||||||
|
}
|
||||||
REQUIRE(result == asEXECUTION_FINISHED);
|
REQUIRE(result == asEXECUTION_FINISHED);
|
||||||
auto v = (bool)data.Context->GetReturnWord();
|
auto v = (bool)data.Context->GetReturnWord();
|
||||||
REQUIRE(v);
|
REQUIRE(v);
|
||||||
|
@ -132,7 +135,7 @@ TEST_CASE("Validate Species Get Default Forme in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testGetDefaultForme");
|
auto data = GetScript(mainLib, "testGetDefaultForme");
|
||||||
|
|
||||||
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2");
|
auto species = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc);
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Library::PokemonSpecies*>(species));
|
||||||
data.Context->SetArgObject(1, const_cast<PkmnLib::Library::PokemonForme*>(species->GetDefaultForme()));
|
data.Context->SetArgObject(1, const_cast<PkmnLib::Library::PokemonForme*>(species->GetDefaultForme()));
|
||||||
|
|
||||||
|
|
|
@ -1,56 +1,57 @@
|
||||||
#include "TestLibrary.hpp"
|
#include "TestLibrary.hpp"
|
||||||
|
#include <Arbutils/ConstString.hpp>
|
||||||
|
|
||||||
PkmnLib::Battling::BattleLibrary* TestLibrary::_library = nullptr;
|
PkmnLib::Battling::BattleLibrary* TestLibrary::_library = nullptr;
|
||||||
PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
||||||
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
||||||
lib->Insert("testSpecies",
|
lib->Insert("testSpecies"_cnc,
|
||||||
new PkmnLib::Library::PokemonSpecies(
|
new PkmnLib::Library::PokemonSpecies(
|
||||||
1, "testSpecies",
|
1, "testSpecies"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0},
|
"default", 1.0f, 1.0f, 100, {0},
|
||||||
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
||||||
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100));
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
||||||
lib->Insert("testSpecies2",
|
lib->Insert("testSpecies2"_cnc,
|
||||||
new PkmnLib::Library::PokemonSpecies(
|
new PkmnLib::Library::PokemonSpecies(
|
||||||
2, "testSpecies2",
|
2, "testSpecies2"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0},
|
"default", 1.0f, 1.0f, 100, {0},
|
||||||
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
||||||
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100));
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
||||||
lib->Insert("statTestSpecies1",
|
lib->Insert("statTestSpecies1"_cnc,
|
||||||
new PkmnLib::Library::PokemonSpecies(
|
new PkmnLib::Library::PokemonSpecies(
|
||||||
3, "statTestSpecies1",
|
3, "statTestSpecies1"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0},
|
"default", 1.0f, 1.0f, 100, {0},
|
||||||
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
||||||
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100));
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
||||||
lib->Insert("testSpecies3",
|
lib->Insert("testSpecies3"_cnc,
|
||||||
new PkmnLib::Library::PokemonSpecies(
|
new PkmnLib::Library::PokemonSpecies(
|
||||||
2, "testSpecies3",
|
2, "testSpecies3"_cnc,
|
||||||
new PkmnLib::Library::PokemonForme(
|
new PkmnLib::Library::PokemonForme(
|
||||||
"default", 1.0f, 1.0f, 100, {0, 4},
|
"default", 1.0f, 1.0f, 100, {0, 4},
|
||||||
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
||||||
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
||||||
0.5f, "testGrowthRate", 100, 100));
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
||||||
|
|
||||||
|
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
PkmnLib::Library::MoveLibrary* TestLibrary::BuildMoveLibrary() {
|
PkmnLib::Library::MoveLibrary* TestLibrary::BuildMoveLibrary() {
|
||||||
auto lib = new PkmnLib::Library::MoveLibrary();
|
auto lib = new PkmnLib::Library::MoveLibrary();
|
||||||
lib->Insert("testMove",
|
lib->Insert("testMove"_cnc,
|
||||||
new PkmnLib::Library::MoveData("testMove", 0, PkmnLib::Library::MoveCategory::Physical, 50, 100, 20,
|
new PkmnLib::Library::MoveData("testMove", 0, PkmnLib::Library::MoveCategory::Physical, 50, 100, 20,
|
||||||
CreatureLib::Library::AttackTarget::Adjacent, 0, {}));
|
CreatureLib::Library::AttackTarget::Adjacent, 0, {}));
|
||||||
lib->Insert("testMove2",
|
lib->Insert("testMove2"_cnc,
|
||||||
new PkmnLib::Library::MoveData("testMove2", 0, PkmnLib::Library::MoveCategory::Special, 30, 100, 10,
|
new PkmnLib::Library::MoveData("testMove2", 0, PkmnLib::Library::MoveCategory::Special, 30, 100, 10,
|
||||||
CreatureLib::Library::AttackTarget::Adjacent, 0, {}));
|
CreatureLib::Library::AttackTarget::Adjacent, 0, {}));
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
PkmnLib::Library::ItemLibrary* TestLibrary::BuildItemLibrary() {
|
PkmnLib::Library::ItemLibrary* TestLibrary::BuildItemLibrary() {
|
||||||
auto lib = new PkmnLib::Library::ItemLibrary();
|
auto lib = new PkmnLib::Library::ItemLibrary();
|
||||||
lib->Insert("testItem", new PkmnLib::Library::Item("testItem", CreatureLib::Library::ItemCategory::MiscItem,
|
lib->Insert("testItem"_cnc, new PkmnLib::Library::Item("testItem"_cnc, CreatureLib::Library::ItemCategory::MiscItem,
|
||||||
CreatureLib::Library::BattleItemCategory::None, 0, {}, 0));
|
CreatureLib::Library::BattleItemCategory::None, 0, {}, 0));
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
static CreatureLib::Library::GrowthRateLibrary* BuildGrowthRateLibrary() {
|
static CreatureLib::Library::GrowthRateLibrary* BuildGrowthRateLibrary() {
|
||||||
auto lib = new CreatureLib::Library::GrowthRateLibrary();
|
auto lib = new CreatureLib::Library::GrowthRateLibrary();
|
||||||
lib->AddGrowthRate("testGrowthRate", new CreatureLib::Library::LookupGrowthRate());
|
lib->AddGrowthRate("testGrowthRate"_cnc, new CreatureLib::Library::LookupGrowthRate());
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue