DarkflameServer/dGame/dBehaviors/RemoveBuffBehavior.cpp
David Markowitz 3939f19b08
Add Remove Buff Behavior and patch infinite use Imagination Backpack()
Testing does not reveal any issues with existing buff removals sending this GM as well and may fix more bugs that were unknown, or cause more.
2022-11-27 16:40:14 -08:00

22 lines
654 B
C++

#include "RemoveBuffBehavior.h"
#include "BehaviorBranchContext.h"
#include "BehaviorContext.h"
#include "EntityManager.h"
#include "BuffComponent.h"
void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(context->caster);
if (!entity) return;
auto* buffComponent = entity->GetComponent<BuffComponent>();
if (!buffComponent) return;
buffComponent->RemoveBuff(m_BuffId, false, m_RemoveImmunity);
}
void RemoveBuffBehavior::Load() {
this->m_RemoveImmunity = GetBoolean("remove_immunity");
this->m_BuffId = GetInt("buff_id");
}