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
|
#ifndef CREATURELIB_SCRIPT_HPP
|
||||||
#define CREATURELIB_SCRIPT_HPP
|
#define CREATURELIB_SCRIPT_HPP
|
||||||
|
|
||||||
|
#include <Arbutils/Collections/List.hpp>
|
||||||
#include <Arbutils/ConstString.hpp>
|
#include <Arbutils/ConstString.hpp>
|
||||||
#include <any>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -25,6 +25,7 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
virtual const ConstString& GetName() const noexcept = 0;
|
virtual const ConstString& GetName() const noexcept = 0;
|
||||||
|
|
||||||
|
virtual void OnInitialize(const Arbutils::Collections::List<void*>& parameters){};
|
||||||
virtual void OnBeforeTurn(const BaseTurnChoice* choice){};
|
virtual void OnBeforeTurn(const BaseTurnChoice* choice){};
|
||||||
|
|
||||||
virtual void ChangeAttack(AttackTurnChoice* choice, ConstString* outAttack){};
|
virtual void ChangeAttack(AttackTurnChoice* choice, ConstString* outAttack){};
|
||||||
|
|
|
@ -23,8 +23,11 @@ namespace CreatureLib::Battling {
|
||||||
if (battle != nullptr) {
|
if (battle != nullptr) {
|
||||||
if (_attack->GetAttack()->HasSecondaryEffect()) {
|
if (_attack->GetAttack()->HasSecondaryEffect()) {
|
||||||
auto library = battle->GetLibrary();
|
auto library = battle->GetLibrary();
|
||||||
_attackScript = library->LoadScript(ScriptCategory::Attack,
|
auto& effect = _attack->GetAttack()->GetSecondaryEffect();
|
||||||
_attack->GetAttack()->GetSecondaryEffect().GetEffectName());
|
_attackScript = library->LoadScript(ScriptCategory::Attack, effect.GetEffectName());
|
||||||
|
if (_attackScript != nullptr) {
|
||||||
|
_attackScript->OnInitialize(effect.GetParameters());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue