A bunch of work on the concept of script owners.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2021-10-29 23:54:44 +02:00
parent 0623bdff06
commit ede314ef39
19 changed files with 110 additions and 32 deletions

View File

@@ -4,7 +4,7 @@ void PkmnLib::Battling::Battle::SetWeather(const ArbUt::StringView& name) {
_weatherScript->OnRemove();
}
_weatherScript = std::unique_ptr<CreatureLib::Battling::BattleScript>(
_library->LoadScript(static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name));
_library->LoadScript(this, static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name));
_eventHook.Trigger<WeatherChangeEvent>(name);
}
void PkmnLib::Battling::Battle::ClearWeather() {
@@ -57,9 +57,9 @@ PkmnLib::Battling::Battle* PkmnLib::Battling::Battle::Clone() const {
battle->_hasEnded = _hasEnded;
battle->_battleResult = _battleResult;
battle->_currentTurn = _currentTurn;
_volatile.Clone(battle->_volatile);
_volatile.Clone(battle, battle->_volatile);
if (_weatherScript != nullptr) {
battle->_weatherScript = std::unique_ptr<CreatureLib::Battling::BattleScript>(_weatherScript->Clone());
battle->_weatherScript = std::unique_ptr<CreatureLib::Battling::BattleScript>(_weatherScript->Clone(battle));
}
return battle;