DarkflameServer/dScripts/EquipmentScripts/PersonalFortress.cpp

51 lines
1.4 KiB
C++
Raw Permalink Normal View History

#include "PersonalFortress.h"
#include "GameMessages.h"
#include "SkillComponent.h"
#include "DestroyableComponent.h"
#include "EntityManager.h"
2022-07-28 13:39:57 +00:00
void PersonalFortress::OnStartup(Entity* self) {
auto* owner = self->GetOwner();
self->AddTimer("FireSkill", 1.5);
GameMessages::SendSetStunned(owner->GetObjectID(), PUSH, owner->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true, true, true
);
auto* destroyableComponent = owner->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->PushImmunity();
}
EntityManager::Instance()->SerializeEntity(owner);
}
2022-07-28 13:39:57 +00:00
void PersonalFortress::OnDie(Entity* self, Entity* killer) {
auto* owner = self->GetOwner();
GameMessages::SendSetStunned(owner->GetObjectID(), POP, owner->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true, true, true
);
2022-07-28 13:39:57 +00:00
auto* destroyableComponent = owner->GetComponent<DestroyableComponent>();
2022-07-28 13:39:57 +00:00
if (destroyableComponent != nullptr) {
destroyableComponent->PopImmunity();
}
2022-07-28 13:39:57 +00:00
EntityManager::Instance()->SerializeEntity(owner);
}
2022-07-28 13:39:57 +00:00
void PersonalFortress::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "FireSkill") {
auto* owner = self->GetOwner();
2022-07-28 13:39:57 +00:00
auto* skillComponent = self->GetComponent<SkillComponent>();
2022-07-28 13:39:57 +00:00
if (skillComponent == nullptr) {
return;
}
2022-07-28 13:39:57 +00:00
skillComponent->CalculateBehavior(650, 13364, LWOOBJID_EMPTY, true, false);
}
}