DarkflameServer/dScripts/AmSkeletonEngineer.cpp

25 lines
726 B
C++
Raw Normal View History

#include "AmSkeletonEngineer.h"
#include "DestroyableComponent.h"
#include "SkillComponent.h"
2022-07-28 13:39:57 +00:00
void AmSkeletonEngineer::OnHit(Entity* self, Entity* attacker) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
2022-07-28 13:39:57 +00:00
if (destroyableComponent == nullptr || skillComponent == nullptr) {
return;
}
2022-07-28 13:39:57 +00:00
if (destroyableComponent->GetHealth() < 12 && !self->GetVar<bool>(u"injured")) {
self->SetVar(u"injured", true);
2022-07-28 13:39:57 +00:00
skillComponent->CalculateBehavior(953, 19864, self->GetObjectID(), true);
2022-07-28 13:39:57 +00:00
const auto attackerID = attacker->GetObjectID();
2022-07-28 13:39:57 +00:00
self->AddCallbackTimer(4.5f, [this, self, attackerID]() {
self->Smash(attackerID);
});
}
}