Support for (un)suppressing weather, adds hook to block weather changes.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user