mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Imminuty updates (#925)
* WIP Immunities * Immunity getters * remove redundent variable replace it use with it's equivalent * remove unused lookups, fix typos * fix tests * added imunity test * address feedback * more immunity tests * explicit this
This commit is contained in:
@@ -2,49 +2,56 @@
|
||||
#include "GameMessages.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "ControllablePhysicsComponent.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
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) destroyableComponent->SetStatusImmunity(
|
||||
eStateChangeType::PUSH,
|
||||
true, true, true, true, true, false, true, false, false
|
||||
);
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->PushImmunity();
|
||||
}
|
||||
auto* controllablePhysicsComponent = owner->GetComponent<ControllablePhysicsComponent>();
|
||||
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
|
||||
);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(owner);
|
||||
}
|
||||
|
||||
void PersonalFortress::OnDie(Entity* self, Entity* killer) {
|
||||
auto* owner = self->GetOwner();
|
||||
GameMessages::SendSetStunned(owner->GetObjectID(), POP, owner->GetSystemAddress(), LWOOBJID_EMPTY,
|
||||
auto* destroyableComponent = owner->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) destroyableComponent->SetStatusImmunity(
|
||||
eStateChangeType::POP,
|
||||
true, true, true, true, true, false, true, false, false
|
||||
);
|
||||
|
||||
auto* controllablePhysicsComponent = owner->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) controllablePhysicsComponent->SetStunImmunity(
|
||||
eStateChangeType::POP, LWOOBJID_EMPTY,
|
||||
true, true, true, true, true, true
|
||||
);
|
||||
|
||||
GameMessages::SendSetStunned(owner->GetObjectID(), eStateChangeType::POP, owner->GetSystemAddress(), LWOOBJID_EMPTY,
|
||||
true, true, true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
auto* destroyableComponent = owner->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->PopImmunity();
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(owner);
|
||||
}
|
||||
|
||||
void PersonalFortress::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "FireSkill") {
|
||||
auto* owner = self->GetOwner();
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
skillComponent->CalculateBehavior(650, 13364, LWOOBJID_EMPTY, true, false);
|
||||
if (skillComponent) skillComponent->CalculateBehavior(650, 13364, LWOOBJID_EMPTY, true, false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user