#ifndef PKMNLIB_BATTLE_HPP #define PKMNLIB_BATTLE_HPP #include #include "../Library/BattleLibrary.hpp" #include "../PkmnScriptCategory.hpp" namespace PkmnLib::Battling { class Battle : public CreatureLib::Battling::Battle { private: CreatureLib::Battling::Script* _weatherScript = nullptr; public: Battle(const BattleLibrary* library, const List& parties, 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(PkmnScriptCategory::Weather), name); } void ClearWeather() { _weatherScript->OnRemove(); delete _weatherScript; _weatherScript = nullptr; } const Arbutils::CaseInsensitiveConstString& GetWeatherName() noexcept { return _weatherScript->GetName(); } void GetActiveScripts(List& scripts) override { CreatureLib::Battling::Battle::GetActiveScripts(scripts); scripts.Append(CreatureLib::Battling::ScriptWrapper(&_weatherScript)); } }; } #endif // PKMNLIB_BATTLE_HPP