#include "CoilBackpackBase.h" #include "Entity.h" #include "SkillComponent.h" void CoilBackpackBase::OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) { itemOwner->Subscribe(itemObjId, this, "HitOrHealResult"); itemOwner->SetVar(u"coilCount", 0); } void CoilBackpackBase::NotifyHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) { if (damage > 0) { self->SetVar(u"coilCount", self->GetVar(u"coilCount") + 1); if (self->GetVar(u"coilCount") > 4) { auto skillComponent = self->GetComponent(); if (!skillComponent) return; skillComponent->CastSkill(m_SkillId); self->SetVar(u"coilCount", 0); } } } void CoilBackpackBase::OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) { itemOwner->Unsubscribe(itemObjId, "HitOrHealResult"); }