Support for (un)suppressing weather, adds hook to block weather changes.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-11-19 14:56:29 +01:00
parent ea3bc7ee33
commit b2accd720e
5 changed files with 33 additions and 4 deletions

View File

@@ -1,11 +1,18 @@
#include "Battle.hpp"
void PkmnLib::Battling::Battle::SetWeather(const ArbUt::StringView& name) {
#include "../PkmnScriptHook.hpp"
bool PkmnLib::Battling::Battle::SetWeather(const ArbUt::StringView& name) {
bool blockWeather = false;
PKMN_HOOK(BlockWeather, this, this, &blockWeather);
if (blockWeather) {
return false;
}
if (_weatherScript != nullptr) {
_weatherScript->OnRemove();
}
_weatherScript = std::unique_ptr<CreatureLib::Battling::BattleScript>(
_library->LoadScript(this, static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name));
_eventHook.Trigger<WeatherChangeEvent>(name);
return true;
}
void PkmnLib::Battling::Battle::ClearWeather() {
if (_weatherScript == nullptr)