Updates needed for breaking change in how abilities work.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-11-15 12:47:02 +01:00
parent 46538092bf
commit 545e321018
14 changed files with 71 additions and 221 deletions

View File

@@ -66,6 +66,10 @@ static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) {
return std::string(obj->GetNickname().value());
}
static const ArbUt::StringView& GetActiveAbilityWrapper(PkmnLib::Battling::Pokemon* p) {
return p->GetActiveTalent()->GetName();
}
static CScriptHandle AddVolatileWrapper(PkmnLib::Battling::Pokemon* obj, const ArbUt::StringView& name) {
auto handle = CScriptHandle();
auto* resolver = static_cast<AngelScriptResolver*>(obj->GetLibrary()->GetScriptResolver().get());
@@ -90,8 +94,6 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
GetHeldItem);
REGISTER_GETTER("Pokemon", "uint32 get_CurrentHealth() const property", CreatureLib::Battling::Creature,
GetCurrentHealth);
REGISTER_GETTER("Pokemon", "const constString& get_ActiveAbility() const property", CreatureLib::Battling::Creature,
GetActiveTalent);
REGISTER_GETTER("Pokemon", "bool get_IsFainted() const property", CreatureLib::Battling::Creature, IsFainted);
REGISTER_GETTER("Pokemon", "uint32 get_MaxHealth() const property", CreatureLib::Battling::Creature, GetMaxHealth);
REGISTER_GETTER("Pokemon", "const Species@ get_DisplaySpecies() const property", CreatureLib::Battling::Creature,
@@ -111,6 +113,10 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
auto r = engine->RegisterObjectMethod("Pokemon", "void set_Weight(float value) property",
asMETHOD(PkmnLib::Battling::Pokemon, SetWeight), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const constString& get_ActiveAbility() const property",
asFUNCTION(GetActiveAbilityWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "void set_Height(float value) property",
asMETHOD(PkmnLib::Battling::Pokemon, SetHeight), asCALL_THISCALL);
Ensure(r >= 0);

View File

@@ -63,7 +63,7 @@ void RegisterSpeciesTypes::RegisterSpeciesType(asIScriptEngine* engine) {
}
const ArbUt::StringView& GetAbility(PkmnLib::Library::PokemonForme* p, bool hidden, uint8_t index) {
return p->GetAbility(CreatureLib::Library::TalentIndex(hidden, index));
return p->GetAbility(CreatureLib::Library::TalentIndex(hidden, index))->GetName();
}
void RegisterSpeciesTypes::RegisterFormeType(asIScriptEngine* engine) {