Battle C Interface.
This commit is contained in:
@@ -1 +1,15 @@
|
||||
#include "Battle.hpp"
|
||||
void PkmnLib::Battling::Battle::SetWeather(const Arbutils::CaseInsensitiveConstString& name) {
|
||||
if (_weatherScript != nullptr) {
|
||||
_weatherScript->OnRemove();
|
||||
delete _weatherScript;
|
||||
}
|
||||
_weatherScript = _library->LoadScript(static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name);
|
||||
_eventHook.TriggerEvent(new WeatherChangeEvent(name));
|
||||
}
|
||||
void PkmnLib::Battling::Battle::ClearWeather() {
|
||||
_weatherScript->OnRemove();
|
||||
delete _weatherScript;
|
||||
_weatherScript = nullptr;
|
||||
_eventHook.TriggerEvent(new WeatherChangeEvent(""_cnc));
|
||||
}
|
||||
|
||||
@@ -16,20 +16,8 @@ namespace PkmnLib::Battling {
|
||||
bool canFlee = true, uint8_t numberOfSides = 2, uint8_t creaturesPerSide = 1)
|
||||
: CreatureLib::Battling::Battle(library, parties, canFlee, numberOfSides, creaturesPerSide) {}
|
||||
|
||||
void SetWeather(const Arbutils::CaseInsensitiveConstString& name) {
|
||||
if (_weatherScript != nullptr) {
|
||||
_weatherScript->OnRemove();
|
||||
delete _weatherScript;
|
||||
}
|
||||
_weatherScript = _library->LoadScript(static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name);
|
||||
_eventHook.TriggerEvent(new WeatherChangeEvent(name));
|
||||
}
|
||||
void ClearWeather() {
|
||||
_weatherScript->OnRemove();
|
||||
delete _weatherScript;
|
||||
_weatherScript = nullptr;
|
||||
_eventHook.TriggerEvent(new WeatherChangeEvent(""_cnc));
|
||||
}
|
||||
void SetWeather(const Arbutils::CaseInsensitiveConstString& name);
|
||||
void ClearWeather();
|
||||
const Arbutils::CaseInsensitiveConstString& GetWeatherName() noexcept { return _weatherScript->GetName(); }
|
||||
|
||||
size_t ScriptCount() const override { return CreatureLib::Battling::Battle::ScriptCount() + 1; }
|
||||
|
||||
Reference in New Issue
Block a user