Large cleanup of type registration, added new "NativeArray" (or narray in angelscript) type that simply holds a pointer to a native list, to prevent copies we don't need
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -38,15 +38,15 @@ bool PkmnLib::Battling::MiscLibrary::CanEvolveFromLevelUp(
|
||||
auto time = GetTime();
|
||||
switch (evolution->GetMethod()) {
|
||||
|
||||
case Library::EvolutionMethod::Level: return pokemon->GetLevel() >= evolution->GetData(0)->AsInt();
|
||||
case Library::EvolutionMethod::Level: return pokemon->GetLevel() >= evolution->GetDataAt(0)->AsInt();
|
||||
case Library::EvolutionMethod::HighFriendship:
|
||||
return pokemon->GetFriendship() >= evolution->GetData(0)->AsInt();
|
||||
return pokemon->GetFriendship() >= evolution->GetDataAt(0)->AsInt();
|
||||
case Library::EvolutionMethod::HighFriendshipTime:
|
||||
return pokemon->GetFriendship() >= evolution->GetData(0)->AsInt() &&
|
||||
time >= (TimeOfDay)evolution->GetData(1)->AsInt() &&
|
||||
time <= (TimeOfDay)evolution->GetData(2)->AsInt();
|
||||
return pokemon->GetFriendship() >= evolution->GetDataAt(0)->AsInt() &&
|
||||
time >= (TimeOfDay)evolution->GetDataAt(1)->AsInt() &&
|
||||
time <= (TimeOfDay)evolution->GetDataAt(2)->AsInt();
|
||||
case Library::EvolutionMethod::KnownMove: {
|
||||
auto v = evolution->GetData(0)->AsString();
|
||||
auto v = evolution->GetDataAt(0)->AsString();
|
||||
return std::any_of(pokemon->GetMoves().begin(), pokemon->GetMoves().end(), [v](const auto& move) {
|
||||
return move.HasValue() && move.GetValue()->GetMoveData()->GetName() == v;
|
||||
});
|
||||
@@ -55,19 +55,19 @@ bool PkmnLib::Battling::MiscLibrary::CanEvolveFromLevelUp(
|
||||
// TODO: Implement this
|
||||
return false;
|
||||
case Library::EvolutionMethod::TimeBased:
|
||||
return time >= (TimeOfDay)evolution->GetData(0)->AsInt() &&
|
||||
time <= (TimeOfDay)evolution->GetData(1)->AsInt();
|
||||
case Library::EvolutionMethod::HoldsItem: return pokemon->HasHeldItem(evolution->GetData(0)->AsString());
|
||||
return time >= (TimeOfDay)evolution->GetDataAt(0)->AsInt() &&
|
||||
time <= (TimeOfDay)evolution->GetDataAt(1)->AsInt();
|
||||
case Library::EvolutionMethod::HoldsItem: return pokemon->HasHeldItem(evolution->GetDataAt(0)->AsString());
|
||||
case Library::EvolutionMethod::HoldsItemTime:
|
||||
return pokemon->HasHeldItem(evolution->GetData(0)->AsString()) &&
|
||||
time >= (TimeOfDay)evolution->GetData(0)->AsInt() &&
|
||||
time <= (TimeOfDay)evolution->GetData(1)->AsInt();
|
||||
return pokemon->HasHeldItem(evolution->GetDataAt(0)->AsString()) &&
|
||||
time >= (TimeOfDay)evolution->GetDataAt(0)->AsInt() &&
|
||||
time <= (TimeOfDay)evolution->GetDataAt(1)->AsInt();
|
||||
case Library::EvolutionMethod::IsGenderAndLevel:
|
||||
return pokemon->GetLevel() >= evolution->GetData(1)->AsInt() &&
|
||||
pokemon->GetGender() == (CreatureLib::Library::Gender)evolution->GetData(0)->AsInt();
|
||||
return pokemon->GetLevel() >= evolution->GetDataAt(1)->AsInt() &&
|
||||
pokemon->GetGender() == (CreatureLib::Library::Gender)evolution->GetDataAt(0)->AsInt();
|
||||
case Library::EvolutionMethod::Custom: {
|
||||
auto script = dynamic_cast<ScriptResolver*>(pokemon->GetLibrary()->GetScriptResolver().get())
|
||||
->LoadEvolutionScript(evolution->GetData(0)->AsString());
|
||||
->LoadEvolutionScript(evolution->GetDataAt(0)->AsString());
|
||||
if (!script.HasValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user