diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp index 206af98..2b92793 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp @@ -81,6 +81,11 @@ static CScriptHandle AddVolatileWrapper(PkmnLib::Battling::Pokemon* obj, const A return handle; } +static bool HasTypeStringWrapper(PkmnLib::Battling::Pokemon* p, const ArbUt::StringView& sv) { + auto typeId = p->GetLibrary()->GetTypeLibrary()->GetTypeId(sv); + return p->HasType(typeId); +} + static float GetEffectivenessHelper(CreatureLib::Library::TypeLibrary* typeLib, u8 attackingType, PkmnLib::Battling::Pokemon* pokemon) { return typeLib->GetEffectiveness(attackingType, pokemon->GetTypes()); @@ -152,6 +157,9 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) { r = engine->RegisterObjectMethod("Pokemon", "bool HasType(uint8 type) const", asMETHOD(PkmnLib::Battling::Pokemon, HasType), asCALL_THISCALL); Ensure(r >= 0); + r = engine->RegisterObjectMethod("Pokemon", "bool HasType(const constString& type) const", + asFUNCTION(HasTypeStringWrapper), asCALL_CDECL_OBJFIRST); + Ensure(r >= 0); r = engine->RegisterObjectMethod("Pokemon", "void Damage(uint32 type, DamageSource source)", asMETHOD(PkmnLib::Battling::Pokemon, Damage), asCALL_THISCALL); Ensure(r >= 0);