2020-02-16 16:50:16 +00:00
|
|
|
#ifndef PKMNLIB_BATTLE_HPP
|
|
|
|
#define PKMNLIB_BATTLE_HPP
|
|
|
|
|
|
|
|
#include <CreatureLib/Battling/Models/Battle.hpp>
|
|
|
|
#include "../Library/BattleLibrary.hpp"
|
2020-04-18 13:35:01 +00:00
|
|
|
#include "../PkmnScriptCategory.hpp"
|
2020-02-16 16:50:16 +00:00
|
|
|
|
|
|
|
namespace PkmnLib::Battling {
|
2020-02-17 15:56:44 +00:00
|
|
|
class Battle : public CreatureLib::Battling::Battle {
|
2020-04-18 13:35:01 +00:00
|
|
|
private:
|
|
|
|
CreatureLib::Battling::Script* _weatherScript = nullptr;
|
|
|
|
|
2020-02-16 16:50:16 +00:00
|
|
|
public:
|
2020-04-06 18:03:44 +00:00
|
|
|
Battle(const BattleLibrary* library, const List<CreatureLib::Battling::BattleParty*>& parties,
|
2020-02-16 16:50:16 +00:00
|
|
|
bool canFlee = true, uint8_t numberOfSides = 2, uint8_t creaturesPerSide = 1)
|
|
|
|
: CreatureLib::Battling::Battle(library, parties, canFlee, numberOfSides, creaturesPerSide) {}
|
2020-04-18 13:35:01 +00:00
|
|
|
|
|
|
|
void SetWeather(const Arbutils::CaseInsensitiveConstString& name) {
|
|
|
|
if (_weatherScript != nullptr) {
|
|
|
|
_weatherScript->OnRemove();
|
|
|
|
delete _weatherScript;
|
|
|
|
}
|
|
|
|
_weatherScript = _library->LoadScript(static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name);
|
|
|
|
}
|
|
|
|
void ClearWeather() {
|
|
|
|
_weatherScript->OnRemove();
|
|
|
|
delete _weatherScript;
|
|
|
|
_weatherScript = nullptr;
|
|
|
|
}
|
|
|
|
const Arbutils::CaseInsensitiveConstString& GetWeatherName() noexcept { return _weatherScript->GetName(); }
|
|
|
|
|
|
|
|
void GetActiveScripts(List<CreatureLib::Battling::ScriptWrapper>& scripts) override {
|
|
|
|
CreatureLib::Battling::Battle::GetActiveScripts(scripts);
|
|
|
|
scripts.Append(CreatureLib::Battling::ScriptWrapper(&_weatherScript));
|
|
|
|
}
|
2020-02-16 16:50:16 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PKMNLIB_BATTLE_HPP
|