Fixes for new CreatureLib.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-12 18:09:24 +02:00
parent ca53676b6d
commit 77eae12326
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 4 additions and 4 deletions

View File

@ -150,7 +150,7 @@ namespace PkmnLib::Battling {
if (!_library->GetMoveLibrary()->TryGet(moveName, move)) {
THROW_CREATURE("Invalid Move given: " << moveName.std_str());
}
if (_currentMove >= _library->GetSettings()->GetMaximalMoves()) {
if (_currentMove >= _library->GetSettings()->GetMaximalAttacks()) {
throw CreatureException("This pokemon already has the maximal allowed moves.");
}
Assert(move != nullptr);

View File

@ -49,7 +49,7 @@ namespace PkmnLib::Battling {
public:
CreatePokemon(const BattleLibrary* library, const ArbUt::StringView& species, uint8_t level)
: _library(library), _species(species), _level(level), _attacks(library->GetSettings()->GetMaximalMoves()) {
: _library(library), _species(species), _level(level), _attacks(library->GetSettings()->GetMaximalAttacks()) {
}
CreatePokemon& WithForme(const ArbUt::StringView& forme);

View File

@ -14,7 +14,7 @@ void RegisterStaticLibraryTypes::RegisterLibrarySettingsType(asIScriptEngine* en
asMETHOD(PkmnLib::Library::LibrarySettings, GetMaximalLevel), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("LibrarySettings", "uint8 get_MaximalMoves() const property",
asMETHOD(PkmnLib::Library::LibrarySettings, GetMaximalMoves), asCALL_THISCALL);
asMETHOD(PkmnLib::Library::LibrarySettings, GetMaximalAttacks), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("LibrarySettings", "uint16 get_ShinyRate() const property",
asMETHOD(PkmnLib::Library::LibrarySettings, GetShinyRate), asCALL_THISCALL);

View File

@ -74,7 +74,7 @@ TEST_CASE("Validate StaticLibrary Maximum Moves in Script") {
auto data = GetScript(mainLib, "testMaximumMoves"_cnc);
data.Context->SetArgObject(0, (void*)mainLib->GetStaticLib().get());
data.Context->SetArgByte(1, mainLib->GetStaticLib()->GetSettings()->GetMaximalMoves());
data.Context->SetArgByte(1, mainLib->GetStaticLib()->GetSettings()->GetMaximalAttacks());
auto result = data.Context->Execute();
REQUIRE(result == asEXECUTION_FINISHED);