Skip to content

Commit

Permalink
Merge pull request #1267 from DarkflameUniverse/dummyfix
Browse files Browse the repository at this point in the history
fix: Nexus Tower Combat Challenge exploding dummy
  • Loading branch information
DarwinAnim8or authored Nov 7, 2023
2 parents 797abb1 + 6795dd1 commit 070d4a1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "NtCombatChallengeExplodingDummy.h"
#include "EntityManager.h"
#include "SkillComponent.h"
#include "DestroyableComponent.h"

void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
Expand All @@ -15,6 +16,17 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
}

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");

auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
Expand All @@ -28,5 +40,6 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at
if (skillComponent != nullptr) {
skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID());
}
self->Kill(attacker);
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16.0f);
self->Smash(attacker->GetObjectID());
}

0 comments on commit 070d4a1

Please sign in to comment.