2021-12-05 17:54:36 +00:00
|
|
|
#include "PersonalFortress.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "SkillComponent.h"
|
|
|
|
#include "DestroyableComponent.h"
|
2023-01-07 05:59:19 +00:00
|
|
|
#include "ControllablePhysicsComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "EntityManager.h"
|
2023-05-02 22:39:21 +00:00
|
|
|
#include "eStateChangeType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void PersonalFortress::OnStartup(Entity* self) {
|
|
|
|
auto* owner = self->GetOwner();
|
|
|
|
self->AddTimer("FireSkill", 1.5);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-06-07 07:23:50 +00:00
|
|
|
auto destroyableComponent = owner->GetComponent<DestroyableComponent>();
|
2023-01-07 05:59:19 +00:00
|
|
|
if (destroyableComponent) destroyableComponent->SetStatusImmunity(
|
|
|
|
eStateChangeType::PUSH,
|
|
|
|
true, true, true, true, true, false, true, false, false
|
|
|
|
);
|
|
|
|
|
2023-06-07 07:23:50 +00:00
|
|
|
auto controllablePhysicsComponent = owner->GetComponent<ControllablePhysicsComponent>();
|
2023-01-07 05:59:19 +00:00
|
|
|
if (controllablePhysicsComponent) controllablePhysicsComponent->SetStunImmunity(
|
|
|
|
eStateChangeType::PUSH, LWOOBJID_EMPTY,
|
|
|
|
true, true, true, true, true, true
|
|
|
|
);
|
|
|
|
|
|
|
|
GameMessages::SendSetStunned(owner->GetObjectID(), eStateChangeType::PUSH, owner->GetSystemAddress(), LWOOBJID_EMPTY,
|
|
|
|
true, true, true, true, true, true, true, true, true
|
|
|
|
);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
EntityManager::Instance()->SerializeEntity(owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PersonalFortress::OnDie(Entity* self, Entity* killer) {
|
|
|
|
auto* owner = self->GetOwner();
|
2023-06-07 07:23:50 +00:00
|
|
|
auto destroyableComponent = owner->GetComponent<DestroyableComponent>();
|
2023-01-07 05:59:19 +00:00
|
|
|
if (destroyableComponent) destroyableComponent->SetStatusImmunity(
|
|
|
|
eStateChangeType::POP,
|
|
|
|
true, true, true, true, true, false, true, false, false
|
|
|
|
);
|
|
|
|
|
2023-06-07 07:23:50 +00:00
|
|
|
auto controllablePhysicsComponent = owner->GetComponent<ControllablePhysicsComponent>();
|
2023-01-07 05:59:19 +00:00
|
|
|
if (controllablePhysicsComponent) controllablePhysicsComponent->SetStunImmunity(
|
|
|
|
eStateChangeType::POP, LWOOBJID_EMPTY,
|
|
|
|
true, true, true, true, true, true
|
|
|
|
);
|
|
|
|
|
|
|
|
GameMessages::SendSetStunned(owner->GetObjectID(), eStateChangeType::POP, owner->GetSystemAddress(), LWOOBJID_EMPTY,
|
2021-12-05 17:54:36 +00:00
|
|
|
true, true, true, true, true, true, true, true, true
|
|
|
|
);
|
|
|
|
|
|
|
|
EntityManager::Instance()->SerializeEntity(owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PersonalFortress::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "FireSkill") {
|
2023-06-07 07:23:50 +00:00
|
|
|
auto skillComponent = self->GetComponent<SkillComponent>();
|
2023-01-07 05:59:19 +00:00
|
|
|
if (skillComponent) skillComponent->CalculateBehavior(650, 13364, LWOOBJID_EMPTY, true, false);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|