Fixes for new CreatureLib.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ca53676b6d
commit
77eae12326
|
@ -150,7 +150,7 @@ namespace PkmnLib::Battling {
|
||||||
if (!_library->GetMoveLibrary()->TryGet(moveName, move)) {
|
if (!_library->GetMoveLibrary()->TryGet(moveName, move)) {
|
||||||
THROW_CREATURE("Invalid Move given: " << moveName.std_str());
|
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.");
|
throw CreatureException("This pokemon already has the maximal allowed moves.");
|
||||||
}
|
}
|
||||||
Assert(move != nullptr);
|
Assert(move != nullptr);
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace PkmnLib::Battling {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CreatePokemon(const BattleLibrary* library, const ArbUt::StringView& species, uint8_t level)
|
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);
|
CreatePokemon& WithForme(const ArbUt::StringView& forme);
|
||||||
|
|
|
@ -14,7 +14,7 @@ void RegisterStaticLibraryTypes::RegisterLibrarySettingsType(asIScriptEngine* en
|
||||||
asMETHOD(PkmnLib::Library::LibrarySettings, GetMaximalLevel), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::LibrarySettings, GetMaximalLevel), asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("LibrarySettings", "uint8 get_MaximalMoves() const property",
|
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);
|
assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("LibrarySettings", "uint16 get_ShinyRate() const property",
|
r = engine->RegisterObjectMethod("LibrarySettings", "uint16 get_ShinyRate() const property",
|
||||||
asMETHOD(PkmnLib::Library::LibrarySettings, GetShinyRate), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::LibrarySettings, GetShinyRate), asCALL_THISCALL);
|
||||||
|
|
|
@ -74,7 +74,7 @@ TEST_CASE("Validate StaticLibrary Maximum Moves in Script") {
|
||||||
auto data = GetScript(mainLib, "testMaximumMoves"_cnc);
|
auto data = GetScript(mainLib, "testMaximumMoves"_cnc);
|
||||||
|
|
||||||
data.Context->SetArgObject(0, (void*)mainLib->GetStaticLib().get());
|
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();
|
auto result = data.Context->Execute();
|
||||||
REQUIRE(result == asEXECUTION_FINISHED);
|
REQUIRE(result == asEXECUTION_FINISHED);
|
||||||
|
|
Loading…
Reference in New Issue