Initialize script with move effect parameters.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
49e0f00237
commit
1537a5f316
|
@ -1,8 +1,8 @@
|
|||
#ifndef CREATURELIB_SCRIPT_HPP
|
||||
#define CREATURELIB_SCRIPT_HPP
|
||||
|
||||
#include <Arbutils/Collections/List.hpp>
|
||||
#include <Arbutils/ConstString.hpp>
|
||||
#include <any>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -25,6 +25,7 @@ namespace CreatureLib::Battling {
|
|||
|
||||
virtual const ConstString& GetName() const noexcept = 0;
|
||||
|
||||
virtual void OnInitialize(const Arbutils::Collections::List<void*>& parameters){};
|
||||
virtual void OnBeforeTurn(const BaseTurnChoice* choice){};
|
||||
|
||||
virtual void ChangeAttack(AttackTurnChoice* choice, ConstString* outAttack){};
|
||||
|
|
|
@ -23,8 +23,11 @@ namespace CreatureLib::Battling {
|
|||
if (battle != nullptr) {
|
||||
if (_attack->GetAttack()->HasSecondaryEffect()) {
|
||||
auto library = battle->GetLibrary();
|
||||
_attackScript = library->LoadScript(ScriptCategory::Attack,
|
||||
_attack->GetAttack()->GetSecondaryEffect().GetEffectName());
|
||||
auto& effect = _attack->GetAttack()->GetSecondaryEffect();
|
||||
_attackScript = library->LoadScript(ScriptCategory::Attack, effect.GetEffectName());
|
||||
if (_attackScript != nullptr) {
|
||||
_attackScript->OnInitialize(effect.GetParameters());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue