2021-12-05 17:54:36 +00:00
|
|
|
#include "TauntBehavior.h"
|
|
|
|
#include "BehaviorBranchContext.h"
|
|
|
|
#include "BehaviorContext.h"
|
|
|
|
#include "BaseCombatAIComponent.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "dLogger.h"
|
|
|
|
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (target == nullptr) {
|
2022-07-25 02:26:51 +00:00
|
|
|
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-06-09 08:27:05 +00:00
|
|
|
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (combatComponent != nullptr) {
|
2021-12-05 17:54:36 +00:00
|
|
|
combatComponent->Taunt(context->originator, m_threatToAdd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (target == nullptr) {
|
2022-07-25 02:26:51 +00:00
|
|
|
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-06-09 08:27:05 +00:00
|
|
|
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (combatComponent != nullptr) {
|
2021-12-05 17:54:36 +00:00
|
|
|
combatComponent->Taunt(context->originator, m_threatToAdd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void TauntBehavior::Load() {
|
2021-12-05 17:54:36 +00:00
|
|
|
this->m_threatToAdd = GetFloat("threat to add");
|
|
|
|
}
|
|
|
|
|