DarkflameServer/dGame/dBehaviors/SkillEventBehavior.cpp

26 lines
1.1 KiB
C++
Raw Normal View History

#include "SkillEventBehavior.h"
#include "BehaviorBranchContext.h"
#include "BehaviorContext.h"
#include "EntityManager.h"
#include "CppScripts.h"
2024-03-07 01:49:29 +00:00
#include "Entity.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);
2022-07-28 13:39:57 +00:00
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
2024-03-07 01:49:29 +00:00
target->GetScript()->OnSkillEventFired(target, caster, *this->m_effectHandle);
2022-07-28 13:39:57 +00:00
}
}
void
SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
auto* target = Game::entityManager->GetEntity(branch.target);
auto* caster = Game::entityManager->GetEntity(context->originator);
2022-07-28 13:39:57 +00:00
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
2024-03-07 01:49:29 +00:00
target->GetScript()->OnSkillEventFired(target, caster, *this->m_effectHandle);
2022-07-28 13:39:57 +00:00
}
}