2021-12-05 17:54:36 +00:00
|
|
|
#include "SkillEventBehavior.h"
|
|
|
|
#include "BehaviorBranchContext.h"
|
|
|
|
#include "BehaviorContext.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "CppScripts.h"
|
|
|
|
|
2024-02-27 07:25:44 +00:00
|
|
|
void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
|
|
|
auto* caster = Game::entityManager->GetEntity(context->originator);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
|
|
|
|
for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) {
|
|
|
|
script->OnSkillEventFired(target, caster, *this->m_effectHandle);
|
|
|
|
}
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2024-02-27 07:25:44 +00:00
|
|
|
SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
|
|
|
auto* caster = Game::entityManager->GetEntity(context->originator);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
|
|
|
|
for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) {
|
|
|
|
script->OnSkillEventFired(target, caster, *this->m_effectHandle);
|
|
|
|
}
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|