mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-09 00:48:04 +00:00
format codebase
This commit is contained in:
@@ -9,8 +9,7 @@
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
|
||||
void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch)
|
||||
{
|
||||
void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
if (this->m_stunCaster || branch.target == context->originator) {
|
||||
return;
|
||||
}
|
||||
@@ -20,8 +19,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (target == nullptr)
|
||||
{
|
||||
if (target == nullptr) {
|
||||
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target);
|
||||
|
||||
return;
|
||||
@@ -33,22 +31,18 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI));
|
||||
|
||||
if (combatAiComponent == nullptr)
|
||||
{
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
combatAiComponent->Stun(branch.duration);
|
||||
}
|
||||
|
||||
void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch)
|
||||
{
|
||||
if (this->m_stunCaster || branch.target == context->originator)
|
||||
{
|
||||
void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
if (this->m_stunCaster || branch.target == context->originator) {
|
||||
auto* self = EntityManager::Instance()->GetEntity(context->originator);
|
||||
|
||||
if (self == nullptr)
|
||||
{
|
||||
if (self == nullptr) {
|
||||
Game::logger->Log("StunBehavior", "Invalid self entity (%llu)!", context->originator);
|
||||
|
||||
return;
|
||||
@@ -60,8 +54,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(self->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI));
|
||||
|
||||
if (combatAiComponent == nullptr)
|
||||
{
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,20 +67,17 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (target != nullptr)
|
||||
{
|
||||
if (target != nullptr) {
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr)
|
||||
{
|
||||
if (destroyableComponent != nullptr) {
|
||||
blocked = destroyableComponent->IsKnockbackImmune();
|
||||
}
|
||||
}
|
||||
|
||||
bitStream->Write(blocked);
|
||||
|
||||
if (target == nullptr)
|
||||
{
|
||||
if (target == nullptr) {
|
||||
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target);
|
||||
|
||||
return;
|
||||
@@ -99,15 +89,13 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI));
|
||||
|
||||
if (combatAiComponent == nullptr)
|
||||
{
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
combatAiComponent->Stun(branch.duration);
|
||||
}
|
||||
|
||||
void StunBehavior::Load()
|
||||
{
|
||||
void StunBehavior::Load() {
|
||||
this->m_stunCaster = GetBoolean("stun_caster");
|
||||
}
|
||||
|
Reference in New Issue
Block a user