mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
bd7f532a28
* Imaginite Pack now works * Remove unused params * Address issues * Add TeslaPack script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
26 lines
910 B
C++
26 lines
910 B
C++
#include "CoilBackpackBase.h"
|
|
|
|
#include "Entity.h"
|
|
#include "SkillComponent.h"
|
|
|
|
void CoilBackpackBase::OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
|
itemOwner->Subscribe(itemObjId, this, "HitOrHealResult");
|
|
itemOwner->SetVar<uint8_t>(u"coilCount", 0);
|
|
}
|
|
|
|
void CoilBackpackBase::NotifyHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
|
if (damage > 0) {
|
|
self->SetVar<uint8_t>(u"coilCount", self->GetVar<uint8_t>(u"coilCount") + 1);
|
|
if (self->GetVar<uint8_t>(u"coilCount") > 4) {
|
|
auto* skillComponent = self->GetComponent<SkillComponent>();
|
|
if (!skillComponent) return;
|
|
skillComponent->CalculateBehavior(m_SkillId, m_BehaviorId, self->GetObjectID());
|
|
self->SetVar<uint8_t>(u"coilCount", 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
void CoilBackpackBase::OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
|
itemOwner->Unsubscribe(itemObjId, "HitOrHealResult");
|
|
}
|