mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
CombatChallenge: Fix exploding dummy
This commit is contained in:
parent
797abb176a
commit
6795dd189c
@ -1,6 +1,7 @@
|
|||||||
#include "NtCombatChallengeExplodingDummy.h"
|
#include "NtCombatChallengeExplodingDummy.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "SkillComponent.h"
|
#include "SkillComponent.h"
|
||||||
|
#include "DestroyableComponent.h"
|
||||||
|
|
||||||
void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
||||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||||
@ -15,6 +16,17 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||||
|
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||||
|
auto numTimesHit = self->GetVar<int32_t>(u"numTimesHit");
|
||||||
|
if (destroyableComponent && numTimesHit == 0) {
|
||||||
|
self->SetVar<int32_t>(u"numTimesHit", 1);
|
||||||
|
destroyableComponent->SetHealth(destroyableComponent->GetHealth() / 2);
|
||||||
|
return;
|
||||||
|
} else if (numTimesHit == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self->SetVar<int32_t>(u"numTimesHit", 2);
|
||||||
|
|
||||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||||
|
|
||||||
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
||||||
@ -28,5 +40,6 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at
|
|||||||
if (skillComponent != nullptr) {
|
if (skillComponent != nullptr) {
|
||||||
skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID());
|
skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID());
|
||||||
}
|
}
|
||||||
self->Kill(attacker);
|
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16.0f);
|
||||||
|
self->Smash(attacker->GetObjectID());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user