mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 13:37:22 +00:00
b261e63233
* chore: Change entity and component logic to use bitstream references * merge
29 lines
1.2 KiB
C++
29 lines
1.2 KiB
C++
#include "SkillEventBehavior.h"
|
|
#include "BehaviorBranchContext.h"
|
|
#include "BehaviorContext.h"
|
|
#include "EntityManager.h"
|
|
#include "CppScripts.h"
|
|
|
|
void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
|
auto* caster = Game::entityManager->GetEntity(context->originator);
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
|
auto* caster = Game::entityManager->GetEntity(context->originator);
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|